aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/cus-edit.el4
-rw-r--r--lisp/dnd.el23
2 files changed, 12 insertions, 15 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index cb1a78d8e20..6d0ec5d1486 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -408,10 +408,6 @@ Use group `text' for this instead. This group is deprecated."
408 "Input from the menus." 408 "Input from the menus."
409 :group 'environment) 409 :group 'environment)
410 410
411(defgroup dnd nil
412 "Handling data from drag and drop."
413 :group 'environment)
414
415(defgroup auto-save nil 411(defgroup auto-save nil
416 "Preventing accidental loss of data." 412 "Preventing accidental loss of data."
417 :group 'files) 413 :group 'files)
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 1d0e26cb013..815a4afbecd 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -1,4 +1,4 @@
1;;; dnd.el --- drag and drop support 1;;; dnd.el --- drag and drop support -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2005-2020 Free Software Foundation, Inc. 3;; Copyright (C) 2005-2020 Free Software Foundation, Inc.
4 4
@@ -33,6 +33,9 @@
33 33
34;;; Customizable variables 34;;; Customizable variables
35 35
36(defgroup dnd nil
37 "Handling data from drag and drop."
38 :group 'environment)
36 39
37;;;###autoload 40;;;###autoload
38(defcustom dnd-protocol-alist 41(defcustom dnd-protocol-alist
@@ -54,14 +57,13 @@ If no match is found, the URL is inserted as text by calling `dnd-insert-text'.
54The function shall return the action done (move, copy, link or private) 57The function shall return the action done (move, copy, link or private)
55if some action was made, or nil if the URL is ignored." 58if some action was made, or nil if the URL is ignored."
56 :version "22.1" 59 :version "22.1"
57 :type '(repeat (cons (regexp) (function))) 60 :type '(repeat (cons (regexp) (function))))
58 :group 'dnd)
59 61
60 62
61(defcustom dnd-open-remote-file-function 63(defcustom dnd-open-remote-file-function
62 (if (eq system-type 'windows-nt) 64 (if (eq system-type 'windows-nt)
63 'dnd-open-local-file 65 #'dnd-open-local-file
64 'dnd-open-remote-url) 66 #'dnd-open-remote-url)
65 "The function to call when opening a file on a remote machine. 67 "The function to call when opening a file on a remote machine.
66The function will be called with two arguments, URI and ACTION. 68The function will be called with two arguments, URI and ACTION.
67See `dnd-open-file' for details. 69See `dnd-open-file' for details.
@@ -71,15 +73,13 @@ Predefined functions are `dnd-open-local-file' and `dnd-open-remote-url'.
71is the default on MS-Windows. `dnd-open-remote-url' uses `url-handler-mode' 73is the default on MS-Windows. `dnd-open-remote-url' uses `url-handler-mode'
72and is the default except for MS-Windows." 74and is the default except for MS-Windows."
73 :version "22.1" 75 :version "22.1"
74 :type 'function 76 :type 'function)
75 :group 'dnd)
76 77
77 78
78(defcustom dnd-open-file-other-window nil 79(defcustom dnd-open-file-other-window nil
79 "If non-nil, always use find-file-other-window to open dropped files." 80 "If non-nil, always use find-file-other-window to open dropped files."
80 :version "22.1" 81 :version "22.1"
81 :type 'boolean 82 :type 'boolean)
82 :group 'dnd)
83 83
84 84
85;; Functions 85;; Functions
@@ -133,7 +133,8 @@ Return nil if URI is not a local file."
133 (string-equal sysname-no-dot hostname))) 133 (string-equal sysname-no-dot hostname)))
134 (concat "file://" (substring uri (+ 7 (length hostname)))))))) 134 (concat "file://" (substring uri (+ 7 (length hostname))))))))
135 135
136(defsubst dnd-unescape-uri (uri) 136(defun dnd--unescape-uri (uri)
137 ;; Merge with corresponding code in URL library.
137 (replace-regexp-in-string 138 (replace-regexp-in-string
138 "%[[:xdigit:]][[:xdigit:]]" 139 "%[[:xdigit:]][[:xdigit:]]"
139 (lambda (arg) 140 (lambda (arg)
@@ -157,7 +158,7 @@ Return nil if URI is not a local file."
157 'utf-8 158 'utf-8
158 (or file-name-coding-system 159 (or file-name-coding-system
159 default-file-name-coding-system)))) 160 default-file-name-coding-system))))
160 (and f (setq f (decode-coding-string (dnd-unescape-uri f) coding))) 161 (and f (setq f (decode-coding-string (dnd--unescape-uri f) coding)))
161 (when (and f must-exist (not (file-readable-p f))) 162 (when (and f must-exist (not (file-readable-p f)))
162 (setq f nil)) 163 (setq f nil))
163 f)) 164 f))