summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorPip Cet <pipcet@gmail.com>2020-09-27 15:07:34 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-09-27 15:07:34 +0200
commit8d241e8840fdb02dcfce52425626dd8f2125e51a (patch)
tree4f1af2b41135a108c52f2b7d55ef66347d56c575 /lisp/comint.el
parentc2da21c4cc2aec2b2271d6603f7d8e40f3039e62 (diff)
downloademacs-8d241e8840fdb02dcfce52425626dd8f2125e51a.tar.gz
Avoid 1s sleep-for before sending the startfile to a comint process
* lisp/comint.el (comint-exec): Simplify startup file code. (Bug#41640).
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el16
1 files changed, 4 insertions, 12 deletions
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)))