1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

Make octave-send-region be asynchronous

* lisp/progmodes/octave.el (octave-send-region): Send things
asynchronously to the inferior process (bug#24492).
This commit is contained in:
Lars Ingebrigtsen 2020-12-28 04:24:01 +01:00
parent 2a64de5e98
commit ed30956099

View file

@ -1512,28 +1512,12 @@ current buffer file unless called with a prefix arg \\[universal-argument]."
(interactive "r")
(inferior-octave t)
(let ((proc inferior-octave-process)
(string (buffer-substring-no-properties beg end))
line)
(string (buffer-substring-no-properties beg end)))
(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)))