From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: Re: ffap: if file at point doesn't exist, but its directory does Date: Mon, 17 Nov 2003 19:14:17 +0200 Organization: JURTA Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87y8uezzme.fsf@mail.jurta.org> References: <87vfplcwmu.fsf@jidanni.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069090639 31303 80.91.224.253 (17 Nov 2003 17:37:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2003 17:37:19 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 17 18:37:13 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ALnJJ-0000k5-01 for ; Mon, 17 Nov 2003 18:37:13 +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 1ALoG6-0008QD-AR for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Nov 2003 13:37:58 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ALoE2-0007iu-L7 for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2003 13:35:50 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ALoDP-0006un-4m for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2003 13:35:42 -0500 Original-Received: from [64.246.52.22] (helo=ns5.tangramltd.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1ALo9W-0002tB-DR for bug-gnu-emacs@gnu.org; Mon, 17 Nov 2003 13:31:10 -0500 Original-Received: from 80-235-34-193-dsl.mus.estpak.ee ([80.235.34.193] helo=mail.jurta.org) by ns5.tangramltd.com with esmtp (Exim 4.20) id 1ALnBw-0004nX-Jp; Mon, 17 Nov 2003 19:29:36 +0200 Original-To: Dan Jacobson In-Reply-To: <87vfplcwmu.fsf@jidanni.org> (Dan Jacobson's message of "Sun, 16 Nov 2003 02:30:33 +0800") User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ns5.tangramltd.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jurta.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:6142 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:6142 Dan Jacobson writes: > 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. I have another problem with ffap: it can't find a file if file name contains spaces. I fixed this problem by the new function: (defun my-find-file-at-point-or-region (&optional arg) "Find filename at point or selected by region. This function is useful, when filename contains spaces, and so can't be fully matched by `find-file-at-point'. In this case user should manually select region around the full filename and invoke this command. This function also maps UNIX filenames to Window$ filenames." (interactive "P") (let ((filename (if (and transient-mark-mode mark-active) (buffer-substring-no-properties (mark) (point)) (ffap-string-at-point)))) (and (eq system-type 'windows-nt) filename (string-match "^/dos/\\([A-Za-z]\\)\\(.*\\)" filename) (setq filename (concat (match-string 1 filename) ":" (match-string 2 filename)))) (or (and filename (file-exists-p filename)) (setq filename (ffap-guesser))) (find-file-at-point (ffap-prompter filename)))) But I think it is not the right thing yet. Ffap should be fixed to pick up full file name with spaces without requiring the user to select a region. -- http://www.jurta.org/emacs/