Subject: Re: bug#64696: 30.0.50; indent-to inherits preceding text properties, including 'invisible

From: Ihor Radchenko <[email-masked]>
Date: Tue, 25 Jul 2023 08:38:38 +0000

Eli Zaretskii <[email-masked]> writes:

>> For example, consider an Org table like
>> 
>> | *This* | is | some text |
>> | more |    |  text     |
>> 
>> It looks aligned in Org buffers ("*" is invisible), but not when copied
>> to message buffer.
>
> Where does fontification enter this picture?

"*" is made invisible after fontification.

Fontified:

 | This | is | some text |
 | more |    |  text     |

Unfontified

 | *This* | is | some text |
 | more |    |  text     |

> IOW, the tendency should be to provide _more_ visual indentation, by
> making our indentation commands smarter and more fine-grained (e.g.,
> pixel-wise), not to make them _less_ visual by disabling the important
> display features.
>
> The important thing to remember is that Emacs makes all those
> display-time transformation because that's how people want to see the
> text on the screen.  It is very rare to see an application that wants
> to show decomposed characters, as in a◌́ instead of á, or to see a TAB
> shown as a single column.  Heck, even the display of control
> characters, like , is part of this, and why would we want to turn
> that off?
>
> IOW, the need for turning these off is extremely rare, and doesn't
> justify such global toggles, because no one will use them.

I can see your point. However, this is sometimes conflicting with
copying text verbatim or viewing it in other editors. For example,
nameless-mode that visually compresses
my-long-package-name-variable-name into :variable-name creates a lot of
mess when the same file is committed to public repo and later opened by
other contributors without nameless-mode enabled.

In the ideal world, Emacs would indent both visually and textually. With
visual part only using 'display text properties that do not modify the
actual text in file.

>> It would help to list what contributes to indentation/columns in the
>> documentation.
>
> They are a legion.  Basically, every display-related feature described
> in the ELisp manual -- and there are a lot of them -- is of this
> nature.  Since we already describe them all in the manual, adding a
> section which mentions them all together is strictly not necessary for
> a reference manual.  It's more a job for a tutorial.
>
> You are asking that someone does a very large job of collecting
> existing stuff together, for facilitating a solution of some pretty
> rare problem.  I cannot justify a large job such as this one -- going
> through all the Emacs display features and describing them together --
> for this kind of purpose.  But if someone wants to work on that, I
> won't necessarily object if the result is concise and doesn't repeat
> the existing material.

I was mostly advocating the need in "disable them all" toggle as a less
maintenance-heavy alternative.

>> A toggle: disable all visual contributors.
>
> It will never be used.

I would use it in Org instead of `org-current-text-column'.
It currently relies upon `string-width' ignoring visuals, which may or
may not hold in future (the docstring implies that `string-width' may as
well consider visuals: "Return width of STRING when displayed in the
current buffer.")

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>