For the most part, I'm really liking shell-mode
. I've configured it to read my .history
file and if I spawn a dired or open a file it uses the current directory.
I'm using tcsh
with the set implicitcd
flag set. This allows me to type a directory and cd to it automatically, e.g.
% cd
<home directory>
% /tmp
% pwd
/tmp
There are two problems with the default shell-mode
configuration from my perspective (although they're fine for the default sh
or csh
settings).
1) I can't tab-complete directories in the first position, only executables. I'd like to be able to tab-complete directories here.
2) If I change directory without using cd
emacs does not know to change the buffer's directory. I'd like to stat the first argument if there's only one argument and see if it's a directory and cd to it.
As for (2), the documentation mentions something about comint-input-filter-functions
.
(defun comint-send-input (&optional no-newline artificial)
"Send input to process.
After the process output mark, sends all text from the process mark to
point as input to the process. Before the process output mark, calls
value of variable `comint-get-old-input' to retrieve old input, copies
it to the process mark, and sends it.
This command also sends and inserts a final newline, unless
NO-NEWLINE is non-nil.
Any history reference may be expanded depending on the value of the variable
`comint-input-autoexpand'. The list of function names contained in the value
of `comint-input-filter-functions' is called on the input before sending it.
The input is entered into the input history ring, if the value of variable
`comint-input-filter' returns non-nil when called on the input.
But I'm a little concerned that comint-input-filter-functions
may not be the appropriate place to parse input and determine if it constitutes changing directory because it's nil
by default and emacs does parse the command if it starts with cd
(but not chdir
oddly enough).
(defvar comint-input-filter-functions '()
"Abnormal hook run before input is sent to the process.
These functions get one argument, a string containing the text to send.")