mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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).
This commit is contained in:
parent
55e18e5649
commit
e55ceca8c7
1 changed files with 12 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue