[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs, Flyspell, and "blocking call to accept-process-outp

From: Stefan Monnier
Subject: Re: Emacs, Flyspell, and "blocking call to accept-process-output with quit inhibited!!"
Date: Wed, 14 Sep 2011 15:15:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> Using Emacs with the flyspell package generates a (constantly
> repeating and annoying) message "blocking call to accept-process-output with
> quit inhibited!!". It doesn't actually seem to "block" anything as flyspell
> still functions as expected, but it's annoying.

The message simply indicates that the code waits for some external event
(in this case answer from ispell) while quit is inhibited, which implies
that if ispell decides to take its time, Emacs will hang.
I.e. it indicates of a latent bug in flyspell.el.

> Or something which can be fixed/hacked in Flyspell?

Can you try the patch below?


=== modified file 'lisp/textmodes/flyspell.el'
--- lisp/textmodes/flyspell.el  2011-09-11 02:14:10 +0000
+++ lisp/textmodes/flyspell.el  2011-09-14 19:14:21 +0000
@@ -931,9 +931,10 @@
 ;;*       previous word nor the current word                            */
 (defun flyspell-post-command-hook ()
-  "The `post-command-hook' used by flyspell to check a word in-the-fly."
+  "The `post-command-hook' used by flyspell to check a word on-the-fly."
   (when flyspell-mode
+    (with-local-quit
     (let ((command this-command)
          ;; Prevent anything we do from affecting the mark.
@@ -946,6 +947,7 @@
       (if (flyspell-check-word-p)
+              ;; FIXME: This should be asynchronous!
            ;; we remember which word we have just checked.
            ;; this will be used next time we will check a word
@@ -960,7 +962,8 @@
          (setq flyspell-pre-pre-point  nil)
          ;; when a word is not checked because of a delayed command
          ;; we do not disable the ispell cache.
-         (if (and (symbolp this-command) (get this-command 'flyspell-delayed))
+            (if (and (symbolp this-command)
+                     (get this-command 'flyspell-delayed))
                (setq flyspell-word-cache-end -1)
                (setq flyspell-word-cache-result '_)))))
@@ -973,7 +976,7 @@
                (goto-char start)
          (setq flyspell-changes (cdr flyspell-changes))))
-      (setq flyspell-previous-command command))))
+        (setq flyspell-previous-command command)))))
 ;;*    flyspell-notify-misspell ...                                     */
@@ -1100,14 +1103,10 @@
                   ;; we mark the ispell process so it can be killed
                   ;; when emacs is exited without query
                   (set-process-query-on-exit-flag ispell-process nil)
-                  ;; Wait until ispell has processed word.  Since this
-                  ;; code is often executed from post-command-hook but
-                  ;; the ispell process may not be responsive, it's
-                  ;; important to make sure we re-enable C-g.
-                  (with-local-quit
+                  ;; Wait until ispell has processed word.
                     (while (progn
                              (accept-process-output ispell-process)
-                             (not (string= "" (car ispell-filter))))))
+                           (not (string= "" (car ispell-filter)))))
                   ;; (ispell-send-string "!\n")
                   ;; back to terse mode.
                   ;; Remove leading empty element

reply via email to

[Prev in Thread] Current Thread [Next in Thread]