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: Heime
Subject: Re: Operation of format-mode-line
Date: Thu, 25 Jul 2024 13:20:54 +0000





Sent with Proton Mail secure email.

On Friday, July 26th, 2024 at 12:50 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:

> On Thu, 25 Jul 2024 at 19:39, Heime heimeborgia@protonmail.com wrote:
> 
> > > The text properties are all generated by
> > > propertized-buffer-identification, so if you leave that intact and
> > > only change "%12b" to "%20b", all the rest should be as it was before.
> > 
> > You really need to assist me with the code. Have been working on modifying
> > the width as seen in vodil-width.
> > 
> > (defun vodil-width (new-width)
> > "Update the width of the buffer name in the mode line to NEW-WIDTH."
> > 
> > (let* ( (current-format
> > (format-mode-line mode-line-buffer-identification))
> > (new-format
> > (replace-regexp-in-string "%[0-9]+b"
> > (format "%%%db" new-width) current-format)))
> > 
> > (setq mode-line-buffer-identification new-format)))
> 
> 
> You are making it much more difficult for yourself. Just put the
> following into your init file:
> 
> (setq mode-line-buffer-identification
> (propertized-buffer-identification "%20b"))
> 
> If you insist on having a function that accepts the new width as a number:
> 
> (defun my-set-mode-line-buffer-identification-width (new-width)
> (setq mode-line-buffer-identification
> (propertized-buffer-identification
> (format "%%%db" new-width))))
> 
> …but you really should not need this unless you are frequently
> switching between very large and very small monitors.


I understand. propertized-buffer-identification has hardwired keymap etc
and calling it only sets the format used for the buffer identification  
name.  

Correct, at work I have very large screen, but very small laptops otherwise.



reply via email to

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