emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8d241e8: Avoid 1s sleep-for before sending the startfile to a com


From: Lars Ingebrigtsen
Subject: master 8d241e8: Avoid 1s sleep-for before sending the startfile to a comint process
Date: Sun, 27 Sep 2020 09:10:42 -0400 (EDT)

branch: master
commit 8d241e8840fdb02dcfce52425626dd8f2125e51a
Author: Pip Cet <pipcet@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Avoid 1s sleep-for before sending the startfile to a comint process
    
    * lisp/comint.el (comint-exec): Simplify startup file code.
    (Bug#41640).
---
 lisp/comint.el | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index b4ea232..b966fae 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -820,18 +820,10 @@ series of processes in the same Comint buffer.  The hook
       (goto-char (point-max))
       (set-marker (process-mark proc) (point))
       ;; Feed it the startfile.
-      (cond (startfile
-            ;;This is guaranteed to wait long enough
-            ;;but has bad results if the comint does not prompt at all
-            ;;      (while (= size (buffer-size))
-            ;;        (sleep-for 1))
-            ;;I hope 1 second is enough!
-            (sleep-for 1)
-            (goto-char (point-max))
-            (insert-file-contents startfile)
-            (setq startfile (buffer-substring (point) (point-max)))
-            (delete-region (point) (point-max))
-            (comint-send-string proc startfile)))
+      (when startfile
+        (comint-send-string proc (with-temp-buffer
+                                   (insert-file-contents startfile)
+                                   (buffer-string))))
       (run-hooks 'comint-exec-hook)
       buffer)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]