emacs-devel
[Top][All Lists]
Advanced

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

Re: Horizontal centering in the display engine


From: Yuan Fu
Subject: Re: Horizontal centering in the display engine
Date: Wed, 14 Apr 2021 09:42:54 -0400


> On Apr 14, 2021, at 9:28 AM, sbaugh@catern.com wrote:
> 
> Eli Zaretskii <eliz@gnu.org> writes:
>>>> E.g., are you planning on centering each line separately, or
>>>> everything together, or something else?
>>> 
>>> Each line separately.
>> 
>> So each line should have a different value of :align-to?
> 
> If they each had a different value of :align-to, then I'd have to update
> those values of align-to every time text size or window size changes,
> which is something I want to avoid.
> 
>> And if we go one level higher, I guess you intend to write a
>> post-command-hook that recalculates the :align-to specs whenever text
>> changes, is that right?  Or how did you plan on taking text changes
>> into consideration?
> 
> No, I want my :align-to specs to stay the same as text changes.  If
> that's not possible with :align-to specs, then I'd use some other
> feature to implement the centering.
> 
> As I mentioned in my initial email, it's entirely possible to center
> text in Emacs today, even by just inserting spaces.  But that doesn't
> update automatically when text or window size changes; those spaces (or
> :align-to specs, in your proposal - they're basically the same) need to
> be updated by Lisp code running in post-command-hook or elsewhere, as
> you say.
> 
> I want this centering display to be handled by the display engine, as
> other similar things are.
> 
> 

Instead of post-command-hook, you can use jit-lock: register a function that 
updates the display spec when text changes. That works fine in my experience. I 
don’t think the display engine can do what you want.

Yuan




reply via email to

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