all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: 7090@debbugs.gnu.org
Subject: bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name
Date: Thu, 23 Sep 2010 14:02:42 +0100	[thread overview]
Message-ID: <m1zkv8fw99.fsf@cam.ac.uk> (raw)


`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)





             reply	other threads:[~2010-09-23 13:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 13:02 Leo [this message]
2010-10-03  1:24 ` bug#7090: 23.2; [PATCH] Fix return value of dnd-get-local-file-name Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1zkv8fw99.fsf@cam.ac.uk \
    --to=sdl.web@gmail.com \
    --cc=7090@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.