|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Shell mode keeps track of `cd', `pushd' and `popd' commands given to the inferior shell, so it can keep the `*shell*' buffer's default directory the same as the shell's working directory. It recognizes these commands syntactically, by examining lines of input that are sent.
If you use aliases for these commands, you can tell Emacs to
recognize them also. For example, if the value of the variable
shell-pushd-regexp matches the beginning of a shell command
line, that line is regarded as a
pushd command. Change this
variable when you add aliases for `pushd'. Likewise,
shell-cd-regexp are used to
recognize commands with the meaning of `popd' and `cd'.
These commands are recognized only at the beginning of a shell command
If Emacs gets confused about changes in the current directory of the subshell, use the command M-x dirs to ask the shell what its current directory is. This command works for shells that support the most common command syntax; it may not work for unusual shells.
You can also use M-x dirtrack-mode to enable (or disable) an alternative and more aggressive method of tracking changes in the current directory.