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

From: Ihor Radchenko <[email-masked]>
Date: Fri, 28 Jul 2023 08:30:47 +0000

Stefan Monnier <[email-masked]> writes:

> Presumably you'll also want to keep columns aligned dynamically as text
> is inserted/deleted.  I suspect that once you try to do that, it's
> fairly easy to temporarily let-bind `buffer-invisibility-spec` around
> the code that inserts SPCs&TABs to enforce the "vanilla" alignment.

Sure. Org is slowly moving in that direction - separating text alignment
and visual alignment. We have a persistent stream of related feature
requests.

However, remember that this thread started with `indent-to' calculating
target column without taking into account the display staff. While the
initial column is using `current-column' and considers
composition/faces/[partially] invisibility, the number of tabs/spaces to
be inserted to reach target column are calculated assuming that each
space occupies 1 column and each tab occupies tab-width columns.

Now, when we established that Emacs indentation is visual, it is clear
that the assumption in `indent-to' is not accurate.

>> Sure, but how can an application, say, disable all the effects of visual
>> representation without (1) searching and let-binding each specific
>
> Define "disable all the effects of visual representation".  I think what
> you mean is something like "pretend the text is displayed by sending it
> to an text terminal", but the width can depend on the specific text
> terminal (especially for non-ASCII Unicode chars, but also for chars <
> 32).  So it's a non-trivial problem, in reality.

You are right. Probably, a good goal would be "looks aligned in
fundamental-mode".

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