emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] lisp/org.el: make org-open-at-point handle parens in encoded urls correctly
@ 2017-08-10 20:25 Marc Ihm
  2017-08-11 16:10 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Ihm @ 2017-08-10 20:25 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]

Hi,

the attached patch changes org-open-at-point in org.el:

Currently, when opening an url the function org-open-at-point uses the 
variable path, which is the result of applying org-link-unescape on the 
original url. Thus, all special chars like '() "' etc. which were 
originally encoded like %20%28 etc. are reverted to their clear text 
form. This worked for me in most cases, but gives me errors when my url 
contains encoded chars like '()', i.e. %28%29.

The submitted patch fixes this by simply using the original url with all 
special chars still encoded.

Please consider applying it, if fit.


Thanks,
Marc


--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10707,7 +10707,7 @@ a timestamp or a link."
                                    (t (list nil
                                             (org-link-unescape 
option)))))))))
                ((functionp (org-link-get-parameter type :follow))
-               (funcall (org-link-get-parameter type :follow) path))
+               (funcall (org-link-get-parameter type :follow) 
(org-element-property :path link)))
                ((member type '("coderef" "custom-id" "fuzzy" "radio"))
                 (unless (run-hook-with-args-until-success
                          'org-open-link-functions path)
--

[-- Attachment #2: 0001-make-org-open-at-point-handle-parens-in-encoded-urls.patch --]
[-- Type: application/x-empty, Size: 896 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lisp/org.el: make org-open-at-point handle parens in encoded urls correctly
  2017-08-10 20:25 [PATCH] lisp/org.el: make org-open-at-point handle parens in encoded urls correctly Marc Ihm
@ 2017-08-11 16:10 ` Nicolas Goaziou
  2017-08-11 18:24   ` Marc Ihm
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2017-08-11 16:10 UTC (permalink / raw)
  To: Marc Ihm; +Cc: emacs-orgmode

Hello,

Marc Ihm <marc@ihm.name> writes:

> the attached patch changes org-open-at-point in org.el:
>
> Currently, when opening an url the function org-open-at-point uses the
> variable path, which is the result of applying org-link-unescape on
> the original url. Thus, all special chars like '() "' etc. which were
> originally encoded like %20%28 etc. are reverted to their clear text
> form. This worked for me in most cases, but gives me errors when my
> url contains encoded chars like '()', i.e. %28%29.
>
> The submitted patch fixes this by simply using the original url with
> all special chars still encoded.
>
> Please consider applying it, if fit.

Thank you.

The problem here is that Org could introduce additional percent-encoding
upon creating a link. This additional layer needs to be removed before
opening the link.

I think there's a deeper issue to solve here. Your patch is likely to
move the problem elsewhere.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lisp/org.el: make org-open-at-point handle parens in encoded urls correctly
  2017-08-11 16:10 ` Nicolas Goaziou
@ 2017-08-11 18:24   ` Marc Ihm
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Ihm @ 2017-08-11 18:24 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Am 11.08.2017 um 18:10 schrieb Nicolas Goaziou:
> Hello,
>
> Marc Ihm <marc@ihm.name> writes:
>
>> the attached patch changes org-open-at-point in org.el:
>>
>> Currently, when opening an url the function org-open-at-point uses the
>> variable path, which is the result of applying org-link-unescape on
>> the original url. Thus, all special chars like '() "' etc. which were
>> originally encoded like %20%28 etc. are reverted to their clear text
>> form. This worked for me in most cases, but gives me errors when my
>> url contains encoded chars like '()', i.e. %28%29.
>>
>> The submitted patch fixes this by simply using the original url with
>> all special chars still encoded.
>>
>> Please consider applying it, if fit.
>
> Thank you.
>
> The problem here is that Org could introduce additional percent-encoding
> upon creating a link. This additional layer needs to be removed before
> opening the link.
>
> I think there's a deeper issue to solve here. Your patch is likely to
> move the problem elsewhere.
>
> Regards,
>

Hi Nicolas,

well the code which I tried to patch is indeed convoluted and changing 
things might indeed have side effects; so I keep this fix for myself and 
see how it behaves on the long run :-)

Thanx for explaining !

regards
Marc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-11 18:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-10 20:25 [PATCH] lisp/org.el: make org-open-at-point handle parens in encoded urls correctly Marc Ihm
2017-08-11 16:10 ` Nicolas Goaziou
2017-08-11 18:24   ` Marc Ihm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).