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: Ihor Radchenko
Subject: bug#64696: 30.0.50; indent-to inherits preceding text properties, including 'invisible
Date: Tue, 18 Jul 2023 12:09:43 +0000

Eli Zaretskii <eliz@gnu.org> writes:

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

The problem is that inheriting 'invisible (if its value is actually
hiding text) yields to cursor not moving to the target column.

When I read the docstring:

    (indent-to COLUMN &optional MINIMUM)
    
    Documentation
    Indent from point with tabs and spaces until COLUMN is reached.

I expect that (current-column) will become COLUMN after calling
`indent-to'. It is not the case in the described scenario.

More generally, `indent-to' implementation assumes that it is sufficient
to insert "COLUMN - (current-column)" spaces in order to reach COLUMN
(let me ignore tabs for simplicity).

However, it is not true for invisible text and when 'display is
specifying custom space width (and what about :align-to?).

And the actual scenario for Org is even more complex because
Org fontification is what is adding that problematic invisible text
property, leading to race condition between redisplay and indentation.
When I sprinkled (redisplay) calls to different places in Org's
tag alignment code, the results varied depending on where the
(redisplay) call was inserted.

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

That's what I did to fix things on Org side, but I believe that the
current behaviour is a genuine bug.

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





reply via email to

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