diff options
Diffstat (limited to 'lisp/shell.el')
| -rw-r--r-- | lisp/shell.el | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index dbff7a389fa..24ef65a384a 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -5,7 +5,7 @@ ;; Author: Olin Shivers <shivers@cs.cmu.edu> ;; Simon Marshall <simon@gnu.org> -;; Maintainer: FSF +;; Maintainer: FSF <emacs-devel@gnu.org> ;; Keywords: processes ;; This file is part of GNU Emacs. @@ -27,11 +27,6 @@ ;;; Commentary: -;; Please send me bug reports, bug fixes, and extensions, so that I can -;; merge them into the master source. -;; - Olin Shivers (shivers@cs.cmu.edu) -;; - Simon Marshall (simon@gnu.org) - ;; This file defines a shell-in-a-buffer package (shell mode) built on ;; top of comint mode. This is actually cmushell with things renamed ;; to replace its counterpart in Emacs 18. cmushell is more @@ -93,7 +88,7 @@ ;; m-c-f shell-forward-command Forward a shell command ;; m-c-b shell-backward-command Backward a shell command ;; dirs Resync the buffer's dir stack -;; dirtrack-mode Turn dir tracking on/off +;; shell-dirtrack-mode Turn dir tracking on/off ;; comint-strip-ctrl-m Remove trailing ^Ms from output ;; ;; The shell mode hook is shell-mode-hook @@ -263,7 +258,9 @@ This mirrors the optional behavior of tcsh." (defcustom shell-dirtrack-verbose t "If non-nil, show the directory stack following directory change. -This is effective only if directory tracking is enabled." +This is effective only if directory tracking is enabled. +The `dirtrack' package provides an alternative implementation of this feature - +see the function `dirtrack-mode'." :type 'boolean :group 'shell-directories) @@ -398,7 +395,9 @@ While directory tracking is enabled, the shell's working directory is displayed by \\[list-buffers] or \\[mouse-buffer-menu] in the `File' field. \\[dirs] queries the shell and resyncs Emacs' idea of what the current directory stack is. -\\[dirtrack-mode] turns directory tracking on and off. +\\[shell-dirtrack-mode] turns directory tracking on and off. +\(The `dirtrack' package provides an alternative implementation of this +feature - see the function `dirtrack-mode'.) \\{shell-mode-map} Customization: Entry to this mode runs the hooks on `comint-mode-hook' and @@ -516,6 +515,9 @@ Sentinels will always get the two parameters PROCESS and EVENT." (defun shell (&optional buffer) "Run an inferior shell, with I/O through BUFFER (which defaults to `*shell*'). Interactively, a prefix arg means to prompt for BUFFER. +If `default-directory' is a remote file name, it is also prompted +to change if called with a prefix arg. + If BUFFER exists but shell process is not running, make new shell. If BUFFER exists and shell process is running, just switch to BUFFER. Program used comes from variable `explicit-shell-file-name', @@ -544,8 +546,16 @@ Otherwise, one argument `-i' is passed to the shell. (interactive (list (and current-prefix-arg - (read-buffer "Shell buffer: " - (generate-new-buffer-name "*shell*"))))) + (prog1 + (read-buffer "Shell buffer: " + (generate-new-buffer-name "*shell*")) + (if (file-remote-p default-directory) + ;; It must be possible to declare a local default-directory. + (setq default-directory + (expand-file-name + (read-file-name + "Default directory: " default-directory default-directory + t nil 'file-directory-p)))))))) (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). @@ -557,7 +567,7 @@ Otherwise, one argument `-i' is passed to the shell. (startfile (concat "~/.emacs_" name)) (xargs-name (intern-soft (concat "explicit-" name "-args")))) (unless (file-exists-p startfile) - (setq startfile (concat "~/.emacs.d/init_" name ".sh"))) + (setq startfile (concat user-emacs-directory "init_" name ".sh"))) (apply 'make-comint-in-buffer "shell" buffer prog (if (file-exists-p startfile) startfile) (if (and xargs-name (boundp xargs-name)) @@ -615,8 +625,10 @@ This function is called on each input passed to the shell. It watches for cd, pushd and popd commands and sets the buffer's default directory to track these commands. -You may toggle this tracking on and off with \\[dirtrack-mode]. +You may toggle this tracking on and off with \\[shell-dirtrack-mode]. If Emacs gets confused, you can resync with the shell with \\[dirs]. +\(The `dirtrack' package provides an alternative implementation of this +feature - see the function `dirtrack-mode'.) See variables `shell-cd-regexp', `shell-chdrive-regexp', `shell-pushd-regexp', and `shell-popd-regexp', while `shell-pushd-tohome', `shell-pushd-dextract', @@ -772,17 +784,17 @@ Environment variables are expanded, see function `substitute-in-file-name'." (defvaralias 'shell-dirtrack-mode 'shell-dirtrackp) (define-minor-mode shell-dirtrack-mode - "Turn directory tracking on and off in a shell buffer." + "Turn directory tracking on and off in a shell buffer. +The `dirtrack' package provides an alternative implementation of this +feature - see the function `dirtrack-mode'." nil nil nil (setq list-buffers-directory (if shell-dirtrack-mode default-directory)) (if shell-dirtrack-mode (add-hook 'comint-input-filter-functions 'shell-directory-tracker nil t) (remove-hook 'comint-input-filter-functions 'shell-directory-tracker t))) -;; For your typing convenience: -(defalias 'shell-dirtrack-toggle 'shell-dirtrack-mode) ;??Convenience?? -(defalias 'dirtrack-toggle 'shell-dirtrack-mode) -(defalias 'dirtrack-mode 'shell-dirtrack-mode) +(define-obsolete-function-alias 'shell-dirtrack-toggle 'shell-dirtrack-mode + "23.1") (defun shell-cd (dir) "Do normal `cd' to DIR, and set `list-buffers-directory'." |
