GNU bug report logs - #7090
23.2; [PATCH] Fix return value of dnd-get-local-file-name

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Thu, 23 Sep 2010 13:01:04 UTC

Severity: normal

Tags: patch

Found in version 23.2

Fixed in version 23.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7090 in the body.
You can then email your comments to 7090 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7090; Package emacs. (Thu, 23 Sep 2010 13:01:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 23 Sep 2010 13:01:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 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)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7090; Package emacs. (Sun, 03 Oct 2010 01:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 7090 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Leo <sdl.web <at> gmail.com>
Cc: 7090 <at> debbugs.gnu.org
Subject: Re: bug#7090: 23.2;
	[PATCH] Fix return value of dnd-get-local-file-name
Date: Sat, 02 Oct 2010 21:24:14 -0400
Leo <sdl.web <at> 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.




bug marked as fixed in version 23.3, send any further explanations to Leo <sdl.web <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 24 Feb 2011 01:49:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Mar 2011 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.