GNU bug report logs - #30056
25.3; battery-mode-line-string missing leading space

Previous Next

Package: emacs;

Reported by: Allen Li <vianchielfaura <at> gmail.com>

Date: Wed, 10 Jan 2018 03:27:02 UTC

Severity: minor

Tags: patch

Found in version 25.3

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30056 in the body.
You can then email your comments to 30056 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Wed, 10 Jan 2018 03:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Allen Li <vianchielfaura <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 10 Jan 2018 03:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <vianchielfaura <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.3; battery-mode-line-string missing leading space
Date: Tue, 9 Jan 2018 19:26:46 -0800
The battery-mode-line-string set by battery-update is missing a
leading space, causing it to get combined with whatever is before it
in the mode line.

In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
 of 2017-12-04 built on arojas
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Wed, 10 Jan 2018 08:46:01 GMT) Full text and rfc822 format available.

Message #8 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <vianchielfaura <at> gmail.com>
To: 30056 <at> debbugs.gnu.org
Subject: [PATCH] Add leading space to battery-mode-line-format
Date: Wed, 10 Jan 2018 00:45:52 -0800
[Message part 1 (text/plain, inline)]
Attached patch.  This seems like a reasonable and trivial change, so I
haven't updated NEWS or :version for defcustom.
[0001-Add-leading-space-to-battery-mode-line-format.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Wed, 10 Jan 2018 15:30:02 GMT) Full text and rfc822 format available.

Message #11 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Wed, 10 Jan 2018 17:29:40 +0200
> From: Allen Li <vianchielfaura <at> gmail.com>
> Date: Tue, 9 Jan 2018 19:26:46 -0800
> 
> The battery-mode-line-string set by battery-update is missing a
> leading space, causing it to get combined with whatever is before it
> in the mode line.

It doesn't get combined here, so please show an example of what you
observe on your system.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Wed, 10 Jan 2018 17:07:02 GMT) Full text and rfc822 format available.

Message #14 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Allen Li <vianchielfaura <at> gmail.com>, 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Wed, 10 Jan 2018 12:06:47 -0500
Eli Zaretskii wrote:

>> The battery-mode-line-string set by battery-update is missing a
>> leading space, causing it to get combined with whatever is before it
>> in the mode line.
>
> It doesn't get combined here, so please show an example of what you
> observe on your system.

M-x display-time-mode
M-x display-battery-mode

-> 9.05AM 0.45 Mail[100.0%]

See also https://debbugs.gnu.org/18164




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Wed, 10 Jan 2018 19:06:01 GMT) Full text and rfc822 format available.

Message #17 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: vianchielfaura <at> gmail.com, 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Wed, 10 Jan 2018 21:05:22 +0200
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: Allen Li <vianchielfaura <at> gmail.com>,  30056 <at> debbugs.gnu.org
> Date: Wed, 10 Jan 2018 12:06:47 -0500
> 
> M-x display-time-mode
> M-x display-battery-mode
> 
> -> 9.05AM 0.45 Mail[100.0%]
> 
> See also https://debbugs.gnu.org/18164

We don't do this consistently in the modes which use
global-mode-string: some of them leave a blank at the beginning,
others (the majority, AFACT) don't.  There's not much space on the
mode line, so I'm not sure which way is better.

But if we want to have a separation there, would it make sense to do
this in bindings.el, so that global-mode-string is always separated by
a blank from the preceding text, and modes don't have to remember this
gork?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Wed, 10 Jan 2018 23:27:01 GMT) Full text and rfc822 format available.

Message #20 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <vianchielfaura <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Wed, 10 Jan 2018 15:26:42 -0800
On Wed, Jan 10, 2018 at 11:05 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Glenn Morris <rgm <at> gnu.org>
>> Cc: Allen Li <vianchielfaura <at> gmail.com>,  30056 <at> debbugs.gnu.org
>> Date: Wed, 10 Jan 2018 12:06:47 -0500
>>
>> M-x display-time-mode
>> M-x display-battery-mode
>>
>> -> 9.05AM 0.45 Mail[100.0%]
>>
>> See also https://debbugs.gnu.org/18164
>
> We don't do this consistently in the modes which use
> global-mode-string: some of them leave a blank at the beginning,
> others (the majority, AFACT) don't.  There's not much space on the
> mode line, so I'm not sure which way is better.

The standard for minor mode strings is to include a leading space, right?

That seems like the right approach for global-mode-strings, which also
follows an "append" pattern like minor modes.

From what I can grok, the general standard of the mode line is to use
spaces at the end for "top level" mode line items (mode-line-modes,
mode-line-position) and spaces at the beginning for sub items (minor
modes, the parts inside mode-line-position).

In any case, Emacs packages should probably be consistent, and
currently display-battery-mode and display-time-mode are inconsistent.
I don’t know which other modes use global-mode-string; is display-time
mode the only outlier?

> But if we want to have a separation there, would it make sense to do
> this in bindings.el, so that global-mode-string is always separated by
> a blank from the preceding text, and modes don't have to remember this
> gork?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Thu, 11 Jan 2018 15:58:01 GMT) Full text and rfc822 format available.

Message #23 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: rgm <at> gnu.org, 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Thu, 11 Jan 2018 17:57:30 +0200
> From: Allen Li <vianchielfaura <at> gmail.com>
> Date: Wed, 10 Jan 2018 15:26:42 -0800
> Cc: Glenn Morris <rgm <at> gnu.org>, 30056 <at> debbugs.gnu.org
> 
> >> See also https://debbugs.gnu.org/18164
> >
> > We don't do this consistently in the modes which use
> > global-mode-string: some of them leave a blank at the beginning,
> > others (the majority, AFACT) don't.  There's not much space on the
> > mode line, so I'm not sure which way is better.
> 
> The standard for minor mode strings is to include a leading space, right?

That's just it: I'm not sure.

> In any case, Emacs packages should probably be consistent, and
> currently display-battery-mode and display-time-mode are inconsistent.
> I don’t know which other modes use global-mode-string; is display-time
> mode the only outlier?

Not at all: grep for that variable in the Emacs source tree, and you
will see that most of its users don't start their strings with a
blank.  Which is why I asked this question:

> > But if we want to have a separation there, would it make sense to do
> > this in bindings.el, so that global-mode-string is always separated by
> > a blank from the preceding text, and modes don't have to remember this
> > gork?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Fri, 12 Jan 2018 08:19:02 GMT) Full text and rfc822 format available.

Message #26 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <vianchielfaura <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Fri, 12 Jan 2018 00:18:21 -0800
Interestingly, when display-battery-mode and display-time-mode are set
through my custom file, the battery display comes before the time
display.  However, toggling either of them interactively will always
result in the time display coming before the battery display.

The cause of this odd behavior is that display-battery-mode appends
and removes its symbol in global-mode-string when it is toggled on or
off, while display-time-mode only appends its symbol and does not
remove it when it is toggled off.  The reason display-battery-mode
comes first after Emacs starts is because of how the custom file
works; user options are sorted alphabetically and display-battery-mode
comes first, so it is appended first.

Naturally, this has some implications for whether each display uses
leading, trailing, or no space.




Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sat, 28 Sep 2019 23:02:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Mon, 10 Aug 2020 13:44:02 GMT) Full text and rfc822 format available.

Message #31 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Mon, 10 Aug 2020 15:43:20 +0200
Allen Li <vianchielfaura <at> gmail.com> writes:

> The cause of this odd behavior is that display-battery-mode appends
> and removes its symbol in global-mode-string when it is toggled on or
> off, while display-time-mode only appends its symbol and does not
> remove it when it is toggled off.  The reason display-battery-mode
> comes first after Emacs starts is because of how the custom file
> works; user options are sorted alphabetically and display-battery-mode
> comes first, so it is appended first.
>
> Naturally, this has some implications for whether each display uses
> leading, trailing, or no space.

Indeed.  Just a random idea: Would it make sense to add a mode line
construct like "%S" to mode-line-format that means "put a space here if
there isn't one already"?  Then battery could put "%S<current string"
into the list?

Would that work?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Tue, 11 Aug 2020 08:41:01 GMT) Full text and rfc822 format available.

Message #34 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <darkfeline <at> felesatra.moe>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Tue, 11 Aug 2020 01:40:40 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Allen Li <vianchielfaura <at> gmail.com> writes:
>
>> The cause of this odd behavior is that display-battery-mode appends
>> and removes its symbol in global-mode-string when it is toggled on or
>> off, while display-time-mode only appends its symbol and does not
>> remove it when it is toggled off.  The reason display-battery-mode
>> comes first after Emacs starts is because of how the custom file
>> works; user options are sorted alphabetically and display-battery-mode
>> comes first, so it is appended first.
>>
>> Naturally, this has some implications for whether each display uses
>> leading, trailing, or no space.
>
> Indeed.  Just a random idea: Would it make sense to add a mode line
> construct like "%S" to mode-line-format that means "put a space here if
> there isn't one already"?  Then battery could put "%S<current string"
> into the list?
>
> Would that work?

I find that idea intriguing.  It would work, and it's a useful feature
to have as an Emacs Lisp developer, because it provide a robust solution
to the problem of "I want to have a space separation in the mode line,
but I don't know what comes before/after me".

Although personally, I feel a little dirty adding a new %-construct just
for this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Tue, 11 Aug 2020 11:21:02 GMT) Full text and rfc822 format available.

Message #37 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Allen Li <darkfeline <at> felesatra.moe>
Cc: Glenn Morris <rgm <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Tue, 11 Aug 2020 13:19:51 +0200
Allen Li <darkfeline <at> felesatra.moe> writes:

> I find that idea intriguing.  It would work, and it's a useful feature
> to have as an Emacs Lisp developer, because it provide a robust solution
> to the problem of "I want to have a space separation in the mode line,
> but I don't know what comes before/after me".
>
> Although personally, I feel a little dirty adding a new %-construct just
> for this.

I think we either have to do this, or introduce a formal convention for
these strings that say either to always add a space to the front or the
back of them.

I guess we don't really see this much as a problem in practice, because
we don't have many of these "non-mode" strings in the mode line.

So perhaps settling on a convention and then altering all the instances
to follow it would be more efficient -- there's probably just a few
dozen of them?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Wed, 12 Aug 2020 07:32:02 GMT) Full text and rfc822 format available.

Message #40 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <darkfeline <at> felesatra.moe>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Wed, 12 Aug 2020 07:31:17 +0000
[Message part 1 (text/plain, inline)]
On Tue, Aug 11, 2020 at 11:20 AM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Allen Li <darkfeline <at> felesatra.moe> writes:
>
> > I find that idea intriguing.  It would work, and it's a useful feature
> > to have as an Emacs Lisp developer, because it provide a robust solution
> > to the problem of "I want to have a space separation in the mode line,
> > but I don't know what comes before/after me".
> >
> > Although personally, I feel a little dirty adding a new %-construct just
> > for this.
>
> I think we either have to do this, or introduce a formal convention for
> these strings that say either to always add a space to the front or the
> back of them.
>
> I guess we don't really see this much as a problem in practice, because
> we don't have many of these "non-mode" strings in the mode line.
>
> So perhaps settling on a convention and then altering all the instances
> to follow it would be more efficient -- there's probably just a few
> dozen of them?
>

I'm fine with that (I assumed that such a convention already existed
previously on this bug's thread).


>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Thu, 22 Jul 2021 14:16:01 GMT) Full text and rfc822 format available.

Message #43 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Thu, 22 Jul 2021 16:15:42 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Indeed.  Just a random idea: Would it make sense to add a mode line
> construct like "%S" to mode-line-format that means "put a space here if
> there isn't one already"?  Then battery could put "%S<current string"
> into the list?

I had a peek at how to implement this, and it's surprisingly hard.  The
mode line stuff is constructed in three different paths
(noprop/string/display), and getting at the "previous character" is
different in every case.

And I'm not really super enthusiastic about the idea in general, because
it means that simple strings (like battery-mode-line-string) will have
to be replaced by ("%S" battery-mode-line-string) lists...

So perhaps we just have to bite the bullet and introduce a new
convention: All `global-mode-string' bits have to start with a space
character (and we'll remove the trailing character from
`mode-line-modes').

This'll make some of these modes look awkward until they're all fixed.

A less breakey change is to institute a different rule: All
`global-mode-string' elements have to have a trailing space.  That'll be
less breakey, but may add spaces before the "----" in terminals.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Fri, 23 Jul 2021 12:49:01 GMT) Full text and rfc822 format available.

Message #46 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 30056 <at> debbugs.gnu.org
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Fri, 23 Jul 2021 14:48:08 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> A less breakey change is to institute a different rule: All
> `global-mode-string' elements have to have a trailing space.  That'll be
> less breakey, but may add spaces before the "----" in terminals.

I've now done this, and it doesn't add spaces before the "---" bit.

I grepped through the Emacs tree to see whether any other packages have
problems in this area, but the ones I skimmed seemed to already adhere
to this previous non-convention (i.e., they added a space at the end).
But I may have missed some, of course.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 30056 <at> debbugs.gnu.org and Allen Li <vianchielfaura <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 23 Jul 2021 12:49:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Fri, 23 Jul 2021 18:25:02 GMT) Full text and rfc822 format available.

Message #51 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Allen Li <vianchielfaura <at> gmail.com>, 30056 <at> debbugs.gnu.org,
 Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Fri, 23 Jul 2021 21:23:58 +0300
>> A less breakey change is to institute a different rule: All
>> `global-mode-string' elements have to have a trailing space.  That'll be
>> less breakey, but may add spaces before the "----" in terminals.
>
> I've now done this, and it doesn't add spaces before the "---" bit.
>
> I grepped through the Emacs tree to see whether any other packages have
> problems in this area, but the ones I skimmed seemed to already adhere
> to this previous non-convention (i.e., they added a space at the end).
> But I may have missed some, of course.

This change broke tab-bar.el that expected that the default value of
mode-line-misc-info contains (global-mode-string ("" global-mode-string " ")).

BTW, 9dfa94aed1 duplicated 3 paragraphs in etc/NEWS.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Sat, 24 Jul 2021 11:55:01 GMT) Full text and rfc822 format available.

Message #54 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Allen Li <vianchielfaura <at> gmail.com>, 30056 <at> debbugs.gnu.org,
 Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Sat, 24 Jul 2021 13:54:41 +0200
Juri Linkov <juri <at> linkov.net> writes:

> This change broke tab-bar.el that expected that the default value of
> mode-line-misc-info contains (global-mode-string ("" global-mode-string " ")).

I've now updated the code in tab-bar.el.  But isn't that a brittle way
to enable this?  The user may have altered the variable value, for instance.

> BTW, 9dfa94aed1 duplicated 3 paragraphs in etc/NEWS.

Now removed.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Mon, 26 Jul 2021 23:22:02 GMT) Full text and rfc822 format available.

Message #57 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Allen Li <vianchielfaura <at> gmail.com>, 30056 <at> debbugs.gnu.org,
 Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Tue, 27 Jul 2021 02:09:27 +0300
>> This change broke tab-bar.el that expected that the default value of
>> mode-line-misc-info contains (global-mode-string ("" global-mode-string " ")).
>
> I've now updated the code in tab-bar.el.  But isn't that a brittle way
> to enable this?  The user may have altered the variable value, for instance.

This code is just for convenience to avoid duplication of the global string
on the mode-line and on the tab-bar.  When the user alters mode-line-misc-info
manually, then we can assume that the user does this intentionally,
e.g. to force duplication of the global string, etc.

But the default value of mode-line-misc-info doesn't change too often,
so there is no problem.

However, there is another problem: now display-time-string contains
additional trailing space, so when time is displayed on the
right edge on the tab-bar, time string is not aligned nicely anymore.
Now there is the gap between the time string and the right edge of the tab-bar.

How this could be avoided?  Maybe tab-bar-format-global now needs
to use 'string-trim' on the result of '(format-mode-line global-mode-string)'?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30056; Package emacs. (Tue, 27 Jul 2021 21:17:01 GMT) Full text and rfc822 format available.

Message #60 received at 30056 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Allen Li <vianchielfaura <at> gmail.com>, 30056 <at> debbugs.gnu.org,
 Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#30056: 25.3; battery-mode-line-string missing leading space
Date: Tue, 27 Jul 2021 23:56:09 +0300
> However, there is another problem: now display-time-string contains
> additional trailing space, so when time is displayed on the
> right edge on the tab-bar, time string is not aligned nicely anymore.
> Now there is the gap between the time string and the right edge of the tab-bar.
>
> How this could be avoided?  Maybe tab-bar-format-global now needs
> to use 'string-trim' on the result of '(format-mode-line global-mode-string)'?

Now added string-trim-right.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 25 Aug 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 217 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.