Subject: Re: bug#45054: 27.1; Can get point into the middle of a run of characters with a replacing display spec

From: Eli Zaretskii <[email-masked]>
Date: Sat, 05 Dec 2020 22:12:48 +0200

> From: Zack Weinberg <[email-masked]>
> Date: Sat, 5 Dec 2020 15:00:30 -0500
> Cc: [email-masked]
> 
> On Sat, Dec 5, 2020 at 11:18 AM Eli Zaretskii <[email-masked]> wrote:
> > > 1. Is this indeed a bug in Emacs?
> >
> > Probably a bug in adjust_point_for_property.  Try your recipe after
> > setting global-disable-point-adjustment non-nil.
> 
> No change, but set-variable doesn't recognize that variable (so I used
> setq instead)  Is this variable possibly only available in development
> trunk and/or in an Emacs compiled with internal debugging enabled?

No, it just isn't a user option, just a variable.

> > A workaround in Lisp?  Try making the affected text, or some of it,
> > invisible, i.e. give it the 'invisible' text property as well.  (I
> > didn't try to test this solution, so I cannot promise it will work.)
> 
> That makes the situation worse: with the mode enabled, I can separate
> point from the visible cursor just by attempting to move the visible
> cursor over the displayed ¶.

Then I guess your method of putting the display property really freaks
out the mechanism of adjusting point to move it out of this and other
similar properties.

> > > 3. I think it would be better UI if the C-d in the recipe deleted the
> > >    entire run of text that’s getting hidden (more generally, deletion
> > >    commands should behave as if the ¶ is really what’s in the buffer).
> > >    I can’t figure out how to implement that, can you suggest anything?
> >
> > Why can't you delete every character around point that has this
> > special property?
> 
> I don't know how to do that.

What part is missing?  Implement a command that uses
next-property-change and previous-property-change to find where the
property starts and ends, then delete all those characters.  Am I
missing something?