all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Anton S." <emacs@alshu.de>
Cc: 24492@debbugs.gnu.org
Subject: bug#24492: 24.5; Emacs unresponsive when sending buffer or region to Octave
Date: Mon, 30 Nov 2020 13:42:46 +0100	[thread overview]
Message-ID: <87ft4r8189.fsf@gnus.org> (raw)
In-Reply-To: <687b2dd9-6626-f1a3-0c46-50410a1c9e64@alshu.de> (Anton S.'s message of "Wed, 21 Sep 2016 10:11:15 +0200")

"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	other threads:[~2020-11-30 12:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  8:11 bug#24492: 24.5; Emacs unresponsive when sending buffer or region to Octave Anton S.
2020-11-30 12:42 ` Lars Ingebrigtsen [this message]
2020-12-28  3:25   ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ft4r8189.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=24492@debbugs.gnu.org \
    --cc=emacs@alshu.de \
    /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 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.