[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question: Is there any way to use the bash completion feature from E
Re: Question: Is there any way to use the bash completion feature from Emacs shell mode.
Mon, 10 Oct 2016 19:02:21 -0600
Dan Hitt wrote:
> But one example where emacs doesn't work as well as bash is emacs can
> get confused over what directory you are in.
> For example, if you have a bash alias that switches directory, emacs
> cannot monitor it.
Perhaps this will help:
37.6 Directory Tracking
Shell mode keeps track of ‘cd’, ‘pushd’ and ‘popd’ commands given to the
subshell, in order to keep the Shell buffer’s default directory (*note
File Names::) the same as the shell’s working directory. It recognizes
these commands by examining lines of input that you send.
If you use aliases for these commands, you can tell Emacs to
recognize them also, by setting the variables ‘shell-pushd-regexp’,
‘shell-popd-regexp’, and ‘shell-cd-regexp’ to the appropriate regular
expressions (*note Regexps::). For example, if ‘shell-pushd-regexp’
matches the beginning of a shell command line, that line is regarded as
a ‘pushd’ command. These commands are recognized only at the beginning
of a shell command line.
If Emacs gets confused about changes in the working directory of the
subshell, type ‘M-x dirs’. This command asks the shell for its working
directory and updates the default directory accordingly. It works for
shells that support the most common command syntax, but may not work for
You can also use Dirtrack mode, a buffer-local minor mode that
implements an alternative method of tracking the shell’s working
directory. To use this method, your shell prompt must contain the
working directory at all times, and you must supply a regular expression
for recognizing which part of the prompt contains the working directory;
see the documentation of the variable ‘dirtrack-list’ for details. To
use Dirtrack mode, type ‘M-x dirtrack-mode’ in the Shell buffer, or add
‘dirtrack-mode’ to ‘shell-mode-hook’ (*note Hooks::).
Re: Question: Is there any way to use the bash completion feature from Emacs shell mode., Bob Proulx, 2016/10/09
Re: Question: Is there any way to use the bash completion feature from Emacs shell mode., Oleksandr Gavenko, 2016/10/10