]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer defvar-keymap in several cases
authorStefan Kangas <stefankangas@gmail.com>
Tue, 13 Sep 2022 13:05:28 +0000 (15:05 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Tue, 13 Sep 2022 13:05:38 +0000 (15:05 +0200)
* lisp/calc/calc-embed.el (calc-override-minor-modes-map):
* lisp/calc/calc-yank.el (calc-edit-mode-map):
* lisp/calc/calc.el (calc-trail-mode-map):
* lisp/cedet/semantic/mru-bookmark.el (semantic-mru-bookmark-mode-map):
* lisp/cedet/semantic/util-modes.el (semantic-highlight-edits-mode-map)
(semantic-show-unmatched-syntax-mode-map)
(semantic-show-parser-state-mode-map)
(semantic-stickyfunc-mode-map, semantic-highlight-func-mode-map):
* lisp/cedet/srecode/srt-mode.el (srecode-template-mode-map):
* lisp/gnus/gnus-art.el (gnus-prev-page-map, gnus-next-page-map):
* lisp/gnus/gnus-search.el (gnus-search-minibuffer-map):
* lisp/gnus/score-mode.el (gnus-score-mode-map):
* lisp/gnus/smime.el (smime-mode-map):
* lisp/indent.el (edit-tab-stops-map):
* lisp/isearch.el (minibuffer-local-isearch-map):
* lisp/printing.el (pr-interface-map):
* lisp/progmodes/prog-mode.el (prog-mode-map):
* lisp/progmodes/subword.el (subword-mode-map):
* lisp/reveal.el (reveal-mode-map):
* lisp/strokes.el (strokes-mode-map):
* lisp/textmodes/flyspell.el (flyspell-mouse-map):
* lisp/textmodes/less-css-mode.el (less-css-mode-map):
* lisp/textmodes/remember.el (remember-mode-map)
(remember-notes-mode-map):
* lisp/wid-browse.el (widget-browse-mode-map):
* lisp/wid-edit.el (widget-key-sequence-map): Prefer defvar-keymap in
some easy-to-convert cases.

22 files changed:
lisp/calc/calc-embed.el
lisp/calc/calc-yank.el
lisp/calc/calc.el
lisp/cedet/semantic/mru-bookmark.el
lisp/cedet/semantic/util-modes.el
lisp/cedet/srecode/srt-mode.el
lisp/gnus/gnus-art.el
lisp/gnus/gnus-search.el
lisp/gnus/score-mode.el
lisp/gnus/smime.el
lisp/indent.el
lisp/isearch.el
lisp/printing.el
lisp/progmodes/prog-mode.el
lisp/progmodes/subword.el
lisp/reveal.el
lisp/strokes.el
lisp/textmodes/flyspell.el
lisp/textmodes/less-css-mode.el
lisp/textmodes/remember.el
lisp/wid-browse.el
lisp/wid-edit.el

index bb427ef86e656893b607c1007d362dc42ab19cb6..4a9ff256f9ffda5a6171aac297ba48e56e586d02 100644 (file)
 
 ;; The following is to take care of any minor modes which override
 ;; a Calc command.
-(defvar calc-override-minor-modes-map
-  (make-sparse-keymap)
-  "A list of keybindings that might be overwritten by minor modes.")
+(defvar-keymap calc-override-minor-modes-map
+  :doc "A list of keybindings that might be overwritten by minor modes.")
 
 ;; Add any keys that might be overwritten here.
 (define-key calc-override-minor-modes-map "`" 'calc-edit)
index 504ba5b40d1bdc4f24e5fdec55c72343ac74cf16..35014e022be4e0faf5fa151a4cf9ebc3eb82a277 100644 (file)
@@ -668,13 +668,11 @@ Interactively, reads the register using `register-read-with-preview'."
   (backward-char 1)
   (calc-set-command-flag 'do-edit))
 
-(defvar calc-edit-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\n" #'calc-edit-finish)
-    (define-key map "\r" #'calc-edit-return)
-    (define-key map "\C-c\C-c" #'calc-edit-finish)
-    map)
-  "Keymap for use by the `calc-edit' command.")
+(defvar-keymap calc-edit-mode-map
+  :doc "Keymap for use by the `calc-edit' command."
+  "C-j"     #'calc-edit-finish
+  "RET"     #'calc-edit-return
+  "C-c C-c" #'calc-edit-finish)
 
 (defvar calc-original-buffer nil)
 (defvar calc-return-buffer nil)
index 6c21430b1b3f6c6b081dc03dc8c144395c0ee9db..5077c8c8528dad70f72e729b48189b63d8e1ec53 100644 (file)
@@ -1373,10 +1373,8 @@ Notations:  3.14e6     3.14 * 10^6
              (calc-check-defines))
          (setplist 'calc-define nil)))))
 
-(defvar calc-trail-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map calc-mode-map)
-    map))
+(defvar-keymap calc-trail-mode-map
+  :parent calc-mode-map)
 
 (defun calc--header-line (long short width &optional fudge)
   "Return a Calc header line appropriate for the buffer WIDTH.
index 9dee0415a33114655fd03f997967bc6ac0bfe9b4..c3f59a3358f6e10e3256ccdc14891e20797b39c6 100644 (file)
@@ -264,11 +264,9 @@ been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]."
   :group 'semantic
   :type 'hook)
 
-(defvar semantic-mru-bookmark-mode-map
-  (let ((km (make-sparse-keymap)))
-    (define-key km "\C-xB" #'semantic-mrub-switch-tags)
-    km)
-  "Keymap for mru-bookmark minor mode.")
+(defvar-keymap semantic-mru-bookmark-mode-map
+  :doc "Keymap for mru-bookmark minor mode."
+  "C-x B" #'semantic-mrub-switch-tags)
 
 (define-minor-mode semantic-mru-bookmark-mode
   "Minor mode for tracking tag-based bookmarks automatically.
index 33fed9191e1ed89b8f7ffe7a1c00911b85914baf..96d1de5a26c372c6ee9d8d1ad77b2f9de3bea4fd 100644 (file)
@@ -196,10 +196,8 @@ Argument OVERLAY is the overlay created to mark the change.
 This function will set the face property on this overlay."
   (overlay-put overlay 'face 'semantic-highlight-edits-face))
 
-(defvar semantic-highlight-edits-mode-map
-  (let ((km (make-sparse-keymap)))
-    km)
-  "Keymap for highlight-edits minor mode.")
+(defvar-keymap semantic-highlight-edits-mode-map
+  :doc "Keymap for highlight-edits minor mode.")
 
 ;;;###autoload
 (define-minor-mode semantic-highlight-edits-mode
@@ -343,11 +341,9 @@ Do not search past BOUND if non-nil."
                 (setq ol (cdr ol))))))
       ol)))
 
-(defvar semantic-show-unmatched-syntax-mode-map
-  (let ((km (make-sparse-keymap)))
-    (define-key km "\C-c,`" #'semantic-show-unmatched-syntax-next)
-    km)
-  "Keymap for command `semantic-show-unmatched-syntax-mode'.")
+(defvar-keymap semantic-show-unmatched-syntax-mode-map
+  :doc "Keymap for command `semantic-show-unmatched-syntax-mode'."
+  "C-c , `" #'semantic-show-unmatched-syntax-next)
 
 ;;;###autoload
 (define-minor-mode semantic-show-unmatched-syntax-mode
@@ -417,10 +413,8 @@ non-nil if the minor mode is enabled.
   :group 'semantic
   :type 'hook)
 
-(defvar semantic-show-parser-state-mode-map
-  (let ((km (make-sparse-keymap)))
-    km)
-  "Keymap for show-parser-state minor mode.")
+(defvar-keymap semantic-show-parser-state-mode-map
+  :doc "Keymap for show-parser-state minor mode.")
 
 ;;;###autoload
 (define-minor-mode semantic-show-parser-state-mode
@@ -553,11 +547,9 @@ to indicate a parse in progress."
   :group 'semantic
   :type 'hook)
 
-(defvar semantic-stickyfunc-mode-map
-  (let ((km (make-sparse-keymap)))
-    (define-key km [ header-line down-mouse-1 ] #'semantic-stickyfunc-menu)
-    km)
-  "Keymap for stickyfunc minor mode.")
+(defvar-keymap semantic-stickyfunc-mode-map
+  :doc "Keymap for stickyfunc minor mode."
+  "<header-line> <down-mouse-1>" #'semantic-stickyfunc-menu)
 
 (defvar semantic-stickyfunc-popup-menu nil
   "Menu used if the user clicks on the header line used by stickyfunc mode.")
@@ -824,11 +816,9 @@ Argument EVENT describes the event that caused this function to be called."
   :group 'semantic
   :type 'hook)
 
-(defvar semantic-highlight-func-mode-map
-  (let ((km (make-sparse-keymap)))
-    (define-key km [mouse-3] #'semantic-highlight-func-menu)
-    km)
-  "Keymap for highlight-func minor mode.")
+(defvar-keymap semantic-highlight-func-mode-map
+  :doc "Keymap for highlight-func minor mode."
+  "<mouse-3>" #'semantic-highlight-func-menu)
 
 (defvar semantic-highlight-func-popup-menu nil
   "Menu used if the user clicks on the header line.
index 56b482e1001c6aca483cebda7d73270cbe42d58d..cc0983f9f9db862eb61d4dcb5ce905c9a7ab4655 100644 (file)
@@ -179,13 +179,11 @@ Don't scan past LIMIT."
 Once the escape_start, and escape_end sequences are known, then
 we can tell font lock about them.")
 
-(defvar srecode-template-mode-map
-  (let ((km (make-sparse-keymap)))
-    (define-key km "\C-c\C-c" #'srecode-compile-templates)
-    (define-key km "\C-c\C-m" #'srecode-macro-help)
-    (define-key km "/" #'srecode-self-insert-complete-end-macro)
-    km)
-  "Keymap used in srecode mode.")
+(defvar-keymap srecode-template-mode-map
+  :doc "Keymap used in srecode mode."
+  "C-c C-c" #'srecode-compile-templates
+  "C-c C-m" #'srecode-macro-help
+  "/"       #'srecode-self-insert-complete-end-macro)
 
 ;;;###autoload
 (define-derived-mode srecode-template-mode fundamental-mode "SRecode"
index 83ba72c091f15a81db9e116be22ac456127fc259..fbcf801313805275e3a95a7fc93c84193037fc14 100644 (file)
@@ -8550,17 +8550,13 @@ url is put as the `gnus-button-url' overlay property on the button."
 (defvar gnus-next-page-line-format "%{%(Next page...%)%}\n")
 (defvar gnus-prev-page-line-format "%{%(Previous page...%)%}\n")
 
-(defvar gnus-prev-page-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [mouse-2] #'gnus-button-prev-page)
-    (define-key map "\r"      #'gnus-button-prev-page)
-    map))
+(defvar-keymap gnus-prev-page-map
+  "<mouse-2>" #'gnus-button-prev-page
+  "RET"       #'gnus-button-prev-page)
 
-(defvar gnus-next-page-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [mouse-2] #'gnus-button-next-page)
-    (define-key map "\r"      #'gnus-button-next-page)
-    map))
+(defvar-keymap gnus-next-page-map
+  "<mouse-2>" #'gnus-button-next-page
+  "RET"       #'gnus-button-next-page)
 
 (defun gnus-insert-prev-page-button ()
   (let ((b (point)) e
index 327dba95c076359eb6f57319733afc0fecb01a2e..b8f7e7a08f09cdc390ca2ea232e028eb806424ec 100644 (file)
@@ -2247,11 +2247,9 @@ article came from is also searched."
            (forward-line)))))
     groups))
 
-(defvar gnus-search-minibuffer-map
-  (let ((km (make-sparse-keymap)))
-    (set-keymap-parent km minibuffer-local-map)
-    (define-key km (kbd "TAB") #'completion-at-point)
-    km))
+(defvar-keymap gnus-search-minibuffer-map
+  :parent minibuffer-local-map
+  "TAB" #'completion-at-point)
 
 (defun gnus-search--complete-key-data ()
   "Potentially return completion data for a search key or value."
index 8e27e879392deb5e717d3e869a3dac5c48ddaf14..4c9d73a6e5e1f1598654fabcdffbbebfa740ce5f 100644 (file)
 (defvar gnus-score-edit-exit-function nil
   "Function run on exit from the score buffer.")
 
-(defvar gnus-score-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map emacs-lisp-mode-map)
-    (define-key map "\C-c\C-c" 'gnus-score-edit-exit)
-    (define-key map "\C-c\C-d" 'gnus-score-edit-insert-date)
-    (define-key map "\C-c\C-p" 'gnus-score-pretty-print)
-    map))
+(defvar-keymap gnus-score-mode-map
+  :parent emacs-lisp-mode-map
+  "C-c C-c" #'gnus-score-edit-exit
+  "C-c C-d" #'gnus-score-edit-insert-date
+  "C-c C-p" #'gnus-score-pretty-print)
 
 (defvar score-mode-syntax-table
   (let ((table (copy-syntax-table lisp-mode-syntax-table)))
index fd2791f5c51c9f2baa735f3a31eb49a8806bb31b..7bb116d0c5430e4788665a4a6461bb45ccaca865 100644 (file)
@@ -614,12 +614,10 @@ A string or a list of strings is returned."
 
 (defvar smime-buffer "*SMIME*")
 
-(defvar smime-mode-map
-  (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
-    (define-key map "q" 'smime-exit)
-    (define-key map "f" 'smime-certificate-info)
-    map))
+(defvar-keymap smime-mode-map
+  :suppress t
+  "q" #'smime-exit
+  "f" #'smime-certificate-info)
 
 (autoload 'gnus-completing-read "gnus-util")
 
index b0c1a021da77c6acae7db2021281e44121e6a2fb..c7ec5c9a3ed29f474f1e000b4ab0171708ccc68e 100644 (file)
@@ -695,12 +695,10 @@ A value of nil means a tab stop every `tab-width' columns."
   :safe 'listp
   :type '(repeat integer))
 
-(defvar edit-tab-stops-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\C-x\C-s" 'edit-tab-stops-note-changes)
-    (define-key map "\C-c\C-c" 'edit-tab-stops-note-changes)
-    map)
-  "Keymap used in `edit-tab-stops'.")
+(defvar-keymap edit-tab-stops-map
+  :doc "Keymap used in `edit-tab-stops'."
+  "C-x C-s" #'edit-tab-stops-note-changes
+  "C-c C-c" #'edit-tab-stops-note-changes)
 
 (defvar edit-tab-stops-buffer nil
   "Buffer whose tab stops are being edited.
index 2ef35438e913bd6268390bca33c41ff786a584af..3e840b014fc733999296db4181ec0992b46de5bf 100644 (file)
@@ -832,17 +832,15 @@ This is like `describe-bindings', but displays only Isearch keys."
             :image '(isearch-tool-bar-image "left-arrow")))
     map))
 
-(defvar minibuffer-local-isearch-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map minibuffer-local-map)
-    (define-key map "\r"    'exit-minibuffer)
-    (define-key map "\M-\t" 'isearch-complete-edit)
-    (define-key map "\C-s"  'isearch-forward-exit-minibuffer)
-    (define-key map "\C-r"  'isearch-reverse-exit-minibuffer)
-    (define-key map "\C-f"  'isearch-yank-char-in-minibuffer)
-    (define-key map [right] 'isearch-yank-char-in-minibuffer)
-    map)
-  "Keymap for editing Isearch strings in the minibuffer.")
+(defvar-keymap minibuffer-local-isearch-map
+  :doc "Keymap for editing Isearch strings in the minibuffer."
+  :parent minibuffer-local-map
+  "RET"     #'exit-minibuffer
+  "M-TAB"   #'isearch-complete-edit
+  "C-s"     #'isearch-forward-exit-minibuffer
+  "C-r"     #'isearch-reverse-exit-minibuffer
+  "C-f"     #'isearch-yank-char-in-minibuffer
+  "<right>" #'isearch-yank-char-in-minibuffer)
 
 ;; Internal variables declared globally for byte-compiler.
 ;; These are all set with setq while isearching
index d10de24e03cca7fd836e6d22dc079626857099c5..0654dcda3df50f0080e59c1dd7014543ba7cce00 100644 (file)
@@ -5546,13 +5546,11 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
 (defvar pr-i-ps-send    'printer)
 
 
-(defvar pr-interface-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map widget-keymap)
-    (define-key map "q" 'pr-interface-quit)
-    (define-key map "?" 'pr-interface-help)
-    map)
-  "Keymap for `pr-interface'.")
+(defvar-keymap pr-interface-map
+  :doc "Keymap for `pr-interface'."
+  :parent widget-keymap
+  "q" #'pr-interface-quit
+  "?" #'pr-interface-help)
 
 (defmacro pr-interface-save (&rest body)
   `(with-current-buffer pr-i-buffer
index 7738de6a7459c4f814fd48aa3cb0d9586a2d866c..f87230bd2f57afca7acf42c4895977672b31fa00 100644 (file)
 
   menu)
 
-(defvar prog-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [?\C-\M-q] 'prog-indent-sexp)
-    map)
-  "Keymap used for programming modes.")
+(defvar-keymap prog-mode-map
+  :doc "Keymap used for programming modes."
+  "C-M-q" #'prog-indent-sexp)
 
 (defvar prog-indentation-context nil
   "When non-nil, provides context for indenting embedded code chunks.
index e06eb9a6f70c2bf50ecdbd961b2146b61ad18376..34327f756eeab9b5d6b53622d8a5f934e97580f7 100644 (file)
   "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([[:upper:]]+\\W*\\)\\|\\W\\w+\\)"
   "Regexp used by `subword-backward-internal'.")
 
-(defvar subword-mode-map
+(defvar-keymap subword-mode-map
   ;; We originally remapped motion keys here, but now use Emacs core
   ;; hooks.  Leave this keymap around so that user additions to it
   ;; keep working.
-  (make-sparse-keymap)
-  "Keymap used in `subword-mode' minor mode.")
+  :doc "Keymap used in `subword-mode' minor mode.")
 
 ;;;###autoload
 (define-obsolete-function-alias
index 64e9ceef64425a4f149e1643214691025edcd8ca..b3b42177f94e418cba96a813a43fe880c7c0db40 100644 (file)
@@ -210,13 +210,11 @@ that text."
   (let ((reveal-auto-hide t))
     (reveal-post-command)))
 
-(defvar reveal-mode-map
-  (let ((map (make-sparse-keymap)))
-    ;; Override the default move-beginning-of-line and move-end-of-line
-    ;; which skips valuable invisible text.
-    (define-key map [remap move-beginning-of-line] 'beginning-of-line)
-    (define-key map [remap move-end-of-line] 'end-of-line)
-    map))
+(defvar-keymap reveal-mode-map
+  ;; Override the default move-beginning-of-line and move-end-of-line
+  ;; which skips valuable invisible text.
+  "<remap> <move-beginning-of-line>" #'beginning-of-line
+  "<remap> <move-end-of-line>"       #'end-of-line)
 
 ;;;###autoload
 (define-minor-mode reveal-mode
index 0edb20c2ebbf3df5ac8e88b8d38bf3ed2ee1f74c..0f84588a41b8636687608849ac6dcb506ea223c2 100644 (file)
@@ -1359,11 +1359,9 @@ If STROKES-MAP is not given, `strokes-global-map' will be used instead."
   "Return t if STROKE1's command name precedes STROKE2's in lexicographic order."
   (string-lessp (cdr stroke1) (cdr stroke2)))
 
-(defvar strokes-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [(shift down-mouse-2)] #'strokes-do-stroke)
-    (define-key map [(meta down-mouse-2)] #'strokes-do-complex-stroke)
-    map))
+(defvar-keymap strokes-mode-map
+  "S-<down-mouse-2>" #'strokes-do-stroke
+  "M-<down-mouse-2>" #'strokes-do-complex-stroke)
 
 ;;;###autoload
 (define-minor-mode strokes-mode
index a893bc7b9cebaccc1d1f4eddb5b29b86e12217ad..774e7ac73778023c4f1426b568fa1986ef1cc6b2 100644 (file)
@@ -425,11 +425,9 @@ like <img alt=\"Some thing.\">."
 ;;*---------------------------------------------------------------------*/
 ;;*    The minor mode declaration.                                      */
 ;;*---------------------------------------------------------------------*/
-(defvar flyspell-mouse-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [mouse-2] 'flyspell-correct-word)
-    map)
-  "Keymap for Flyspell to put on erroneous words.")
+(defvar-keymap flyspell-mouse-map
+  :doc "Keymap for Flyspell to put on erroneous words."
+  "<mouse-2>" #'flyspell-correct-word)
 
 (defvar flyspell-mode-map
   (let ((map (make-sparse-keymap)))
index a0462756b0b6b2dcc4657f4b480a219dcb979a0b..5d17b390f4de31a54ee860ed092e8406274b7ae7 100644 (file)
@@ -209,10 +209,8 @@ directory by default."
     (modify-syntax-entry ?. "'" st)
     st))
 
-(defvar less-css-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\C-c\C-c" #'less-css-compile)
-    map))
+(defvar-keymap less-css-mode-map
+  "C-c C-c" #'less-css-compile)
 
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.less\\'" . less-css-mode))
 ;;;###autoload
index c7a9f20ea2c2635d5bc080850d53e8049446277f..f8c7af250051298924cf81dbb0f706475c07b4d5 100644 (file)
@@ -548,13 +548,11 @@ If this is nil, then `diary-file' will be used instead."
 
 ;;; Internal Functions:
 
-(defvar remember-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\C-x\C-s" #'remember-finalize)
-    (define-key map "\C-c\C-c" #'remember-finalize)
-    (define-key map "\C-c\C-k" #'remember-destroy)
-    map)
-  "Keymap used in `remember-mode'.")
+(defvar-keymap remember-mode-map
+  :doc "Keymap used in `remember-mode'."
+  "C-x C-s" #'remember-finalize
+  "C-c C-c" #'remember-finalize
+  "C-c C-k" #'remember-destroy)
 
 (define-derived-mode remember-mode text-mode "Remember"
   "Major mode for output from \\[remember].
@@ -596,11 +594,9 @@ If this is nil, use `initial-major-mode'."
 
 
 
-(defvar remember-notes-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "\C-c\C-c" #'remember-notes-save-and-bury-buffer)
-    map)
-  "Keymap used in `remember-notes-mode'.")
+(defvar-keymap remember-notes-mode-map
+  :doc "Keymap used in `remember-notes-mode'."
+  "C-c C-c" #'remember-notes-save-and-bury-buffer)
 
 (define-minor-mode remember-notes-mode
   "Minor mode for the `remember-notes' buffer.
index 7fc476e5dfdf9d6162213a6c23ca0574814644f8..a90f7bc160b70d23f7ed7f128a0dab1f635db5de 100644 (file)
 
 ;;; The Mode.
 
-(defvar widget-browse-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map widget-keymap)
-    (define-key map "q" #'bury-buffer)
-    map)
-  "Keymap for `widget-browse-mode'.")
+(defvar-keymap widget-browse-mode-map
+  :doc "Keymap for `widget-browse-mode'."
+  :parent widget-keymap
+  "q" #'bury-buffer)
 
 (easy-menu-define widget-browse-mode-customize-menu
     widget-browse-mode-map
@@ -245,11 +243,9 @@ VALUE is assumed to be a list of widgets."
 
 ;;; Widget Minor Mode.
 
-(defvar widget-minor-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map widget-keymap)
-    map)
-  "Keymap used in Widget Minor Mode.")
+(defvar-keymap widget-minor-mode-map
+  :doc "Keymap used in Widget Minor Mode."
+  :parent widget-keymap)
 
 ;;;###autoload
 (define-minor-mode widget-minor-mode
index 9aec6b02441accd57ae0ea0a37b8c8bcebf3c438..4d9663cea959f60b0f30f59b5b3eb1af2a35eac5 100644 (file)
@@ -3452,11 +3452,9 @@ It reads a directory name from an editable text field."
 (defvar widget-key-sequence-default-value [ignore]
   "Default value for an empty key sequence.")
 
-(defvar widget-key-sequence-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map widget-field-keymap)
-    (define-key map [(control ?q)] 'widget-key-sequence-read-event)
-    map))
+(defvar-keymap widget-key-sequence-map
+  :parent widget-field-keymap
+  "C-q" #'widget-key-sequence-read-event)
 
 (define-widget 'key-sequence 'restricted-sexp
   "A key sequence.  This is obsolete; use the `key' type instead."