From: Pip Cet Date: Sun, 27 Sep 2020 13:07:34 +0000 (+0200) Subject: Avoid 1s sleep-for before sending the startfile to a comint process X-Git-Tag: emacs-28.0.90~5850 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8d241e8840fdb02dcfce52425626dd8f2125e51a;p=emacs.git Avoid 1s sleep-for before sending the startfile to a comint process * lisp/comint.el (comint-exec): Simplify startup file code. (Bug#41640). --- diff --git a/lisp/comint.el b/lisp/comint.el index b4ea232767c..b966fae9364 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)))