emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: David Maus <dmaus@ictsoc.de>
Cc: Jeff Horn <jrhorn424@gmail.com>,
	Org-mode ml <emacs-orgmode@gnu.org>,
	nicholas.dokos@hp.com
Subject: Re: [bug] Org link dialog escapes URL spaces incorrectly
Date: Sun, 06 Nov 2011 17:29:06 -0500	[thread overview]
Message-ID: <835.1320618546@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from David Maus <dmaus@ictsoc.de> of "Sun, 06 Nov 2011 15:48:44 +0100." <87hb2hcnn7.wl%dmaus@ictsoc.de>

David Maus <dmaus@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.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de

  reply	other threads:[~2011-11-06 22:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02  2:02 [bug] Org link dialog escapes URL spaces incorrectly Jeff Horn
2011-11-04 15:59 ` Jeff Horn
2011-11-04 16:14   ` Nick Dokos
2011-11-04 16:33   ` Nick Dokos
2011-11-04 16:52     ` Nick Dokos
     [not found]       ` <CALbR623mDyhC=LRAQBW9-vJxhsFWR0L+xFOKnE3eq5Wn92y04g@mail.gmail.com>
2011-11-04 18:19         ` Nick Dokos
2011-11-04 18:25       ` Nick Dokos
2011-11-05 14:04         ` David Maus
2011-11-05 15:38           ` Nick Dokos
2011-11-06 14:48             ` David Maus
2011-11-06 22:29               ` Nick Dokos [this message]
2011-11-13  9:12                 ` David Maus
2011-11-13 17:32                   ` Nick Dokos
2011-12-15  1:30                     ` Jeff Horn
2011-12-18 17:13                       ` David Maus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=835.1320618546@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=jrhorn424@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).