From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Pettersson <daniel@dpettersson.net>
Cc: 69733@debbugs.gnu.org
Subject: bug#69733: [PATCH] Flyspell (flyspell-word): do not force 'save-excursion' on timers
Date: Fri, 15 Mar 2024 14:36:23 +0200 [thread overview]
Message-ID: <86edcb8yew.fsf@gnu.org> (raw)
In-Reply-To: <m24jd7wx5h.fsf@dpettersson.net> (message from Daniel Pettersson on Fri, 15 Mar 2024 12:29:46 +0100)
> From: Daniel Pettersson <daniel@dpettersson.net>
> Cc: 69733@debbugs.gnu.org
> Date: Fri, 15 Mar 2024 12:29:46 +0100
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Thanks, but I'm still confused regarding what you are trying to fix
> > and why you are trying to fix it with the patch you proposed.
>
> Lets just preface with that for accept-process-output non idle timers
> and process filters are the same thing, right? So any filter or timer
> might run inside of accept-process-output if JUST-THIS-ONE is nil.
>
> The issue was noticed with the elpa package dape, with
> flyspell-prog-mode. But I was able to reproduce it in gdb-mi.el
> (gud-next) as well. The common denominator here is moving the point
> from filter/timer functions, in both cases source buffers.
I think (and you agree below) that these are bugs in these packages.
Non-idle timer cannot safely move point, and neither can a process
filter. It basically means we move point while the user might be
typing something, which would be a terrible misfeature!
> > First, AFAIU, save-excursion is there because flyspell-get-word might
> > move point. So this is justified.
>
> No doubt that the save-excursion is justified but it surly does not need
> to wrap everything, one could be a bit more exact (wrap those parts)
> that actually move the point.
That's correct, so if you want to move save-excursion closer to
flyspell-get-word, it would be fine.
> After some thinking I it might be impossible to impose anything on the
> caller of accept-process-output. And the bug is in dape and gdb-mi.el
> that gud should call gud-display-line inside of an idle timer to ensure
> that the point is moved, if I understand how idle timers are called
> which might be false.
Exactly. Idle timers can move point, provided that they wait a
reasonable amount of idleness time, to avoid interpreting a 0.01 sec
gap in user typing as "idle".
> Maybe it would be a good idea if "(elisp) Timers" would mention these
> things. Would that be an good idea?
Yes, I think so. We already advise not to do certain things in a
timer function, so this could be an addition to those parts.
> I could be up for writing something up, even if don't consider
> myself to be that good at writing documentation.
Thanks, please do.
next prev parent reply other threads:[~2024-03-15 12:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-11 14:37 bug#69733: [PATCH] Flyspell (flyspell-word): do not force 'save-excursion' on timers Daniel Pettersson
2024-03-12 13:20 ` Eli Zaretskii
2024-03-12 14:28 ` Daniel Pettersson
2024-03-14 10:36 ` Eli Zaretskii
2024-03-15 11:29 ` Daniel Pettersson
2024-03-15 12:36 ` Eli Zaretskii [this message]
2024-03-15 15:59 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86edcb8yew.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=69733@debbugs.gnu.org \
--cc=daniel@dpettersson.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.