emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] %20 in file://... URL


From: Vincent Belaïche
Subject: Re: [Orgmode] %20 in file://... URL
Date: Sat, 13 Nov 2010 07:18:42 +0100

[...]

>
>Please, do! :-)
>
>Giovanni
>

Herein attached follows my patch. Please feel free for brickbats...

   Vincent.

*** org.el.old  Fri Nov  5 19:16:29 2010
--- org.el      Sat Nov 13 05:50:54 2010
***************
*** 9639,9647 ****
  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 "")
                   buffer-file-name
!                (substitute-in-file-name (expand-file-name path))))
         (file-apps (append org-file-apps (org-default-apps)))
         (apps (org-remove-if
                'org-file-apps-entry-match-against-dlink-p file-apps))
--- 9639,9666 ----
  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* ((%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 %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))
2010-11-13  Vincent Belaïche  <address@hidden>

        * 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]