aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/shell.el
diff options
context:
space:
mode:
authorStefan Monnier2010-11-23 09:19:54 -0500
committerStefan Monnier2010-11-23 09:19:54 -0500
commit8f5f1e686e457d046198a6894fd4eca2cf12aaae (patch)
tree840f4e26aac4566b2840ed3e59e876e731e8f7af /lisp/shell.el
parenta299480856a08e59f7b88de2577534215d8aaf7b (diff)
downloademacs-8f5f1e686e457d046198a6894fd4eca2cf12aaae.tar.gz
emacs-8f5f1e686e457d046198a6894fd4eca2cf12aaae.zip
* lisp/shell.el (shell): Use current-buffer by default if it's already
a shell mode buffer and its process is dead. Suggested by <jemarch@gnu.org>.
Diffstat (limited to 'lisp/shell.el')
-rw-r--r--lisp/shell.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index 7771c0d1c4f..4288834e029 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -554,13 +554,19 @@ Otherwise, one argument `-i' is passed to the shell.
554 (generate-new-buffer-name "*shell*")) 554 (generate-new-buffer-name "*shell*"))
555 (if (file-remote-p default-directory) 555 (if (file-remote-p default-directory)
556 ;; It must be possible to declare a local default-directory. 556 ;; It must be possible to declare a local default-directory.
557 ;; FIXME: This can't be right: it changes the default-directory
558 ;; of the current-buffer rather than of the *shell* buffer.
557 (setq default-directory 559 (setq default-directory
558 (expand-file-name 560 (expand-file-name
559 (read-file-name 561 (read-file-name
560 "Default directory: " default-directory default-directory 562 "Default directory: " default-directory default-directory
561 t nil 'file-directory-p)))))))) 563 t nil 'file-directory-p))))))))
562 (require 'ansi-color) 564 (require 'ansi-color)
563 (setq buffer (get-buffer-create (or buffer "*shell*"))) 565 (setq buffer (if (or buffer (not (derived-mode-p 'shell-mode))
566 (comint-check-proc (current-buffer)))
567 (get-buffer-create (or buffer "*shell*"))
568 ;; If the current buffer is a dead shell buffer, use it.
569 (current-buffer)))
564 ;; Pop to buffer, so that the buffer's window will be correctly set 570 ;; Pop to buffer, so that the buffer's window will be correctly set
565 ;; when we call comint (so that comint sets the COLUMNS env var properly). 571 ;; when we call comint (so that comint sets the COLUMNS env var properly).
566 (pop-to-buffer buffer) 572 (pop-to-buffer buffer)