From: Stefan Kangas Date: Thu, 4 Aug 2022 21:35:46 +0000 (+0200) Subject: Prefer defvar-keymap in mail/*.el X-Git-Tag: emacs-29.0.90~1447^2~427 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8ea7506d724903008910bc47e88212da55549ede;p=emacs.git Prefer defvar-keymap in mail/*.el * lisp/mail/mspools.el (mspools-mode-map): * lisp/mail/rmailedit.el (rmail-edit-map): * lisp/mail/rmailsum.el (rmail-summary-edit-map): * lisp/mail/supercite.el (sc-T-keymap, sc-mode-map) (sc-electric-mode-map, sc-minibuffer-local-completion-map) (sc-minibuffer-local-map): Prefer defvar-keymap. --- diff --git a/lisp/mail/mspools.el b/lisp/mail/mspools.el index 4dcde0d3545..2ab4fa411a6 100644 --- a/lisp/mail/mspools.el +++ b/lisp/mail/mspools.el @@ -164,17 +164,13 @@ your primary spool is. If this fails, set it to something like (defvar mspools-buffer "*spools*" "Name of buffer for displaying spool info.") -(defvar mspools-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-c\C-c" #'mspools-visit-spool) - (define-key map "\C-m" #'mspools-visit-spool) - (define-key map " " #'mspools-visit-spool) - (define-key map "n" #'next-line) - (define-key map "p" #'previous-line) - map) - "Keymap for the *spools* buffer.") - -;;; Code +(defvar-keymap mspools-mode-map + :doc "Keymap for the *spools* buffer." + "C-c C-c" #'mspools-visit-spool + "RET" #'mspools-visit-spool + "SPC" #'mspools-visit-spool + "n" #'next-line + "p" #'previous-line) ;;; VM Specific code (if mspools-using-vm diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el index 79bd02fd67e..553fac26f9e 100644 --- a/lisp/mail/rmailedit.el +++ b/lisp/mail/rmailedit.el @@ -34,13 +34,10 @@ :group 'rmail-edit) -(defvar rmail-edit-map - (let ((map (make-sparse-keymap))) - ;; Make a keymap that inherits text-mode-map. - (set-keymap-parent map text-mode-map) - (define-key map "\C-c\C-c" #'rmail-cease-edit) - (define-key map "\C-c\C-]" #'rmail-abort-edit) - map)) +(defvar-keymap rmail-edit-map + :parent text-mode-map + "C-c C-c" #'rmail-cease-edit + "C-c C-]" #'rmail-abort-edit) (declare-function rmail-summary-disable "rmailsum" ()) diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index b23fbc3f600..cc76df718c2 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -1480,11 +1480,10 @@ 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 - (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)) +(defvar-keymap rmail-summary-edit-map + :parent text-mode-map + "C-c C-c" #'rmail-cease-edit + "C-c C-]" #'rmail-abort-edit) (defun rmail-summary-edit-current-message () "Edit the contents of this message." diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el index 3f8a940382e..98f46a3af55 100644 --- a/lisp/mail/supercite.el +++ b/lisp/mail/supercite.el @@ -520,75 +520,67 @@ string." ;; ====================================================================== ;; supercite keymaps -(defvar sc-T-keymap - (let ((map (make-sparse-keymap))) - (define-key map "a" #'sc-S-preferred-attribution-list) - (define-key map "b" #'sc-T-mail-nuke-blank-lines) - (define-key map "c" #'sc-T-confirm-always) - (define-key map "d" #'sc-T-downcase) - (define-key map "e" #'sc-T-electric-references) - (define-key map "f" #'sc-T-auto-fill-region) - (define-key map "h" #'sc-T-describe) - (define-key map "l" #'sc-S-cite-region-limit) - (define-key map "n" #'sc-S-mail-nuke-mail-headers) - (define-key map "N" #'sc-S-mail-header-nuke-list) - (define-key map "o" #'sc-T-electric-circular) - (define-key map "p" #'sc-S-preferred-header-style) - (define-key map "s" #'sc-T-nested-citation) - (define-key map "u" #'sc-T-use-only-preferences) - (define-key map "w" #'sc-T-fixup-whitespace) - (define-key map "?" #'sc-T-describe) - map) - "Keymap for sub-keymap of setting and toggling functions.") - -(defvar sc-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "c" #'sc-cite-region) - (define-key map "f" #'sc-mail-field-query) - (define-key map "g" #'sc-mail-process-headers) - (define-key map "h" #'sc-describe) - (define-key map "i" #'sc-insert-citation) - (define-key map "o" #'sc-open-line) - (define-key map "r" #'sc-recite-region) - (define-key map "\C-p" #'sc-raw-mode-toggle) - (define-key map "u" #'sc-uncite-region) - (define-key map "w" #'sc-insert-reference) - (define-key map "\C-t" sc-T-keymap) - (define-key map "?" #'sc-describe) - map) - "Keymap for Supercite quasi-mode.") - -(defvar sc-electric-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "p" #'sc-eref-prev) - (define-key map "n" #'sc-eref-next) - (define-key map "s" #'sc-eref-setn) - (define-key map "j" #'sc-eref-jump) - (define-key map "x" #'sc-eref-abort) - (define-key map "q" #'sc-eref-abort) - (define-key map "\r" #'sc-eref-exit) - (define-key map "\n" #'sc-eref-exit) - (define-key map "g" #'sc-eref-goto) - (define-key map "?" #'describe-mode) - (define-key map "\C-h" #'describe-mode) - (define-key map [f1] #'describe-mode) - (define-key map [help] #'describe-mode) - map) - "Keymap for `sc-electric-mode' electric references mode.") - - -(defvar sc-minibuffer-local-completion-map - (let ((map (copy-keymap minibuffer-local-completion-map))) - (define-key map "\C-t" #'sc-toggle-fn) - (define-key map " " #'self-insert-command) - map) - "Keymap for minibuffer confirmation of attribution strings.") - -(defvar sc-minibuffer-local-map - (let ((map (copy-keymap minibuffer-local-map))) - (define-key map "\C-t" #'sc-toggle-fn) - map) - "Keymap for minibuffer confirmation of attribution strings.") +(defvar-keymap sc-T-keymap + :doc "Keymap for sub-keymap of setting and toggling functions." + "a" #'sc-S-preferred-attribution-list + "b" #'sc-T-mail-nuke-blank-lines + "c" #'sc-T-confirm-always + "d" #'sc-T-downcase + "e" #'sc-T-electric-references + "f" #'sc-T-auto-fill-region + "h" #'sc-T-describe + "l" #'sc-S-cite-region-limit + "n" #'sc-S-mail-nuke-mail-headers + "N" #'sc-S-mail-header-nuke-list + "o" #'sc-T-electric-circular + "p" #'sc-S-preferred-header-style + "s" #'sc-T-nested-citation + "u" #'sc-T-use-only-preferences + "w" #'sc-T-fixup-whitespace + "?" #'sc-T-describe) + +(defvar-keymap sc-mode-map + :doc "Keymap for Supercite quasi-mode." + "c" #'sc-cite-region + "f" #'sc-mail-field-query + "g" #'sc-mail-process-headers + "h" #'sc-describe + "i" #'sc-insert-citation + "o" #'sc-open-line + "r" #'sc-recite-region + "C-p" #'sc-raw-mode-toggle + "u" #'sc-uncite-region + "w" #'sc-insert-reference + "C-t" sc-T-keymap + "?" #'sc-describe) + +(defvar-keymap sc-electric-mode-map + :doc "Keymap for `sc-electric-mode' electric references mode." + "p" #'sc-eref-prev + "n" #'sc-eref-next + "s" #'sc-eref-setn + "j" #'sc-eref-jump + "x" #'sc-eref-abort + "q" #'sc-eref-abort + "RET" #'sc-eref-exit + "C-j" #'sc-eref-exit + "g" #'sc-eref-goto + "?" #'describe-mode + "C-h" #'describe-mode + "" #'describe-mode + "" #'describe-mode) + + +(defvar-keymap sc-minibuffer-local-completion-map + :doc "Keymap for minibuffer confirmation of attribution strings." + :parent minibuffer-local-completion-map + "C-t" #'sc-toggle-fn + "SPC" #'self-insert-command) + +(defvar-keymap sc-minibuffer-local-map + :doc "Keymap for minibuffer confirmation of attribution strings." + :parent minibuffer-local-map + "C-t" #'sc-toggle-fn) ;; ======================================================================