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

From: Ihor Radchenko <[email-masked]>
Date: Mon, 24 Jul 2023 08:18:54 +0000

Eli Zaretskii <[email-masked]> writes:

>> 1. Org mode is generally aiming for the produced Org files to be
>>    readable as unfontified plain text. So, quirks related to visual
>>    indentation generally tend to mess things up.
>
> "Unfontified"?  AFAIK, Org files do use fontifications, don't they?
> So what do you mean by "unfontified plain text" here?  But that's an
> aside, feel free to ignore.

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.

>> 2. Org mode uses indentation as part of the syntax. I had to get rid of
>>    using `current-column' and calculated "true textual indentation"
>>    manually to avoid breakage after `current-column' started to take
>>    into account invisibility. (bug#56837)
>
> This cannot be avoided.  Emacs provides by default many features that
> "mess up" this kind of "true textual indentation".  Some of these
> features include:
> ...
> (I'm probably missing some more.)  Only the Lisp program knows which
> of those are relevant to the particular application at hand.

Sure, but how can an application, say, disable all the effects of visual
representation without (1) searching and let-binding each specific
toggle (and possibly adding more in future versions of Emacs); (2)
re-implementing the existing indentation code (like what
`org-current-text-column' does)?

> We could introduce separate indentation/current-column knobs for each
> of the above features, but it would make little sense to me, since
> most, if not all, of them already have such knobs.  For example,
> character composition can be disabled by flipping a variable.

It would help to list what contributes to indentation/columns in the
documentation.

> See above: you are actually opening a Pandora box, and any solution
> will likely be based on existing variables.  So I think we already
> have what you want, it just might not be immediately obvious in each
> case which of the knobs to use.  The default behavior of
> current-column can already be affected by disabling
> auto-composition-mode, by tweaking the buffer's invisibility spec, and
> by defining display properties whose values are conditional.  Tab
> expansion can also be controlled.  What else would make sense?

A toggle: disable all visual contributors.

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