emacs-devel
[Top][All Lists]
Advanced

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

Re: Better handling of window margins


From: Stefan Monnier
Subject: Re: Better handling of window margins
Date: Fri, 04 Dec 2015 15:55:59 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> Basically, package A uses the margin to place a few things in it.  So it
>> needs a left margin that at least X pixels wide so its goodies
>> are visible (i.e. its function will return the max between X and
>> whatever else is decided).
>> 
>> Then comes package B which uses that same margin for other things of
>> size Y.  Since its other things are placed elsewhere, it requests that
>> the margin be the max of Y and whatever else is decided.
>> 
>> Then comes package C which adds something of size Z to every line in
>> that same margin.  So it requests (with "depth") to be placed
>> last, and its function returns the sum of Z and whatever else
>> is decided.

> My suggestion was to ask each package to provide 2 numbers, not one.

Each package above knows (internally) a single number in this case, but
it does not provide it.  It only provides a function which combines this
number with the one it gets from the rest.

> (I also don't understand the "displayed elsewhere" part of package B.
> What does "elsewhere" mean here?  Is that stuff displayed on the
> margins or not?)

It means that package A and B place their things on different lines, so
the needed margin size is the max of X and Y rather than the sum.

> If you are saying that both numbers are the same for each of the
> packages in your scenario, then the result under my suggestion will be
> X+Y+Z, and we don't need to rely on any package for this wisdom, or
> request them to understand how we allocate space for the margins.

That would be too wide a margin in my example where we'd want
(+ (max X Y) Z) instead.

>> Currently, this is done arbitrarily by the display engine, but we should
>> instead provide new functions which perform this combination in Elisp
>> and then place a single `display' property for the margin.
> How can you provide a single display property when the original
> properties are in different buffer locations?

You can't.  But if you need to share those two properties, it means
they're displayed at the same place, which also means that maybe they
don't need to be in different buffer location.
At least, that's my assumption.


        Stefan



reply via email to

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