From cbbecd46fda2c07b5e00d5ad63e7487680cd5b36 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 12 Sep 2022 16:47:53 +0200 Subject: [PATCH] Prefer defvar-keymap in lisp/epa*.el * lisp/epa-ks.el (epa-ks-search-mode-map): * lisp/epa.el (epa-key-list-mode-map, epa-key-mode-map): Prefer defvar-keymap. --- lisp/epa-ks.el | 14 ++++++-------- lisp/epa.el | 48 ++++++++++++++++++++++-------------------------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/lisp/epa-ks.el b/lisp/epa-ks.el index 7c60b659f0a..df8a72af70e 100644 --- a/lisp/epa-ks.el +++ b/lisp/epa-ks.el @@ -66,14 +66,12 @@ This is used by `epa-ks-lookup-key', for looking up public keys." "List of arguments to pass to `epa-search-keys'. This is used when reverting a buffer to restart search.") -(defvar epa-ks-search-mode-map - (let ((map (make-sparse-keymap))) - (suppress-keymap map) - (define-key map (kbd "f") #'epa-ks-mark-key-to-fetch) - (define-key map (kbd "i") #'epa-ks-inspect-key-to-fetch) - (define-key map (kbd "u") #'epa-ks-unmark-key-to-fetch) - (define-key map (kbd "x") #'epa-ks-do-key-to-fetch) - map)) +(defvar-keymap epa-ks-search-mode-map + :suppress t + "f" #'epa-ks-mark-key-to-fetch + "i" #'epa-ks-inspect-key-to-fetch + "u" #'epa-ks-unmark-key-to-fetch + "x" #'epa-ks-do-key-to-fetch) (define-derived-mode epa-ks-search-mode tabulated-list-mode "Keyserver" "Major mode for listing public key search results." diff --git a/lisp/epa.el b/lisp/epa.el index 63bc0941d62..cb87d808857 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -183,28 +183,26 @@ You should bind this variable with `let', but do not set it globally.") (defvar epa-suppress-error-buffer nil) (defvar epa-last-coding-system-specified nil) -(defvar epa-key-list-mode-map - (let ((keymap (make-sparse-keymap))) - (define-key keymap "\C-m" 'epa-show-key) - (define-key keymap [?\t] 'forward-button) - (define-key keymap [backtab] 'backward-button) - (define-key keymap "m" 'epa-mark-key) - (define-key keymap "u" 'epa-unmark-key) - (define-key keymap "d" 'epa-decrypt-file) - (define-key keymap "v" 'epa-verify-file) - (define-key keymap "s" 'epa-sign-file) - (define-key keymap "e" 'epa-encrypt-file) - (define-key keymap "r" 'epa-delete-keys) - (define-key keymap "i" 'epa-import-keys) - (define-key keymap "o" 'epa-export-keys) - (define-key keymap "g" 'revert-buffer) - (define-key keymap "n" 'next-line) - (define-key keymap "p" 'previous-line) - (define-key keymap " " 'scroll-up-command) - (define-key keymap [?\S-\ ] 'scroll-down-command) - (define-key keymap [delete] 'scroll-down-command) - (define-key keymap "q" 'epa-exit-buffer) - keymap)) +(defvar-keymap epa-key-list-mode-map + "RET" #'epa-show-key + "TAB" #'forward-button + "" #'backward-button + "m" #'epa-mark-key + "u" #'epa-unmark-key + "d" #'epa-decrypt-file + "v" #'epa-verify-file + "s" #'epa-sign-file + "e" #'epa-encrypt-file + "r" #'epa-delete-keys + "i" #'epa-import-keys + "o" #'epa-export-keys + "g" #'revert-buffer + "n" #'next-line + "p" #'previous-line + "SPC" #'scroll-up-command + "S-SPC" #'scroll-down-command + "" #'scroll-down-command + "q" #'epa-exit-buffer) (easy-menu-define epa-key-list-mode-menu epa-key-list-mode-map "Menu for `epa-key-list-mode'." @@ -230,10 +228,8 @@ You should bind this variable with `let', but do not set it globally.") ["Unmark Key" epa-unmark-key :help "Unmark a key"])) -(defvar epa-key-mode-map - (let ((keymap (make-sparse-keymap))) - (define-key keymap "q" 'epa-exit-buffer) - keymap)) +(defvar-keymap epa-key-mode-map + "q" #'epa-exit-buffer) (defvar epa-exit-buffer-function #'quit-window)