From unknown Sat Aug 16 23:47:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17723: 24.3.91; Improvements for ffap 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: To: 17723@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.140212750130117 (code B ref -1); Sat, 07 Jun 2014 07:52:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Jun 2014 07:51:41 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 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 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 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 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 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) 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) From: Ivan Andrus Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <34410D30-1B4F-4A14-92B3-4F6C76A5435E@gmail.com> Date: Sat, 7 Jun 2014 01:51:02 -0600 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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)))) From unknown Sat Aug 16 23:47:05 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ivan Andrus Subject: bug#17723: closed (Re: bug#17723: 24.3.91; Improvements for ffap) Message-ID: References: <34410D30-1B4F-4A14-92B3-4F6C76A5435E@gmail.com> X-Gnu-PR-Message: they-closed 17723 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 17723@debbugs.gnu.org Date: Thu, 12 Jun 2014 02:32:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1402540323-19236-1" This is a multi-part message in MIME format... ------------=_1402540323-19236-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #17723: 24.3.91; Improvements for ffap which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 17723@debbugs.gnu.org. --=20 17723: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17723 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1402540323-19236-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 17723-done) by debbugs.gnu.org; 12 Jun 2014 02:32:01 +0000 Received: from localhost ([127.0.0.1]:44715 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wuuo4-0004zy-RH for submit@debbugs.gnu.org; Wed, 11 Jun 2014 22:32:01 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:59643) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wuuo3-0004zk-2R for 17723-done@debbugs.gnu.org; Wed, 11 Jun 2014 22:31:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYGAIDvNVNLd+D9/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIwULCw4mEhQYDSSIBAjSGReOegeEOASpGYFqg0wh X-IPAS-Result: ArYGAIDvNVNLd+D9/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIwULCw4mEhQYDSSIBAjSGReOegeEOASpGYFqg0wh X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="66631957" Received: from 75-119-224-253.dsl.teksavvy.com (HELO pastel.home) ([75.119.224.253]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 11 Jun 2014 22:31:53 -0400 Received: by pastel.home (Postfix, from userid 20848) id 143A360358; Wed, 11 Jun 2014 22:31:53 -0400 (EDT) From: Stefan Monnier To: Ivan Andrus Subject: Re: bug#17723: 24.3.91; Improvements for ffap Message-ID: References: <34410D30-1B4F-4A14-92B3-4F6C76A5435E@gmail.com> Date: Wed, 11 Jun 2014 22:31:53 -0400 In-Reply-To: <34410D30-1B4F-4A14-92B3-4F6C76A5435E@gmail.com> (Ivan Andrus's message of "Sat, 7 Jun 2014 01:51:02 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 17723-done Cc: 17723-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > 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. Thanks, installed into `trunk', and changed the default. The patch was mangled, tho, please try and make sure you use a MUA that doesn't try to be too clever. Stefan ------------=_1402540323-19236-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Jun 2014 07:51:41 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 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 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 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 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 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) 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) From: Ivan Andrus Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: 24.3.91; Improvements for ffap Message-Id: <34410D30-1B4F-4A14-92B3-4F6C76A5435E@gmail.com> Date: Sat, 7 Jun 2014 01:51:02 -0600 To: bug-gnu-emacs@gnu.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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)))) ------------=_1402540323-19236-1--