From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Problems with opening a link Date: Sat, 1 Apr 2017 10:57:33 +0200 Message-ID: References: <874ly95o2n.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113a0ab21f21bf054c171f5a Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuEr6-0001GJ-4k for emacs-orgmode@gnu.org; Sat, 01 Apr 2017 04:57:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuEr4-0003ee-MV for emacs-orgmode@gnu.org; Sat, 01 Apr 2017 04:57:56 -0400 Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]:33583) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuEr4-0003eQ-Fn for emacs-orgmode@gnu.org; Sat, 01 Apr 2017 04:57:54 -0400 Received: by mail-io0-x22e.google.com with SMTP id f84so52144256ioj.0 for ; Sat, 01 Apr 2017 01:57:54 -0700 (PDT) In-Reply-To: <874ly95o2n.fsf@fastmail.fm> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Carsten Dominik , org-mode list --001a113a0ab21f21bf054c171f5a Content-Type: text/plain; charset=UTF-8 Hi everyone, thank you for your input. Matt, thanks a lot for the detailed look into this. Indeed there are inconsistencies on how this works in Org, and there are things happening that are system dependent. I thibk what is biting me this time is the system dependence which is really weird. When I, on my Mac, call this from a commandline in bash $ open https://ui.adsabs.harvard.edu/#search/q=author%3A%22Dominik%2CC%22/metrics things work. So I made a little perl program, myopenurl, that looks like this: #!/usr/bin/perl $url = join(" ",@ARGV); system "open \"$url\"; and that does the trick when I put it into browse-url-generic-program. Fixed for now, but I think the entire url quoting scheme in Org might deserve another look. Thanks. Carsten On Fri, Mar 31, 2017 at 7:54 PM, Matt Lundin wrote: > Hi Carsten, > > Carsten Dominik writes: > > > Hi everyone, > > > > I have problems opening a link in org. > > > > The link looks like this: > > > > https://ui.adsabs.harvard.edu/#search/q=author%3A%22Dominik% > 2CC%22/metrics > > > > I have copied it like this from the address bar in a browser. > > > > If I click on it in Org-mode, the link is modified to > > > > https://ui.adsabs.harvard.edu/%23search/q=author:%22Dominik,C%22/metrics > > > > before being sent to the browser, and the browser cannot resolve it. > > The problem seems to be that # has been turned into %23 > > I cannot replicate this on Linux, but there do seem to be some > inconsistencies with how Org-mode is escaping/unescaping links: > > AFAICT, Org-mode itself is not modifying the "#". The relevant lines of > org-open-at-point are 10747-10748: > > ((functionp (org-link-get-parameter type :follow)) > (funcall (org-link-get-parameter type :follow) path)) > > Just simply copying and pasting the link from the browser, I found that > `path` at the lines above is: > > //ui.adsabs.harvard.edu/#search/q=author:"Dominik,C"/metrics > > Note: the time one gets to this point, the path has already been > unescaped (see line 10712). > > Meanwhile, `type` is... > > https > > ...which results in org-open-at-point calling the following: > > (lambda (path) (browse-url (concat "https:" path))) > > However, there are inconsistencies when one turns the pasted url above > into an actual org-link (e.g., by calling org-insert-link). > > Then the link in org-mode looks like this (note that the escape > percentage characters are themselves escaped, which seems a bit strange > to me): > > [[https://ui.adsabs.harvard.edu/#search/q=author%253A% > 2522Dominik%252CC%2522/metrics]] > > Now when you open at point, the `path` at line 10748 is: > > //ui.adsabs.harvard.edu/#search/q=author%3A%22Dominik%2CC%22/metrics > > Hope this helps in debugging. > Matt > --001a113a0ab21f21bf054c171f5a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi everyone, thank you for your input.=C2=A0 Matt, th= anks a lot for the detailed look into this.=C2=A0 Indeed there are inconsis= tencies on how this works in Org, and there are things happening that are s= ystem dependent.=C2=A0 I thibk what is biting me this time is the system de= pendence which is really weird.

When I, on my Mac,= call this from a commandline in bash
$ open https:= //ui.adsabs.harvard.edu/#search/q=3Dauthor%3A%22Dominik%2CC%22/metrics<= /div>

things work.=C2=A0 So I made a little perl program= , myopenurl, that looks like this:

#!/usr/bin/perl=
$url =3D join(" ",@ARGV);
system "open = \"$url\";

and that does the trick when I= put it into browse-url-generic-program.
Fixed for now, but I thi= nk the entire url quoting scheme in Org might deserve another look.

Thanks.

Carsten
<= div class=3D"gmail_extra">
On Fri, Mar 31, 20= 17 at 7:54 PM, Matt Lundin <mdl@imapmail.org> wrote:
Hi Carsten,

Carsten Dominik <dominik@uva.nl>= ; writes:

> Hi everyone,
>
> I have problems opening a link in org.
>
> The link looks like this:
>
> https://ui.adsabs.h= arvard.edu/#search/q=3Dauthor%3A%22Dominik%2CC%22/metrics
>
> I have copied it like this from the address bar in a browser.
>
> If I click on it in Org-mode, the link is modified to
>
> https://ui.adsabs.har= vard.edu/%23search/q=3Dauthor:%22Dominik,C%22/metrics
>
> before being sent to the browser, and the browser cannot resolve it. > The problem seems to be that # has been turned into %23

I cannot replicate this on Linux, but there do seem to be some
inconsistencies with how Org-mode is escaping/unescaping links:

AFAICT, Org-mode itself is not modifying the "#". The relevant li= nes of
org-open-at-point are 10747-10748:

=C2=A0 =C2=A0 =C2=A0 ((functionp (org-link-get-parameter type :follow))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (funcall (org-link-get-parameter type :follow) = path))

Just simply copying and pasting the link from the browser, I found that
`path` at the lines above is:

//ui.adsabs.harvard.edu/#search/q=3Dauthor:&= quot;Dominik,C"/metrics

Note: the time one gets to this point, the path has already been
unescaped (see line 10712).

Meanwhile, `type` is...

https

...which results in org-open-at-point calling the following:

(lambda (path) (browse-url (concat "https:" path)))

However, there are inconsistencies when one turns the pasted url above
into an actual org-link (e.g., by calling org-insert-link).

Then the link in org-mode looks like this (note that the escape
percentage characters are themselves escaped, which seems a bit strange
to me):

[[https://ui.ads= abs.harvard.edu/#search/q=3Dauthor%253A%2522Dominik%252CC%2522/me= trics]]

Now when you open at point, the `path` at line 10748 is:

//ui.adsabs.harvard.edu/#= search/q=3Dauthor%3A%22Dominik%2CC%22/metrics

Hope this helps in debugging.
Matt

--001a113a0ab21f21bf054c171f5a--