* bug#39967: 27.0.90; how to debug point moving erratically?
@ 2020-03-07 3:49 William Rankin
2020-03-07 8:00 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: William Rankin @ 2020-03-07 3:49 UTC (permalink / raw)
To: 39967
Hello,
I've been on the emacs-27 branch for about six months, and every now and then
the point will begin erratically jumping around the current buffer without
input. (I only got to addessing it now due to the impending release of 27.1.)
Some observations: This only happens about once a week. C-g has no effect.
There's no clues in *Messages* buffer. Point movement is beyond visible portion
of buffer. It usually happens in emacs-lisp-mode buffers that have been open a
few hours, but I've experienced it in other modes too.
It seems like it could be font-lock/jit-lock moving point around outside of a
save-excursion, but I know no way of confiming this.
How should I go about debugging this?
GNU Emacs 27.0.90 (build 2, x86_64-apple-darwin19.3.0, NS appkit-1894.30 Version
10.15.3 (Build 19D76)) of 2020-03-05
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-07 3:49 bug#39967: 27.0.90; how to debug point moving erratically? William Rankin
@ 2020-03-07 8:00 ` Eli Zaretskii
2020-03-07 9:10 ` William Rankin
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2020-03-07 8:00 UTC (permalink / raw)
To: William Rankin; +Cc: 39967
> From: William Rankin <william@bydasein.com>
> Date: Sat, 07 Mar 2020 13:49:33 +1000
>
> I've been on the emacs-27 branch for about six months, and every now and then
> the point will begin erratically jumping around the current buffer without
> input. (I only got to addessing it now due to the impending release of 27.1.)
>
> Some observations: This only happens about once a week. C-g has no effect.
> There's no clues in *Messages* buffer. Point movement is beyond visible portion
> of buffer. It usually happens in emacs-lisp-mode buffers that have been open a
> few hours, but I've experienced it in other modes too.
>
> It seems like it could be font-lock/jit-lock moving point around outside of a
> save-excursion, but I know no way of confiming this.
>
> How should I go about debugging this?
Find the feature you load/activate in your init files which causes
this?
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-07 8:00 ` Eli Zaretskii
@ 2020-03-07 9:10 ` William Rankin
2020-03-07 11:04 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: William Rankin @ 2020-03-07 9:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 39967
> On 7 Mar 2020, at 6:00 pm, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> How should I go about debugging this?
>
> Find the feature you load/activate in your init files which causes
> this?
Hmm given the way it moves point, I would put money on this not being my
init. I'm not smart enough to write something that would work in such a
sporadic way.
I will of course endeavour to isolate my init away from the problem to
confirm it's not the culprit, but given that the problem only occurs
after hours of use and maybe a couple of times a week, this is going to
mean some time before I can give any useful confirmation.
Given the impending release of 27.1 maybe there are other avenues I can
check too?
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-07 9:10 ` William Rankin
@ 2020-03-07 11:04 ` Eli Zaretskii
2020-03-07 12:16 ` William Rankin
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2020-03-07 11:04 UTC (permalink / raw)
To: William Rankin; +Cc: 39967
> From: William Rankin <william@bydasein.com>
> Date: Sat, 7 Mar 2020 19:10:09 +1000
> Cc: 39967@debbugs.gnu.org
>
> > Find the feature you load/activate in your init files which causes
> > this?
>
> Hmm given the way it moves point, I would put money on this not being my
> init. I'm not smart enough to write something that would work in such a
> sporadic way.
I didn't mean something you wrote, I meant some feature you turn on
that is not turned on by default, a feature that is part of Emacs or
some third-party package you are using.
> Given the impending release of 27.1 maybe there are other avenues I can
> check too?
You could try running under GDB with a breakpoint in set_point_both
and temp_set_point_both, with breakpoint commands that show the C and
Lisp backtrace and then immediately continue the program. Let me know
if you need more detailed instructions for setting this up.
Can you describe the issue in more detail? Are you saying this
happens when Emacs is idle, i.e. you are not typing any commands and
no sub-processes should be running? And what exactly do you see when
this happens? Also, do you see any error messages in *Messages*? when
that happens?
FWIW, I don't see anything like this on my system in Emacs 27.0.90, so
I have hard time believing that something as basic as JIT font-lock
could do this, at least not by default.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-07 11:04 ` Eli Zaretskii
@ 2020-03-07 12:16 ` William Rankin
2020-03-07 13:06 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: William Rankin @ 2020-03-07 12:16 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 39967
> On 7 Mar 2020, at 9:04 pm, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> Hmm given the way it moves point, I would put money on this not being my
>> init. I'm not smart enough to write something that would work in such a
>> sporadic way.
>
> I didn't mean something you wrote, I meant some feature you turn on
> that is not turned on by default, a feature that is part of Emacs or
> some third-party package you are using.
Ah I see. Okay, that does increase the surface area.
>> Given the impending release of 27.1 maybe there are other avenues I can
>> check too?
>
> You could try running under GDB with a breakpoint in set_point_both
> and temp_set_point_both, with breakpoint commands that show the C and
> Lisp backtrace and then immediately continue the program. Let me know
> if you need more detailed instructions for setting this up.
I should be able to figure this out and report back.
> Can you describe the issue in more detail? Are you saying this
> happens when Emacs is idle, i.e. you are not typing any commands and
> no sub-processes should be running? And what exactly do you see when
> this happens? Also, do you see any error messages in *Messages*? when
> that happens?
>
> FWIW, I don't see anything like this on my system in Emacs 27.0.90, so
> I have hard time believing that something as basic as JIT font-lock
> could do this, at least not by default.
I've only observed this after Emacs has been open for more than a few
hours or overnight.
It will only happen after Emacs is idle for a few seconds, i.e. no user
input.
The point will start jumping to different positions in the buffer, and
this will then repeat at regular intervals of ~0.5 seconds per jump.
These positions do not appear totally random, but seem like jumps of a
similar sized chunk of text, like they are being calculated.
I think the only process running is ispell (enchant).
There are no error messages in *Messages*.
C-g does not immediately stop point jumping, however, if I give more
input (e.g. C-n/p or C-x o, etc.) then either this will stop point
jumping, or will delay it for ~2 seconds, and then point starts
jumping again. This repetition only happens a once or twice before it
seems to "finish" and the problem appears gone.
There is this in my init:
(advice-add 'mark-word :before
(lambda (&rest args)
(unless (looking-at-p "\\b")
(backward-word))))
Could this be causing such havoc??
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-07 12:16 ` William Rankin
@ 2020-03-07 13:06 ` Eli Zaretskii
2020-03-07 13:47 ` William Rankin
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2020-03-07 13:06 UTC (permalink / raw)
To: William Rankin; +Cc: 39967
> From: William Rankin <william@bydasein.com>
> Date: Sat, 7 Mar 2020 22:16:56 +1000
> Cc: 39967@debbugs.gnu.org
>
> I've only observed this after Emacs has been open for more than a few
> hours or overnight.
>
> It will only happen after Emacs is idle for a few seconds, i.e. no user
> input.
>
> The point will start jumping to different positions in the buffer, and
> this will then repeat at regular intervals of ~0.5 seconds per jump.
> These positions do not appear totally random, but seem like jumps of a
> similar sized chunk of text, like they are being calculated.
If this happens when Emacs is idle, the first suspect is some idle
timer you have running. The variable timer-idle-list holds the list
of the active idle timers, so look there for some hints.
> There is this in my init:
>
> (advice-add 'mark-word :before
> (lambda (&rest args)
> (unless (looking-at-p "\\b")
> (backward-word))))
>
> Could this be causing such havoc??
Unlikely, since this only runs when you invoke mark-word.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-07 13:06 ` Eli Zaretskii
@ 2020-03-07 13:47 ` William Rankin
2020-03-07 15:32 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: William Rankin @ 2020-03-07 13:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 39967
> On 7 Mar 2020, at 11:06 pm, Eli Zaretskii <eliz@gnu.org> wrote:
>
> If this happens when Emacs is idle, the first suspect is some idle
> timer you have running. The variable timer-idle-list holds the list
> of the active idle timers, so look there for some hints.
This is what made me suspect jit-lock, because of the 5 sec idle timer
followed by jumping at 0.5 secs intervals.
Here's my timer list:
0.37 0.01 blink-cursor-timer-function
6.59 - undo-auto--boundary-timer
47.03 1.00 display-time-event-handler
* 0.00 t show-paren-function
* 0.50 t #f(compiled-function () #<bytecode 0x41903951> [jit-lock--antiblink-grace-timer jit-lock-context-fontify])
* 0.50 :repeat blink-cursor-start
* 1.00 t which-key--update
* 5.00 t jit-lock-stealth-fontify
Could the sporadic nature hint at the byte-compiled function that calls
jit-lock-context-fontify? (Also I see jit-lock-antiblink-grace is new
in 27.)
Of course there's also which-key, so I've turned that off for the time
being.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-07 13:47 ` William Rankin
@ 2020-03-07 15:32 ` Eli Zaretskii
2020-03-10 10:29 ` William Rankin
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2020-03-07 15:32 UTC (permalink / raw)
To: William Rankin; +Cc: 39967
> From: William Rankin <william@bydasein.com>
> Date: Sat, 7 Mar 2020 23:47:24 +1000
> Cc: 39967@debbugs.gnu.org
>
>
> 0.37 0.01 blink-cursor-timer-function
> 6.59 - undo-auto--boundary-timer
> 47.03 1.00 display-time-event-handler
> * 0.00 t show-paren-function
> * 0.50 t #f(compiled-function () #<bytecode 0x41903951> [jit-lock--antiblink-grace-timer jit-lock-context-fontify])
> * 0.50 :repeat blink-cursor-start
> * 1.00 t which-key--update
> * 5.00 t jit-lock-stealth-fontify
>
> Could the sporadic nature hint at the byte-compiled function that calls
> jit-lock-context-fontify? (Also I see jit-lock-antiblink-grace is new
> in 27.)
How about changing jit-lock-context-time to something like 1.5, and
checking whether this affects the frequency of the jumps in any way?
I looked at the code of the involved functions, and couldn't spot any
place where they move point without wrapping that in save-excursion.
But maybe I'm missing something -- can you see any suspects?
Also, do you have any features enabled which could perform a redisplay
triggered by point movement? If you do, perhaps they cause point to
be displayed when Emacs doesn't expect that.
Btw, in your original description you said when point jumps, it's
outside of the current window -- but if so, how do you see that it
jumps, when the cursor is not shown?
And finally, what happens if you disable the blink-cursor-mode?
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-07 15:32 ` Eli Zaretskii
@ 2020-03-10 10:29 ` William Rankin
2022-02-02 18:24 ` Lars Ingebrigtsen
0 siblings, 1 reply; 12+ messages in thread
From: William Rankin @ 2020-03-10 10:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 39967
On Sun, Mar 08 2020, Eli Zaretskii wrote:
> How about changing jit-lock-context-time to something like 1.5, and
> checking whether this affects the frequency of the jumps in any way?
Good idea. I think the difficulty with debugging this is how difficult it will
be for me to solve without reliably reproducing it.
> I looked at the code of the involved functions, and couldn't spot any
> place where they move point without wrapping that in save-excursion.
> But maybe I'm missing something -- can you see any suspects?
The only thing (I'm guessing here) is that the macro
with-buffer-prepared-for-jit-lock uses inhibit-point-motion-hooks which is
marked obsolete since Emacs-25.1; but there's nothing in the NEWS about this.
Also manually calling jit-lock-context-fontify or jit-lock-stealth-fontify
doesn't move point :/
> Also, do you have any features enabled which could perform a redisplay
> triggered by point movement? If you do, perhaps they cause point to
> be displayed when Emacs doesn't expect that.
This would only be on post-command-hook or with cursor-sensor-mode activated
right? As far as I can tell I don't have any buffers with cursor-sensor-mode
active, and this is the value of post-command-hook in an elisp buffer:
(jit-lock--antiblink-post-command eldoc-schedule-timer t)
Local in buffer binder.el; global value is
(global-font-lock-mode-check-buffers global-eldoc-mode-check-buffers
global-page-break-lines-mode-check-buffers)
> Btw, in your original description you said when point jumps, it's
> outside of the current window -- but if so, how do you see that it
> jumps, when the cursor is not shown?
Sorry, I was unclear. I only meant that e.g. if the window shows buffer lines
500 - 580 then point may jump to position 250, i.e. beyond the window
boundaries, and the window scrolls to keep point visible. So essentially the
window jumps around to follow point jumping around.
> And finally, what happens if you disable the blink-cursor-mode?
Done. Still a waiting game...
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2020-03-10 10:29 ` William Rankin
@ 2022-02-02 18:24 ` Lars Ingebrigtsen
2022-02-04 5:06 ` Paul W. Rankin via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-02 18:24 UTC (permalink / raw)
To: William Rankin; +Cc: 39967
William Rankin <william@bydasein.com> writes:
>> And finally, what happens if you disable the blink-cursor-mode?
>
> Done. Still a waiting game...
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)
Are you still seeing this odd behaviour in more recent Emacs versions?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2022-02-02 18:24 ` Lars Ingebrigtsen
@ 2022-02-04 5:06 ` Paul W. Rankin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-05 6:34 ` Lars Ingebrigtsen
0 siblings, 1 reply; 12+ messages in thread
From: Paul W. Rankin via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-04 5:06 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, 39967
On 2022-02-03 04:24, Lars Ingebrigtsen wrote:
>
> Are you still seeing this odd behaviour in more recent Emacs versions?
I haven't seen this in a while; I think it was isolated to that
version/build.
Thanks for following up.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#39967: 27.0.90; how to debug point moving erratically?
2022-02-04 5:06 ` Paul W. Rankin via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-05 6:34 ` Lars Ingebrigtsen
0 siblings, 0 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-05 6:34 UTC (permalink / raw)
To: Paul W. Rankin; +Cc: 39967
"Paul W. Rankin" <pwr@bydasein.com> writes:
>> Are you still seeing this odd behaviour in more recent Emacs
>> versions?
>
> I haven't seen this in a while; I think it was isolated to that
> version/build.
Thanks; I'm closing this bug report, then.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-02-05 6:34 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-07 3:49 bug#39967: 27.0.90; how to debug point moving erratically? William Rankin
2020-03-07 8:00 ` Eli Zaretskii
2020-03-07 9:10 ` William Rankin
2020-03-07 11:04 ` Eli Zaretskii
2020-03-07 12:16 ` William Rankin
2020-03-07 13:06 ` Eli Zaretskii
2020-03-07 13:47 ` William Rankin
2020-03-07 15:32 ` Eli Zaretskii
2020-03-10 10:29 ` William Rankin
2022-02-02 18:24 ` Lars Ingebrigtsen
2022-02-04 5:06 ` Paul W. Rankin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-05 6:34 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).