emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master bb68fae 1/3: 'global-mode-string' elements should have a space at


From: Lars Ingebrigtsen
Subject: master bb68fae 1/3: 'global-mode-string' elements should have a space at the end
Date: Fri, 23 Jul 2021 08:46:24 -0400 (EDT)

branch: master
commit bb68faed02d6c0eef48923b4ef4e4eda5e6486ba
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    'global-mode-string' elements should have a space at the end
    
    * lisp/time.el (display-time-string-forms):
    * lisp/battery.el (battery-mode-line-format): Add a space to the
    end (bug#30056).
    * lisp/bindings.el (mode-line-misc-info): Remove space from end.
    This will make the default format have one space before the
    line-of-dashes (instead of two) on terminals.
---
 doc/lispref/modes.texi | 11 +++++++----
 etc/NEWS               |  5 +++++
 lisp/battery.el        |  4 ++--
 lisp/bindings.el       |  2 +-
 lisp/time.el           |  3 ++-
 5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 7214948..b0dc0ff 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -2287,11 +2287,14 @@ enabled separately in each buffer.
 
 @defvar global-mode-string
 This variable holds a mode line construct that, by default, appears in
-the mode line just after the @code{which-function-mode} minor mode if set,
-else after @code{mode-line-modes}.  The command @code{display-time} sets
+the mode line just after the @code{which-function-mode} minor mode if
+set, else after @code{mode-line-modes}.  Elements that are added to
+this construct should normally end in a space (to ensure that
+consecutive @code{global-mode-string} elements display properly).  For
+instance, the command @code{display-time} sets
 @code{global-mode-string} to refer to the variable
-@code{display-time-string}, which holds a string containing the time and
-load information.
+@code{display-time-string}, which holds a string containing the time
+and load information.
 
 The @samp{%M} construct substitutes the value of
 @code{global-mode-string}, but that is obsolete, since the variable is
diff --git a/etc/NEWS b/etc/NEWS
index 95218fa..759f7ca 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2506,6 +2506,11 @@ If non-nil, repeating spaces are compressed into a 
single space.  If
 current window width (in characters).
 
 +++
+*** 'global-mode-string' constructs should end with a space.
+This was previously not formalized, which led to combinations of modes
+displaying data "smushed together" on the mode line.
+
++++
 *** New command 'submit-emacs-patch'.
 This works like 'report-emacs-bug', but is more geared towards sending
 patches to the Emacs issue tracker.
diff --git a/lisp/battery.el b/lisp/battery.el
index 59f6987..bf864c2 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -161,9 +161,9 @@ The full `format-spec' formatting syntax is supported."
 
 (defcustom battery-mode-line-format
   (cond ((eq battery-status-function #'battery-linux-proc-acpi)
-        "[%b%p%%,%d°C]")
+        "[%b%p%%,%d°C] ")
        (battery-status-function
-        "[%b%p%%]"))
+        "[%b%p%%] "))
   "Control string formatting the string to display in the mode line.
 Ordinary characters in the control string are printed as-is, while
 conversion specifications introduced by a `%' character in the control
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 06ba5d0..4b194c0 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -580,7 +580,7 @@ Major modes that edit things other than ordinary files may 
change this
 (put 'mode-line-buffer-identification 'risky-local-variable t)
 
 (defvar mode-line-misc-info
-  '((global-mode-string ("" global-mode-string " ")))
+  '((global-mode-string ("" global-mode-string)))
   "Mode line construct for miscellaneous information.
 By default, this shows the information specified by `global-mode-string'.")
 (put 'mode-line-misc-info 'risky-local-variable t)
diff --git a/lisp/time.el b/lisp/time.el
index fd53f63..9f25f99 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -205,7 +205,8 @@ depend on `display-time-day-and-date' and 
`display-time-24hr-format'."
          'mouse-face 'mode-line-highlight
          'local-map (make-mode-line-mouse-map 'mouse-2
                                               read-mail-command)))
-      ""))
+      "")
+    " ")
   "List of expressions governing display of the time in the mode line.
 For most purposes, you can control the time format using `display-time-format'
 which is a more standard interface.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]