An Emacs buffer can have but one working directory, stored in the
buffer-local variable default-directory
. A Dired buffer may have
several subdirectories inserted, but still has but one working
directory: that of the top level Dired directory in that buffer. For
some commands it is appropriate that they use the current Dired
directory instead of default-directory
, e.g., find-file
and
compile
.
A general mechanism is provided for special handling of the working directory in special major modes:
default-directory-alist
((dired-mode . (dired-current-directory)))
Alist of major modes and their opinion on default-directory
, as a
lisp expression to evaluate. A resulting value of nil
is ignored
in favor of default-directory
.
default-directory
default-directory
, but knows about the
special cases in variable default-directory-alist
.
`dired-x' provides a method of visiting or editing a file mentioned in the buffer you are viewing (e.g., a mail buffer, a news article, a README file, etc.) or to test if that file exists. You can then modify this in the minibuffer after snatching the filename.
When installed `dired-x' will substitute dired-x-find-file
for
find-file
(normally bound to C-x C-f) and
dired-x-find-file-other-window
for find-file-other-window
(normally bound to C-x 4 C-f).
In order to use this feature, you will need to set
dired-x-hands-off-my-keys
to nil
inside dired-load-hook
(See section Optional Installation File At Point).
dired-x-find-file
dired-x-find-file
behaves exactly like find-file
(normally bound
to C-x C-f) unless a prefix argument is passed to the function in which
case it will use the filename at point as a guess for the file to visit.
For example, if the buffer you were reading contained the words
Available via anonymous ftp in /roebling.poly.edu:/pub/lisp/crypt++.el.gzthen you could move your cursor to the line containing the ftp address and type C-u C-x C-f (the C-u is a universal argument). The minibuffer would read
Find file: /roebling.poly.edu:/pub/lisp/crypt++.el.gzwith the point after the last
/
. If you hit return emacs will visit
the file at that address. This also works with files on your own computer.
dired-x-find-file-other-window
dired-x-find-file-other-window
behaves exactly like
find-file-other-window
(normally bound to C-x 4 C-f) unless a
prefix argument is used. See dired-x-find-file
for more information.
dired-x-hands-off-my-keys
t
, then it means that `dired-x' should not bind
dired-x-find-file
over find-file
on keyboard. Similarly, it
should not bind dired-x-find-file-other-window
over
find-file-other-window
. If you change this variable after
`dired-x.el' is loaded then do M-x dired-x-bind-find-file. The
default value of this variable is t; by default, the binding is not
done. See See section Optional Installation File At Point.
dired-x-bind-find-file
dired-x-hands-off-my-keys
to determine if
dired-x-find-file
should be bound over find-file
and
dired-x-find-file-other-window
bound over
find-file-other-window
. See See section Optional Installation File At Point.
Go to the first, previous, next, last section, table of contents.