bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#24492: 24.5; Emacs unresponsive when sending buffer or region to Oct


From: Lars Ingebrigtsen
Subject: bug#24492: 24.5; Emacs unresponsive when sending buffer or region to Octave
Date: Mon, 30 Nov 2020 13:42:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

"Anton S." <emacs@alshu.de> writes:

> Reproduction guide :beetle:
>
>     Start Emacs
>     write folling in octave mode: for i=1:10 i, pause(1); end
>     send the buffer to octave with
>          octave-send-buffer
>     or mark everything and do
>         octave-send-region
>
> Observed behavior:
>
> Emacs is unresponsive for 10 seconds. Then a second buffer window opens
> with the input lines visible but without output:

(This bug report unfortunately got no response at the time.)

Yes, the `C-c C-i C-a' command in octave-mode is totally synchronous
(per line).  I wondered whether you can just avoid splitting up the
region into lines and just send them to the process, and that works
fine, as far as I can see.

And it fixes the test case.

However, I'm not an octave-mode user.  Does anybody have a comment on
making a change like this?

diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index c313ad1179..24e69ab992 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -1517,23 +1517,8 @@ octave-send-region
     (with-current-buffer inferior-octave-buffer
       ;; https://lists.gnu.org/r/emacs-devel/2013-10/msg00095.html
       (compilation-forget-errors)
-      (setq inferior-octave-output-list nil)
-      (while (not (string-equal string ""))
-        (if (string-match "\n" string)
-            (setq line (substring string 0 (match-beginning 0))
-                  string (substring string (match-end 0)))
-          (setq line string string ""))
-        (setq inferior-octave-receive-in-progress t)
-        (inferior-octave-send-list-and-digest (list (concat line "\n")))
-        (while inferior-octave-receive-in-progress
-          (accept-process-output proc))
-        (insert-before-markers
-         (mapconcat 'identity
-                    (append
-                     (if octave-send-echo-input (list line) (list ""))
-                     inferior-octave-output-list
-                     (list inferior-octave-output-string))
-                    "\n")))))
+      (insert-before-markers string "\n")
+      (comint-send-string proc (concat string "\n"))))
   (if octave-send-show-buffer
       (display-buffer inferior-octave-buffer)))
 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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