diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-03-17 15:04:07 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-03-17 15:04:42 +0100 |
commit | e55ceca8c787c84ed43e5be3c6dbe3d7aad14f8b (patch) | |
tree | d073f9ad676dfb5db6907cf379bf0913c7e2e9fe | |
parent | 55e18e5649bd2a3783e89413ccfd633d12b8f165 (diff) | |
download | emacs-e55ceca8c787c84ed43e5be3c6dbe3d7aad14f8b.tar.gz |
Avoid repeated prompts in `M-x shell' if using ~/.emacs_bash
* lisp/shell.el (shell): Use `shell-eval-command' to avoid
repeated prompts (bug#9961).
-rw-r--r-- | lisp/shell.el | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index 7d5cb475eb2..565ededa1ef 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -783,17 +783,26 @@ Make the shell buffer the current buffer, and return it. (getenv "ESHELL") shell-file-name)) (name (file-name-nondirectory prog)) (startfile (concat "~/.emacs_" name)) - (xargs-name (intern-soft (concat "explicit-" name "-args")))) + (xargs-name (intern-soft (concat "explicit-" name "-args"))) + (start-point (point))) (unless (file-exists-p startfile) (setq startfile (locate-user-emacs-file (concat "init_" name ".sh")))) (setq-local shell--start-prog (file-name-nondirectory prog)) (apply #'make-comint-in-buffer "shell" buffer prog - (if (file-exists-p startfile) startfile) + nil (if (and xargs-name (boundp xargs-name)) (symbol-value xargs-name) '("-i"))) - (shell-mode)))) + (shell-mode) + (when (file-exists-p startfile) + ;; Wait until the prompt has appeared. + (while (= start-point (point)) + (sleep-for 0.1)) + (shell-eval-command + (with-temp-buffer + (insert-file-contents startfile) + (buffer-string))))))) buffer) ;;; Directory tracking |