From: Lars Ingebrigtsen Date: Tue, 19 Oct 2021 02:50:59 +0000 (+0200) Subject: Error out on invalid `define-keymap' keywords X-Git-Tag: emacs-29.0.90~3671^2~501 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5c996471babfca2ac54591f7182d31fe7df151f0;p=emacs.git Error out on invalid `define-keymap' keywords * lisp/subr.el (define-keymap--define): Error out on invalid keywords (bug#51268). * lisp/emacs-lisp/byte-opt.el (byte-optimize-define-keymap): Check keywords at compile time. * lisp/vc/cvs-status.el (cvs-status-mode-map): Fix keyword. --- diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index abfc9b3b316..9b3b2e5ce14 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1211,6 +1211,9 @@ See Info node `(elisp) Integer Basics'." (while (and form (keywordp (car form)) (not (eq (car form) :menu))) + (unless (memq (car form) + '(:full :keymap :parent :suppress :name :prefix)) + (error "Invalid keyword: %s" (car form))) (push (pop form) result) (when (null form) (error "Uneven number of keywords in %S" form)) diff --git a/lisp/subr.el b/lisp/subr.el index 78709b7fa9c..91189787d55 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6664,7 +6664,8 @@ should be a MENU form as accepted by `easy-menu-define'. (:parent (setq parent value)) (:suppress (setq suppress value)) (:name (setq name value)) - (:prefix (setq prefix value)))))) + (:prefix (setq prefix value)) + (_ (error "Invalid keyword: %s" keyword)))))) (when (and prefix (or full parent suppress keymap)) diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el index 723f277e07f..86b62eb1ce6 100644 --- a/lisp/vc/cvs-status.el +++ b/lisp/vc/cvs-status.el @@ -35,7 +35,7 @@ ;;; (defvar-keymap cvs-status-mode-map - :inherit 'cvs-mode-map + :parent 'cvs-mode-map "n" #'next-line "p" #'previous-line "N" #'cvs-status-next