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: Fri, 26 Jul 2024 15:03:12 +0000





Sent with Proton Mail secure email.

On Saturday, July 27th, 2024 at 2:40 AM, Yuri Khan <yuri.v.khan@gmail.com> 
wrote:

> On Fri, 26 Jul 2024 at 21:19, Heime heimeborgia@protonmail.com wrote:
> 
> 
> 
> > > | ‘(WIDTH REST...)’
> > > | A list whose first element is an integer specifies truncation or
> > > | padding of the results of REST. The remaining elements REST are
> > > | processed recursively as mode line constructs and concatenated
> > > | together. When WIDTH is positive, the result is space filled on
> > > | the right if its width is less than WIDTH. When WIDTH is negative,
> > > | the result is truncated on the right to −WIDTH columns if its width
> > > | exceeds −WIDTH.
> > 
> > For case of (WIDTH REST...), what do I have to do exactly ?
> 
> 
> Have you read the explanation about positive and negative WIDTHs above?
> 
> > Certainly not this way
> > 
> > (setq-default mode-line-buffer-identification
> > (list 8
> > (propertized-buffer-identification (format "%%%db" width))))
> 
> 
> This seems to work for me:
> 
> (setq-default mode-line-buffer-identification
> (list -8 (propertized-buffer-identification "%b")))
> 
> -8 specifies truncation to 8 characters. And we don’t need to pad if
> we’re going to truncate anyway.
> 
> (8 is way too small for a buffer name though.)

Have noticed that doing like this crashes emacs

  (setq-default mode-line-buffer-identification
    (list wmin (propertized-buffer-identification
                 (format "%%%db" wmax))))





reply via email to

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