all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#48379: 27.2; ispell-init-process may be called recursively during sit-for
@ 2021-05-12 14:14 miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-12 19:50 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-05-12 14:14 UTC (permalink / raw)
  To: 48379

[-- 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 --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-16 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-12 14:14 bug#48379: 27.2; ispell-init-process may be called recursively during sit-for miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-12 19:50 ` 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

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.