unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24492: 24.5; Emacs unresponsive when sending buffer or region to Octave
@ 2016-09-21  8:11 Anton S.
  2020-11-30 12:42 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Anton S. @ 2016-09-21  8:11 UTC (permalink / raw)
  To: 24492

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






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#24492: 24.5; Emacs unresponsive when sending buffer or region to Octave
  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
  2020-12-28  3:25   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-11-30 12:42 UTC (permalink / raw)
  To: Anton S.; +Cc: 24492

"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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#24492: 24.5; Emacs unresponsive when sending buffer or region to Octave
  2020-11-30 12:42 ` Lars Ingebrigtsen
@ 2020-12-28  3:25   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-28  3:25 UTC (permalink / raw)
  To: Anton S.; +Cc: 24492

Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-28  3:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-12-28  3:25   ` Lars Ingebrigtsen

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).