bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#59624: Usning global-mode-string for small screens


From: Heime
Subject: 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@hotmail.com> 
wrote:


> Heime via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" bug-gnu-emacs@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?
>





reply via email to

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