GNU bug report logs - #31927
26.1; Fragment/bookmark part of URL omitted in default offered by `eww'

Previous Next

Package: emacs;

Reported by: nljlistbox2 <at> gmail.com (N. Jackson)

Date: Thu, 21 Jun 2018 15:06:01 UTC

Severity: minor

Tags: fixed

Found in version 26.1

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 31927 in the body.
You can then email your comments to 31927 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#31927; Package emacs. (Thu, 21 Jun 2018 15:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to nljlistbox2 <at> gmail.com (N. Jackson):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 21 Jun 2018 15:06:02 GMT) Full text and rfc822 format available.

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

From: nljlistbox2 <at> gmail.com (N. Jackson)
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Thu, 21 Jun 2018 11:05:13 -0400
When `eww' is invoked interactively with point in an URL, that URL is
offered in the minibuffer as the default web page to open. However, if
the URL has a fragment (aka bookmark) part, the fragment part is ignored
by EWW.

For example:

  0. $ emacs -Q

  1. In scratch type https://en.wikipedia.org/wiki/Midsummer#History

  2. Move point back into the just-typed URL

  3. M-x eww RET

Expected result:
EWW offers https://en.wikipedia.org/wiki/Midsummer#History as the
default.

Actual result:
EWW offers https://en.wikipedia.org/wiki/Midsummer as the default.

Note that the following works just fine, though:

  0. $ emacs -Q

  1. M-x eww RET https://en.wikipedia.org/wiki/Midsummer#History RET

This problem is also present on master
(5583e6460c38c5d613e732934b066421349a5259).






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Thu, 21 Jun 2018 15:48:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: nljlistbox2 <at> gmail.com (N. Jackson)
Cc: 31927 <at> debbugs.gnu.org
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Thu, 21 Jun 2018 18:47:39 +0300
> From: nljlistbox2 <at> gmail.com (N. Jackson)
> Date: Thu, 21 Jun 2018 11:05:13 -0400
> 
> 
> When `eww' is invoked interactively with point in an URL, that URL is
> offered in the minibuffer as the default web page to open. However, if
> the URL has a fragment (aka bookmark) part, the fragment part is ignored
> by EWW.
> 
> For example:
> 
>   0. $ emacs -Q
> 
>   1. In scratch type https://en.wikipedia.org/wiki/Midsummer#History
> 
>   2. Move point back into the just-typed URL
> 
>   3. M-x eww RET
> 
> Expected result:
> EWW offers https://en.wikipedia.org/wiki/Midsummer#History as the
> default.
> 
> Actual result:
> EWW offers https://en.wikipedia.org/wiki/Midsummer as the default.

You could customize eww-suggest-uris to add, say
thing-at-point-url-at-point.  I think this should give you what you
want.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Thu, 21 Jun 2018 23:12:01 GMT) Full text and rfc822 format available.

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

From: nljlistbox2 <at> gmail.com (N. Jackson)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 31927 <at> debbugs.gnu.org
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Thu, 21 Jun 2018 19:11:23 -0400
At 18:47 +0300 on Thursday 2018-06-21, Eli Zaretskii wrote:
>
>> From: nljlistbox2 <at> gmail.com (N. Jackson)
>> 
>>   1. In scratch type https://en.wikipedia.org/wiki/Midsummer#History
>> 
>>   2. Move point back into the just-typed URL
>> 
>>   3. M-x eww RET
>> 
>> Expected result:
>> EWW offers https://en.wikipedia.org/wiki/Midsummer#History as the
>> default.
>> 
>> Actual result:
>> EWW offers https://en.wikipedia.org/wiki/Midsummer as the default.
>
> You could customize eww-suggest-uris to add, say
> thing-at-point-url-at-point. I think this should give you what you
> want.

Thank you for the suggestion. But, no, that doesn't quite help.

By default the value of `eww-suggest-uris' is `(eww-links-at-point
url-get-url-at-point eww-current-url)'.

When I add `thing-at-point-url-at-point' it's added to the end of the
list and the behaviour is unchanged presumably because
`url-get-url-at-point' comes first.

However if I set `eww-suggest-uris' to just
`(thing-at-point-url-at-point)', then I see the "correct" behaviour --
that is, the fragment/bookmark part of the URL is picked up.

So the question is, why does `thing-at-point-url-at-point' pick up the
fragment/bookmark part or the URL but `url-get-url-at-point' does not?

That is, removing EWW from the picture altogether:

  0. $ emacs -Q

  1. On a new line in scratch type https://en.wikipedia.org/wiki/Midsummer#History

  2. C-a	; Move point to beginning of the just-typed URL.

  3. M-: (thing-at-point-url-at-point) RET
  => https://en.wikipedia.org/wiki/Midsummer#History

  4. M-: (url-get-url-at-point) RET
  => https://en.wikipedia.org/wiki/Midsummer

Is it expected for these two functions to behave differently here?

(And an additional anomaly: In Step 2, if point is just moved back one
character into the just-typed URL (between the `r' and `y' in
"#History") then:

  3. M-: (thing-at-point-url-at-point) RET
  => https://en.wikipedia.org/wiki/Midsummer#History

  4. M-: (url-get-url-at-point) RET
  => nil

).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Fri, 22 Jun 2018 06:30:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: nljlistbox2 <at> gmail.com (N. Jackson), Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 31927 <at> debbugs.gnu.org
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Fri, 22 Jun 2018 09:29:41 +0300
> From: nljlistbox2 <at> gmail.com (N. Jackson)
> Cc: 31927 <at> debbugs.gnu.org
> Date: Thu, 21 Jun 2018 19:11:23 -0400
> 
> So the question is, why does `thing-at-point-url-at-point' pick up the
> fragment/bookmark part or the URL but `url-get-url-at-point' does not?
> 
> That is, removing EWW from the picture altogether:
> 
>   0. $ emacs -Q
> 
>   1. On a new line in scratch type https://en.wikipedia.org/wiki/Midsummer#History
> 
>   2. C-a	; Move point to beginning of the just-typed URL.
> 
>   3. M-: (thing-at-point-url-at-point) RET
>   => https://en.wikipedia.org/wiki/Midsummer#History
> 
>   4. M-: (url-get-url-at-point) RET
>   => https://en.wikipedia.org/wiki/Midsummer
> 
> Is it expected for these two functions to behave differently here?

Yes, that's the question.  I hope Lars (CC'ed) could comment on that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Sun, 22 Jul 2018 13:11:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "N. Jackson" <nljlistbox2 <at> gmail.com>, 31927 <at> debbugs.gnu.org
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Sun, 22 Jul 2018 15:10:42 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>>   1. On a new line in scratch type
>> https://en.wikipedia.org/wiki/Midsummer#History
>> 
>>   2. C-a	; Move point to beginning of the just-typed URL.
>> 
>>   3. M-: (thing-at-point-url-at-point) RET
>>   => https://en.wikipedia.org/wiki/Midsummer#History
>> 
>>   4. M-: (url-get-url-at-point) RET
>>   => https://en.wikipedia.org/wiki/Midsummer
>> 
>> Is it expected for these two functions to behave differently here?
>
> Yes, that's the question.  I hope Lars (CC'ed) could comment on that.

I think the behaviour of `url-get-url-at-point' is suboptimal here.
Perhaps we should just make eww use `thing-at-point-url-at-point'
instead?  And mark `url-get-url-at-point' as obsolete, as it doesn't
seem very actively maintained and duplicates thingatpt functionality.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Sun, 22 Jul 2018 14:40:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: nljlistbox2 <at> gmail.com, 31927 <at> debbugs.gnu.org
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Sun, 22 Jul 2018 17:38:54 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: nljlistbox2 <at> gmail.com (N. Jackson),  31927 <at> debbugs.gnu.org
> Date: Sun, 22 Jul 2018 15:10:42 +0200
> 
> >>   3. M-: (thing-at-point-url-at-point) RET
> >>   => https://en.wikipedia.org/wiki/Midsummer#History
> >> 
> >>   4. M-: (url-get-url-at-point) RET
> >>   => https://en.wikipedia.org/wiki/Midsummer
> >> 
> >> Is it expected for these two functions to behave differently here?
> >
> > Yes, that's the question.  I hope Lars (CC'ed) could comment on that.
> 
> I think the behaviour of `url-get-url-at-point' is suboptimal here.
> Perhaps we should just make eww use `thing-at-point-url-at-point'
> instead?  And mark `url-get-url-at-point' as obsolete, as it doesn't
> seem very actively maintained and duplicates thingatpt functionality.

Probably.  Unless some functionality really needs to ignore the parts
after the hash, for some reason.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Sun, 29 Jul 2018 15:58:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: nljlistbox2 <at> gmail.com, Lars Ingebrigtsen <larsi <at> gnus.org>,
 31927 <at> debbugs.gnu.org
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Sun, 29 Jul 2018 11:57:21 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Lars Ingebrigtsen <larsi <at> gnus.org>
>> Cc: nljlistbox2 <at> gmail.com (N. Jackson),  31927 <at> debbugs.gnu.org
>> Date: Sun, 22 Jul 2018 15:10:42 +0200
>> 
>> >>   3. M-: (thing-at-point-url-at-point) RET
>> >>   => https://en.wikipedia.org/wiki/Midsummer#History
>> >> 
>> >>   4. M-: (url-get-url-at-point) RET
>> >>   => https://en.wikipedia.org/wiki/Midsummer
>> >> 
>> >> Is it expected for these two functions to behave differently here?
>> >
>> > Yes, that's the question.  I hope Lars (CC'ed) could comment on that.
>> 
>> I think the behaviour of `url-get-url-at-point' is suboptimal here.
>> Perhaps we should just make eww use `thing-at-point-url-at-point'
>> instead?  And mark `url-get-url-at-point' as obsolete, as it doesn't
>> seem very actively maintained and duplicates thingatpt functionality.
>
> Probably.  Unless some functionality really needs to ignore the parts
> after the hash, for some reason.

If it's really needed, then it's probably better to parse the url and
explicitly remove unwanted parts.  I notice this bug is pretty similar
to Bug#898 "ffap -> emacs-w3m dropping of #anchor"; it seems pretty
clear that dropping the part after the hash is the wrong thing in web
browsing contexts.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Sun, 29 Jul 2018 17:17:01 GMT) Full text and rfc822 format available.

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

From: "N. Jackson" <nljlistbox2 <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 31927 <at> debbugs.gnu.org,
 Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Sun, 29 Jul 2018 13:16:29 -0400
At 11:57 -0400 on Sunday 2018-07-29, Noam Postavsky wrote:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: Lars Ingebrigtsen <larsi <at> gnus.org>
>>> Cc: nljlistbox2 <at> gmail.com (N. Jackson),  31927 <at> debbugs.gnu.org
>>> Date: Sun, 22 Jul 2018 15:10:42 +0200
>>> 
>>> >>   3. M-: (thing-at-point-url-at-point) RET
>>> >>   => https://en.wikipedia.org/wiki/Midsummer#History
>>> >> 
>>> >>   4. M-: (url-get-url-at-point) RET
>>> >>   => https://en.wikipedia.org/wiki/Midsummer
>>> >> 
>>> >> Is it expected for these two functions to behave
>>> >> differently here?
>>> >
>>> > Yes, that's the question. I hope Lars (CC'ed) could comment
>>> > on that.
>>> 
>>> I think the behaviour of `url-get-url-at-point' is suboptimal
>>> here. Perhaps we should just make eww use
>>> `thing-at-point-url-at-point' instead? And mark
>>> `url-get-url-at-point' as obsolete, as it doesn't seem very
>>> actively maintained and duplicates thingatpt functionality.
>>
>> Probably. Unless some functionality really needs to ignore the
>> parts after the hash, for some reason.
>
> If it's really needed, then it's probably better to parse the
> url and explicitly remove unwanted parts. I notice this bug is
> pretty similar to Bug#898 "ffap -> emacs-w3m dropping of
> #anchor"; it seems pretty clear that dropping the part after the
> hash is the wrong thing in web browsing contexts.

FWIW, in the Emacs codebase at least, `url-get-url-at-point' is
only used twice, both in eww.el:

    $ grep -rHn 'url-get-url-at-point' *
    ChangeLog.3:21009:      * lisp/url/url-util.el (url-get-url-at-point): Add missing group
    lisp/loaddefs.el~:11861:(defvar eww-suggest-uris '(eww-links-at-point url-get-url-at-point eww-current-url) "\
    Binary file lisp/net/eww.elc matches
    lisp/net/eww.el:32:(require 'url-util)                  ; for url-get-url-at-point
--> lisp/net/eww.el:67:    url-get-url-at-point
--> lisp/net/eww.el:77:             url-get-url-at-point
    Binary file lisp/url/url-util.elc matches
    lisp/url/url-util.el:544:(defun url-get-url-at-point (&optional pt)
    lisp/url/ChangeLog.1:742:       (url-get-url-at-point): Don't use eval-when-compile.
    lisp/url/ChangeLog.1:2799:      * url-util.el (url-get-url-at-point): Guard against 'url'
    lisp/url/ChangeLog.1:2859:      * url-util.el (url-get-url-at-point): Allow URLs wrapped in
    lisp/url/ChangeLog.1:2977:      * url-util.el (url-get-url-at-point): Re-integrated.
    lisp/loaddefs.el:11861:(defvar eww-suggest-uris '(eww-links-at-point url-get-url-at-point eww-current-url) "\
    lisp/ldefs-boot.el:11763:(defvar eww-suggest-uris '(eww-links-at-point url-get-url-at-point eww-current-url) "\
    Binary file src/emacs-master-2017-05-31 matches
    Binary file src/emacs matches
    Binary file src/emacs-25.3-2017-09-12 matches
    Binary file src/emacs-head-2017-12-29 matches
    Binary file src/emacs-27.0.50.1 matches
    Binary file src/emacs-master-2016-12-01 matches
    Binary file src/bootstrap-emacs matches





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Sun, 29 Jul 2018 20:45:02 GMT) Full text and rfc822 format available.

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

From: "N. Jackson" <nljlistbox2 <at> gmail.com>
To: 31927 <at> debbugs.gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Sun, 29 Jul 2018 16:44:04 -0400
At 13:16 -0400 on Sunday 2018-07-29, N. Jackson wrote:
>
> FWIW, in the Emacs codebase at least, `url-get-url-at-point' is
> only used twice, both in eww.el:
>
> --> lisp/net/eww.el:67:    url-get-url-at-point
> --> lisp/net/eww.el:77:             url-get-url-at-point

And in emacs/elpa `url-get-url-at-point' is nowhere used.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31927; Package emacs. (Mon, 13 May 2019 19:18:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "N. Jackson" <nljlistbox2 <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 31927 <at> debbugs.gnu.org,
 Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#31927: 26.1;
 Fragment/bookmark part of URL omitted in default offered by `eww'
Date: Mon, 13 May 2019 15:17:44 -0400
"N. Jackson" <nljlistbox2 <at> gmail.com> writes:

> At 13:16 -0400 on Sunday 2018-07-29, N. Jackson wrote:
>>
>> FWIW, in the Emacs codebase at least, `url-get-url-at-point' is
>> only used twice, both in eww.el:
>>
>> --> lisp/net/eww.el:67:    url-get-url-at-point
>> --> lisp/net/eww.el:77:             url-get-url-at-point
>
> And in emacs/elpa `url-get-url-at-point' is nowhere used.

OK; I've now switched eww to thing-at-point-url-at-point and marked the
url.el function as obsolete in Emacs 27.1.

-- 
(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. (Mon, 13 May 2019 19:19:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 31927 <at> debbugs.gnu.org and nljlistbox2 <at> gmail.com (N. Jackson) Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 13 May 2019 19:19:02 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. (Tue, 11 Jun 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 320 days ago.

Previous Next


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