diff options
| author | Stefan Monnier | 2001-12-02 07:39:23 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-12-02 07:39:23 +0000 |
| commit | 5a45735a4b88cb44e8f51f7a3608f76121a4e950 (patch) | |
| tree | 2582008d031da2f4d18365ec5cad2a9b4e9dd2a9 | |
| parent | 686d0681369244694c91911a1261a07d530ae9ce (diff) | |
| download | emacs-5a45735a4b88cb44e8f51f7a3608f76121a4e950.tar.gz emacs-5a45735a4b88cb44e8f51f7a3608f76121a4e950.zip | |
(shell): Use shell-file-name.
Pop to buffer before calling comint to set COLUMNS properly.
| -rw-r--r-- | lisp/shell.el | 38 |
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. | |||
| 486 | (list | 486 | (list |
| 487 | (and current-prefix-arg | 487 | (and current-prefix-arg |
| 488 | (read-buffer "Shell buffer: " "*shell*")))) | 488 | (read-buffer "Shell buffer: " "*shell*")))) |
| 489 | (when (null buffer) | 489 | (setq buffer (get-buffer-create (or buffer "*shell*"))) |
| 490 | (setq buffer "*shell*")) | 490 | ;; Pop to buffer, so that the buffer's window will be correctly set |
| 491 | (if (not (comint-check-proc buffer)) | 491 | ;; when we call comint (so that comint sets the COLUMNS env var properly). |
| 492 | (let* ((prog (or explicit-shell-file-name | 492 | (pop-to-buffer buffer) |
| 493 | (getenv "ESHELL") | 493 | (unless (comint-check-proc buffer) |
| 494 | (getenv "SHELL") | 494 | (let* ((prog (or explicit-shell-file-name |
| 495 | "/bin/sh")) | 495 | (getenv "ESHELL") shell-file-name)) |
| 496 | (name (file-name-nondirectory prog)) | 496 | (name (file-name-nondirectory prog)) |
| 497 | (startfile (concat "~/.emacs_" name)) | 497 | (startfile (concat "~/.emacs_" name)) |
| 498 | (xargs-name (intern-soft (concat "explicit-" name "-args"))) | 498 | (xargs-name (intern-soft (concat "explicit-" name "-args")))) |
| 499 | shell-buffer) | 499 | (apply 'make-comint-in-buffer "shell" buffer prog |
| 500 | (save-excursion | 500 | (if (file-exists-p startfile) startfile) |
| 501 | (set-buffer (apply 'make-comint-in-buffer "shell" buffer prog | 501 | (if (and xargs-name (boundp xargs-name)) |
| 502 | (if (file-exists-p startfile) startfile) | 502 | (symbol-value xargs-name) |
| 503 | (if (and xargs-name (boundp xargs-name)) | 503 | '("-i"))) |
| 504 | (symbol-value xargs-name) | 504 | (shell-mode))) |
| 505 | '("-i")))) | 505 | buffer) |
| 506 | (setq shell-buffer (current-buffer)) | ||
| 507 | (shell-mode)) | ||
| 508 | (pop-to-buffer shell-buffer)) | ||
| 509 | (pop-to-buffer buffer))) | ||
| 510 | 506 | ||
| 511 | ;;; Don't do this when shell.el is loaded, only while dumping. | 507 | ;;; Don't do this when shell.el is loaded, only while dumping. |
| 512 | ;;;###autoload (add-hook 'same-window-buffer-names "*shell*") | 508 | ;;;###autoload (add-hook 'same-window-buffer-names "*shell*") |