Subject: Re: bug#37858: 27.0.50; Ensure a minimum width for `space` display prop

From: Robert Pluim <[email-masked]>
Date: Tue, 22 Oct 2019 10:03:46 +0200

>>>>> On Mon, 21 Oct 2019 16:03:58 -0400, Stefan Monnier <[email-masked]> said:

    Stefan> Package: Emacs
    Stefan> Version: 27.0.50

    Stefan> For text displayed in columns, alignment is generally obtained with
    Stefan> a `display` text-property of the form

    Stefan>     (space :align-to FOO)

    Stefan> This works great when the previous text ends before FOO, but when we
    Stefan> mis-calculate (or didn't calculate at all) and the previous text already
    Stefan> extends further than the desired alignment of the following text, such
    Stefan> space is reduced down to 0 pixels which is often not what we want.

    Stefan> Sometimes one can workaround this by placing 2 spaces in the buffer: one
    Stefan> with the :align-to and another fixed size space.  But it can be
    Stefan> cumbersome to do that and it leads to undesirable artifacts (e.g. the
    Stefan> cursor can be placed between the two space).

    Stefan> So, I'd like to extend our `space` specifications so as to be able to
    Stefan> specify a minimum width.  I came up with the patch below which lets you
    Stefan> write:

    Stefan>     (space :align-to FOO :min-width BAR)

    Stefan> which seems to work fine, but while trying to update the Elisp doc for
    Stefan> it I realized that maybe a better option is to extend the acceptable
    Stefan> forms for FOO so it can be of the form:

    Stefan>     (space :align-to (max FOO (+ BAR current-x)))

Hmm, I think I probably prefer the former. Perhaps when you've
documented the semantics of your :min-relative-width addition Iʼll be
able to judge better :-)

Robert