summaryrefslogtreecommitdiff
path: root/doc/lispref/strings.texi
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2022-09-27 18:16:51 +0200
committerStefan Kangas <stefankangas@gmail.com>2022-09-29 15:39:27 +0200
commit5281946fbf6b3cdbec5ce82e0057c71849faf4d2 (patch)
tree8f519625372642a2faaa4a1bf314a07e2e283a6b /doc/lispref/strings.texi
parent423bdd5f7f273f40f750eac83017074501d52823 (diff)
downloademacs-5281946fbf6b3cdbec5ce82e0057c71849faf4d2.tar.gz
emacs-5281946fbf6b3cdbec5ce82e0057c71849faf4d2.tar.bz2
emacs-5281946fbf6b3cdbec5ce82e0057c71849faf4d2.zip
Make format-spec accept function substitutions
* lisp/format-spec.el (format-spec): Accept a function producing the substitution for a character. * doc/lispref/strings.texi (Custom Format Strings): Document the above change. * test/lisp/format-spec-tests.el (format-spec/function): New test. Ref. https://lists.gnu.org/r/emacs-devel/2022-09/msg01875.html
Diffstat (limited to 'doc/lispref/strings.texi')
-rw-r--r--doc/lispref/strings.texi5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 374381e5955..ba247a3edae 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -1293,6 +1293,11 @@ The order of specifications in @var{template} need not correspond to
the order of associations in @var{spec-alist}.
@end itemize
+REPLACEMENT can also be a function taking no arguments, and returning
+a string to be used for the replacement. It will only be called when
+the corresponding LETTER is used in the TEMPLATE. This is useful, for
+example, to avoid prompting for input unless it is needed.
+
The optional argument @var{ignore-missing} indicates how to handle
specification characters in @var{template} that are not found in
@var{spec-alist}. If it is @code{nil} or omitted, the function