]> git.eshelyaron.com Git - emacs.git/commitdiff
Define some more keymaps in one step
authorStefan Kangas <stefan@marxist.se>
Wed, 8 Dec 2021 16:15:28 +0000 (17:15 +0100)
committerStefan Kangas <stefan@marxist.se>
Wed, 8 Dec 2021 16:48:25 +0000 (17:48 +0100)
* lisp/calc/calc-store.el (calc-var-name-map):
* lisp/mail/rmailsum.el (rmail-summary-edit-map):
* lisp/speedbar.el (speedbar-buffers-key-map): Define in one step.
* lisp/progmodes/ebrowse.el (ebrowse-global-submap-4)
(ebrowse-global-submap-5): Define in one step and use defvar-keymap.

lisp/calc/calc-store.el
lisp/mail/rmailsum.el
lisp/progmodes/ebrowse.el
lisp/speedbar.el

index de2f18f39479acdee8d8e6625400f37b9847c692..817b50951dd561fc05d79a7de5358bd85cd32210 100644 (file)
                             tag (and (not val) 1))
           (message "Variable \"%s\" changed" (calc-var-name var)))))))
 
-(defvar calc-var-name-map nil "Keymap for reading Calc variable names.")
-(if calc-var-name-map
-    ()
-  (setq calc-var-name-map (copy-keymap minibuffer-local-completion-map))
-  (define-key calc-var-name-map " " 'self-insert-command)
-  (mapc (lambda (x)
-         (define-key calc-var-name-map (char-to-string x)
-            'calcVar-digit))
-       "0123456789")
-  (mapc (lambda (x)
-         (define-key calc-var-name-map (char-to-string x)
-            'calcVar-oper))
-       "+-*/^|"))
+(defvar calc-var-name-map
+  (let ((map (copy-keymap minibuffer-local-completion-map)))
+    (define-key map " " #'self-insert-command)
+    (mapc (lambda (x)
+            (define-key map (char-to-string x)
+                        #'calcVar-digit))
+          "0123456789")
+    (mapc (lambda (x)
+            (define-key map (char-to-string x)
+                        #'calcVar-oper))
+          "+-*/^|")
+    map)
+  "Keymap for reading Calc variable names.")
 
 (defvar calc-store-opers)
 
index 9dd9573a9fc14f6769ed9dc983fc655f61bf8aa2..8fc3fc095cce20c8a0aad7e7907123f9a51b8e6f 100644 (file)
@@ -1480,13 +1480,11 @@ argument says to read a file name and use that file as the inbox."
 (declare-function rmail-output-read-file-name "rmailout" ())
 (declare-function mail-send-and-exit "sendmail" (&optional arg))
 
-(defvar rmail-summary-edit-map nil)
-(if rmail-summary-edit-map
-    nil
-  (setq rmail-summary-edit-map
-       (nconc (make-sparse-keymap) text-mode-map))
-  (define-key rmail-summary-edit-map "\C-c\C-c" 'rmail-cease-edit)
-  (define-key rmail-summary-edit-map "\C-c\C-]" 'rmail-abort-edit))
+(defvar rmail-summary-edit-map
+  (let ((map (nconc (make-sparse-keymap) text-mode-map)))
+    (define-key map "\C-c\C-c" #'rmail-cease-edit)
+    (define-key map "\C-c\C-]" #'rmail-abort-edit)
+    map))
 
 (defun rmail-summary-edit-current-message ()
   "Edit the contents of this message."
index 6e416d064a84a91a692da67b7f4693c5fd47c313..0713370da3c08e40e43c0ff35f0f1ca57df33ff7 100644 (file)
@@ -4045,23 +4045,27 @@ NUMBER-OF-STATIC-VARIABLES:"
 (defvar ebrowse-global-map nil
   "Keymap for Ebrowse commands.")
 
-
 (defvar ebrowse-global-prefix-key "\C-c\C-m"
   "Prefix key for Ebrowse commands.")
 
-
-(defvar ebrowse-global-submap-4 nil
-  "Keymap used for `ebrowse-global-prefix' followed by `4'.")
-
-
-(defvar ebrowse-global-submap-5 nil
-  "Keymap used for `ebrowse-global-prefix' followed by `5'.")
-
+(defvar-keymap ebrowse-global-submap-4
+  :doc "Keymap used for `ebrowse-global-prefix' followed by `4'."
+  "." #'ebrowse-tags-find-definition-other-window
+  "f" #'ebrowse-tags-find-definition-other-window
+  "v" #'ebrowse-tags-find-declaration-other-window
+  "F" #'ebrowse-tags-view-definition-other-window
+  "V" #'ebrowse-tags-view-declaration-other-window)
+
+(defvar-keymap ebrowse-global-submap-5
+  :doc "Keymap used for `ebrowse-global-prefix' followed by `5'."
+  "." #'ebrowse-tags-find-definition-other-frame
+  "f" #'ebrowse-tags-find-definition-other-frame
+  "v" #'ebrowse-tags-find-declaration-other-frame
+  "F" #'ebrowse-tags-view-definition-other-frame
+  "V" #'ebrowse-tags-view-declaration-other-frame)
 
 (unless ebrowse-global-map
   (setq ebrowse-global-map (make-sparse-keymap))
-  (setq ebrowse-global-submap-4 (make-sparse-keymap))
-  (setq ebrowse-global-submap-5 (make-sparse-keymap))
   (define-key ebrowse-global-map "a" 'ebrowse-tags-apropos)
   (define-key ebrowse-global-map "b" 'ebrowse-pop-to-browser-buffer)
   (define-key ebrowse-global-map "-" 'ebrowse-back-in-position-stack)
@@ -4082,17 +4086,7 @@ NUMBER-OF-STATIC-VARIABLES:"
   (define-key ebrowse-global-map " " 'ebrowse-electric-buffer-list)
   (define-key ebrowse-global-map "\t" 'ebrowse-tags-complete-symbol)
   (define-key ebrowse-global-map "4" ebrowse-global-submap-4)
-  (define-key ebrowse-global-submap-4 "." 'ebrowse-tags-find-definition-other-window)
-  (define-key ebrowse-global-submap-4 "f" 'ebrowse-tags-find-definition-other-window)
-  (define-key ebrowse-global-submap-4 "v" 'ebrowse-tags-find-declaration-other-window)
-  (define-key ebrowse-global-submap-4 "F" 'ebrowse-tags-view-definition-other-window)
-  (define-key ebrowse-global-submap-4 "V" 'ebrowse-tags-view-declaration-other-window)
   (define-key ebrowse-global-map "5" ebrowse-global-submap-5)
-  (define-key ebrowse-global-submap-5 "." 'ebrowse-tags-find-definition-other-frame)
-  (define-key ebrowse-global-submap-5 "f" 'ebrowse-tags-find-definition-other-frame)
-  (define-key ebrowse-global-submap-5 "v" 'ebrowse-tags-find-declaration-other-frame)
-  (define-key ebrowse-global-submap-5 "F" 'ebrowse-tags-view-definition-other-frame)
-  (define-key ebrowse-global-submap-5 "V" 'ebrowse-tags-view-declaration-other-frame)
   (define-key global-map ebrowse-global-prefix-key ebrowse-global-map))
 
 
index 3cc3e2760670e747296268f61c29b11004045d7d..cfa96608bff7ff4b9ccf7fed432a60a20cd52ee2 100644 (file)
@@ -3694,27 +3694,21 @@ regular expression EXPR."
 \f
 ;;; BUFFER DISPLAY mode.
 ;;
-(defvar speedbar-buffers-key-map nil
+(defvar speedbar-buffers-key-map
+  (let ((map (speedbar-make-specialized-keymap)))
+    ;; Basic tree features
+    (define-key map "e" #'speedbar-edit-line)
+    (define-key map "\C-m" #'speedbar-edit-line)
+    (define-key map "+" #'speedbar-expand-line)
+    (define-key map "=" #'speedbar-expand-line)
+    (define-key map "-" #'speedbar-contract-line)
+    (define-key map " " #'speedbar-toggle-line-expansion)
+    ;; Buffer specific keybindings
+    (define-key map "k" #'speedbar-buffer-kill-buffer)
+    (define-key map "r" #'speedbar-buffer-revert-buffer)
+    map)
   "Keymap used when in the buffers display mode.")
 
-(if speedbar-buffers-key-map
-    nil
-  (setq speedbar-buffers-key-map (speedbar-make-specialized-keymap))
-
-  ;; Basic tree features
-  (define-key speedbar-buffers-key-map "e" 'speedbar-edit-line)
-  (define-key speedbar-buffers-key-map "\C-m" 'speedbar-edit-line)
-  (define-key speedbar-buffers-key-map "+" 'speedbar-expand-line)
-  (define-key speedbar-buffers-key-map "=" 'speedbar-expand-line)
-  (define-key speedbar-buffers-key-map "-" 'speedbar-contract-line)
-  (define-key speedbar-buffers-key-map " " 'speedbar-toggle-line-expansion)
-
-  ;; Buffer specific keybindings
-  (define-key speedbar-buffers-key-map "k" 'speedbar-buffer-kill-buffer)
-  (define-key speedbar-buffers-key-map "r" 'speedbar-buffer-revert-buffer)
-
-  )
-
 (defvar speedbar-buffer-easymenu-definition
   '(["Jump to buffer" speedbar-edit-line t]
     ["Expand File Tags" speedbar-expand-line