Subject: bug#27036: 25.1; Blocking call to accept-process-output with quit inhibited!!

From: Dmitry Gutov <[email-masked]>
Date: Fri, 26 May 2017 04:02:34 +0300

On 5/25/17 7:14 PM, Eli Zaretskii wrote:

> So I guess octave-eldoc-function-signatures should temporarily reset
> inhibit-quit?

Yes. Or more concretely, use with-local-quit like 
url-retrieve-synchronously does.

In the context of comint, though, we might consider what to do if Octave 
actually takes too long to produce the result, the user presses C-g, and 
we need to abort. Do we restore the normal process filter, and refuse to 
be bothered even though Octave will continue producing output (now 
visible to the user if they switch to the REPL buffer)?

As a first approximation, this seems to fix the bug:

diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index ac9ba63..ce3c27a 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -939,8 +939,10 @@ inferior-octave-send-list-and-digest
  	  (setq inferior-octave-output-string nil
  		inferior-octave-receive-in-progress t)
  	  (comint-send-string proc string)
-	  (while inferior-octave-receive-in-progress
-	    (accept-process-output proc))
+	  (while
+              (and inferior-octave-receive-in-progress
+                   (with-local-quit
+                     (accept-process-output proc))))
  	  (setq list (cdr list)))
        (set-process-filter proc filter))))