From aac4965702d3d8c665e13e8c8c7f6fb229b05097 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 13 Sep 2022 15:05:28 +0200 Subject: [PATCH] Prefer defvar-keymap in several cases * 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. --- lisp/calc/calc-embed.el | 5 ++-- lisp/calc/calc-yank.el | 12 ++++------ lisp/calc/calc.el | 6 ++--- lisp/cedet/semantic/mru-bookmark.el | 8 +++---- lisp/cedet/semantic/util-modes.el | 36 +++++++++++------------------ lisp/cedet/srecode/srt-mode.el | 12 ++++------ lisp/gnus/gnus-art.el | 16 +++++-------- lisp/gnus/gnus-search.el | 8 +++---- lisp/gnus/score-mode.el | 12 ++++------ lisp/gnus/smime.el | 10 ++++---- lisp/indent.el | 10 ++++---- lisp/isearch.el | 20 ++++++++-------- lisp/printing.el | 12 ++++------ lisp/progmodes/prog-mode.el | 8 +++---- lisp/progmodes/subword.el | 5 ++-- lisp/reveal.el | 12 ++++------ lisp/strokes.el | 8 +++---- lisp/textmodes/flyspell.el | 8 +++---- lisp/textmodes/less-css-mode.el | 6 ++--- lisp/textmodes/remember.el | 20 +++++++--------- lisp/wid-browse.el | 18 ++++++--------- lisp/wid-edit.el | 8 +++---- 22 files changed, 102 insertions(+), 158 deletions(-) diff --git a/lisp/calc/calc-embed.el b/lisp/calc/calc-embed.el index bb427ef86e6..4a9ff256f9f 100644 --- a/lisp/calc/calc-embed.el +++ b/lisp/calc/calc-embed.el @@ -207,9 +207,8 @@ ;; 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) diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el index 504ba5b40d1..35014e022be 100644 --- a/lisp/calc/calc-yank.el +++ b/lisp/calc/calc-yank.el @@ -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) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 6c21430b1b3..5077c8c8528 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -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. diff --git a/lisp/cedet/semantic/mru-bookmark.el b/lisp/cedet/semantic/mru-bookmark.el index 9dee0415a33..c3f59a3358f 100644 --- a/lisp/cedet/semantic/mru-bookmark.el +++ b/lisp/cedet/semantic/mru-bookmark.el @@ -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. diff --git a/lisp/cedet/semantic/util-modes.el b/lisp/cedet/semantic/util-modes.el index 33fed9191e1..96d1de5a26c 100644 --- a/lisp/cedet/semantic/util-modes.el +++ b/lisp/cedet/semantic/util-modes.el @@ -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." + " " #'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." + "" #'semantic-highlight-func-menu) (defvar semantic-highlight-func-popup-menu nil "Menu used if the user clicks on the header line. diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el index 56b482e1001..cc0983f9f9d 100644 --- a/lisp/cedet/srecode/srt-mode.el +++ b/lisp/cedet/srecode/srt-mode.el @@ -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" diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 83ba72c091f..fbcf8013138 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -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 + "" #'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 + "" #'gnus-button-next-page + "RET" #'gnus-button-next-page) (defun gnus-insert-prev-page-button () (let ((b (point)) e diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 327dba95c07..b8f7e7a08f0 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -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." diff --git a/lisp/gnus/score-mode.el b/lisp/gnus/score-mode.el index 8e27e879392..4c9d73a6e5e 100644 --- a/lisp/gnus/score-mode.el +++ b/lisp/gnus/score-mode.el @@ -45,13 +45,11 @@ (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))) diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el index fd2791f5c51..7bb116d0c54 100644 --- a/lisp/gnus/smime.el +++ b/lisp/gnus/smime.el @@ -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") diff --git a/lisp/indent.el b/lisp/indent.el index b0c1a021da7..c7ec5c9a3ed 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -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. diff --git a/lisp/isearch.el b/lisp/isearch.el index 2ef35438e91..3e840b014fc 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -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 + "" #'isearch-yank-char-in-minibuffer) ;; Internal variables declared globally for byte-compiler. ;; These are all set with setq while isearching diff --git a/lisp/printing.el b/lisp/printing.el index d10de24e03c..0654dcda3df 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -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 diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 7738de6a745..f87230bd2f5 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -100,11 +100,9 @@ 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. diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el index e06eb9a6f70..34327f756ee 100644 --- a/lisp/progmodes/subword.el +++ b/lisp/progmodes/subword.el @@ -79,12 +79,11 @@ "\\(\\(\\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 diff --git a/lisp/reveal.el b/lisp/reveal.el index 64e9ceef644..b3b42177f94 100644 --- a/lisp/reveal.el +++ b/lisp/reveal.el @@ -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. + " " #'beginning-of-line + " " #'end-of-line) ;;;###autoload (define-minor-mode reveal-mode diff --git a/lisp/strokes.el b/lisp/strokes.el index 0edb20c2ebb..0f84588a41b 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el @@ -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-" #'strokes-do-stroke + "M-" #'strokes-do-complex-stroke) ;;;###autoload (define-minor-mode strokes-mode diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index a893bc7b9ce..774e7ac7377 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -425,11 +425,9 @@ like \"Some." ;;*---------------------------------------------------------------------*/ ;;* 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." + "" #'flyspell-correct-word) (defvar flyspell-mode-map (let ((map (make-sparse-keymap))) diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el index a0462756b0b..5d17b390f4d 100644 --- a/lisp/textmodes/less-css-mode.el +++ b/lisp/textmodes/less-css-mode.el @@ -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 diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el index c7a9f20ea2c..f8c7af25005 100644 --- a/lisp/textmodes/remember.el +++ b/lisp/textmodes/remember.el @@ -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. diff --git a/lisp/wid-browse.el b/lisp/wid-browse.el index 7fc476e5dfd..a90f7bc160b 100644 --- a/lisp/wid-browse.el +++ b/lisp/wid-browse.el @@ -35,12 +35,10 @@ ;;; 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 diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 9aec6b02441..4d9663cea95 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -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." -- 2.39.2