From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov 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 23:54:31 +0200 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87ad3i667c.fsf@mail.jurta.org> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1076968943 17173 80.91.224.253 (16 Feb 2004 22:02:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Feb 2004 22:02:23 +0000 (UTC) Cc: jidanni@jidanni.org, rms@gnu.org, rv@gnu.org, gnu@dsmit.com Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Feb 16 23:02:10 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 1Asqob-0007Rt-00 for ; Mon, 16 Feb 2004 23:02:09 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Asqob-0008D6-00 for ; Mon, 16 Feb 2004 23:02:09 +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 1AsqlQ-0006tj-F9 for emacs-devel@quimby.gnus.org; Mon, 16 Feb 2004 16:58:52 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Asql2-0006tP-3d for emacs-devel@gnu.org; Mon, 16 Feb 2004 16:58:28 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AsqkV-0006ml-4a for emacs-devel@gnu.org; Mon, 16 Feb 2004 16:58:26 -0500 Original-Received: from [66.33.219.4] (helo=spork.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AsqkU-0006mX-SJ; Mon, 16 Feb 2004 16:57:54 -0500 Original-Received: from mail.jurta.org (80-235-38-186-dsl.mus.estpak.ee [80.235.38.186]) by spork.dreamhost.com (Postfix) with ESMTP id 45B2011DC2E; Mon, 16 Feb 2004 13:57:48 -0800 (PST) Original-To: emacs-devel@gnu.org In-Reply-To: (Richard Stallman's message of "Tue, 16 Dec 2003 22:28:07 -0500") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) 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:19999 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19999 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)))) -- http://www.jurta.org/emacs/