manpagez: man pages & more
info emacs
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

41.6 Directory Tracking

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-popd-regexp and 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 line.

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.


© manpagez.com 2000-2024
Individual documents may contain additional copyright information.