summaryrefslogtreecommitdiff
path: root/lisp/x-dnd.el
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2006-05-20 04:29:18 +0000
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2006-05-20 04:29:18 +0000
commitf9be433c82c1c0bb8903dbd180b599c292557eee (patch)
tree5fae014a93f795dc86d9951a7ea41dc9432aba95 /lisp/x-dnd.el
parent01aa8c41f37a23b2149f5e86b6f6b7d3261d6ca2 (diff)
downloademacs-f9be433c82c1c0bb8903dbd180b599c292557eee.tar.gz
(x-dnd-handle-file-name): Encode and escape file names
on conversion to URLs.
Diffstat (limited to 'lisp/x-dnd.el')
-rw-r--r--lisp/x-dnd.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index a5b6d409b87..693a2d7fa4b 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -256,14 +256,20 @@ STRING is the uri-list as a string. The URIs are separated by \r\n."
retval))
(defun x-dnd-handle-file-name (window action string)
- "Prepend file:// to file names and call `dnd-handle-one-url'.
+ "Convert file names to URLs and call `dnd-handle-one-url'.
WINDOW is the window where the drop happened.
STRING is the file names as a string, separated by nulls."
(let ((uri-list (split-string string "[\0\r\n]" t))
+ (coding (and default-enable-multibyte-characters
+ (or file-name-coding-system
+ default-file-name-coding-system)))
retval)
(dolist (bf uri-list)
;; If one URL is handeled, treat as if the whole drop succeeded.
- (let* ((file-uri (concat "file://" bf))
+ (if coding (setq bf (encode-coding-string bf coding)))
+ (let* ((file-uri (concat "file://"
+ (mapconcat 'url-hexify-string
+ (split-string bf "/") "/")))
(did-action (dnd-handle-one-url window action file-uri)))
(when did-action (setq retval did-action))))
retval))