diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2020-09-09 13:33:15 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2020-09-09 13:33:15 -0400 |
commit | 4064d074459ea3eebbc596b7ad645fab95a5b30f (patch) | |
tree | 331de964c294ace3e9edc44868fa04c7d4b38eaa /lisp/dnd.el | |
parent | 6e7736ac5f42e2f1b17aacdfb2a60d8bb951d038 (diff) | |
download | emacs-4064d074459ea3eebbc596b7ad645fab95a5b30f.tar.gz |
* lisp/dnd.el: Use lexical-binding. Remove redundant :group
(dnd--unescape-uri): Mark it internal, but don't mark it inlinable.
* lisp/cus-edit.el (dnd): Move the group to dnd.el.
Diffstat (limited to 'lisp/dnd.el')
-rw-r--r-- | lisp/dnd.el | 23 |
1 files changed, 12 insertions, 11 deletions
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 @@ -;;; dnd.el --- drag and drop support +;;; dnd.el --- drag and drop support -*- lexical-binding: t; -*- ;; Copyright (C) 2005-2020 Free Software Foundation, Inc. @@ -33,6 +33,9 @@ ;;; Customizable variables +(defgroup dnd nil + "Handling data from drag and drop." + :group 'environment) ;;;###autoload (defcustom dnd-protocol-alist @@ -54,14 +57,13 @@ If no match is found, the URL is inserted as text by calling `dnd-insert-text'. The function shall return the action done (move, copy, link or private) if some action was made, or nil if the URL is ignored." :version "22.1" - :type '(repeat (cons (regexp) (function))) - :group 'dnd) + :type '(repeat (cons (regexp) (function)))) (defcustom dnd-open-remote-file-function (if (eq system-type 'windows-nt) - 'dnd-open-local-file - 'dnd-open-remote-url) + #'dnd-open-local-file + #'dnd-open-remote-url) "The function to call when opening a file on a remote machine. The function will be called with two arguments, URI and ACTION. See `dnd-open-file' for details. @@ -71,15 +73,13 @@ Predefined functions are `dnd-open-local-file' and `dnd-open-remote-url'. is the default on MS-Windows. `dnd-open-remote-url' uses `url-handler-mode' and is the default except for MS-Windows." :version "22.1" - :type 'function - :group 'dnd) + :type 'function) (defcustom dnd-open-file-other-window nil "If non-nil, always use find-file-other-window to open dropped files." :version "22.1" - :type 'boolean - :group 'dnd) + :type 'boolean) ;; Functions @@ -133,7 +133,8 @@ Return nil if URI is not a local file." (string-equal sysname-no-dot hostname))) (concat "file://" (substring uri (+ 7 (length hostname)))))))) -(defsubst dnd-unescape-uri (uri) +(defun dnd--unescape-uri (uri) + ;; Merge with corresponding code in URL library. (replace-regexp-in-string "%[[:xdigit:]][[:xdigit:]]" (lambda (arg) @@ -157,7 +158,7 @@ Return nil if URI is not a local file." 'utf-8 (or file-name-coding-system default-file-name-coding-system)))) - (and f (setq f (decode-coding-string (dnd-unescape-uri f) coding))) + (and f (setq f (decode-coding-string (dnd--unescape-uri f) coding))) (when (and f must-exist (not (file-readable-p f))) (setq f nil)) f)) |