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 14:18:01 +0000

On Saturday, July 27th, 2024 at 1:26 AM, Michael Heerdegen via Users list for 
the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> > Meaning that if a buffer name length exceeds the width, the full
> > buffer name is still printed. Something must be wrong because it
> > should not be this hard to change this minor buffer name appearance.
> 
> 
> I think I see now one reason of your confusion:
> 
> | In any construct except ‘%%’, you can add a decimal integer after the
> | ‘%’ to specify a minimum field width.
> 
> See (info "(elisp) %-Constructs"). Not the maximum width. Ok?
> 
> To truncate a string, use `truncate-string-to-width'. Or, if you want
> to rely on mode-line special constructs,
> 
> | ‘(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.
> 
> See (info "(elisp) Mode Line Data").
> 
> I guess it could be less confusing and annoying for you to have a look
> at those parts of the manual. - Michael.

For case of (WIDTH REST...), what do I have to do exactly ?

Certainly not this way

  (setq-default mode-line-buffer-identification
    (list 8
     (propertized-buffer-identification (format "%%%db" width))))



reply via email to

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