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: Yuri Khan
Subject: Re: Operation of format-mode-line
Date: Fri, 26 Jul 2024 21:40:09 +0700

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



reply via email to

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