From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Andrus Newsgroups: gmane.emacs.bugs Subject: bug#17723: 24.3.91; Improvements for ffap Date: Sat, 7 Jun 2014 01:51:02 -0600 Message-ID: <34410D30-1B4F-4A14-92B3-4F6C76A5435E@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1402127552 21234 80.91.229.3 (7 Jun 2014 07:52:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Jun 2014 07:52:32 +0000 (UTC) To: 17723@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 07 09:52:25 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WtBQN-0001yl-Un for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jun 2014 09:52:24 +0200 Original-Received: from localhost ([::1]:50887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtBQN-00037M-E3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jun 2014 03:52:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtBQB-00036H-W6 for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 03:52:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtBQ2-0004Tq-NX for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 03:52:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtBQ2-0004Te-K8 for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 03:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WtBQ2-0007qQ-58 for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 03:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Andrus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Jun 2014 07:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17723 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.140212750130117 (code B ref -1); Sat, 07 Jun 2014 07:52:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Jun 2014 07:51:41 +0000 Original-Received: from localhost ([127.0.0.1]:40097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WtBPh-0007pf-03 for submit@debbugs.gnu.org; Sat, 07 Jun 2014 03:51:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58446) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WtBPe-0007pM-ID for submit@debbugs.gnu.org; Sat, 07 Jun 2014 03:51:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtBPQ-000481-Gc for submit@debbugs.gnu.org; Sat, 07 Jun 2014 03:51:33 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:45164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtBPQ-00047v-Da for submit@debbugs.gnu.org; Sat, 07 Jun 2014 03:51:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtBPH-00033x-D0 for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 03:51:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtBP8-0003uC-Az for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 03:51:15 -0400 Original-Received: from mail-ie0-x22e.google.com ([2607:f8b0:4001:c03::22e]:59383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtBP8-0003tk-5S for bug-gnu-emacs@gnu.org; Sat, 07 Jun 2014 03:51:06 -0400 Original-Received: by mail-ie0-f174.google.com with SMTP id lx4so203467iec.33 for ; Sat, 07 Jun 2014 00:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=twJUEVgD7TvHQiRTPfrSKTEL8JDTCV9ZBqv5GrlfirQ=; b=eiLg9ddWIIO8f4+4EN4bpeLj7keeKtCEz3PFRRcpc+521aKVwWEEDVwtzrADpJ2mE4 0UlWb/T+ShYLfVK6n/U67eTgRmCWvCcUEy+PZUwEksDwZIOTTSYsi40oiLf1PJoiGrwS Xck6ax0aaeuToYUcPJMAnEz231unqsZbAKRvWc4CpukveGPULP0gRy70r3hxodhxa3+X zc0RoI0ktJ1EtRbRR1mP13zfs3dsJPgaJWxBReXEo/yYnRI+EhciphHz8jBYaKseK6as lrRSK6cUChNhiCccfS0MuJ1xQb9uOrHkznFM9KpfNaFj2gprpUEaiutPowWNsWKBM14b RjFQ== X-Received: by 10.42.4.201 with SMTP id 9mr12417485ict.57.1402127464759; Sat, 07 Jun 2014 00:51:04 -0700 (PDT) Original-Received: from [192.168.0.3] (65-130-127-191.slkc.qwest.net. [65.130.127.191]) by mx.google.com with ESMTPSA id j3sm32764518igx.8.2014.06.07.00.51.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Jun 2014 00:51:04 -0700 (PDT) X-Mailer: Apple Mail (2.1878.2) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:90157 Archived-At: Find file at point has two annoyances for me (I've rebound C-x C-f to = ffap). The first is that closing xml tags take me to the root directory since they start with "/". I fixed by simply disallowing "/" as a valid match in this case. The second is that when editing C++ code, namespaced functions (like std::find) get picked up as URLs. I changed this by adding an option. I personally haven't found a reason for it to be non-nil (use lax matching), but I presume there must have been one so I defaulted to no behavior change. Here's a proposed ChangeLog entry (please let me know if the format is = wrong): 2014-06-07 Ivan Andrus * ffap.el (ffap-url-at-point): Added `ffap-lax-url' to disallow lax URL matching. (ffap-file-at-point): Disallow "/" so closing xml tags don't interfere. Thanks, Ivan diff --git a/lisp/ffap.el b/lisp/ffap.el index 119e0ad..e36e613 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -163,6 +163,12 @@ schemes (e.g. \"ftp\"); in that case, only convert = those URLs." :group 'ffap :version "24.3") +(defcustom ffap-lax-url t + "If non-nil, allow lax URL matching." + :type 'boolean + :group 'ffap + :version "24.4") + (defcustom ffap-ftp-default-user "anonymous" "User name in FTP file names generated by `ffap-host-to-path'. Note this name may be omitted if it equals the default @@ -1096,7 +1102,7 @@ Assumes the buffer has not changed." (w3-view-this-url t)) (let ((thing-at-point-beginning-of-url-regexp ffap-url-regexp) (thing-at-point-default-mail-uri-scheme = ffap-foo-at-bar-prefix)) - (thing-at-point-url-at-point t + (thing-at-point-url-at-point ffap-lax-url (if (use-region-p) (cons (region-beginning) (region-end)))))))) @@ -1253,7 +1259,8 @@ which may actually result in an URL rather than a = filename." (not (ffap-file-exists-string dir)) (not (equal dir (setq dir (file-name-directory (directory-file-name = dir))))))) - (ffap-file-exists-string dir))) + (and (not (string=3D dir "/")) + (ffap-file-exists-string dir)))) ) (set-match-data data))))