GNU bug report logs - #24492
24.5; Emacs unresponsive when sending buffer or region to Octave

Previous Next

Package: emacs;

Reported by: "Anton S." <emacs <at> alshu.de>

Date: Wed, 21 Sep 2016 08:15:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 24.5

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24492 in the body.
You can then email your comments to 24492 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24492; Package emacs. (Wed, 21 Sep 2016 08:15:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Anton S." <emacs <at> alshu.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 21 Sep 2016 08:15:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Anton S." <emacs <at> alshu.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; Emacs unresponsive when sending buffer or region to Octave
Date: Wed, 21 Sep 2016 10:11:15 +0200
Description

Sending a buffer or a region to octave makes emacs unresponsive until 
the evaluation is complete. When the commands are executed manually in 
the inferior process buffer, everything works fine.

I tried this on two workstations. I have opened an issue for
spacemacs and was told to report upstream: 
https://github.com/syl20bnr/spacemacs/issues/7150

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:

GNU Octave, version 4.0.3
Copyright (C) 2016 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-redhat-linux-gnu".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.


>> for i=1:10
>>   i,
>   pause(1)
> end
> >>

Doing ether
octave-send-buffer or octave-send-region again will also trigger emacs
being unresponsive for 10 seconds but this time after 10 seconds the 
full output is
displayed at once:

>> for i=1:10
>   i,
>   pause(1)
> end
i =  1
i =  2
i =  3
i =  4
i =  5
i =  6
i =  7
i =  8
i =  9
i =  10

Expected behavior:
Second buffer opens and i is counting up.

>> for i=1:10
>   i,
>   pause(1)
> end
i =  1
i =  2
i =  3
i =  4
i =  5
...

This can already be achieved by copying and yanking the commands 
manually to the inferior octave process.

Best Regards

Anton

In GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-11 on buildvm-25.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11803000
Configured using:
 `configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -m64 -mtune=generic' LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Octave

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Mark set
Making completion list...
You can run the command `octave-send-buffer' with C-c TAB C-a
Mark set [2 times]
Making completion list...
call-interactively: End of buffer
End of buffer [2 times]
s-x is undefined
Mark set [6 times]
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils compile octave smie comint ansi-color
ring vc-git cc-langs cl-loaddefs cl-lib cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs help-mode
easymenu time-date tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 113885 7021)
 (symbols 48 21069 0)
 (miscs 40 68 281)
 (strings 32 19997 3842)
 (string-bytes 1 666291)
 (vectors 16 12696)
 (vector-slots 8 423400 5738)
 (floats 8 70 487)
 (intervals 56 451 13)
 (buffers 960 14)
 (heap 1024 51524 973))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24492; Package emacs. (Mon, 30 Nov 2020 12:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 24492 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Anton S." <emacs <at> alshu.de>
Cc: 24492 <at> debbugs.gnu.org
Subject: Re: bug#24492: 24.5; Emacs unresponsive when sending buffer or
 region to Octave
Date: Mon, 30 Nov 2020 13:42:46 +0100
"Anton S." <emacs <at> 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




Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 30 Nov 2020 12:44:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24492; Package emacs. (Mon, 28 Dec 2020 03:26:02 GMT) Full text and rfc822 format available.

Message #13 received at 24492 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Anton S." <emacs <at> alshu.de>
Cc: 24492 <at> debbugs.gnu.org
Subject: Re: bug#24492: 24.5; Emacs unresponsive when sending buffer or
 region to Octave
Date: Mon, 28 Dec 2020 04:25:21 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> 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?

Nobody had any comments in a month, so I went ahead and pushed the
change.  It doesn't seem to regress using octave-mode for me, but like I
said -- I don't use it, really.  So if this causes regressions, please
pipe up, and we'll revert.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 28 Dec 2020 03:26:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 24492 <at> debbugs.gnu.org and "Anton S." <emacs <at> alshu.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 28 Dec 2020 03:26:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 25 Jan 2021 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 172 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.