]> git.eshelyaron.com Git - emacs.git/commitdiff
cl-lib.el (cl-generic-generalizers): Fix partial bootstrap
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 8 May 2025 03:26:40 +0000 (23:26 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:54:52 +0000 (10:54 +0200)
* 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
lisp/emacs-lisp/cl-macs.el

index 4ceb9e708659f9b99cca51ac7052cdbcb00c5b3c..745bdcfeeacc8d3a30663417706a28d63c3ea35b 100644 (file)
@@ -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'."
index 221af7dfa69bcf6c7720bab3b95466574e5390c6..4147ec25dbf8a83b3daf85b8782807cd2bd2542d 100644 (file)
@@ -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)