[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: when my cursor is sitting on top of a filename, C-x C-f , find-file
From: |
Ehud Karni |
Subject: |
Re: when my cursor is sitting on top of a filename, C-x C-f , find-file etc. should take note, perhaps |
Date: |
Tue, 26 Dec 2000 17:12:01 +0200 |
On Tue, 26 Dec 2000 11:09:40, Eli Zaretskii <eliz@is.elta.co.il> wrote:
>
> On Tue, 26 Dec 2000, Dan Jacobson wrote:
>
> > Idea for the next GNU Emacs, perhaps make an optional behaviour:
> > When my cursor is sitting on top of a filename, and I
> > hit C-x C-f find-file, [or dired, etc.], it ought to suggest in the
> > minibuffer
> > that filename perhaps...
>
> Type "M-x ffap-bindings RET" (perhaps after "M-x load-library RET ffap
> RET"), and you can have it right now.
I use the following function which is modified from dired-x in emacs 19
(it was dropped in emacs 19.26).
(defun dired-find-this-file (&optional as-directory)
"Edit filename or directory at point.
Switch to a buffer visiting filename, creating one if none already exists.
With non-nil prefix argument AS-DIRECTORY do `dired' on the file-name.
Useful for editing the file mentioned in the buffer you are viewing, or to
test if that file exists. Use minibuffer after snatching the filename."
(interactive "P")
(require 'dired)
(let* ((guess (dired-filename-at-point))
(file (read-file-name (if as-directory "dired: " "Find file: ")
guess guess nil nil)))
(if as-directory
(dired (expand-file-name file))
(find-file (expand-file-name file)))))
I assign it to ^X^E (which is usually `eval-last-sexp'). You can bind it
to any other keys you don't use (e.g ^Xf - `set-fill-column' or ^X^T -
`transpose-lines') or to any ^X[upper case letter] since none of them
is used in ctl-x-map. I use ^XF for `find-file-literally'.
In my experience, `dired-find-this-file' (or its ffap equivalent) is
much more useful than `transpose-lines' (which I never used).
Ehud.
--
@@@@@@ @@@ @@@@@@ @ @ Ehud Karni Simon & Wiesel Insurance agency
@ @ @ @@ @ Tel: +972-3-6212-757 Fax: +972-3-6292-544
@ @ @ @ @ @@ (USA) Fax and voice mail: 1-815-5509341
@ @ @ @ @ @ Better Safe Than Sorry
http://www.simonwiesel.co.il mailto:ehud@unix.simonwiesel.co.il
- when my cursor is sitting on top of a filename, C-x C-f find-file etc. should take note, perhaps, Dan Jacobson, 2000/12/25
- Re: when my cursor is sitting on top of a filename, C-x C-f , find-file etc. should take note, perhaps, Eli Zaretskii, 2000/12/26
- Re: when my cursor is sitting on top of a filename, C-x C-f , find-file etc. should take note, perhaps,
Ehud Karni <=
- Re: when my cursor is sitting on top of a filename, C-x C-f find-file etc. should take note, perhaps, Klaus Zeitler, 2000/12/27