* bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name
@ 2010-09-23 13:02 Leo
2010-10-03 1:24 ` Chong Yidong
0 siblings, 1 reply; 2+ messages in thread
From: Leo @ 2010-09-23 13:02 UTC (permalink / raw)
To: 7090
`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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name
2010-09-23 13:02 bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name Leo
@ 2010-10-03 1:24 ` Chong Yidong
0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2010-10-03 1:24 UTC (permalink / raw)
To: Leo; +Cc: 7090
Leo <sdl.web@gmail.com> writes:
> `dnd-get-local-file-name' returns nil when must-exist is nil, which
> contradicts its doc string. The patch fixes this.
Thanks; applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-03 1:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 13:02 bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name Leo
2010-10-03 1:24 ` Chong Yidong
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.