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))