[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30056: 25.3; battery-mode-line-string missing leading space
From: |
Allen Li |
Subject: |
bug#30056: 25.3; battery-mode-line-string missing leading space |
Date: |
Tue, 11 Aug 2020 01:40:40 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Allen Li <vianchielfaura@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.