]> code.delx.au - gnu-emacs/blobdiff - lisp/dnd.el
Try and be more careful about propagation of lexical environment.
[gnu-emacs] / lisp / dnd.el
index 7eb6395e280e17ee4b408f362d2867ec729f5b7c..cbbef3844367d63b2d768f973b789592d89ef58b 100644 (file)
@@ -1,10 +1,12 @@
-;;; dnd.el --- drag and drop support.
+;;; dnd.el --- drag and drop support.  -*- coding: utf-8 -*-
 
-;; Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
-;; Author: Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
+;; Author: Jan Djรคrv <jan.h.d@swipnet.se>
 ;; Maintainer: FSF
 ;; Keywords: window, drag, drop
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
 
 ;;;###autoload
 (defcustom dnd-protocol-alist
-  '(("^file:///"  . dnd-open-local-file)       ; XDND format.
-    ("^file://"   . dnd-open-file)             ; URL with host
-    ("^file:"     . dnd-open-local-file)       ; Old KDE, Motif, Sun
-    ("^\\(https?\\|ftp\\|file\\|nfs\\)://" . dnd-open-file)
+  `((,(purecopy "^file:///")  . dnd-open-local-file)   ; XDND format.
+    (,(purecopy "^file://")   . dnd-open-file)         ; URL with host
+    (,(purecopy "^file:")     . dnd-open-local-file)   ; Old KDE, Motif, Sun
+    (,(purecopy "^\\(https?\\|ftp\\|file\\|nfs\\)://") . dnd-open-file)
    )
 
   "The functions to call for different protocols when a drop is made.
@@ -153,10 +155,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)
   "Open a local file.