bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64696: 30.0.50; indent-to inherits preceding text properties, includ


From: Eli Zaretskii
Subject: bug#64696: 30.0.50; indent-to inherits preceding text properties, including 'invisible
Date: Sat, 22 Jul 2023 14:35:26 +0300

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: monnier@iro.umontreal.ca, 64696@debbugs.gnu.org
> Date: Sat, 22 Jul 2023 07:09:25 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> With `indent-tabs-mode' disabled, running the test yields different
> >> results. (AFAIU, it should not).
> >
> > Is this about indent-to or about current-column?  I'd like to see
> > first if there are any problems in current-column.
> 
> Ok.
> 
> Test #3 with and without indent-tabs-mode are not the same:
> 
> (indent-tabs-mode is nil)
> ⛔ Warning (emacs): Test #3:: ’word’ is hidden applying ’invisible text 
> property to heading body.
> ⛔ Warning (emacs): Moved point after first ’word’
> ⛔ Warning (emacs): 1:: current-column = 0
> ⛔ Warning (emacs): Indented to column 50
> ⛔ Warning (emacs): 3:: current-column = 0
> ⛔ Warning (emacs): Enabled visible mode
> ⛔ Warning (emacs): 5:: current-column = 54
> 
> (indent-tabs-mode is t)
> ⛔ Warning (emacs): Test #3:: ’word’ is hidden applying ’invisible text 
> property to heading body.
> ⛔ Warning (emacs): Moved point after first ’word’
> ⛔ Warning (emacs): 1:: current-column = 0
> ⛔ Warning (emacs): Indented to column 50
> ⛔ Warning (emacs): 3:: current-column = 0
> ⛔ Warning (emacs): Enabled visible mode
> ⛔ Warning (emacs): 5:: current-column = 50
> 
> Note how the last current-column value is different.
> It may be something about current-column or about indent-to.

(With the patched current-column, I get 48 and 50.)

It's neither.  If you think about this, you will realize that
something like this is expected: current-column will always return
different results when you remove the invisibility properties,
depending on whether tabs were used for indentation, because the width
of a tab is not constant, it depends on where on display it is
located.

In this case, the "real" column after the first "word" is 4, but when
there are invisible properties, its column is 6 (with the patched
current-column).  So indent-to needs to insert the equivalent of 44
columns to get to column 50.  With indent-tabs-mode nil it actually
inserts 44 spaces, so when the invisibility is removed, we get
current-column = 4 + 44 = 48.  When indent-tabs-mode is t, indent-to
decides to insert 6 tabs and 2 spaces, so you get a different result
when you remove the invisibility.

Bottom line: indentation with invisible text is tricky.  (Who was the
genius who decided that using invisibility in Org is a good idea??)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]