Subject: bug#72309: propertized-buffer-identification with maximum width

From: Heime <[email-masked]>
Date: Sun, 28 Jul 2024 12:51:06 +0000

Sent with Proton Mail secure email.

On Monday, July 29th, 2024 at 12:29 AM, Eli Zaretskii <[email-masked]> wrote:

> > Date: Sun, 28 Jul 2024 12:18:32 +0000
> > From: Heime [email-masked]
> > Cc: Eli Zaretskii [email-masked], [email-masked]
> > 
> > > > > What is the big problem of showing how to implement this, buffer name
> > > > > with truncation ellipses using mode-line-buffer-identification ?
> > > > 
> > > > We don't have people here whose job is to write code for others. This
> > > > is a volunteer-based project, where people help you with ideas, but
> > > > the actual job of writing and debugging the code is yours.
> > > > 
> > > > So please take the ideas, read the documentation, and work on the
> > > > implementation you want. If you have questions about the
> > > > implementation, please ask them on help-gnu-emacs, which is where
> > > > user-level help should be sought.
> > 
> > The implementations do not work.
> > 
> > For instance, using
> > 
> > (name (buffer-name))
> > 
> > or with
> > 
> > (buffer-name (window-buffer))
> > 
> > See
> > 
> > (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))))) )
> > 
> > And neither does this
> > 
> > (let* ( (bfname (buffer-name (window-buffer)))
> > (tkname (if (> (length bfname) wmax)
> > (truncate-string-to-width bfname wmax nil nil "...")
> > bfname)))
> > (propertized-buffer-identification (format " %s " tkname))))
> > 
> > So there is no option other than using %b, where one has no control about
> > how it gets displayed.
> 
> 
> Your conclusions are wrong.

If I put a question on emacs help, would you answer it in
a way that gets things to work ?