aboutsummaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorBasil L. Contovounesios2020-05-29 19:56:14 +0100
committerBasil L. Contovounesios2020-06-18 12:46:21 +0100
commit0185d76e7426eb1b58a9b60b0d18e763ddf57dea (patch)
tree68e6f560b1751902e98a241a3bf732b9fd596364 /etc
parent97d1f672ac1529ac07a999405f630cb19a1010eb (diff)
downloademacs-0185d76e7426eb1b58a9b60b0d18e763ddf57dea.tar.gz
emacs-0185d76e7426eb1b58a9b60b0d18e763ddf57dea.zip
Fix and extend format-spec (bug#41758)
* lisp/format-spec.el: Use lexical-binding. Remove dependence on subr-x.el. (format-spec-make): Clarify docstring. (format-spec--parse-modifiers): Rename to... (format-spec--parse-flags): ...this and simplify. In particular, don't bother parsing :space-pad which is redundant and unused. (format-spec--pad): Remove, replacing with... (format-spec--do-flags): ...this new helper function which performs more of format-spec's supported text manipulation. (format-spec): Autoload. Allow optional argument to take on special values 'ignore' and 'delete' for more control over what happens when a replacement for a format specification isn't provided. Bring back proper support for a precision modifier similar to that of 'format'. * lisp/battery.el (battery-format): Rewrite in terms of format-spec. (battery-echo-area-format, battery-mode-line-format): Mention support of format-spec syntax in docstrings. * doc/lispref/strings.texi (Custom Format Strings): * etc/NEWS: Document and announce these changes. * lisp/dired-aux.el (dired-do-compress-to): * lisp/erc/erc-match.el (erc-log-matches): * lisp/erc/erc.el (erc-update-mode-line-buffer): * lisp/gnus/gnus-sieve.el (gnus-sieve-update): * lisp/gnus/gssapi.el (open-gssapi-stream): * lisp/gnus/mail-source.el (mail-source-fetch-file) (mail-source-fetch-directory, mail-source-fetch-pop) (mail-source-fetch-imap): * lisp/gnus/message.el (message-insert-formatted-citation-line): * lisp/image-dired.el: * lisp/net/eww.el: * lisp/net/imap.el (imap-kerberos4-open, imap-gssapi-open) (imap-shell-open): * lisp/net/network-stream.el (network-stream-open-shell): * lisp/obsolete/tls.el (open-tls-stream): * lisp/textmodes/tex-mode.el: Remove extraneous loads and autoloads of format-spec now that it is autoloaded and simplify its uses where possible. * test/lisp/battery-tests.el (battery-format): Test new format-spec support. * test/lisp/format-spec-tests.el (test-format-spec): Rename to... (format-spec) ...this, extending test cases. (test-format-unknown): Rename to... (format-spec-unknown): ...this, extending test cases. (test-format-modifiers): Rename to... (format-spec-flags): ...this. (format-spec-make, format-spec-parse-flags, format-spec-do-flags) (format-spec-do-flags-truncate, format-spec-do-flags-pad) (format-spec-do-flags-chop, format-spec-do-flags-case): New tests.
Diffstat (limited to 'etc')
-rw-r--r--etc/NEWS17
1 files changed, 17 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index d702f758f23..4d730228139 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -461,6 +461,16 @@ In Emacs 24.3, the variable 'dbus-event-error-hooks' was renamed to
461The old names, which were kept as obsolete aliases of the new names, 461The old names, which were kept as obsolete aliases of the new names,
462have now been removed. 462have now been removed.
463 463
464** Battery
465
466---
467*** A richer syntax can be used to format battery status information.
468The user options 'battery-mode-line-format' and
469'battery-echo-area-format' now support the full formatting syntax of
470the function 'format-spec' documented under '(elisp) Custom Format
471Strings'. The new syntax includes specifiers for padding and
472truncation, amongst other things.
473
464 474
465* New Modes and Packages in Emacs 28.1 475* New Modes and Packages in Emacs 28.1
466 476
@@ -578,6 +588,13 @@ for encoding and decoding without having to bind
578It controls, whether 'process-file' returns a string when a remote 588It controls, whether 'process-file' returns a string when a remote
579process is interrupted by a signal. 589process is interrupted by a signal.
580 590
591+++
592** The behavior of 'format-spec' is now closer to that of 'format'.
593In order for the two functions to behave more consistently,
594'format-spec' now pads and truncates based on string width rather than
595length, and also supports format specifications that include a
596truncating precision field, such as '%.2a'.
597
581 598
582* Changes in Emacs 28.1 on Non-Free Operating Systems 599* Changes in Emacs 28.1 on Non-Free Operating Systems
583 600