From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [bug] Org link dialog escapes URL spaces incorrectly Date: Sun, 06 Nov 2011 17:29:06 -0500 Message-ID: <835.1320618546@alphaville.dokosmarshall.org> References: <23807.1320424380@alphaville.dokosmarshall.org> <24425.1320425559@alphaville.dokosmarshall.org> <26969.1320431142@alphaville.dokosmarshall.org> <87mxcazmvj.wl%dmaus@ictsoc.de> <23704.1320507536@alphaville.dokosmarshall.org> <87hb2hcnn7.wl%dmaus@ictsoc.de> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNBDF-00046Z-7N for emacs-orgmode@gnu.org; Sun, 06 Nov 2011 17:29:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNBDE-0002dV-1v for emacs-orgmode@gnu.org; Sun, 06 Nov 2011 17:29:13 -0500 Received: from g1t0027.austin.hp.com ([15.216.28.34]:35280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNBDD-0002dE-Pp for emacs-orgmode@gnu.org; Sun, 06 Nov 2011 17:29:12 -0500 In-Reply-To: Message from David Maus of "Sun, 06 Nov 2011 15:48:44 +0100." <87hb2hcnn7.wl%dmaus@ictsoc.de> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Maus Cc: Jeff Horn , Org-mode ml , nicholas.dokos@hp.com David Maus 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.... dmjena@jabber.org > Email..... dmaus@ictsoc.de