From: Spencer Baugh <sbaugh@janestreet.com>
To: emacs-devel@gnu.org
Subject: Re: min-width display property, but with padding at the start
Date: Tue, 20 Aug 2024 08:09:51 -0400 [thread overview]
Message-ID: <ier1q2jcs4w.fsf@janestreet.com> (raw)
In-Reply-To: 86ikvvwgjs.fsf@gnu.org
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Date: Mon, 19 Aug 2024 16:53:58 -0400
>>
>>
>> I'm writing a mode which adds an entry to the mode-line containing a
>> number. This number can rapidly grow or shrink (it's a number of build
>> targets left to build, for a build system like Bazel) so I would like to
>> pad it to a specified width, to avoid the mode-line jittering around as
>> the number changes.
>>
>> Adding a `display' property with the value '(min-width (5.0)) works
>> fine.
>>
>> However, min-width pads by adding padding at the end. I'd like to add
>> padding at the start instead.
>>
>> Is there a way to achieve this with display properties?
>
> Why do you need display properties? What's wrong with
>
> (format "%5s" THE-STRING)
>
> ?
That is probably what I'll do if I can't find another solution, but
doing it with display properties works with non-fixed-width characters
and faces, which a user might have configured.
If simply padding with spaces sufficed, the display properties in
(info "(elisp) Specified Space") would have little reason to exist.
next prev parent reply other threads:[~2024-08-20 12:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 20:53 min-width display property, but with padding at the start Spencer Baugh
2024-08-20 11:59 ` Eli Zaretskii
2024-08-20 12:09 ` Spencer Baugh [this message]
2024-08-20 13:28 ` Eli Zaretskii
2024-08-20 13:42 ` Spencer Baugh
2024-08-20 14:03 ` Ihor Radchenko
2024-08-20 14:26 ` Eli Zaretskii
2024-08-20 14:34 ` Ihor Radchenko
2024-08-20 18:23 ` Eli Zaretskii
2024-08-20 18:33 ` Ihor Radchenko
2024-08-20 19:31 ` Petteri Hintsanen
2024-08-20 19:46 ` Jim Porter
2024-08-20 12:21 ` tomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ier1q2jcs4w.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.