diff options
| author | YAMAMOTO Mitsuharu | 2006-05-20 04:29:18 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-05-20 04:29:18 +0000 |
| commit | f9be433c82c1c0bb8903dbd180b599c292557eee (patch) | |
| tree | 5fae014a93f795dc86d9951a7ea41dc9432aba95 | |
| parent | 01aa8c41f37a23b2149f5e86b6f6b7d3261d6ca2 (diff) | |
| download | emacs-f9be433c82c1c0bb8903dbd180b599c292557eee.tar.gz emacs-f9be433c82c1c0bb8903dbd180b599c292557eee.zip | |
(x-dnd-handle-file-name): Encode and escape file names
on conversion to URLs.
| -rw-r--r-- | lisp/x-dnd.el | 10 |
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." | |||
| 256 | retval)) | 256 | retval)) |
| 257 | 257 | ||
| 258 | (defun x-dnd-handle-file-name (window action string) | 258 | (defun x-dnd-handle-file-name (window action string) |
| 259 | "Prepend file:// to file names and call `dnd-handle-one-url'. | 259 | "Convert file names to URLs and call `dnd-handle-one-url'. |
| 260 | WINDOW is the window where the drop happened. | 260 | WINDOW is the window where the drop happened. |
| 261 | STRING is the file names as a string, separated by nulls." | 261 | STRING is the file names as a string, separated by nulls." |
| 262 | (let ((uri-list (split-string string "[\0\r\n]" t)) | 262 | (let ((uri-list (split-string string "[\0\r\n]" t)) |
| 263 | (coding (and default-enable-multibyte-characters | ||
| 264 | (or file-name-coding-system | ||
| 265 | default-file-name-coding-system))) | ||
| 263 | retval) | 266 | retval) |
| 264 | (dolist (bf uri-list) | 267 | (dolist (bf uri-list) |
| 265 | ;; If one URL is handeled, treat as if the whole drop succeeded. | 268 | ;; If one URL is handeled, treat as if the whole drop succeeded. |
| 266 | (let* ((file-uri (concat "file://" bf)) | 269 | (if coding (setq bf (encode-coding-string bf coding))) |
| 270 | (let* ((file-uri (concat "file://" | ||
| 271 | (mapconcat 'url-hexify-string | ||
| 272 | (split-string bf "/") "/"))) | ||
| 267 | (did-action (dnd-handle-one-url window action file-uri))) | 273 | (did-action (dnd-handle-one-url window action file-uri))) |
| 268 | (when did-action (setq retval did-action)))) | 274 | (when did-action (setq retval did-action)))) |
| 269 | retval)) | 275 | retval)) |