all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications
@ 2020-04-25 21:24 Clément Pit-Claudel
  2020-04-26 15:33 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Clément Pit-Claudel @ 2020-04-25 21:24 UTC (permalink / raw)
  To: 40856

Hi all,

The wrap-prefix property is very convenient, but it's hard to use for alignment when the width of the item to align to is not easy to compute.  For example, to get the following effect, it's easy to use 'wrap-prefix "  "

- Test
  wrapped
  wrapped

But take a more complex case, like this:

xyz
⟝ abc
   wrapped
   wrapped

Depending on the font in use, the ⟝ character may be more or less wide.  So, the wrap prefix can't just be "  " here; it needs to be calculated using `window-text-pixel-size`, which is costly if it needs to be repeated for many lines.  Additionally, this calculation becomes obsolete and needs to be redone as soon as the user changes the font size.

Or consider the first example again, but this time with non-monospace text:

- Test
  wrapped
  wrapped

Depending on the width of "-" and of the space in the current font, the with of the wrapping prefix should be different.

Specified spaces can already measure the width of an image and many other elements.  Could they be extended to measure an arbitrary string?  Concretely, one would use (:space :width "- ") in the first case and (:space :width "⟝ ") in the second case, and get perfect alignment.  This is similar to what LaTeX calls "phantoms": spaces whose width is exactly that of their argument text.

Clément.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-04-26 18:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-25 21:24 bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications Clément Pit-Claudel
2020-04-26 15:33 ` Eli Zaretskii
2020-04-26 16:09   ` Clément Pit-Claudel
2020-04-26 17:07     ` Eli Zaretskii
2020-04-26 17:23       ` Clément Pit-Claudel
2020-04-26 17:43         ` Eli Zaretskii
2020-04-26 18:25           ` Clément Pit-Claudel

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.