diff options
author | Basil L. Contovounesios <contovob@tcd.ie> | 2019-07-20 16:46:04 +0100 |
---|---|---|
committer | Basil L. Contovounesios <contovob@tcd.ie> | 2019-07-20 16:46:04 +0100 |
commit | a1b49f3bff5e104581b43ac5a9093a576f87f04b (patch) | |
tree | 76a0d85c4a2bceaa6380abe148da3cb82e804fb8 /lisp/format-spec.el | |
parent | b728620a756db78b8cb0a41afa72db6209102cdf (diff) | |
download | emacs-a1b49f3bff5e104581b43ac5a9093a576f87f04b.tar.gz emacs-a1b49f3bff5e104581b43ac5a9093a576f87f04b.tar.bz2 emacs-a1b49f3bff5e104581b43ac5a9093a576f87f04b.zip |
Fix last change to format-spec
* doc/lispref/text.texi (Interpolated Strings): Use @result and fix
typos.
* lisp/format-spec.el: Avoid loading subr-x at runtime.
(format-spec--parse-modifiers): Optimize slightly.
Diffstat (limited to 'lisp/format-spec.el')
-rw-r--r-- | lisp/format-spec.el | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lisp/format-spec.el b/lisp/format-spec.el index 220cecd9b05..fec93ce83d9 100644 --- a/lisp/format-spec.el +++ b/lisp/format-spec.el @@ -24,7 +24,8 @@ ;;; Code: -(require 'subr-x) +(eval-when-compile + (require 'subr-x)) (defun format-spec (format specification &optional only-present) "Return a string based on FORMAT and SPECIFICATION. @@ -118,8 +119,7 @@ where they are, including \"%%\" strings." (concat padding text))))) (defun format-spec--parse-modifiers (modifiers) - (let ((elems nil)) - (mapc (lambda (char) + (mapcan (lambda (char) (when-let ((modifier (pcase char (?0 :zero-pad) @@ -129,9 +129,8 @@ where they are, including \"%%\" strings." (?- :right-pad) (?< :chop-left) (?> :chop-right)))) - (push modifier elems))) - modifiers) - elems)) + (list modifier))) + modifiers)) (defun format-spec-make (&rest pairs) "Return an alist suitable for use in `format-spec' based on PAIRS. |