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

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

Eli Zaretskii <[email-masked]> writes:

>> However, I do not fully understand what happens if we try to indent
>> fully hidden text (like inside Org's folds). See my previous bug
>> reports: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56837 and
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58791
>
> Invisible text is skipped by current-column.

I am not sure if I understand what you mean by "skipped".
Consider the following file in outline-mode:

-----
<point>
* This
word word
-----

I tried the following command with M-:

(progn
  (visible-mode -1)
  (search-forward "word")
  (message "1:: current-column = %d" (current-column))
  (redisplay)
  (message "2:: current-column = %d" (current-column))
  (indent-to 50)
  (message "3:: current-column = %d" (current-column))
  (redisplay)
  (message "4:: current-column = %d" (current-column))
  (visible-mode +1)
  (message "5:: current-column = %d" (current-column))
  (redisplay)
  (message "6:: current-column = %d" (current-column))
  (visible-mode -1))

First, I left the heading unfolded:

1:: current-column = 4
2:: current-column = 4
3:: current-column = 50
4:: current-column = 50
5:: current-column = 50
6:: current-column = 50

Then, I undid the indent, folded the heading, and repeated

1:: current-column = 4 <==== same despite text being invisible via overlay
2:: current-column = 4
3:: current-column = 50
4:: current-column = 50
5:: current-column = 50
6:: current-column = 50

Then, I undid the indent again, and applied 'invisible text property to
the heading text

1:: current-column = 0 <==== now, `current-column' ignores the invisible text
2:: current-column = 0
3:: current-column = 50 <=== This presumably inserts more tabs/spaces, but not!
4:: current-column = 0  <=== redisplay changed `current-column' ??
5:: current-column = 50 <=== indeed, the number of spaces is the same as visible text
6:: current-column = 50

Then, I repeated again, but applied 'rear-nonsticky (invisible) text
property as well

1:: current-column = 0
2:: current-column = 0
3:: current-column = 50
4:: current-column = 50
5:: current-column = 50
6:: current-column = 50

I cannot make much sense of the above results.

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