bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#29279: Sharing the margins


From: Eli Zaretskii
Subject: bug#29279: Sharing the margins
Date: Thu, 16 Nov 2017 17:50:31 +0200

> Cc: address@hidden, address@hidden
> From: Dmitry Gutov <address@hidden>
> Date: Wed, 15 Nov 2017 23:49:05 +0200
> 
> >> If not, let's put all padding on the outside and be done with that concern.
> > 
> > This is doable, but the implementation will be more complex.
> > Remember: the display engine lays out stuff left to right.  So padding
> > what's left after we are done with all of the "columns" is easy;
> > padding _before_ requires that you either compute all the widths in
> > advance, or that you come back after laying out the columns and insert
> > the stretch before it, moving all the glyphs to the right.
> 
> Sounds straightforward to me. Since we know the sizes of all the columns 
> in advance, we can just substract them from the target total width, and 
> pad with the resulting number of spaces.

Maybe, but IME things are rarely so easy.

> Further, even though we have a separate accessor for its width 
> (line-number-display-width), if a package depends on it and needs to 
> draw something based on its value, it should want to be notified when 
> there is a change (*). window-configuration-change-hook seems natural. 
> Unless we have a separate hook for that?

The way this feature is designed and implemented, it doesn't lend
itself easily to hooks, primarily because it works in the inner-most
level of redisplay.

> Can't you save the necessary data to a variable, finish redisplay,
> and then run the hook (if the data says so)?

That would be pointless, because there are already hooks which work
before redisplay or after it finishes.  All such a hook needs to do is
compare the value returned by line-number-display-width with the last
value it saw.  That's what I did in tabulated-list-mode, which has
some unique requirements in this area.  Avoiding the comparison
doesn't justify a new hook.

And anyway, what do you envision that a hook function will want to do?
Most probably, it will want to change the window dimensions, or affect
what's on display in some other way, which means an immediate second
redisplay cycle.  So we gain nothing by making the display engine call
the hook.

> It's somewhat hypothetical, but I'd like to refer to (*) above. That is, 
> somebody will probably ask for that anyway, sooner or later.

Somebody already did, and I declined for now, because I think the same
effect can be achieved via existing hooks.





reply via email to

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