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

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

Re: Question about align-to behaviour with wrap-mode


From: Abdul-Lateef Haji-Ali
Subject: Re: Question about align-to behaviour with wrap-mode
Date: Tue, 22 Nov 2022 09:45:20 +0000

Thanks Eli for explaining.

> I don't see the correct alignment here.  I see a behavior similar to the
> first recipe, as I'd expect.

This is what I see with this example on my Emacs 28.2 (assume window width is 
50):

,----
| EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
|                                         After
`----

So the text is "correctly" aligned to (- right 10) on the second line. Are you 
seeing something different?

The only problem I see is that when the word is broken and word-wrap is off 
then I get

,----
| EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE Af
| ter                                      
`----

while if word wrap is on I get

,----
| EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
| After                                      
`----


> The bottom line is that you cannot use relative alignment if your lines can
> wrap, and hope for that to work.  For wrapped lines the alignment must be to
> absolute column numbers, and it must take the continuation lines into
> consideration when you calculate the alignment column.

I see. Do you mean that I should write a hook to update the alignment of 
"After" as more text is inserted before it (to calculate the alignment column 
taking the continuation lines into considerations)?
Or is there a way to have `align-to` be calculated from a function?

Thanks,
-- Al

________________________________
Heriot-Watt University was founded in 1821 and is a registered Scottish charity 
(SC000278).



reply via email to

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