From: Juri Linkov <juri@jurta.org>
Cc: jidanni@jidanni.org, rms@gnu.org, rv@gnu.org, gnu@dsmit.com
Subject: Re: [jidanni@jidanni.org: ffap: if file at point doesn't exist, but its directory does]
Date: Mon, 16 Feb 2004 23:54:31 +0200 [thread overview]
Message-ID: <87ad3i667c.fsf@mail.jurta.org> (raw)
In-Reply-To: <E1AWSM3-0006Ss-CK@fencepost.gnu.org> (Richard Stallman's message of "Tue, 16 Dec 2003 22:28:07 -0500")
Richard Stallman <rms@gnu.org> writes:
> Would someone like to work on this? (rv has not responded in a month.)
>
> From: Dan Jacobson <jidanni@jidanni.org>
> Subject: ffap: if file at point doesn't exist, but its directory does
> To: bug-gnu-emacs@gnu.org
> Date: Sun, 16 Nov 2003 02:30:33 +0800
>
> Ffap gentlemen, assume your cursor is on
> "/usr/X11R6/lib/X11/xdm/Xreset" but the file doesn't exist, but the
> directory does. Well, ffap should (optionally ask, and) take you to a
> dired of that directory... better than the current nothing.
Since nobody has implemented this useful feature yet, here is the patch:
2004-02-16 Juri Linkov <juri@jurta.org>
* ffap.el (ffap-file-at-point): Try parent directories.
Index: emacs/lisp/ffap.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ffap.el,v
retrieving revision 1.42
diff -c -r1.42 ffap.el
*** emacs/lisp/ffap.el 25 Dec 2003 17:44:48 -0000 1.42
--- emacs/lisp/ffap.el 16 Feb 2004 21:44:46 -0000
***************
*** 1185,1190 ****
--- 1187,1200 ----
remote-dir (substring name (match-end 1)))))
(ffap-file-exists-string
(ffap-replace-file-component remote-dir name))))))
+ ;; Try all parent directories by deleting the trailing directory
+ ;; name until existing directory is found or name stops changing
+ ((let ((dir name))
+ (while (and dir
+ (not (ffap-file-exists-string dir))
+ (not (equal dir (setq dir (file-name-directory
+ (directory-file-name dir)))))))
+ (ffap-file-exists-string dir)))
)
(set-match-data data))))
\f
--
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2004-02-16 21:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-17 3:28 [jidanni@jidanni.org: ffap: if file at point doesn't exist, but its directory does] Richard Stallman
2004-01-03 8:46 ` gnu
2004-02-16 21:54 ` Juri Linkov [this message]
2004-02-17 3:38 ` Rajesh Vaidheeswarran
2004-02-17 21:09 ` Juri Linkov
2004-02-18 19:52 ` Dan Jacobson
2004-02-19 7:07 ` Eli Zaretskii
2004-02-19 23:24 ` Dan Jacobson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ad3i667c.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=gnu@dsmit.com \
--cc=jidanni@jidanni.org \
--cc=rms@gnu.org \
--cc=rv@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).