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: [ffap.el] dired-at-point bug Date: Mon, 23 Feb 2004 05:55:19 +0200 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87k72eh2rs.fsf@mail.jurta.org> References: <7c7jyjr7i3.fsf@eyesore.nature.tsukuba.ac.jp> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077508768 16757 80.91.224.253 (23 Feb 2004 03:59:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 Feb 2004 03:59:28 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Feb 23 04:59:24 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 1Av7Fc-0005Kx-00 for ; Mon, 23 Feb 2004 04:59:24 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Av7Fb-0008HK-00 for ; Mon, 23 Feb 2004 04:59:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Av7Ef-0007mK-IZ for emacs-devel@quimby.gnus.org; Sun, 22 Feb 2004 22:58:25 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1Av7EE-0007m9-Ti for emacs-devel@gnu.org; Sun, 22 Feb 2004 22:57:58 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1Av7Di-0007Iw-Pt for emacs-devel@gnu.org; Sun, 22 Feb 2004 22:57:57 -0500 Original-Received: from [66.33.219.4] (helo=spork.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Av7Di-0007Ip-Bp for emacs-devel@gnu.org; Sun, 22 Feb 2004 22:57:26 -0500 Original-Received: from mail.jurta.org (80-235-32-131-dsl.mus.estpak.ee [80.235.32.131]) by spork.dreamhost.com (Postfix) with ESMTP id EBF7911DC22; Sun, 22 Feb 2004 19:57:19 -0800 (PST) Original-To: Hiroshi Fujishima In-Reply-To: <7c7jyjr7i3.fsf@eyesore.nature.tsukuba.ac.jp> (Hiroshi Fujishima's message of "Thu, 19 Feb 2004 13:57:40 +0900") 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:20124 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20124 Hiroshi Fujishima writes: > M-x ffap-bindings and C-x d ~not-exest causes `Wrong type argument: > stringp, nil' error, because (file-name-directory "~not-exest") return > nil though file-writable-p() require string type argument. The patch below fixes this bug. BTW, I have another problem with dired-at-point: its prompter deals with local directories as with regular files. It's very inconvenient. For example, ("^" indicates the default point position in the minibuffer): File: "/dir1/dir2" Prompt: /dir1/^dir2 File: "/dir1/file" Prompt: /dir1/^file I fixed the dired prompter function so that it interprets directories as a directory and gets a directory component from existing local files: File: "/dir1/dir2" Prompt: /dir1/dir2/^ File: "/dir1/file" Prompt: /dir1/^ Index: emacs/lisp/ffap.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/ffap.el,v retrieving revision 1.43 diff -c -r1.43 ffap.el *** emacs/lisp/ffap.el 21 Feb 2004 13:41:04 -0000 1.43 --- emacs/lisp/ffap.el 23 Feb 2004 02:59:30 -0000 *************** *** 1,7 **** ! ;; ffap.el --- find file (or url) at point ! ;; ! ;; Copyright (C) 1995, 96, 97, 2000 Free Software Foundation, Inc. ! ;; ;; Author: Michelangelo Grigni ;; Maintainer: Rajesh Vaidheeswarran ;; Created: 29 Mar 1993 --- 1,7 ---- ! ;;; ffap.el --- find file (or url) at point ! ! ;; Copyright (C) 1995, 96, 97, 2000, 2004 Free Software Foundation, Inc. ! ;; Author: Michelangelo Grigni ;; Maintainer: Rajesh Vaidheeswarran ;; Created: 29 Mar 1993 *************** *** 1675,1681 **** (if (file-directory-p filename) (dired (expand-file-name filename)) (dired (concat (expand-file-name filename) "*")))) ! ((and (file-writable-p (file-name-directory filename)) (y-or-n-p "Directory does not exist, create it? ")) (make-directory filename) (dired filename)) --- 1678,1686 ---- (if (file-directory-p filename) (dired (expand-file-name filename)) (dired (concat (expand-file-name filename) "*")))) ! ((and (file-writable-p ! (or (file-name-directory (directory-file-name filename)) ! filename)) (y-or-n-p "Directory does not exist, create it? ")) (make-directory filename) (dired filename)) *************** *** 1688,1696 **** (ffap-read-file-or-url (if ffap-url-regexp "Dired file or URL: " "Dired file: ") (prog1 ! (setq guess (or guess (ffap-guesser))) ! (and guess (ffap-highlight)) ! )) (ffap-highlight t))) ;;; Offer default global bindings (`ffap-bindings'): --- 1693,1716 ---- (ffap-read-file-or-url (if ffap-url-regexp "Dired file or URL: " "Dired file: ") (prog1 ! (setq guess (or guess ! (let ((guess (ffap-guesser))) ! (if (or (not guess) ! (ffap-url-p guess) ! (ffap-file-remote-p guess)) ! guess ! (setq guess (abbreviate-file-name ! (expand-file-name guess))) ! (cond ! ;; interpret local directory as directory ! ((file-directory-p guess) ! (file-name-as-directory guess)) ! ;; get directory from local file ! ((file-regular-p guess) ! (file-name-directory guess)) ! (guess)))) ! )) ! (and guess (ffap-highlight)))) (ffap-highlight t))) ;;; Offer default global bindings (`ffap-bindings'): -- http://www.jurta.org/emacs/