Subject: bug#71605: 30.0.50; [PATCH] Support variable-width text in 'visual-wrap-prefix-mode'

From: Eli Zaretskii <[email-masked]>
Date: Mon, 17 Jun 2024 22:55:14 +0300

> Cc: [email-masked]
> Date: Mon, 17 Jun 2024 11:17:45 -0700
> From: Jim Porter <[email-masked]>
> 
> Maybe :align-to could be made to work. It doesn't seem to work at all 
> for me, even in a minimal test case like calling this on a long line of 
> text:
> 
>    (put-text-property (point-min) (point-max) 'wrap-prefix '(space 
> :align-to 4))
> 
> Replacing :align-to with :width works just fine though. It's entirely 
> possible I'm just doing something wrong, but maybe this is a bug?

It's a bug in Emacs 29 and Emacs 30.  It works in Emacs 27.

> (Now what would be great is if :align-to supported a *string* value that 
> meant "use the pixel-width of this string".

It's already possible: just have a variable that holds the width, and
use it in the :align-to expression.

> Which actually gives me an 
> idea... what if the wrap-prefix is just the original text like "* " and 
> we fontify it to be invisible? It's not part of the buffer and you can't 
> select it anyway, so it doesn't really matter what the text is so long 
> as it's not visible.)

I don't think I follow: how is this relevant to the issue at hand?