GNU bug report logs - #40856
Feature request: support arbitrary propertized strings in wrap-prefix specifications

Previous Next

Package: emacs;

Reported by: Clément Pit-Claudel <cpitclaudel <at> gmail.com>

Date: Sat, 25 Apr 2020 21:25:01 UTC

Severity: wishlist

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Feature request: support arbitrary propertized strings in wrap-prefix
 specifications
Date: Sat, 25 Apr 2020 17:24:19 -0400
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.




This bug report was last modified 5 years and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.