emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make Emacs popular again: Use monospaced fonts less


From: Stefan Monnier
Subject: Re: How to make Emacs popular again: Use monospaced fonts less
Date: Thu, 15 Oct 2020 10:21:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> The advantage of %12b and its ilk is that it solves 2 problems at the
> same time: removes the potential contradiction between the width
> specification in mode-line-format and this new property; and allows to
> get rid of the text property, which is a certain complication.

But the %12b approach doesn't let you specify a max/min width for other
elements such as `mode-line-process`, `major-mode, `minor-mode-alist`, ...

>> > Outside of the mode line, I don't know how to implement that easily,
>> > because that would need some kind of looking-back to find where the
>> > text property started.
>> Indeed.  Maybe the text-property's value should include the information
>> of what is the "starting position".
> ??? How can Lisp know that?

Oh, I see we were not talking about the same thing.
Yes, we'd need somehow to walk back the glyph structure to find the
pixel position of the start position of the element.

What I was trying to address is the issue of text properties being
potentially split, so you can't really rely on

    (put-text-property START END 'width 50)

so I was thinking of instead doing something like

    (put-text-property (1- END) END 'relative-end-position (list START 50))

so when the redisplay sees this position, it would walk back the glyphs
to find the nearest one corresponding to START, and then either truncate
the last few glyphs to fit in a width of 50, or add some space to reach
a width of 50.

Of course, on the next day someone would come along and want to use it
with START on another line with the intention to do relative
indentation ;-)

At which point we may prefer to use something like:

    (put-text-property START (1+ START) 'glyph-mark 'my-glyph-mark)
    (put-text-property (1- END) END 'relative-end-position (list 'my-glyph-mark 
50))

with the redisplay keeping track somehow(!) of a set of "glyph-marks" seen
in the current window.


        Stefan




reply via email to

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