From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jens Lechtenboerger Newsgroups: gmane.emacs.bugs Subject: bug#9131: 23.3; ffap-url-unwrap-local broken for file URIs Date: Wed, 20 Jul 2011 17:28:21 +0200 Message-ID: <87k4bdott6.fsf@pcwi7557.uni-muenster.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: dough.gmane.org 1311195772 30472 80.91.229.12 (20 Jul 2011 21:02:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Jul 2011 21:02:52 +0000 (UTC) To: 9131@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 20 23:02:49 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qjduo-0007zw-HL for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Jul 2011 23:02:46 +0200 Original-Received: from localhost ([::1]:45540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qjdun-0006Ox-8R for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Jul 2011 17:02:45 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjaCp-0000ZD-L5 for bug-gnu-emacs@gnu.org; Wed, 20 Jul 2011 13:05:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjaCl-00086X-Py for bug-gnu-emacs@gnu.org; Wed, 20 Jul 2011 13:05:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjaCl-00086M-6c for bug-gnu-emacs@gnu.org; Wed, 20 Jul 2011 13:05:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QjaCk-0001Rm-4v; Wed, 20 Jul 2011 13:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jens Lechtenboerger Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Jul 2011 17:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9131 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13111814955545 (code B ref -1); Wed, 20 Jul 2011 17:05:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Jul 2011 17:04:55 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QjaCc-0001RN-5F for submit@debbugs.gnu.org; Wed, 20 Jul 2011 13:04:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QjZ1a-00089U-1F for submit@debbugs.gnu.org; Wed, 20 Jul 2011 11:49:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjZ1T-0002HV-7g for submit@debbugs.gnu.org; Wed, 20 Jul 2011 11:49:20 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:56308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjZ1S-0002HO-KV for submit@debbugs.gnu.org; Wed, 20 Jul 2011 11:49:18 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:53532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjZ1P-0001ZV-H5 for bug-gnu-emacs@gnu.org; Wed, 20 Jul 2011 11:49:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjZ1N-0002GY-8c for bug-gnu-emacs@gnu.org; Wed, 20 Jul 2011 11:49:14 -0400 Original-Received: from wi-vm700.wi1.uni-muenster.de ([128.176.158.92]:33053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjZ1M-0002Fh-Ot for bug-gnu-emacs@gnu.org; Wed, 20 Jul 2011 11:49:13 -0400 Original-Received: from pcwi7557.uni-muenster.de (128.176.159.107) by wi-vm700.wi1.uni-muenster.de (128.176.159.139) with Microsoft SMTP Server id 8.1.375.2; Wed, 20 Jul 2011 17:28:24 +0200 Original-Received: from lechten by pcwi7557.uni-muenster.de with local (Exim 4.71) (envelope-from ) id 1QjYhB-0005lo-51 for bug-gnu-emacs@gnu.org; Wed, 20 Jul 2011 17:28:21 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP4, XP SP1+ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Wed, 20 Jul 2011 13:04:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 20 Jul 2011 13:05:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org 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 Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:49476 Archived-At: Dear all, ffap-url-unwrap-local does not work properly for file URIs. Recipe starting from `emacs -Q': M-x ffap-bindings M-: (ffap-url-unwrap-local "file:///home/foo/bar") This results in nil, while "/home/foo/bar" would be correct. The regular expression within ffap-url-unwrap-local is incorrect. Moreover, I don't understand why and how ffap distinguishes local from remote URLs. The doc string for variable ffap-url-unwrap-local talks about "file:" URLs, while the one for ffap-url-unwrap-remote talks about "ftp:" URLs. Nevertheless, the regular expressions in both functions, ffap-url-unwrap-local and ffap-url-unwrap-remote, match both, "file:" and "ftp:"... The incorrect function is: (defsubst ffap-url-unwrap-local (url) "Return URL as a local file, or nil. Ignores `ffap-url-regexp'." (and (string-match "\\`\\(file\\|ftp\\):/?\\([^/]\\|\\'\\)" url) (substring url (1+ (match-end 1))))) I suggest the following: (defsubst ffap-url-unwrap-local (url) "Return URL as a local file, or nil. Ignores `ffap-url-regexp'." (and (not (string-match "^\\(file\\|ftp\\)://[^/]" url)) (string-match "^\\(file\\|ftp\\):\\(//\\)?\\(.*\\)" url) (match-string 3 url))) The first condition ("not ...") makes sure that we look at a URI without authority part, which is my interpretation of "local" URI (although there are "local" authority parts such as "localhost", local IP addresses, or DNS names of the local machine). Thanks for ffap, which I only discovered today ;) Jens