From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rajesh Vaidheeswarran Newsgroups: gmane.emacs.devel Subject: Re: [jidanni@jidanni.org: ffap: if file at point doesn't exist, but its directory does] Date: Mon, 16 Feb 2004 22:38:47 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <40318CC7.90001@gnu.org> References: <87ad3i667c.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1076989498 15358 80.91.224.253 (17 Feb 2004 03:44:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 17 Feb 2004 03:44:58 +0000 (UTC) Cc: jidanni@jidanni.org, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Feb 17 04:44:50 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AswAE-0008S7-00 for ; Tue, 17 Feb 2004 04:44:50 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AswAE-0008Lu-00 for ; Tue, 17 Feb 2004 04:44:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Asw6E-00042Q-EM for emacs-devel@quimby.gnus.org; Mon, 16 Feb 2004 22:40:42 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Asw5u-0003tH-87 for emacs-devel@gnu.org; Mon, 16 Feb 2004 22:40:22 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1Asw5H-0002p4-6m for emacs-devel@gnu.org; Mon, 16 Feb 2004 22:40:15 -0500 Original-Received: from [216.234.118.53] (helo=pear.arborhosting.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1Asw4g-0001ia-Mi; Mon, 16 Feb 2004 22:39:06 -0500 X-ClientAddr: 68.186.248.172 Original-Received: from gnu.org (cpe-68-186-248-172.ma.charter.com [68.186.248.172]) by pear.arborhosting.com (8.11.6/8.11.6) with ESMTP id i1H3cSo02094; Mon, 16 Feb 2004 22:38:28 -0500 User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en Original-To: Juri Linkov In-Reply-To: <87ad3i667c.fsf@mail.jurta.org> X-MailScanner: Found to be clean X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-6.7, required 5, BAYES_01, EMAIL_ATTRIBUTION, IN_REP_TO, QUOTED_EMAIL_TEXT, REFERENCES, REPLY_WITH_QUOTES, USER_AGENT) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20010 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20010 It seems Juri just beat me to it. I'll test it and check it in, if all is well. Thanks Juri. rv Juri Linkov wrote: > Richard Stallman writes: > >>Would someone like to work on this? (rv has not responded in a month.) >> >>From: Dan Jacobson >>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 > > * 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)))) > >