From d5f1df0edfe6f5d4b178d30d78567bec223927ee Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Thu, 4 Jun 2020 21:18:10 +0000 Subject: [PATCH] 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 ea06f8af87..4354a155c3 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -809,18 +809,10 @@ comint-exec (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))) -- 2.27.0.rc0