]> git.eshelyaron.com Git - emacs.git/commitdiff
Make octave-send-region be asynchronous
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 28 Dec 2020 03:24:01 +0000 (04:24 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 28 Dec 2020 03:24:01 +0000 (04:24 +0100)
* lisp/progmodes/octave.el (octave-send-region): Send things
asynchronously to the inferior process (bug#24492).

lisp/progmodes/octave.el

index bda4e60c55cda00157cd9a10dbe587b23f19f4c6..f295917c0ad6b38fb654c74256773ab019cd362c 100644 (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)))