aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-03-17 15:04:07 +0100
committerLars Ingebrigtsen2022-03-17 15:04:42 +0100
commite55ceca8c787c84ed43e5be3c6dbe3d7aad14f8b (patch)
treed073f9ad676dfb5db6907cf379bf0913c7e2e9fe
parent55e18e5649bd2a3783e89413ccfd633d12b8f165 (diff)
downloademacs-e55ceca8c787c84ed43e5be3c6dbe3d7aad14f8b.tar.gz
emacs-e55ceca8c787c84ed43e5be3c6dbe3d7aad14f8b.zip
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.el15
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.
783 (getenv "ESHELL") shell-file-name)) 783 (getenv "ESHELL") shell-file-name))
784 (name (file-name-nondirectory prog)) 784 (name (file-name-nondirectory prog))
785 (startfile (concat "~/.emacs_" name)) 785 (startfile (concat "~/.emacs_" name))
786 (xargs-name (intern-soft (concat "explicit-" name "-args")))) 786 (xargs-name (intern-soft (concat "explicit-" name "-args")))
787 (start-point (point)))
787 (unless (file-exists-p startfile) 788 (unless (file-exists-p startfile)
788 (setq startfile (locate-user-emacs-file 789 (setq startfile (locate-user-emacs-file
789 (concat "init_" name ".sh")))) 790 (concat "init_" name ".sh"))))
790 (setq-local shell--start-prog (file-name-nondirectory prog)) 791 (setq-local shell--start-prog (file-name-nondirectory prog))
791 (apply #'make-comint-in-buffer "shell" buffer prog 792 (apply #'make-comint-in-buffer "shell" buffer prog
792 (if (file-exists-p startfile) startfile) 793 nil
793 (if (and xargs-name (boundp xargs-name)) 794 (if (and xargs-name (boundp xargs-name))
794 (symbol-value xargs-name) 795 (symbol-value xargs-name)
795 '("-i"))) 796 '("-i")))
796 (shell-mode)))) 797 (shell-mode)
798 (when (file-exists-p startfile)
799 ;; Wait until the prompt has appeared.
800 (while (= start-point (point))
801 (sleep-for 0.1))
802 (shell-eval-command
803 (with-temp-buffer
804 (insert-file-contents startfile)
805 (buffer-string)))))))
797 buffer) 806 buffer)
798 807
799;;; Directory tracking 808;;; Directory tracking