unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Abdul-Lateef Haji-Ali via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: eliz@gnu.org, help-gnu-emacs@gnu.org
Subject: Re: Question about align-to behaviour with wrap-mode
Date: Tue, 22 Nov 2022 09:45:20 +0000	[thread overview]
Message-ID: <x1o8rk3pbkf.fsf@hw.ac.uk> (raw)
In-Reply-To: 838rk42oie.fsf@gnu.org


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	other threads:[~2022-11-22  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22  9:45 Abdul-Lateef Haji-Ali via Users list for the GNU Emacs text editor [this message]
2022-11-22 13:46 ` Question about align-to behaviour with wrap-mode Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2022-11-20 22:20 Abdul-Lateef Haji-Ali via Users list for the GNU Emacs text editor
2022-11-21 17:42 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x1o8rk3pbkf.fsf@hw.ac.uk \
    --to=help-gnu-emacs@gnu.org \
    --cc=a.hajiali@hw.ac.uk \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).