)
"The functions to call for different protocols when a drop is made.
-This variable is used by `x-dnd-handle-uri-list' and `x-dnd-handle-moz-url'.
-The list contains of (REGEXP . FUNCTION) pairs.
+This variable is used by `x-dnd-handle-uri-list', `x-dnd-handle-file-name'
+and `x-dnd-handle-moz-url'. The list contains of (REGEXP . FUNCTION) pairs.
The functions shall take two arguments, URL, which is the URL dropped and
ACTION which is the action to be performed for the drop (move, copy, link,
private or ask).
:type 'boolean
:group 'x)
-;; Internal variables
-
-(defvar x-dnd-known-types
+(defcustom x-dnd-known-types
'("text/uri-list"
"text/x-moz-url"
"_NETSCAPE_URL"
"TEXT"
)
"The types accepted by default for dropped data.
-The types are chosen in the order they appear in the list.")
+The types are chosen in the order they appear in the list."
+ :type '(repeat string)
+ :group 'x
+)
+
+;; Internal variables
(defvar x-dnd-current-state nil
"The current state for a drop.
The last / in file:/// is part of the file name. ACTION is ignored."
(let* ((f (x-dnd-get-local-file-name uri t)))
- (when f
- (if (file-readable-p f)
- (progn
- (if x-dnd-open-file-other-window
- (find-file-other-window f)
- (find-file f))
- 'private)
- (error "Can not read %s (%s)" f uri)))))
+ (if (and f (file-readable-p f))
+ (progn
+ (if x-dnd-open-file-other-window
+ (find-file-other-window f)
+ (find-file f))
+ 'private)
+ (error "Can not read %s" uri))))
(defun x-dnd-open-file (uri action)
"Open a local or remote file.
;; The hostname may be our hostname, in that case, convert to a local
;; file. Otherwise return nil.
(let ((local-file (x-dnd-get-local-file-uri uri)))
- (when local-file (x-dnd-open-local-file local-file action))))
+ (if local-file (x-dnd-open-local-file local-file action)
+ (error "Remote files not supported"))))
(defun x-dnd-handle-moz-url (window action data)
timestamp)
(x-dnd-forget-drop frame)))
- (t (error "Unknown Motif DND message %s %s" message data)))))
+ (t (error "Unknown Motif DND message %s %s" message-atom data)))))
;;;