[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about align-to behaviour with wrap-mode
From: |
Abdul-Lateef Haji-Ali |
Subject: |
Question about align-to behaviour with wrap-mode |
Date: |
Sun, 20 Nov 2022 22:20:50 +0000 |
I noticed what I think is strange behaviour with `:align-to` that I am
wondering if it's intended and if there's a way of achieving a desired
behaviour.
To reproduce in an `emacs -Q`, just run this:
(progn
(toggle-word-wrap +1)
(goto-char (point-max))
(insert
(concat "\n\n"
(make-string (- (window-width) 3) 69)
" "
(propertize " " 'display
`(space :align-to (- right
10)))
"After\n\n")))
The word 'After' is not aligned to `(- right 10)` because the text before is
too long. Instead "After" is displayed at the beginning of the next line (or
broken across two lines if toggle-word-wrap is disabled) and the alignment is
ignored.
If I execute instead
(progn
(toggle-word-wrap +1)
(goto-char (point-max))
(insert
(concat "\n\n"
(make-string (window-width) 69)
" "
(propertize " " 'cursor 1 'display
`(space :align-to (- right
10)))
"After\n\n")))
the alignment is "correct" on the second line.
In both situation, I was intending (and expecting) the word "After" to be on
the second line and to be correctly aligned at (- right 10). Is the current
behaviour intended? Is there a way to achieve my desired behaviour?
I could of course add spaces before the right-aligned text, but then if more
text is added I would need to adjust the spaces dynamically which is
less-than-ideal.
-- Al
________________________________
Heriot-Watt University was founded in 1821 and is a registered Scottish charity
(SC000278).
- Question about align-to behaviour with wrap-mode,
Abdul-Lateef Haji-Ali <=