all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
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 09:42:49 -0400	[thread overview]
Message-ID: <ierwmkbb99i.fsf@janestreet.com> (raw)
In-Reply-To: 867ccbwcgf.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Date: Tue, 20 Aug 2024 08:09:51 -0400
>> 
>> >> 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.
>
> Using variable-pitch fonts on the mode line is not recommended, as the
> results could be problematic around fields that change dynamically.
> The min-width property was introduced to make that easier during the
> short period when we considered switching to variable-pitch font by
> default, but we later decided not to do that for several reasons.

Ah, okay, that makes sense.  I'll just use a format invocation as you
described, then.

> Are there many people who use variable-pitch fonts on the mode line?
>
>> If simply padding with spaces sufficed, the display properties in
>> (info "(elisp) Specified Space") would have little reason to exist.
>
> As an alternative to min-width, you could use a :space display spec
> whose width you calculate in Lisp, given string-width of the string
> you want to pad.  I think this should work.

Yes, that makes sense as a way to support variable-pitch fonts (although
probably a little less reliable than something supported directly by the
display engine)




  reply	other threads:[~2024-08-20 13:42 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
2024-08-20 13:28     ` Eli Zaretskii
2024-08-20 13:42       ` Spencer Baugh [this message]
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=ierwmkbb99i.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.