summaryrefslogtreecommitdiff
path: root/lisp/dnd.el
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2006-05-20 04:28:48 +0000
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2006-05-20 04:28:48 +0000
commit01aa8c41f37a23b2149f5e86b6f6b7d3261d6ca2 (patch)
treef3326ffe11a93436276ab047ef22c15b5738baa7 /lisp/dnd.el
parentcf1c2307d3ff4121863a421df546fff8ba82dc00 (diff)
downloademacs-01aa8c41f37a23b2149f5e86b6f6b7d3261d6ca2.tar.gz
(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.
Diffstat (limited to 'lisp/dnd.el')
-rw-r--r--lisp/dnd.el26
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."
;; Functions
-(defun dnd-handle-one-url (window action arg)
+(defun dnd-handle-one-url (window action url)
"Handle one dropped url by calling the appropriate handler.
The handler is first located by looking at `dnd-protocol-alist'.
If no match is found here, and the value of `browse-url-browser-function'
is a pair of (REGEXP . FUNCTION), those regexps are tried for a match.
If no match is found, just call `dnd-insert-text'.
WINDOW is where the drop happend, ACTION is the action for the drop,
-ARG is the URL that has been dropped.
+URL is what has been dropped.
Returns ACTION."
(require 'browse-url)
- (let* ((uri (replace-regexp-in-string
- "%[A-Z0-9][A-Z0-9]"
- (lambda (arg)
- (format "%c" (string-to-number (substring arg 1) 16)))
- arg))
- ret)
+ (let (ret)
(or
(catch 'done
(dolist (bf dnd-protocol-alist)
- (when (string-match (car bf) uri)
- (setq ret (funcall (cdr bf) uri action))
+ (when (string-match (car bf) url)
+ (setq ret (funcall (cdr bf) url action))
(throw 'done t)))
nil)
(when (not (functionp browse-url-browser-function))
(catch 'done
(dolist (bf browse-url-browser-function)
- (when (string-match (car bf) uri)
+ (when (string-match (car bf) url)
(setq ret 'private)
- (funcall (cdr bf) uri action)
+ (funcall (cdr bf) url action)
(throw 'done t)))
nil))
(progn
- (dnd-insert-text window action uri)
+ (dnd-insert-text window action url)
(setq ret 'private)))
ret))
@@ -134,6 +129,11 @@ Return nil if URI is not a local file."
((string-match "^file:" uri) ; Old KDE, Motif, Sun
(substring uri (match-end 0))))))
(when (and f must-exist)
+ (setq f (replace-regexp-in-string
+ "%[A-Z0-9][A-Z0-9]"
+ (lambda (arg)
+ (format "%c" (string-to-number (substring arg 1) 16)))
+ f nil t))
(let* ((decoded-f (decode-coding-string
f
(or file-name-coding-system