David Maus <dm...@ictsoc.de> wrote: > > What a mess - thanks for the clear explanation. Be that as it may, the > > treatment of links in org-insert-link is inconsistent: in one case, the > > link is unescaped once, in the other not at all. > > Hm. I still don't see an inconsistency here: `org-insert-link' reads a > link, `org-open-at-point' calls the target application with exactly > this link but applies percent escaping. >
No, I mean the handling in org-insert-link itself: line 9048 says (setq link (org-extract-attributes (org-link-unescape (org-match-string-no-properties 1)))) but further down, on line 9114 the link is not unescaped: (setq link (let ((org-completion-use-ido nil) (org-completion-use-iswitchb nil)) (org-completing-read "Link: " (append (mapcar (lambda (x) (list (concat x ":"))) all-prefixes) (mapcar 'car org-stored-links)) nil nil nil 'tmphist (car (car org-stored-links))))) The last line of org-insert-link then takes the value of link (unescaped in one case but not the other), passes it to org-make-link-string and inserts the result. That's what I thought was inconsistent. Nick > Maybe we could drop this last escaping and push the responsibilty of > handling non-conformant URLs to the target application. After all: If > the user enters an unescaped link and the target application can't > handle it, it's the users fault. > > > So I presume that a single unescaping is desirable (it would > > e.g. deal with both wikipedia links correctly). But there will be > > corner cases where this will fail and some manual editing of the > > link will be necessary, > > If you mean unescape the user input in step 1 (`org-insert-link'): > This could work, too. Besides the edge cases it requires some care to > stored links (via `org-store-links') -- the percent character is a > valid character for certain link types (e.g. message ids). > > Personally I start to like the idea of just dopping the escaping > before calling the target application. > > Best, > -- David > -- > OpenPGP... 0x99ADB83B5A4478E6 > Jabber.... dmj...@jabber.org > Email..... dm...@ictsoc.de