unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: "Francesco Potortì" <pot@gnu.org>, 27036@debbugs.gnu.org
Subject: bug#27036: Acknowledgement (25.1; Blocking call to accept-process-output with quit inhibited!!)
Date: Sat, 27 May 2017 03:22:19 +0300	[thread overview]
Message-ID: <d529a831-e8eb-8383-6d89-b227dab6a009@yandex.ru> (raw)
In-Reply-To: <E1dEF7L-0007Wz-P3@tucano.isti.cnr.it>

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

On 5/26/17 4:17 PM, Francesco Potortì wrote:

> if Octave is running a long command it
> locks Emacs until the long command execution finishes and the prompt is
> returned.

Yes, this problem should be common for all modes that use the REPL for 
fetching information like this. E.g. python-eldoc-function.

Normally, we don't see long-running commands in the user REPL. Or don't 
expect the user to switch back to the source buffer and continue 
editing. Octave might be a significant exception in that regard.

Anyway, please try the attached combined patch and see if it fixes your 
problem.

> It also makes damage in some other cases that I cannot identify.

If you have company-mode installed and enabled, similar problem can 
occur (when completion is triggered automatically).

[-- Attachment #2: octave-eldoc.diff --]
[-- Type: text/x-patch, Size: 2378 bytes --]

diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index ac9ba63..d0a92d8 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -938,12 +938,19 @@ inferior-octave-send-list-and-digest
 	(while (setq string (car list))
 	  (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))
+	  (process-send-string proc string)
+	  (while
+              (and inferior-octave-receive-in-progress
+                   (with-local-quit
+                     (accept-process-output proc))))
 	  (setq list (cdr list)))
       (set-process-filter proc filter))))
 
+(defun inferior-octave--busy-p ()
+  (not
+   (buffer-local-value 'comint-last-prompt
+                       (process-buffer inferior-octave-process))))
+
 (defvar inferior-octave-directory-tracker-resync nil)
 (make-variable-buffer-local 'inferior-octave-directory-tracker-resync)
 
@@ -1586,19 +1593,21 @@ octave-eldoc-message-style
 (defvar octave-eldoc-cache nil)
 
 (defun octave-eldoc-function-signatures (fn)
-  (unless (equal fn (car octave-eldoc-cache))
-    (inferior-octave-send-list-and-digest
-     (list (format "print_usage ('%s');\n" fn)))
-    (let (result)
-      (dolist (line inferior-octave-output-list)
-        (when (string-match
-               "\\s-*\\(?:--[^:]+\\|usage\\):\\s-*\\(.*\\)$"
-               line)
-          (push (match-string 1 line) result)))
-      (setq octave-eldoc-cache
-            (cons (substring-no-properties fn)
-                  (nreverse result)))))
-  (cdr octave-eldoc-cache))
+  (if (equal fn (car octave-eldoc-cache))
+      (cdr octave-eldoc-cache)
+    (unless (inferior-octave--busy-p)
+      (inferior-octave-send-list-and-digest
+       (list (format "print_usage ('%s');\n" fn)))
+      (let (result)
+        (dolist (line inferior-octave-output-list)
+          (when (string-match
+                 "\\s-*\\(?:--[^:]+\\|usage\\):\\s-*\\(.*\\)$"
+                 line)
+            (push (match-string 1 line) result)))
+        (setq octave-eldoc-cache
+              (cons (substring-no-properties fn)
+                    (nreverse result))))
+      (cdr octave-eldoc-cache))))
 
 (defun octave-eldoc-function ()
   "A function for `eldoc-documentation-function' (which see)."

  reply	other threads:[~2017-05-27  0:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 12:20 bug#27036: 25.1; Blocking call to accept-process-output with quit inhibited!! Francesco Potortì
     [not found] ` <handler.27036.B.1495542030639.ack@debbugs.gnu.org>
2017-05-24 11:21   ` bug#27036: Acknowledgement (25.1; Blocking call to accept-process-output with quit inhibited!!) Francesco Potortì
2017-05-24 14:27   ` Francesco Potortì
2017-05-24 17:57     ` Eli Zaretskii
2017-05-25 15:58   ` Francesco Potortì
2017-05-26  0:41     ` Dmitry Gutov
2017-05-26 13:17   ` Francesco Potortì
2017-05-27  0:22     ` Dmitry Gutov [this message]
2017-05-30  7:46       ` Francesco Potortì
2017-05-30 22:39         ` Dmitry Gutov
2017-09-28 21:06           ` Dmitry Gutov
2017-09-29  7:03             ` Francesco Potortì
2022-04-23 15:24               ` bug#27036: 25.1; Blocking call to accept-process-output with quit inhibited!! Lars Ingebrigtsen
2017-05-24 12:24 ` Dmitry Gutov
2017-05-24 18:01   ` Eli Zaretskii
2017-05-24 18:17     ` Dmitry Gutov
2017-05-24 19:05       ` Eli Zaretskii
2017-05-25 12:43         ` Dmitry Gutov
2017-05-25 12:51           ` Noam Postavsky
2017-05-25 16:14             ` Eli Zaretskii
2017-05-26  1:02               ` Dmitry Gutov
2017-05-26  6:07                 ` Eli Zaretskii
2017-05-26  0:38             ` Dmitry Gutov

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=d529a831-e8eb-8383-6d89-b227dab6a009@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=27036@debbugs.gnu.org \
    --cc=pot@gnu.org \
    /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).