> Some code in paren.el probably moves point without unwind-protect, or
something like that.
It's not. To answer you, I've created a new recipe that only moves overlay, and
triggers the problem:
1. emacs -Q
2. M-x find-library RET paren
3. M-x split-window-horizontally
4. Go to the bottom of the file
5. M-x read-only-mode to turn off read-only-mode so we can write things here.
Also M-x auto-save-mode to stop Emacs from auto saving it.
6. Paste and eval this:
(defvar test-overlay (make-overlay (point-min) (1+ (point-min))))
(overlay-put test-overlay 'face 'isearch)
(run-with-timer 0 0.05 (lambda ()
(let ((beg (random 5)))
(move-overlay test-overlay beg (1+ beg)))))
(defvar test-overlay2 (make-overlay (1- (point-max)) (point-max)))
(overlay-put test-overlay2 'face 'isearch)
(run-with-timer 0 0.05 (lambda ()
(let ((beg (- (point-max) (random 5))))
(move-overlay test-overlay beg (1+ beg)))))
Now we have 2 overlays dancing at the beginning and end of buffer.
7. Go to the end of ther buffer, holding C-g for several secs. You may need to
do this several times, but there are chances that the cursor goes to the
beginning of the buffer.
Screen recording attached. For things like system information, see my last
reply to Lars.
> From: Amai Kinono <amaikinono@gmail.com>
> Date: Wed, 11 Aug 2021 13:49:08 +0800
>
> My recent test shows this also happens when you modify overlay in the buffer
> frequently. Also, a timer is not needed, it happens when it's frequent enough.
>
> Recipe:
>
> 1. emacs -Q
>
> 2. Eval this:
>
> (require 'paren)
> (add-hook 'post-command-hook
> (lambda ()
> (let ((show-paren-mode t))
> (show-paren-function))))
>
> It's a setup to run show-paren-function in post-command-hook. Directly using
> show-paren-mode also cause the bug, but the chance is way lower, as it
> delays the refreshing using a timer. It happens to me occasionally when I'm
> coding with show-paren-mode on.
>
> 3. M-x find-library RET paren
>
> 4. M-x split-window-horizontally
>
> 5. Move to a position in the left window where there's a bunch of closing
> parens. You should see show-paren-function is highting them for you.
>
> 6. Scroll the right window to a position where you can see the matching opening
> parens. Now show-paren-function should highlight opening parens in the right
> window, and closing parens in the left window.
>
> 7. Go back to the left window. Hold Ctrl and press f/b/g at the same time
> several times (so you are sending C-f, C-b and C-g frequently)
>
> 8. The cursor in the left window will jump to the position of the
> right window cursor.
Some code in paren.el probably moves point without unwind-protect, or
something like that.