summaryrefslogtreecommitdiff
path: root/lisp/shell.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2001-12-02 07:39:23 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2001-12-02 07:39:23 +0000
commit5a45735a4b88cb44e8f51f7a3608f76121a4e950 (patch)
tree2582008d031da2f4d18365ec5cad2a9b4e9dd2a9 /lisp/shell.el
parent686d0681369244694c91911a1261a07d530ae9ce (diff)
downloademacs-5a45735a4b88cb44e8f51f7a3608f76121a4e950.tar.gz
(shell): Use shell-file-name.
Pop to buffer before calling comint to set COLUMNS properly.
Diffstat (limited to 'lisp/shell.el')
-rw-r--r--lisp/shell.el38
1 files changed, 17 insertions, 21 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index f09e2c6b56e..0a4119f0f8d 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -486,27 +486,23 @@ Otherwise, one argument `-i' is passed to the shell.
(list
(and current-prefix-arg
(read-buffer "Shell buffer: " "*shell*"))))
- (when (null buffer)
- (setq buffer "*shell*"))
- (if (not (comint-check-proc buffer))
- (let* ((prog (or explicit-shell-file-name
- (getenv "ESHELL")
- (getenv "SHELL")
- "/bin/sh"))
- (name (file-name-nondirectory prog))
- (startfile (concat "~/.emacs_" name))
- (xargs-name (intern-soft (concat "explicit-" name "-args")))
- shell-buffer)
- (save-excursion
- (set-buffer (apply 'make-comint-in-buffer "shell" buffer prog
- (if (file-exists-p startfile) startfile)
- (if (and xargs-name (boundp xargs-name))
- (symbol-value xargs-name)
- '("-i"))))
- (setq shell-buffer (current-buffer))
- (shell-mode))
- (pop-to-buffer shell-buffer))
- (pop-to-buffer buffer)))
+ (setq buffer (get-buffer-create (or buffer "*shell*")))
+ ;; Pop to buffer, so that the buffer's window will be correctly set
+ ;; when we call comint (so that comint sets the COLUMNS env var properly).
+ (pop-to-buffer buffer)
+ (unless (comint-check-proc buffer)
+ (let* ((prog (or explicit-shell-file-name
+ (getenv "ESHELL") shell-file-name))
+ (name (file-name-nondirectory prog))
+ (startfile (concat "~/.emacs_" name))
+ (xargs-name (intern-soft (concat "explicit-" name "-args"))))
+ (apply 'make-comint-in-buffer "shell" buffer prog
+ (if (file-exists-p startfile) startfile)
+ (if (and xargs-name (boundp xargs-name))
+ (symbol-value xargs-name)
+ '("-i")))
+ (shell-mode)))
+ buffer)
;;; Don't do this when shell.el is loaded, only while dumping.
;;;###autoload (add-hook 'same-window-buffer-names "*shell*")