comparison lisp/shell.el @ 15370:b75fc8f3b376

(shell-directory-tracker): Use comint-substitute-in-file-name to handle system-specific syntax. (shell-chdrive-regexp): New variable. (shell-mode): Update doc string. (shell-directory-tracker): Detect drive changes. Update doc string.
author Richard M. Stallman <rms@gnu.org>
date Sun, 09 Jun 1996 20:31:51 +0000
parents 2c508f2c884d
children f2f66323f14a
comparison
equal deleted inserted replaced
15369:0c818ae83d43 15370:b75fc8f3b376
184 This mirrors the optional behavior of tcsh.") 184 This mirrors the optional behavior of tcsh.")
185 185
186 (defvar shell-cd-regexp "cd" 186 (defvar shell-cd-regexp "cd"
187 "*Regexp to match subshell commands equivalent to cd.") 187 "*Regexp to match subshell commands equivalent to cd.")
188 188
189 (defvar shell-chdrive-regexp
190 (if (memq system-type '(ms-dos windows-nt))
191 ; NetWare allows the five chars between upper and lower alphabetics.
192 "[]a-zA-Z^_`\\[\\\\]:"
193 nil)
194 "*If non-nil, is regexp used to track drive changes.")
195
189 (defvar explicit-shell-file-name nil 196 (defvar explicit-shell-file-name nil
190 "*If non-nil, is file name to use for explicitly requested inferior shell.") 197 "*If non-nil, is file name to use for explicitly requested inferior shell.")
191 198
192 (defvar explicit-csh-args 199 (defvar explicit-csh-args
193 (if (eq system-type 'hpux) 200 (if (eq system-type 'hpux)
285 Customization: Entry to this mode runs the hooks on `comint-mode-hook' and 292 Customization: Entry to this mode runs the hooks on `comint-mode-hook' and
286 `shell-mode-hook' (in that order). Before each input, the hooks on 293 `shell-mode-hook' (in that order). Before each input, the hooks on
287 `comint-input-filter-functions' are run. After each shell output, the hooks 294 `comint-input-filter-functions' are run. After each shell output, the hooks
288 on `comint-output-filter-functions' are run. 295 on `comint-output-filter-functions' are run.
289 296
290 Variables `shell-cd-regexp', `shell-pushd-regexp' and `shell-popd-regexp' 297 Variables `shell-cd-regexp', `shell-chdrive-regexp', `shell-pushd-regexp'
291 are used to match their respective commands, while `shell-pushd-tohome', 298 and `shell-popd-regexp' are used to match their respective commands,
292 `shell-pushd-dextract' and `shell-pushd-dunique' control the behavior of the 299 while `shell-pushd-tohome', `shell-pushd-dextract' and `shell-pushd-dunique'
293 relevant command. 300 control the behavior of the relevant command.
294 301
295 Variables `comint-completion-autolist', `comint-completion-addsuffix', 302 Variables `comint-completion-autolist', `comint-completion-addsuffix',
296 `comint-completion-recexact' and `comint-completion-fignore' control the 303 `comint-completion-recexact' and `comint-completion-fignore' control the
297 behavior of file name, command name and variable name completion. Variable 304 behavior of file name, command name and variable name completion. Variable
298 `shell-completion-execonly' controls the behavior of command name completion. 305 `shell-completion-execonly' controls the behavior of command name completion.
439 default directory to track these commands. 446 default directory to track these commands.
440 447
441 You may toggle this tracking on and off with M-x dirtrack-toggle. 448 You may toggle this tracking on and off with M-x dirtrack-toggle.
442 If emacs gets confused, you can resync with the shell with M-x dirs. 449 If emacs gets confused, you can resync with the shell with M-x dirs.
443 450
444 See variables `shell-cd-regexp', `shell-pushd-regexp', and `shell-popd-regexp', 451 See variables `shell-cd-regexp', `shell-chdrive-regexp', `shell-pushd-regexp',
445 while `shell-pushd-tohome', `shell-pushd-dextract' and `shell-pushd-dunique' 452 and `shell-popd-regexp', while `shell-pushd-tohome', `shell-pushd-dextract',
446 control the behavior of the relevant command. 453 and `shell-pushd-dunique' control the behavior of the relevant command.
447 454
448 Environment variables are expanded, see function `substitute-in-file-name'." 455 Environment variables are expanded, see function `substitute-in-file-name'."
449 (if shell-dirtrackp 456 (if shell-dirtrackp
450 ;; We fail gracefully if we think the command will fail in the shell. 457 ;; We fail gracefully if we think the command will fail in the shell.
451 (condition-case chdir-failure 458 (condition-case chdir-failure
457 cmd (comint-arguments (substring str start end) 0 0) 464 cmd (comint-arguments (substring str start end) 0 0)
458 arg1 (comint-arguments (substring str start end) 1 1)) 465 arg1 (comint-arguments (substring str start end) 1 1))
459 (cond ((string-match (concat "\\`\\(" shell-popd-regexp 466 (cond ((string-match (concat "\\`\\(" shell-popd-regexp
460 "\\)\\($\\|[ \t]\\)") 467 "\\)\\($\\|[ \t]\\)")
461 cmd) 468 cmd)
462 (shell-process-popd (substitute-in-file-name arg1))) 469 (shell-process-popd (comint-substitute-in-file-name arg1)))
463 ((string-match (concat "\\`\\(" shell-pushd-regexp 470 ((string-match (concat "\\`\\(" shell-pushd-regexp
464 "\\)\\($\\|[ \t]\\)") 471 "\\)\\($\\|[ \t]\\)")
465 cmd) 472 cmd)
466 (shell-process-pushd (substitute-in-file-name arg1))) 473 (shell-process-pushd (comint-substitute-in-file-name arg1)))
467 ((string-match (concat "\\`\\(" shell-cd-regexp 474 ((string-match (concat "\\`\\(" shell-cd-regexp
468 "\\)\\($\\|[ \t]\\)") 475 "\\)\\($\\|[ \t]\\)")
469 cmd) 476 cmd)
470 (shell-process-cd (substitute-in-file-name arg1)))) 477 (shell-process-cd (comint-substitute-in-file-name arg1)))
478 ((and shell-chdrive-regexp
479 (string-match (concat "\\`\\(" shell-chdrive-regexp
480 "\\)\\($\\|[ \t]\\)")
481 cmd))
482 (shell-process-cd (comint-substitute-in-file-name cmd))))
471 (setq start (progn (string-match "[; \t]*" str end) ; skip again 483 (setq start (progn (string-match "[; \t]*" str end) ; skip again
472 (match-end 0))))) 484 (match-end 0)))))
473 (error "Couldn't cd")))) 485 (error "Couldn't cd"))))
474 486
475 ;;; popd [+n] 487 ;;; popd [+n]