dired-x: Find File At Point
9 Find File At Point
********************
‘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 file name.
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’ (
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 file name 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.gz
then 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.gz
with the point after the last ‘/’. If you hit <RET>, 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’
If set to ‘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 Optional Installation File At Point.
‘dired-x-bind-find-file’
A function, which can be called interactively or in your ‘~/.emacs’
file, that uses the value of ‘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 Optional Installation File At
Point.