all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Cc: 40856@debbugs.gnu.org
Subject: bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications
Date: Sun, 26 Apr 2020 18:33:13 +0300	[thread overview]
Message-ID: <83sggq5kjq.fsf@gnu.org> (raw)
In-Reply-To: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@gmail.com> (message from Clément Pit-Claudel on Sat, 25 Apr 2020 17:24:19 -0400)

> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> Date: Sat, 25 Apr 2020 17:24:19 -0400
> 
> 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.

wrap-prefix can have value that uses :align-to, so I don't see why
you'd need to call window-text-pixel-size many times.  You could call
it once, and then use the result in the subsequent values of prefix.

> 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.

It should be possible to do that, but I'm not sure it will be cheaper
than calling window-text-pixel-size or something similar, because
(unlike with images) Emacs doesn't have the width already calculated
and stashed somewhere, it would need to lay out the string and
calculate the resulting pixel width each time it sees such a display
spec.





  reply	other threads:[~2020-04-26 15:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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

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

  git send-email \
    --in-reply-to=83sggq5kjq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=40856@debbugs.gnu.org \
    --cc=cpitclaudel@gmail.com \
    /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.
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.