help-gnu-emacs
[Top][All Lists]
Advanced

[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


From: Bob Proulx
Subject: Re: Question: Is there any way to use the bash completion feature from Emacs shell mode.
Date: Mon, 10 Oct 2016 19:02:21 -0600
User-agent: NeoMutt/20160916 (1.7.0)

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:

  
https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Tracking.html#Directory-Tracking

  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
  unusual shells.

     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::).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]