From 126eda8b301574e39520317042be3cfb88cf523a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 7 May 2025 23:26:40 -0400 Subject: [PATCH] cl-lib.el (cl-generic-generalizers): Fix partial bootstrap * lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers): Tweak the bootstrap hack to avoid a problem when dumping `bootstrap-emacs` when `cl-lib.el` has already been compiled. * lisp/emacs-lisp/cl-macs.el (list): Move out of `static-if` test. (cherry picked from commit 322ed637b4c2fe826d41c5af3800b2f2e381bb0f) --- lisp/emacs-lisp/cl-lib.el | 11 +++++------ lisp/emacs-lisp/cl-macs.el | 9 +++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 4ceb9e70865..745bdcfeeac 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -552,12 +552,11 @@ If ALIST is non-nil, the new pairs are prepended to it." ;; those rare places where we do need it. ) -(static-if (not (fboundp 'cl-defmethod)) - ;; `cl-generic' requires `cl-lib' at compile-time, so `cl-lib' can't - ;; use `cl-defmethod' before `cl-generic' has been compiled. - ;; Also, there is no mechanism to autoload methods, so this can't be - ;; moved to `cl-extra.el'. - nil +(when (fboundp 'cl-generic-define-method) + ;; `cl-generic' requires `cl-lib' at compile-time, so `cl-lib' can't + ;; use `cl-defmethod' before `cl-generic' has been loaded. + ;; Also, there is no mechanism to autoload methods, so this can't be + ;; moved to `cl-extra.el'. (declare-function cl--derived-type-generalizers "cl-extra" (type)) (cl-defmethod cl-generic-generalizers :extra "derived-types" (type) "Support for dispatch on derived types, i.e. defined with `cl-deftype'." diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 221af7dfa69..4147ec25dbf 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3762,6 +3762,11 @@ If PARENTS is non-nil, ARGLIST must be nil." (cl--define-derived-type ',name ,expander ,predicate ',parents))))) +;; This one is redundant, but we keep it to silence a +;; warning during the early bootstrap when `cl-seq.el' gets +;; loaded before `cl-preloaded.el' is defined. +(put 'list 'cl-deftype-satisfies #'listp) + (static-if (not (fboundp 'cl--define-derived-type)) nil ;; Can't define them yet! (cl-deftype natnum () (declare (parents integer)) '(satisfies natnump)) @@ -3777,10 +3782,6 @@ If PARENTS is non-nil, ARGLIST must be nil." ;; keyboard macros, which are redundant since `kmacro.el'!! ;;(declare (parents function)) '(satisfies commandp)) - ;; This one is redundant, but we keep it to silence a - ;; warning during the early bootstrap when `cl-seq.el' gets - ;; loaded before `cl-preloaded.el' is defined. - (put 'list 'cl-deftype-satisfies #'listp) (eval-when-compile (defmacro cl--defnumtype (type base) -- 2.39.5