emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Problems with opening a link


From: Carsten Dominik
Subject: Re: [O] Problems with opening a link
Date: Sat, 1 Apr 2017 10:57:33 +0200

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 = "" ",@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 <address@hidden> wrote:
Hi Carsten,

Carsten Dominik <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]