]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer defvar-keymap in dired.el
authorStefan Kangas <stefankangas@gmail.com>
Fri, 13 Dec 2024 03:40:02 +0000 (04:40 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 15 Dec 2024 16:37:01 +0000 (17:37 +0100)
* lisp/dired.el (dired-mouse-drag-files-map)
(dired-click-to-select-map): Convert to defvar-keymap.

(cherry picked from commit 65aa5608f2c02bb90742d4d176c61182915f7755)

lisp/dired.el

index 8999c55004b3f3a0d50da5b92d3cc87dc7c12e3b..18a2c375923ac6d1fddd735f9d643b2c1238a1b2 100644 (file)
@@ -1955,13 +1955,12 @@ other marked file as well.  Otherwise, unmark all files."
                        ;; a remote file.
                        (user-error (cadr error)))))))))))
 
-(defvar dired-mouse-drag-files-map (let ((keymap (make-sparse-keymap)))
-                                     (define-key keymap [down-mouse-1] #'dired-mouse-drag)
-                                     (define-key keymap [C-down-mouse-1] #'dired-mouse-drag)
-                                     (define-key keymap [S-down-mouse-1] #'dired-mouse-drag)
-                                     (define-key keymap [M-down-mouse-1] #'dired-mouse-drag)
-                                     keymap)
-  "Keymap applied to file names when `dired-mouse-drag-files' is enabled.")
+(defvar-keymap dired-mouse-drag-files-map
+  :doc "Keymap applied to file names when `dired-mouse-drag-files' is enabled."
+  "<down-mouse-1>"   #'dired-mouse-drag
+  "C-<down-mouse-1>" #'dired-mouse-drag
+  "S-<down-mouse-1>" #'dired-mouse-drag
+  "M-<down-mouse-1>" #'dired-mouse-drag)
 
 (defvar dired-click-to-select-mode)
 (defvar dired-click-to-select-map)
@@ -5282,8 +5281,8 @@ Interactively with prefix argument, read FILE-NAME."
 \f
 ;;; Click-To-Select mode
 
-(defvar dired-click-to-select-map (make-sparse-keymap)
-  "Keymap placed on files under `dired-click-to-select' mode.")
+(defvar-keymap dired-click-to-select-map
+  :doc "Keymap placed on files under `dired-click-to-select' mode.")
 
 (define-key dired-click-to-select-map [mouse-2]
             #'dired-mark-for-click)