diff options
| author | YAMAMOTO Mitsuharu | 2006-05-20 04:28:48 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-05-20 04:28:48 +0000 |
| commit | 01aa8c41f37a23b2149f5e86b6f6b7d3261d6ca2 (patch) | |
| tree | f3326ffe11a93436276ab047ef22c15b5738baa7 | |
| parent | cf1c2307d3ff4121863a421df546fff8ba82dc00 (diff) | |
| download | emacs-01aa8c41f37a23b2149f5e86b6f6b7d3261d6ca2.tar.gz emacs-01aa8c41f37a23b2149f5e86b6f6b7d3261d6ca2.zip | |
(dnd-handle-one-url): Change 3rd arg ARG to URL. Don't unescape URL.
(dnd-get-local-file-name): Unescape URL on conversion to file name.
Specify LITERAL in replace-regexp-in-string.
| -rw-r--r-- | lisp/dnd.el | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lisp/dnd.el b/lisp/dnd.el index dec57481570..85881b3261f 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el | |||
| @@ -69,39 +69,34 @@ if some action was made, or nil if the URL is ignored." | |||
| 69 | 69 | ||
| 70 | ;; Functions | 70 | ;; Functions |
| 71 | 71 | ||
| 72 | (defun dnd-handle-one-url (window action arg) | 72 | (defun dnd-handle-one-url (window action url) |
| 73 | "Handle one dropped url by calling the appropriate handler. | 73 | "Handle one dropped url by calling the appropriate handler. |
| 74 | The handler is first located by looking at `dnd-protocol-alist'. | 74 | The handler is first located by looking at `dnd-protocol-alist'. |
| 75 | If no match is found here, and the value of `browse-url-browser-function' | 75 | If no match is found here, and the value of `browse-url-browser-function' |
| 76 | is a pair of (REGEXP . FUNCTION), those regexps are tried for a match. | 76 | is a pair of (REGEXP . FUNCTION), those regexps are tried for a match. |
| 77 | If no match is found, just call `dnd-insert-text'. | 77 | If no match is found, just call `dnd-insert-text'. |
| 78 | WINDOW is where the drop happend, ACTION is the action for the drop, | 78 | WINDOW is where the drop happend, ACTION is the action for the drop, |
| 79 | ARG is the URL that has been dropped. | 79 | URL is what has been dropped. |
| 80 | Returns ACTION." | 80 | Returns ACTION." |
| 81 | (require 'browse-url) | 81 | (require 'browse-url) |
| 82 | (let* ((uri (replace-regexp-in-string | 82 | (let (ret) |
| 83 | "%[A-Z0-9][A-Z0-9]" | ||
| 84 | (lambda (arg) | ||
| 85 | (format "%c" (string-to-number (substring arg 1) 16))) | ||
| 86 | arg)) | ||
| 87 | ret) | ||
| 88 | (or | 83 | (or |
| 89 | (catch 'done | 84 | (catch 'done |
| 90 | (dolist (bf dnd-protocol-alist) | 85 | (dolist (bf dnd-protocol-alist) |
| 91 | (when (string-match (car bf) uri) | 86 | (when (string-match (car bf) url) |
| 92 | (setq ret (funcall (cdr bf) uri action)) | 87 | (setq ret (funcall (cdr bf) url action)) |
| 93 | (throw 'done t))) | 88 | (throw 'done t))) |
| 94 | nil) | 89 | nil) |
| 95 | (when (not (functionp browse-url-browser-function)) | 90 | (when (not (functionp browse-url-browser-function)) |
| 96 | (catch 'done | 91 | (catch 'done |
| 97 | (dolist (bf browse-url-browser-function) | 92 | (dolist (bf browse-url-browser-function) |
| 98 | (when (string-match (car bf) uri) | 93 | (when (string-match (car bf) url) |
| 99 | (setq ret 'private) | 94 | (setq ret 'private) |
| 100 | (funcall (cdr bf) uri action) | 95 | (funcall (cdr bf) url action) |
| 101 | (throw 'done t))) | 96 | (throw 'done t))) |
| 102 | nil)) | 97 | nil)) |
| 103 | (progn | 98 | (progn |
| 104 | (dnd-insert-text window action uri) | 99 | (dnd-insert-text window action url) |
| 105 | (setq ret 'private))) | 100 | (setq ret 'private))) |
| 106 | ret)) | 101 | ret)) |
| 107 | 102 | ||
| @@ -134,6 +129,11 @@ Return nil if URI is not a local file." | |||
| 134 | ((string-match "^file:" uri) ; Old KDE, Motif, Sun | 129 | ((string-match "^file:" uri) ; Old KDE, Motif, Sun |
| 135 | (substring uri (match-end 0)))))) | 130 | (substring uri (match-end 0)))))) |
| 136 | (when (and f must-exist) | 131 | (when (and f must-exist) |
| 132 | (setq f (replace-regexp-in-string | ||
| 133 | "%[A-Z0-9][A-Z0-9]" | ||
| 134 | (lambda (arg) | ||
| 135 | (format "%c" (string-to-number (substring arg 1) 16))) | ||
| 136 | f nil t)) | ||
| 137 | (let* ((decoded-f (decode-coding-string | 137 | (let* ((decoded-f (decode-coding-string |
| 138 | f | 138 | f |
| 139 | (or file-name-coding-system | 139 | (or file-name-coding-system |