emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4064d07: * lisp/dnd.el: Use lexical-binding. Remove redundant :gr


From: Stefan Monnier
Subject: master 4064d07: * lisp/dnd.el: Use lexical-binding. Remove redundant :group
Date: Wed, 9 Sep 2020 13:33:27 -0400 (EDT)

branch: master
commit 4064d074459ea3eebbc596b7ad645fab95a5b30f
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * 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.
---
 lisp/cus-edit.el |  4 ----
 lisp/dnd.el      | 23 ++++++++++++-----------
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index cb1a78d..6d0ec5d 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."
   "Input from the menus."
   :group 'environment)
 
-(defgroup dnd nil
-  "Handling data from drag and drop."
-  :group 'environment)
-
 (defgroup auto-save nil
   "Preventing accidental loss of data."
   :group 'files)
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 1d0e26c..815a4af 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]