[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
:align-to space spec and line wrap
From: |
Qiantan Hong |
Subject: |
:align-to space spec and line wrap |
Date: |
Mon, 24 Apr 2023 19:23:48 +0000 |
Hi,
I use the :align-to space spec to right align texts, like this:
(defun k-insert-fill-right (string)
;; More correct than `k-fill-right' in some cases, respect current
;; buffer settings (e.g. invisibility spec)
(let ((from (point)))
(insert " " string)
(save-restriction
(narrow-to-region (1+ from) (point))
(let ((width (car (buffer-text-pixel-size))))
(widen)
(put-text-property from (1+ from)
'display
`(space :align-to (- right-fringe (,width))))))
nil))
It works when there is no line wrap. However, when there is line wrap,
the space width shrink to zero rather than fill to (- right-fringe
(,width)) position on the new line. Seem that the width calculation
does not take line wrap into account. Is this intended? Is the
behavior that align to the right position on the new line possible to
implement?
I'm on GNU Emacs 29.0.50.
- :align-to space spec and line wrap,
Qiantan Hong <=