Subject: bug#10222: intangible property and sentence movement

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 27 Jan 2022 18:50:54 +0100

Tassilo Horn <[email-masked]> writes:

> (defun hide-every-2nd-line ()
>   (interactive)
>   (while t
>     (next-line 2)
>     (let ((ol (make-overlay (line-beginning-position)
> 			    (line-end-position))))
>       (overlay-put ol 'invisible t)
>       (overlay-put ol 'intangible t))))
> 
> 3. C-h t (use the tutorial as test buffer)
> 4. M-x hide-every-2nd-line RET

> So now we have the TUTORIAL buffer where every second line is invisible
> and intangible and point is at `point-max'.  In this situation, there
> are two problems with the M-a and M-e.
>
>   1. In some situations, M-a/M-e don't move at all.  (I think, that's
>      the case, if the sentence start/end is inside a hidden line, but
>      I'm not too sure.)
>
>      For example, when point is at point-max, I can hit M-a once so that
>      point is at the beginning of the invisible line below the "Please
>      read the file COPYING...".  Hitting M-a again has no effect
>      anymore.
>
>      (BTW: This "M-a/M-e don't move issue" is also present in the bug
>      messages buffer.)
>
>   2. At some positions in that file, invoking M-a/M-e will make emacs
>      hang.  Try hitting M-e repeatedly beginning at the start of the
>      buffer.  After the second M-e, point is after "See end for copying
>      conditions.".  Hitting it again makes emacs hang.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Testing this recipe in Emacs 29, I don't see any hangs with those
commands, but perhaps you need to put point in certain particular
places -- or perhaps this has been fixed in the years since it was
reported.

Are you still seeing this issue in recent Emacs versions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no