]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer defvar-keymap in info.el
authorStefan Kangas <stefankangas@gmail.com>
Sun, 15 Dec 2024 23:18:18 +0000 (00:18 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Dec 2024 15:01:18 +0000 (16:01 +0100)
* lisp/info.el (Info-mode-line-node-keymap, Info-link-keymap):
Convert to defvar-keymap.

(cherry picked from commit 29058579e9f27872d47e9d5146dfd9ce79697a0d)

lisp/info.el

index a375d542641a3cebb3836e2c324a7a46c6011ab0..cd1766e6c8b4b06f639d90fdd2c8f5f31aa35de9 100644 (file)
@@ -1822,12 +1822,10 @@ escaped (\\\",\\\\)."
        (Info-hide-cookies-node)
        (run-hooks 'Info-selection-hook)))))
 
-(defvar Info-mode-line-node-keymap
-  (let ((map (make-sparse-keymap)))
-    (define-key map [mode-line mouse-1] 'Info-mouse-scroll-up)
-    (define-key map [mode-line mouse-3] 'Info-mouse-scroll-down)
-    map)
-  "Keymap to put on the Info node name in the mode line.")
+(defvar-keymap Info-mode-line-node-keymap
+  :doc "Keymap to put on the Info node name in the mode line."
+  "<mode-line> <mouse-1>" #'Info-mouse-scroll-up
+  "<mode-line> <mouse-3>" #'Info-mouse-scroll-down)
 
 (defun Info-set-mode-line ()
   (setq mode-line-buffer-identification
@@ -4886,17 +4884,15 @@ the variable `Info-file-list-for-emacs'."
               "\\`%s' invokes an anonymous command defined with `lambda'"
               (key-description key))))))))
 \f
-(defvar Info-link-keymap
-  (let ((keymap (make-sparse-keymap)))
-    (define-key keymap [header-line down-mouse-1] 'mouse-drag-header-line)
-    (define-key keymap [header-line mouse-1] 'Info-mouse-follow-link)
-    (define-key keymap [header-line mouse-2] 'Info-mouse-follow-link)
-    (define-key keymap [mouse-2] 'Info-mouse-follow-link)
-    (define-key keymap [follow-link] 'mouse-face)
-    keymap)
-  "Keymap to put on Info links.
+(defvar-keymap Info-link-keymap
+  :doc "Keymap to put on Info links.
 This is used for the \"Next\", \"Prev\", and \"Up\" links in the
-first line or header line, and for breadcrumb links.")
+first line or header line, and for breadcrumb links."
+  "<header-line> <down-mouse-1>" #'mouse-drag-header-line
+  "<header-line> <mouse-1>"      #'Info-mouse-follow-link
+  "<header-line> <mouse-2>"      #'Info-mouse-follow-link
+  "<mouse-2>"                    #'Info-mouse-follow-link
+  "<follow-link>"                'mouse-face)
 
 (defun Info-breadcrumbs ()
   (let ((nodes (Info-toc-nodes Info-current-file))