From: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
To: Org mode <emacs-orgmode@gnu.org>
Cc: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
Subject: RE: %20 in file://... URL
Date: Mon, 22 Nov 2010 16:46:44 +0100 [thread overview]
Message-ID: <801v6dqs2j.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]
> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch --]
[-- Type: text/x-patch, Size: 1448 bytes --]
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))
[-- Attachment #3: ChangeLog --]
[-- Type: text/plain, Size: 218 bytes --]
2010-11-13 Vincent Belaïche <vincentb1@users.sourceforge.net>
* org.el (org-open-file): Decode %XX escapes in URL with file
type, so that applications other than browsers are not confused with the filename.
[-- Attachment #4: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
next reply other threads:[~2010-11-22 15:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 15:46 Vincent Belaïche [this message]
2010-11-22 18:16 ` %20 in file://... URL David Maus
2011-02-12 15:02 ` Bastien
-- strict thread matches above, loose matches on Subject: below --
2010-12-30 5:29 Vincent Belaïche
2010-11-23 5:25 Vincent Belaïche
2010-11-24 20:57 ` David Maus
2011-02-12 14:36 ` Bastien
[not found] ` <BLU104-W15A3F7F6097ED8F6D95CEB84210@phx.gbl>
2010-11-29 20:03 ` David Maus
2010-11-22 15:46 Vincent Belaïche
2010-11-13 6:18 Vincent Belaïche
2010-11-13 6:28 ` Vincent Belaïche
2010-11-14 17:30 ` David Maus
2010-11-17 20:43 ` David Maus
2010-11-17 20:43 ` David Maus
2010-11-05 6:42 Vincent Belaïche
2010-11-05 8:39 ` Giovanni Ridolfi
2010-10-27 21:19 Vincent Belaïche
2010-10-26 5:15 Vincent Belaïche
2010-10-26 15:39 ` Giovanni Ridolfi
2010-10-24 20:49 Vincent Belaïche
2010-10-24 21:02 ` 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=801v6dqs2j.fsf@gmail.com \
--to=vincent.b.1@hotmail.fr \
--cc=emacs-orgmode@gnu.org \
/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).