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

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

Re: Operation of format-mode-line


From: Eli Zaretskii
Subject: Re: Operation of format-mode-line
Date: Sat, 27 Jul 2024 09:01:02 +0300

> Date: Fri, 26 Jul 2024 22:30:21 +0200
> From:  Michael Heerdegen via Users list for the GNU Emacs text editor 
> <help-gnu-emacs@gnu.org>
> 
> >   (setq-default mode-line-buffer-identification
> >     (propertized-buffer-identification
> >       (format " %s "
> >         (let ( (name (buffer-name)) )
> >           (if (> (length name) wmax)
> >               (concat (substring name 0 (- wmax 3)) "...")
> >             name))))) )
> 
> This is expected: the display engine doesn't switch buffers when drawing
> mode-lines all the time.  With other words: In the above context the
> return value of `buffer-name' does not always correspond to the buffer
> of the window whose mode-line gets computed.

IOW, instead of (buffer-name), one should probably use something like

  (buffer-name (window-buffer))



reply via email to

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