GNU bug report logs - #48379
27.2; ispell-init-process may be called recursively during sit-for

Previous Next

Package: emacs;

Reported by: miha <at> kamnitnik.top

Date: Wed, 12 May 2021 14:14:02 UTC

Severity: normal

Found in version 27.2

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: miha <at> kamnitnik.top
To: 48379 <at> 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
[Message part 1 (text/plain, inline)]
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.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 4 years and 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.