]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bootstrap problems and various misc issues found along the way
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 17 Dec 2021 19:53:03 +0000 (14:53 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 17 Dec 2021 19:53:03 +0000 (14:53 -0500)
* lisp/simple.el (function-docstring): Fix call to `signal`.

* lisp/emacs-lisp/oclosure.el (oclosure--define): Use `cl-deftype-satisfies`.

* lisp/emacs-lisp/cl-generic.el (cl--generic-prefill-dispatchers):
Bind `cl--generic-compiler` around the right part of the function (duh!).

lisp/emacs-lisp/cl-generic.el
lisp/emacs-lisp/oclosure.el
lisp/simple.el

index ba1547075160f433ab0b45ac4321180364e6cc14..5e468cd02239c8e837e57d1a7270b6c256396e04 100644 (file)
@@ -880,16 +880,20 @@ those methods.")
     (setq arg-or-context `(&context . ,arg-or-context)))
   (unless (fboundp 'cl--generic-get-dispatcher)
     (require 'cl-generic))
-  (let ((fun (cl--generic-get-dispatcher
-              `(,arg-or-context
-                ,@(apply #'append
-                         (mapcar #'cl-generic-generalizers specializers))
-                ,cl--generic-t-generalizer)))
-        ;; When compiling `cl-generic' during bootstrap, make sure
-        ;; we prefill with compiled dispatchers even though the loaded
-        ;; `cl-generic' is still interpreted.
-        (cl--generic-compiler
-         (if (featurep 'bytecomp) #'byte-compile cl--generic-compiler)))
+  (let ((fun
+         ;; Let-bind cl--generic-dispatchers so we *re*compute the function
+         ;; from scratch, since the one in the cache may be non-compiled!
+         (let ((cl--generic-dispatchers (make-hash-table))
+               ;; When compiling `cl-generic' during bootstrap, make sure
+               ;; we prefill with compiled dispatchers even though the loaded
+               ;; `cl-generic' is still interpreted.
+               (cl--generic-compiler
+                (if (featurep 'bytecomp) #'byte-compile cl--generic-compiler)))
+           (cl--generic-get-dispatcher
+            `(,arg-or-context
+              ,@(apply #'append
+                       (mapcar #'cl-generic-generalizers specializers))
+              ,cl--generic-t-generalizer)))))
     ;; Recompute dispatch at run-time, since the generalizers may be slightly
     ;; different (e.g. byte-compiled rather than interpreted).
     ;; FIXME: There is a risk that the run-time generalizer is not equivalent
index 6015e32b91795da92616bd5fb8ecfd7998cb8b27..4fafa1ac46dfe7c2dd742ce41ad19320e7f72941 100644 (file)
 
 (defun oclosure--define (class pred)
   (let* ((name (cl--class-name class))
-         (predname (intern (format "oclosure--%s-p" name)))
-         (type `(satisfies ,predname)))
+         (predname (intern (format "oclosure--%s-p" name))))
     (setf (cl--find-class name) class)
     (defalias predname pred)
-    (put name 'cl-deftype-handler (lambda () type))))
+    (put name 'cl-deftype-satisfies predname)))
 
 (defmacro oclosure-lambda (type fields args &rest body)
   (declare (indent 3) (debug (sexp (&rest (sexp form)) sexp def-body)))
index 09e1c7d845ffdb18516e930f8643eb7e22723b1c..ffb1331e6ac3f62131f4159c2256916d7a87f5a7 100644 (file)
@@ -2343,7 +2343,7 @@ FUNCTION is expected to be a function value rather than, say, a mere symbol."
                 ;; in the function body, so reject them if they are last.
                  (cdr body))
         doc)))
-   (_ (signal 'invalid-function))))
+   (_ (signal 'invalid-function (list function)))))
 
 (cl-defgeneric interactive-form (cmd)
   "Return the interactive form of CMD or nil if none.