From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 48379@debbugs.gnu.org
Subject: bug#48379: 27.2; ispell-init-process may be called recursively during sit-for
Date: Wed, 12 May 2021 16:14:07 +0200 [thread overview]
Message-ID: <87v97oca4w.fsf@miha-pc> (raw)
[-- Attachment #1: Type: text/plain, Size: 1751 bytes --]
In ispell-init-process, sit-for can accept process output, which may in
turn call ispell-init-process again, recursively. If needed, I can post
a short reproducer.
This recursive call results in the following sequence of events:
(ispell-kill-ispell t)
(ispell-kill-ispell t)
(setq ispell-process (ispell-start-process))
(setq ispell-process (ispell-start-process))
where the middle two calls happen recursively from within sit-for. As
you can see, this creates one extra useless ispell process.
The following simple patch fixes this by moving the killing of the
process closer to starting of the new process without sit-for in the
middle
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 4dbc7640bc..80ddb4861f 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2865,8 +2865,6 @@ ispell-init-process
(or (or ispell-local-pdict ispell-personal-dictionary)
(equal ispell-process-directory default-directory)))
(setq ispell-filter nil ispell-filter-continue nil)
- ;; may need to restart to select new personal dictionary.
- (ispell-kill-ispell t)
(let ((reporter
(make-progress-reporter
(format "Starting new Ispell process %s with %s dictionary..."
@@ -2874,6 +2872,8 @@ ispell-init-process
(or ispell-local-dictionary ispell-dictionary
"default")))))
(sit-for 0)
+ ;; May need to restart to select new personal dictionary.
+ (ispell-kill-ispell t)
(setq ispell-library-directory (ispell-check-version)
;; Assign a non-nil value to ispell-process-directory
;; before calling ispell-start-process, since that
Best regards.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next reply other threads:[~2021-05-12 14:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-12 14:14 miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-05-12 19:50 ` bug#48379: 27.2; ispell-init-process may be called recursively during sit-for Lars Ingebrigtsen
2021-05-14 13:09 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-16 14:06 ` Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v97oca4w.fsf@miha-pc \
--to=bug-gnu-emacs@gnu.org \
--cc=48379@debbugs.gnu.org \
--cc=miha@kamnitnik.top \
/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 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).