GNU bug report logs - #23343
25.0.93; URI schemes are not regexp-quoted for `goto-address-url-regexp'

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Sat, 23 Apr 2016 13:52:02 UTC

Severity: normal

Tags: fixed, patch

Found in version 25.0.93

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23343 in the body.
You can then email your comments to 23343 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23343; Package emacs. (Sat, 23 Apr 2016 13:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Phil Sainty <psainty <at> orcon.net.nz>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 23 Apr 2016 13:52:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.93; URI schemes are not regexp-quoted for
 `goto-address-url-regexp'
Date: Sun, 24 Apr 2016 01:51:08 +1200
The URI schemes from `thing-at-point-uri-schemes' are concatenated
into a regexp group without being suitably escaped, meaning there
are bugs whenever regexp meta-characters appear. e.g.:

bzr+ssh://
iris.beep:





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23343; Package emacs. (Sat, 23 Apr 2016 14:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 23343 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: 23343 <at> debbugs.gnu.org
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 part 1 (text/plain, inline)]
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
[0001-Fix-goto-address-url-regexp.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23343; Package emacs. (Sat, 23 Apr 2016 22:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 23343 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: 23343 <at> debbugs.gnu.org
Subject: Re: bug#23343: 25.0.93; [PATCH] URI schemes are not regexp-quoted for
 `goto-address-url-regexp'
Date: Sun, 24 Apr 2016 10:48:04 +1200
[Message part 1 (text/plain, inline)]
I've made docstring changes to point out that it's only useful to
set goto-address-uri-schemes-ignored and goto-address-uri-schemes
prior to loading the library.

I'm not sure if there's any policy about such things, but it seemed
like it would be quite a lot more work to get around that. I imagine
the :set ability of defcustom would make it possible to have changes
to those variables dynamically update goto-address-url-regexp as well;
but in doing that you'd need to take care not to clobber values which
had themselves been customized also, and it all seemed like a lot of
added complexity for little benefit.


-Phil
[0001-Fix-goto-address-url-regexp.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23343; Package emacs. (Sun, 24 Apr 2016 11:38:02 GMT) Full text and rfc822 format available.

Message #14 received at 23343 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 23343 <at> debbugs.gnu.org
Subject: Re: bug#23343: 25.0.93; [PATCH] URI schemes are not regexp-quoted for
 `goto-address-url-regexp'
Date: Sun, 24 Apr 2016 13:36:47 +0200
Phil Sainty <psainty <at> orcon.net.nz> writes:

> I've made docstring changes to point out that it's only useful to
> set goto-address-uri-schemes-ignored and goto-address-uri-schemes
> prior to loading the library.
>
> I'm not sure if there's any policy about such things, but it seemed
> like it would be quite a lot more work to get around that. I imagine
> the :set ability of defcustom would make it possible to have changes
> to those variables dynamically update goto-address-url-regexp as well;
> but in doing that you'd need to take care not to clobber values which
> had themselves been customized also, and it all seemed like a lot of
> added complexity for little benefit.

Having variable defaults depend on each other can be awkward, especially
when it's the "first" variable that users will realistically be
tweaking.

[...]

> +(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:")

Which is this one.  But I don't really see how to fix that without
having a different interface here (i.e., getting rid of
goto-address-url-regexp), so perhaps it's OK...

But:

> +(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))

I don't much value to this "intermediate" variable.  It just makes
things even more complicated to work with, I think.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23343; Package emacs. (Sun, 24 Apr 2016 13:49:02 GMT) Full text and rfc822 format available.

Message #17 received at 23343 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: 23343 <at> debbugs.gnu.org
Subject: Re: bug#23343: 25.0.93; [PATCH] URI schemes are not regexp-quoted for
 `goto-address-url-regexp'
Date: Mon, 25 Apr 2016 01:48:10 +1200
On 24/04/16 23:36, Lars Magne Ingebrigtsen wrote:
> Having variable defaults depend on each other can be awkward, especially
> when it's the "first" variable that users will realistically be
> tweaking.

Yes indeed. I don't especially like the way I've done it -- but it
seemed like an improvement, nevertheless.

>> +(defvar goto-address-uri-schemes
>
> I don't much value to this "intermediate" variable.  It just makes
> things even more complicated to work with, I think.

It's true that this one is an intermediate by default; but it's one
which users might potentially want to set in order to say "I don't
care about the default schemes at all; I only want the specific
schemes I've specified here to be matched."

So of the two new variables I'm adding, a user might set one or the
other depending on their needs. That was my line of thought, anyhow.

-Phil




Added tag(s) patch. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 25 Apr 2016 23:17:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23343; Package emacs. (Tue, 25 Jun 2019 14:03:02 GMT) Full text and rfc822 format available.

Message #22 received at 23343 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 23343 <at> debbugs.gnu.org
Subject: Re: bug#23343: 25.0.93; [PATCH] URI schemes are not regexp-quoted for
 `goto-address-url-regexp'
Date: Tue, 25 Jun 2019 16:02:37 +0200
Phil Sainty <psainty <at> orcon.net.nz> writes:

> It's true that this one is an intermediate by default; but it's one
> which users might potentially want to set in order to say "I don't
> care about the default schemes at all; I only want the specific
> schemes I've specified here to be matched."
>
> So of the two new variables I'm adding, a user might set one or the
> other depending on their needs. That was my line of thought, anyhow.

That's true.  I've now applied your patch to the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 14:03:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 23343 <at> debbugs.gnu.org and Phil Sainty <psainty <at> orcon.net.nz> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 14:03:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 24 Jul 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.