summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-06-24 10:54:01 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-06-24 11:04:51 +0200
commit49910adf872a98d9c144d34478a53ecb3e01856f (patch)
treee5b69dc0e59565cfd537ae14ba0dffef107de619 /lisp/emacs-lisp
parent2ff5cb4cb4420e2b18ea8451ad0b29f1a69bdb6c (diff)
downloademacs-49910adf872a98d9c144d34478a53ecb3e01856f.tar.gz
emacs-49910adf872a98d9c144d34478a53ecb3e01856f.tar.bz2
emacs-49910adf872a98d9c144d34478a53ecb3e01856f.zip
Fix cl-generic bootstrap problems
* lisp/sqlite-mode.el (require): * lisp/net/eudc.el (require): * lisp/arc-mode.el (require): Require subr-x, since these files are using macros from there. * lisp/emacs-lisp/subr-x.el (with-memoization): Move from here... * lisp/subr.el (with-memoization): ... to here, as it's used from the preloaded cl-generic.el file. * lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Don't use the autoloaded `byte-compile' function during bootstrap. (cl--generic-get-dispatcher): Don't require subr-x, either. cl-generic has been preloaded since 2015, and most usages of it (in preloaded files) work fine. In particular, using `cl-defgeneric' is unproblematic. However, `cl-defmethod' would end up pulling in the byte compiler (at load time), which would make it impossible to use `cl-defmethod' in pre-loaded files, and this change fixes that (but possibly not in the most self-evidently correct way).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cl-generic.el9
-rw-r--r--lisp/emacs-lisp/subr-x.el13
2 files changed, 4 insertions, 18 deletions
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 200af057cd7..6c5813959fa 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -658,8 +658,10 @@ The set of acceptable TYPEs (also called \"specializers\") is defined
;; compiled. Otherwise the byte-compiler and all the code on
;; which it depends needs to be usable before cl-generic is loaded,
;; which imposes a significant burden on the bootstrap.
- (if (consp (lambda (x) (+ x 1)))
- (lambda (exp) (eval exp t)) #'byte-compile))
+ (if (or (consp (lambda (x) (+ x 1)))
+ (not (featurep 'bytecomp)))
+ (lambda (exp) (eval exp t))
+ #'byte-compile))
(defun cl--generic-get-dispatcher (dispatch)
(with-memoization
@@ -708,9 +710,6 @@ The set of acceptable TYPEs (also called \"specializers\") is defined
(funcall
cl--generic-compiler
`(lambda (generic dispatches-left methods)
- ;; FIXME: We should find a way to expand `with-memoize' once
- ;; and forall so we don't need `subr-x' when we get here.
- (eval-when-compile (require 'subr-x))
(let ((method-cache (make-hash-table :test #'eql)))
(lambda (,@fixedargs &rest args)
(let ,bindings
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 5c3dff62c8a..b0de5d155ac 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -290,19 +290,6 @@ as the new values of the bound variables in the recursive invocation."
(cl-labels ((,name ,fargs . ,body)) #',name)
. ,aargs)))
-(defmacro with-memoization (place &rest code)
- "Return the value of CODE and stash it in PLACE.
-If PLACE's value is non-nil, then don't bother evaluating CODE
-and return the value found in PLACE instead."
- (declare (indent 1) (debug (gv-place body)))
- (gv-letplace (getter setter) place
- `(or ,getter
- ,(macroexp-let2 nil val (macroexp-progn code)
- `(progn
- ,(funcall setter val)
- ,val)))))
-
-
;;;###autoload
(defun string-pixel-width (string)
"Return the width of STRING in pixels."