GNU bug report logs - #59624
Usning global-mode-string for small screens

Previous Next

Package: emacs;

Reported by: Heime <heimeborgia <at> protonmail.com>

Date: Sun, 27 Nov 2022 02:53:02 UTC

Severity: normal

To reply to this bug, email your comments to 59624 AT debbugs.gnu.org.

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#59624; Package emacs. (Sun, 27 Nov 2022 02:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Heime <heimeborgia <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 27 Nov 2022 02:53:02 GMT) Full text and rfc822 format available.

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

From: Heime <heimeborgia <at> protonmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Usning global-mode-string for small screens
Date: Sun, 27 Nov 2022 02:51:58 +0000
A convenenient way to update the mode-line is to use "global-mode-string".  This is quite powerful
because I can easily insert and remove the information in "global-mode-string" that one introduces 
in the mode-line.  For instance, one can add an indicator "Indic" in the mode.  Then easily remove 
it by resetting "global-mode-string".

Yet introducing global-mode-string, gets to be printed after the mode-lighters.  This is a problem
far small screens.  

(setq act "Indic")
(push '("" act) global-mode-string)

A more appropriate implementation could allow one to decide where to insert "global-mode-string"
(beginning, before buffer-name, before mode-lighter, end) or some other way suitable to people 
who have to endure small screens.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59624; Package emacs. (Sun, 27 Nov 2022 05:33:01 GMT) Full text and rfc822 format available.

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

From: Gabriel <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#59624: Usning global-mode-string for small screens
Date: Sun, 27 Nov 2022 02:32:35 -0300
You can customize the variable `mode-line-format' in order to change the
position of `mode-line-misc-info', e.g.:

(setq act "Indic")
(push '("" act) global-mode-string)

(setq-default mode-line-format
              '("%e" mode-line-front-space
                (:propertize ("" mode-line-mule-info mode-line-client
                              mode-line-modified mode-line-remote)
                             display (min-width (5.0)))
                mode-line-frame-identification mode-line-buffer-identification
                mode-line-misc-info ;; <-- HERE
                "   " mode-line-position
                (vc-mode vc-mode)
                "  " mode-line-modes mode-line-end-spaces))

---
Gabriel




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59624; Package emacs. (Sun, 27 Nov 2022 06:55:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gabriel <gabriel376 <at> hotmail.com>
Cc: 59624 <at> debbugs.gnu.org
Subject: Re: bug#59624: Usning global-mode-string for small screens
Date: Sun, 27 Nov 2022 08:55:01 +0200
> From: Gabriel <gabriel376 <at> hotmail.com>
> Date: Sun, 27 Nov 2022 02:32:35 -0300
> 
> You can customize the variable `mode-line-format' in order to change the
> position of `mode-line-misc-info', e.g.:
> 
> (setq act "Indic")
> (push '("" act) global-mode-string)
> 
> (setq-default mode-line-format
>               '("%e" mode-line-front-space
>                 (:propertize ("" mode-line-mule-info mode-line-client
>                               mode-line-modified mode-line-remote)
>                              display (min-width (5.0)))
>                 mode-line-frame-identification mode-line-buffer-identification
>                 mode-line-misc-info ;; <-- HERE
>                 "   " mode-line-position
>                 (vc-mode vc-mode)
>                 "  " mode-line-modes mode-line-end-spaces))

Is there a bug or some issue here?

IOW, I don't understand what you wanted to say.  Please explain.
(Or did you send this to the wrong address?)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59624; Package emacs. (Sun, 27 Nov 2022 08:09:01 GMT) Full text and rfc822 format available.

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

From: Gabriel <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#59624: Usning global-mode-string for small screens
Date: Sun, 27 Nov 2022 05:08:03 -0300
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Gabriel <gabriel376 <at> hotmail.com>
>> Date: Sun, 27 Nov 2022 02:32:35 -0300
>> 
>> You can customize the variable `mode-line-format' in order to change the
>> position of `mode-line-misc-info', e.g.:
>> 
>> (setq act "Indic")
>> (push '("" act) global-mode-string)
>> 
>> (setq-default mode-line-format
>>               '("%e" mode-line-front-space
>>                 (:propertize ("" mode-line-mule-info mode-line-client
>>                               mode-line-modified mode-line-remote)
>>                              display (min-width (5.0)))
>>                 mode-line-frame-identification mode-line-buffer-identification
>>                 mode-line-misc-info ;; <-- HERE
>>                 "   " mode-line-position
>>                 (vc-mode vc-mode)
>>                 "  " mode-line-modes mode-line-end-spaces))
>
> Is there a bug or some issue here?
>
> IOW, I don't understand what you wanted to say.  Please explain.
> (Or did you send this to the wrong address?)

I wanted to respond to OP one way to customize the display position of
`global-mode-string' in mode-line, which I think could solve their
issue.

---
Gabriel




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59624; Package emacs. (Sun, 27 Nov 2022 08:22:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gabriel <gabriel376 <at> hotmail.com>
Cc: 59624 <at> debbugs.gnu.org
Subject: Re: bug#59624: Usning global-mode-string for small screens
Date: Sun, 27 Nov 2022 10:21:46 +0200
> From: Gabriel <gabriel376 <at> hotmail.com>
> Date: Sun, 27 Nov 2022 05:08:03 -0300
> 
> > IOW, I don't understand what you wanted to say.  Please explain.
> > (Or did you send this to the wrong address?)
> 
> I wanted to respond to OP one way to customize the display position of
> `global-mode-string' in mode-line, which I think could solve their
> issue.

Sorry, I was confused because your message didn't quote the one to which you
were responding.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59624; Package emacs. (Sun, 27 Nov 2022 17:05:02 GMT) Full text and rfc822 format available.

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

From: Heime <heimeborgia <at> protonmail.com>
To: "59624 <at> debbugs.gnu.org" <59624 <at> debbugs.gnu.org>,
 "gabriel376 <at> hotmail.com" <gabriel376 <at> hotmail.com>
Subject: Re: bug#59624: Usning global-mode-string for small screens
Date: Sun, 27 Nov 2022 17:04:20 +0000
I would need some more assistance to get this to work for me.

When should I update mode-line-format ?  

Call it first, followed by (push '("" act) global-mode-string).

Would I have to call (force-mode-line-update) ?

> > Sent: Sunday, November 27, 2022 at 8:08 PM
> > From: "Gabriel" gabriel376 <at> hotmail.com
> > To: 59624 <at> debbugs.gnu.org
> > Subject: bug#59624: Usning global-mode-string for small screens
> > 
> > Eli Zaretskii eliz <at> gnu.org writes:
> > 
> > > > From: Gabriel gabriel376 <at> hotmail.com
> > > > Date: Sun, 27 Nov 2022 02:32:35 -0300
> > > > 
> > > > You can customize the variable `mode-line-format' in order to change the position of` mode-line-misc-info', e.g.:
> > > > 
> > > > (setq act "Indic")
> > > > (push '("" act) global-mode-string)
> > > > 
> > > > (setq-default mode-line-format
> > > > '("%e" mode-line-front-space
> > > > (:propertize ("" mode-line-mule-info mode-line-client
> > > > mode-line-modified mode-line-remote)
> > > > display (min-width (5.0)))
> > > > mode-line-frame-identification mode-line-buffer-identification
> > > > mode-line-misc-info ;; <-- HERE
> > > > " " mode-line-position
> > > > (vc-mode vc-mode)
> > > > " " mode-line-modes mode-line-end-spaces))
> > > 
> > > Is there a bug or some issue here?
> > > 
> > > IOW, I don't understand what you wanted to say. Please explain.
> > > (Or did you send this to the wrong address?)
> > 
> > I wanted to respond to OP one way to customize the display position of
> > `global-mode-string' in mode-line, which I think could solve their
> > issue.
> > 
> > ---
> > Gabriel




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59624; Package emacs. (Tue, 29 Nov 2022 12:40:02 GMT) Full text and rfc822 format available.

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

From: Gabriel <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#59624: Usning global-mode-string for small screens
Date: Tue, 29 Nov 2022 09:34:04 -0300
Heime via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> I would need some more assistance to get this to work for me.
>
> When should I update mode-line-format ?  
>
> Call it first, followed by (push '("" act) global-mode-string).
>
> Would I have to call (force-mode-line-update) ?
>

Emacs is smart enough to know when to update the mode-line.  What is
the exactly problem you are facing?  Does the following code do not work
for you?

(progn
  ;; create the `act` variable
  (setq act "Indic")

  ;; add `act` to `global-mode-string`, so it's displayed in the mode-line
  (push '("" act) global-mode-string)

  ;; change position of `global-mode-string` in the mode-line
  (setq-default mode-line-format
        '("%e" mode-line-front-space
                  (:propertize ("" mode-line-mule-info mode-line-client
                mode-line-modified mode-line-remote)
                               display (min-width (5.0)))
                  mode-line-frame-identification mode-line-buffer-identification
                  mode-line-misc-info ;; <-- TO HERE
                  "   " mode-line-position
                  (vc-mode vc-mode)
                  "  " mode-line-modes mode-line-end-spaces))

  ;; you can then update `act' as you want

  ;; the mode-line will be automatically
  ;; updated (when Emacs thinks it needs to)

  ;; the code below will update `act' every 3s
  (run-with-timer 3
                  3
                  (lambda ()
                    ;; not really needed, but you can force it
                    ;;(force-mode-line-update)
                    (setq act
                          (format"|act=%s|" (current-time-string))))))

---
Gabriel?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59624; Package emacs. (Tue, 29 Nov 2022 18:54:02 GMT) Full text and rfc822 format available.

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

From: Heime <heimeborgia <at> protonmail.com>
To: Gabriel <gabriel376 <at> hotmail.com>
Cc: 59624 <at> debbugs.gnu.org
Subject: Re: bug#59624: Usning global-mode-string for small screens
Date: Tue, 29 Nov 2022 18:52:54 +0000
------- Original Message -------
On Tuesday, November 29th, 2022 at 12:34 PM, Gabriel <gabriel376 <at> hotmail.com> wrote:


> Heime via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" bug-gnu-emacs <at> gnu.org writes:
> 
> > I would need some more assistance to get this to work for me.
> > 
> > When should I update mode-line-format ?
> > 
> > Call it first, followed by (push '("" act) global-mode-string).
> > 
> > Would I have to call (force-mode-line-update) ?
> 
> 
> Emacs is smart enough to know when to update the mode-line. What is
> the exactly problem you are facing? Does the following code do not work
> for you?

Wanted to knew the exoct calling sequence, as you described.

What if a package or made changes the mode-line?  Changing
mode-line-format would not be an option then.  I want to add
a small list to whatever there is.  A suggestion has been to
add a list at the beginning of mode-line-format.

(push '("" act) mode-line-format)

> (progn
> ;; create the `act` variable
> (setq act "Indic")
> 
> ;; add `act` to `global-mode-string`, so it's displayed in the mode-line
> (push '("" act) global-mode-string)
> 
> ;; change position of `global-mode-string` in the mode-line
> (setq-default mode-line-format
> '("%e" mode-line-front-space
> (:propertize ("" mode-line-mule-info mode-line-client
> mode-line-modified mode-line-remote)
> display (min-width (5.0)))
> mode-line-frame-identification mode-line-buffer-identification
> mode-line-misc-info ;; <-- TO HERE
> " " mode-line-position
> (vc-mode vc-mode)
> " " mode-line-modes mode-line-end-spaces))
> 
> ;; you can then update `act' as you want ;; the mode-line will be automatically ;; updated (when Emacs thinks it needs to) ;; the code below will update` act' every 3s
> (run-with-timer 3
> 3
> (lambda ()
> ;; not really needed, but you can force it
> ;;(force-mode-line-update)
> (setq act
> (format"|act=%s|" (current-time-string))))))
> 
> ---
> Gabriel?
>




This bug report was last modified 1 year and 120 days ago.

Previous Next


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