From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Vincent_Bela=EFche?= Subject: RE: %20 in file://... URL Date: Mon, 22 Nov 2010 16:46:44 +0100 Message-ID: <801v6dqs2j.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=47225 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PKYdM-0006q4-Nl for emacs-orgmode@gnu.org; Mon, 22 Nov 2010 10:49:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PKYbY-0002gF-LY for emacs-orgmode@gnu.org; Mon, 22 Nov 2010 10:48:47 -0500 Received: from smtp28.orange.fr ([80.12.242.99]:64546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PKYbY-0002g6-E6 for emacs-orgmode@gnu.org; Mon, 22 Nov 2010 10:46:56 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org mode Cc: =?iso-8859-1?Q?Vincent_Bela=EFche?= --=-=-= > Date: Wed, 17 Nov 2010 21:43:59 +0100 > From: dmaus@ictsoc.de > To: vincent.b.1@hotmail.fr > Subject: Re: [Orgmode] %20 in file://... URL > CC: emacs-orgmode@gnu.org; carsten.dominik@gmail.com > [...] Hello, Sorry for the delay, I was on business trip. > > Thanks for sending the patch, but it won't provide a clean solution to > the problem: The function modified by your patch works under the > assumption, that for example the sequence %3A represents a percent > escaped colon. But the function that creates the link in the first > place does not percent-escape chars Er, in my situation I create the link with another package, and I *did* escaped the colon. > -- If we use just this patch, opening a link to a file literarally > called "%3A.org" will fail. > > So we need to modify all functions that create links to propertly > percent-escape the part of a link that follows the link type in order > to make all functions unescape the link. > > Good news: Reworking the percent-escaping is a work in progress on my > list[1] and if it is finished and accepted, the problem should be > solved. > > Best, > -- David I see, so I understand that you will someday modify a function creating links in order to implement character escaping. I can give a hand if tell me the function name. I also send you my patch with a git diff, just in case (with same changelog attached again). Sorry for using `diff -c', I just followed the info node `(emacs) Sending Patches' Vincent. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=org.el.diff Content-Description: Patch diff --git a/lisp/org.el b/lisp/org.el index 201dd87..4e2e2c4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9639,9 +9639,28 @@ to search for. If LINE or SEARCH is given, the file will be opened in Emacs, unless an entry from org-file-apps that makes use of groups in a regexp matches. If the file does not exist, an error is thrown." - (let* ((file (if (equal path "") + (let* ((%xx-decoded-path + (let ((pos 0) (%xx-decoded-path path)) + (setq %xx-decoded-path path) + (while (setq pos (string-match "%\\([0-9A-F]\\)\\([0-9A-F]\\)" %xx-decoded-path pos)) + (setq pos (1+ pos) + %xx-decoded-path (replace-match + (string (let ((code 0) digit) + (dotimes (i 2) + (setq + digit (aref (match-string (1+ i) %xx-decoded-path) 0) + code (+ (if (<= digit ?9) + (- digit ?0) + (- digit 55)) + (* 16 code)))) code)) + t t %xx-decoded-path))) + ;; remove //localhost/ prefix if any + (and (string-match "\\`//localhost/" %xx-decoded-path) + (setq %xx-decoded-path (substring %xx-decoded-path 12))) + %xx-decoded-path)) + (file (if (equal path "") buffer-file-name - (substitute-in-file-name (expand-file-name path)))) + (substitute-in-file-name (expand-file-name %xx-decoded-path)))) (file-apps (append org-file-apps (org-default-apps))) (apps (org-remove-if 'org-file-apps-entry-match-against-dlink-p file-apps)) --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline; filename=ChangeLog Content-Transfer-Encoding: quoted-printable 2010-11-13 Vincent Bela=EFche * org.el (org-open-file): Decode %XX escapes in URL with file type, so that applications other than browsers are not confused with the f= ilename. --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--