From: Lars Ingebrigtsen Date: Sun, 17 Oct 2021 19:29:59 +0000 (+0200) Subject: Reinstate defvar-keymap expansion X-Git-Tag: emacs-29.0.90~3671^2~528 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=50296843582b13d3e43c4215c7c4e98e44ce650f;p=emacs.git Reinstate defvar-keymap expansion * lisp/emacs-lisp/byte-opt.el (byte-optimize-define-keymap--define): Make more robust. --- diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index aa57e022c5a..abfc9b3b316 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1237,14 +1237,17 @@ See Info node `(elisp) Integer Basics'." (defun byte-optimize-define-keymap--define (form) "Expand key bindings in FORM." - (let ((optimized (byte-optimize-define-keymap (nth 1 form)))) - (if (eq optimized (nth 1 form)) - ;; No improvement. - form - (list (car form) optimized)))) - -;;(put 'define-keymap 'byte-optimizer #'byte-optimize-define-keymap) -;;(put 'define-keymap--define 'byte-optimizer #'byte-optimize-define-keymap--define) + (if (not (consp (nth 1 form))) + form + (let ((optimized (byte-optimize-define-keymap (nth 1 form)))) + (if (eq optimized (nth 1 form)) + ;; No improvement. + form + (list (car form) optimized))))) + +(put 'define-keymap 'byte-optimizer #'byte-optimize-define-keymap) +(put 'define-keymap--define 'byte-optimizer + #'byte-optimize-define-keymap--define) ;; I'm not convinced that this is necessary. Doesn't the optimizer loop ;; take care of this? - Jamie