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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 18 Jul 2023 14:23:25 +0300

> From: Ihor Radchenko <[email-masked]>
> Date: Tue, 18 Jul 2023 07:58:11 +0000
> 
> (progn
>   (switch-to-buffer (get-buffer-create "*Test*"))
>   (erase-buffer)
>   (insert "Test case with char before point hidden<point>     :more text:")
>   (search-backward ">")
>   (forward-char)
>   (with-silent-modifications (put-text-property (1- (point)) (point) 'invisible t))
>   (let ((indent-tabs-mode nil)) (indent-to 100)))
> 
> The text is inserted and then indented as expected when 'invisible
> property is not applied:
> 
> -------------
> Test case with char before point hidden<point>                                                      <point>     :more text:
> -------------
> 
> However, after un-commenting `put-text-property' line, no indentation is
> done "visually" because Finsert_char is called with INHERIT argument Qt.

Isn't that in general TRT?  When you indent text, you _want_ to
inherit the text properties, right?

Whether the inherited properties should also include the invisible
property could be subject to discussion, but it isn't 100% clear to me
that it should always be excluded.

In any case, I think you can bind text-property-default-nonsticky
around the indent-to call to control this, right?  Or use the
rear-sticky text property.

Adding Stefan, in case he has some comments.