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 12:39:01 +0000





Sent with Proton Mail secure email.

On Thursday, July 25th, 2024 at 7:18 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Wed, 24 Jul 2024 16:30:51 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: Eli Zaretskii eliz@gnu.org, help-gnu-emacs@gnu.org
> > 
> > > > > More generally, take a look at lisp/bindings.el, where all the parts
> > > > > of mode-line-format are defined and then used to produce the final
> > > > > value of that variable.
> > > > 
> > > > If I change mode-line-buffer-identification, would I not loose the text
> > > > properties and the local-map for the mouse action ? Somehow I have to 
> > > > put
> > > > those back.
> > > 
> > > Have you actually looked at the definition of 
> > > mode-line-buffer-identification?
> > > 
> > > (defvar-local mode-line-buffer-identification
> > > (propertized-buffer-identification "%12b")
> > > "…docstring…")
> > > 
> > > Reuse the wrapper. Change the payload.
> > 
> > I am not sure whether there are hidden text properties. You all talk to me
> > in the abstract, expecting me to know what to do.
> 
> 
> 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.

propertized-buffer-identification is a function that is used to construct
all the details including the keymap.  You previously mentioned that I do not
need to handle any keymade, but just change the numeric value

(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)))





reply via email to

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