Re: [O] Problems with opening a link

2017-04-01 Thread Nicolas Goaziou
Hello,

Carsten Dominik  writes:

> but I think the entire url quoting scheme in Org might deserve another
> look.

It does. I also suggested to think about it some time ago.

Ideally, Org should never quote any URI whatsoever. This is really the
root of all evil, because you never know if characters are escaped, and,
as a consequence, you never really know how many un-escaping turns are
required.

Unfortunately, there are a couple of forbidden characters in link
syntax, namely "[", "]", and multiple consecutive spaces. So, if we want
to allow those in, e.g. file names or labels ("http" URL are not
a problem since you can hex-encode them), we need some kind of escaping
mechanism.

In any case, it should be different than hex-encoding so we can tell if
there is some Org specific escaping involved.

Just some data to keep the ball rolling.

Regards,

-- 
Nicolas Goaziou



Re: [O] Problems with opening a link

2017-04-01 Thread Carsten Dominik
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
>


Re: [O] Problems with opening a link

2017-03-31 Thread Matt Lundin
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



Re: [O] Problems with opening a link

2017-03-31 Thread Matt Lundin
"Tim O'Callaghan"  writes:

> I've had a similar issue, but with redmine links.
> if i have
>
> #+LINK: rm http://redmine/issues/%s
>
> * link [[rm:3287]] does not work properly any more (with firefox under
> KDE)

The link above is missing ".org". It should look like this:

#+LINK: rm http://redmine.org/issues/%s

Matt



Re: [O] Problems with opening a link

2017-03-31 Thread Scott Randby
On 03/31/2017 08:52 AM, Carsten Dominik wrote:
> Hi Scott,
>
> which system are you on?
>
> I am using a Mac, and the "open" command in the mac as
> browse-url-generic-program

I'm using Xubuntu 16.04. I believe the function being used is
browse-url-browser-function which I have set to browse-url-firefox. The
variable browse-url-generic-program has no value on my system.

Scott

>
> Carsten
>
> On Fri, Mar 31, 2017 at 2:22 PM, Scott Randby  > wrote:
>
> On 03/31/2017 05:39 AM, Carsten Dominik wrote:
> > 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
>
> The link worked fine when I tried opening it from an Org file. I'm using
> Org 9.0.3 in Emacs 24.5.1 and my browser is Firefox.
>
> Scott Randby
>
> >
> > Where does this happen, and how can I fix this?
> >
> > Thank you.
> >
> > Carsten
>
>



Re: [O] Problems with opening a link

2017-03-31 Thread Tim O'Callaghan
Hi,

I've had a similar issue, but with redmine links.
if i have
#+LINK: rm http://redmine/issues/%s

* link [[rm:3287]] does not work properly any more (with firefox under KDE)

best regards,

Tim.

On 31 March 2017 at 14:52, Carsten Dominik  wrote:
> Hi Scott,
>
> which system are you on?
>
> I am using a Mac, and the "open" command in the mac as
> browse-url-generic-program
>
> Carsten
>
> On Fri, Mar 31, 2017 at 2:22 PM, Scott Randby  wrote:
>>
>> On 03/31/2017 05:39 AM, Carsten Dominik wrote:
>> > 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
>>
>> The link worked fine when I tried opening it from an Org file. I'm using
>> Org 9.0.3 in Emacs 24.5.1 and my browser is Firefox.
>>
>> Scott Randby
>>
>> >
>> > Where does this happen, and how can I fix this?
>> >
>> > Thank you.
>> >
>> > Carsten
>
>



Re: [O] Problems with opening a link

2017-03-31 Thread Carsten Dominik
Hi Scott,

which system are you on?

I am using a Mac, and the "open" command in the mac as
browse-url-generic-program

Carsten

On Fri, Mar 31, 2017 at 2:22 PM, Scott Randby  wrote:

> On 03/31/2017 05:39 AM, Carsten Dominik wrote:
> > 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
>
> The link worked fine when I tried opening it from an Org file. I'm using
> Org 9.0.3 in Emacs 24.5.1 and my browser is Firefox.
>
> Scott Randby
>
> >
> > Where does this happen, and how can I fix this?
> >
> > Thank you.
> >
> > Carsten
>


Re: [O] Problems with opening a link

2017-03-31 Thread Scott Randby
On 03/31/2017 05:39 AM, Carsten Dominik wrote:
> 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

The link worked fine when I tried opening it from an Org file. I'm using
Org 9.0.3 in Emacs 24.5.1 and my browser is Firefox.

Scott Randby

> 
> Where does this happen, and how can I fix this?
> 
> Thank you.
> 
> Carsten



Re: [O] Problems with opening a link

2017-03-31 Thread Peter Davis
It also appears that %3A gets turned into :





On Fri, Mar 31, 2017, at 05:39 AM, Carsten Dominik wrote:

> 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
> 

> Where does this happen, and how can I fix this?

> 

> Thank you.

> 

> Carsten



--

  Peter Davis

  www.techcurmudgeon.com


[O] Problems with opening a link

2017-03-31 Thread Carsten Dominik
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

Where does this happen, and how can I fix this?

Thank you.

Carsten