[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name
From: |
Leo |
Subject: |
bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name |
Date: |
Thu, 23 Sep 2010 14:02:42 +0100 |
`dnd-get-local-file-name' returns nil when must-exist is nil, which
contradicts its doc string. The patch fixes this.
diff --git a/lisp/dnd.el b/lisp/dnd.el
index d7cbb64..ef41b76 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -137,7 +137,7 @@ Return nil if URI is not a local file."
(defun dnd-get-local-file-name (uri &optional must-exist)
"Return file name converted from file:/// or file: syntax.
URI is the uri for the file. If MUST-EXIST is given and non-nil,
-only return non-nil if the file exists.
+only return non-nil if the file is readable.
Return nil if URI is not a local file."
(let ((f (cond ((string-match "^file:///" uri) ; XDND format.
(substring uri (1- (match-end 0))))
@@ -154,9 +154,11 @@ Return nil if URI is not a local file."
(let* ((decoded-f (decode-coding-string
f
(or file-name-coding-system
- default-file-name-coding-system)))
- (try-f (if (file-readable-p decoded-f) decoded-f f)))
- (when (file-readable-p try-f) try-f)))))
+ default-file-name-coding-system))))
+ (setq f (cond ((file-readable-p decoded-f) decoded-f)
+ ((file-readable-p f) f)
+ (t nil)))))
+ f))
(defun dnd-open-local-file (uri action)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name,
Leo <=