From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#23343: 25.0.93; [PATCH] URI schemes are not regexp-quoted for `goto-address-url-regexp' Date: Sun, 24 Apr 2016 02:02:40 +1200 Message-ID: <571B8080.90009@orcon.net.nz> References: <571B7DCC.5090506@orcon.net.nz> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040109020806040006060005" X-Trace: ger.gmane.org 1461420205 22150 80.91.229.3 (23 Apr 2016 14:03:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Apr 2016 14:03:25 +0000 (UTC) To: 23343@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 23 16:03:13 2016 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 1aty9R-0005PN-D2 for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Apr 2016 16:03:13 +0200 Original-Received: from localhost ([::1]:52596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aty9Q-0003pK-IU for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Apr 2016 10:03:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aty9L-0003m7-BI for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2016 10:03:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aty9G-0001AV-BZ for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2016 10:03:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aty9G-0001AP-86 for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2016 10:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1aty9F-0004Ot-Ux for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2016 10:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Apr 2016 14:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23343 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23343-submit@debbugs.gnu.org id=B23343.146142017016898 (code B ref 23343); Sat, 23 Apr 2016 14:03:01 +0000 Original-Received: (at 23343) by debbugs.gnu.org; 23 Apr 2016 14:02:50 +0000 Original-Received: from localhost ([127.0.0.1]:44148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aty94-0004OU-A7 for submit@debbugs.gnu.org; Sat, 23 Apr 2016 10:02:50 -0400 Original-Received: from [219.88.242.52] (port=52071 helo=mail.orcon.net.nz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aty91-0004OJ-Nt for 23343@debbugs.gnu.org; Sat, 23 Apr 2016 10:02:48 -0400 Original-Received: from [192.168.20.100] (host-203-94-60-222.xdsl.kinect.net.nz [203.94.60.222] (may be forged)) (authenticated bits=0) by mail.orcon.net.nz (8.14.3/8.14.3/Debian-9.4) with ESMTP id u3NE2eiZ028285 for <23343@debbugs.gnu.org>; Sun, 24 Apr 2016 02:02:41 +1200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: <571B7DCC.5090506@orcon.net.nz> X-Bayes-Prob: 0.0001 (Score 0: No Bayes scoring rules defined, tokens from: outbound) X-CanIt-Geo: ip=203.94.60.222; country=NZ; region=Waikato; city=Hamilton; latitude=-37.7610; longitude=175.2474; http://maps.google.com/maps?q=-37.7610,175.2474&z=6 X-CanItPRO-Stream: base:outbound X-Canit-Stats-ID: 01QJO2ELB - 95c3bcd73d43 - 20160424 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:116700 Archived-At: This is a multi-part message in MIME format. --------------040109020806040006060005 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit This could be resolved with - (mapconcat 'identity + (mapconcat 'regexp-quote But on account of http://stackoverflow.com/questions/36787889/how-to-remove-some-link-type-in-emacs I thought that making it easier to customise this feature was a useful improvement to make. -Phil --------------040109020806040006060005 Content-Type: text/x-patch; name="0001-Fix-goto-address-url-regexp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-goto-address-url-regexp.patch" >From 0d7a39a1c56700020127c01a622d13c27aec498d Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Sun, 24 Apr 2016 01:40:47 +1200 Subject: [PATCH] Fix `goto-address-url-regexp' * lisp/net/goto-addr.el: The URI schemes to be recognised by `goto-address-mode' were not regexp-quoted. (Bug#23343) --- lisp/net/goto-addr.el | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el index bc3c403..e4bbf76 100644 --- a/lisp/net/goto-addr.el +++ b/lisp/net/goto-addr.el @@ -59,6 +59,7 @@ ;;; Code: +(require 'seq) (require 'thingatpt) (autoload 'browse-url-url-at-point "browse-url") @@ -101,23 +102,26 @@ goto-address-mail-regexp "[-a-zA-Z0-9=._+]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+" "A regular expression probably matching an e-mail address.") +(defvar goto-address-uri-schemes-ignored + ;; By default we exclude `mailto:' (email addresses are matched + ;; by `goto-address-mail-regexp') and also `data:', as it is not + ;; terribly useful to follow those URIs, and leaving them causes + ;; `use Data::Dumper;' to be fontified oddly in Perl files. + '("mailto:" "data:") + "List of URI schemes to exclude from `goto-address-uri-schemes'.") + +(defvar goto-address-uri-schemes + ;; We use `thing-at-point-uri-schemes', with a few exclusions, + ;; as listed in `goto-address-uri-schemes-ignored'. + (seq-reduce (lambda (accum elt) (delete elt accum)) + goto-address-uri-schemes-ignored + (copy-sequence thing-at-point-uri-schemes)) + "List of URI schemes matched by `goto-address-url-regexp'.") + (defvar goto-address-url-regexp - (concat - "\\<\\(" - (mapconcat 'identity - (delete "mailto:" - ;; Remove `data:', as it's not terribly useful to follow - ;; those. Leaving them causes `use Data::Dumper;' to be - ;; fontified oddly in Perl files. - (delete "data:" - (copy-sequence thing-at-point-uri-schemes))) - "\\|") - "\\)" - thing-at-point-url-path-regexp) - ;; (concat "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|" - ;; "telnet\\|wais\\):\\(//[-a-zA-Z0-9_.]+:" - ;; "[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*" - ;; "[-a-zA-Z0-9_=#$@~`%&*+|\\/]") + (concat "\\<" + (regexp-opt goto-address-uri-schemes t) + thing-at-point-url-path-regexp) "A regular expression probably matching a URL.") (defvar goto-address-highlight-keymap -- 2.8.0 --------------040109020806040006060005--