diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-03-03 18:40:03 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-03-03 18:40:03 -0500 |
commit | 88ca2280ba430ad2fa681c72cc6ba8216709e63f (patch) | |
tree | 9dd1cbafe588534340cbf70d735cbb36058272a2 /lisp/emacs-lisp | |
parent | b379420a5b005d0e12d12fc162aa34851d456c61 (diff) | |
download | emacs-88ca2280ba430ad2fa681c72cc6ba8216709e63f.tar.gz emacs-88ca2280ba430ad2fa681c72cc6ba8216709e63f.tar.bz2 emacs-88ca2280ba430ad2fa681c72cc6ba8216709e63f.zip |
* lisp/emacs-lisp/pcase.el (pcase-defmacro): Fix `pcase-tests-macro`
* lisp/emacs-lisp/radix-tree.el (radix-tree-leaf): Simplify accordingly.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/pcase.el | 8 | ||||
-rw-r--r-- | lisp/emacs-lisp/radix-tree.el | 13 |
2 files changed, 13 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 4804180ac9b..5342a0179d9 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -436,7 +436,13 @@ for the result of evaluating EXP (first arg to `pcase'). (decl (assq 'declare body))) (when decl (setq body (remove decl body))) `(progn - (defun ,fsym ,args ,@body) + ;; FIXME: We use `eval-and-compile' here so that the pcase macro can be + ;; used in the same file where it's defined, but ideally, we should + ;; handle this using something similar to `overriding-plist-environment' + ;; but for `symbol-function' slots so compiling a file doesn't have the + ;; side-effect of defining the function. + (eval-and-compile + (defun ,fsym ,args ,@body)) (define-symbol-prop ',fsym 'edebug-form-spec ',(cadr (assq 'debug decl))) (define-symbol-prop ',name 'pcase-macroexpander #',fsym)))) diff --git a/lisp/emacs-lisp/radix-tree.el b/lisp/emacs-lisp/radix-tree.el index 0905ac608bb..fb659753501 100644 --- a/lisp/emacs-lisp/radix-tree.el +++ b/lisp/emacs-lisp/radix-tree.el @@ -194,14 +194,13 @@ If not found, return nil." "Return an alist of all bindings in TREE for prefixes of STRING." (radix-tree--prefixes tree string 0 nil)) -(eval-and-compile - (pcase-defmacro radix-tree-leaf (vpat) - "Pattern which matches a radix-tree leaf. +(pcase-defmacro radix-tree-leaf (vpat) + "Pattern which matches a radix-tree leaf. The pattern VPAT is matched against the leaf's carried value." - ;; We used to use `(pred atom)', but `pcase' doesn't understand that - ;; `atom' is equivalent to the negation of `consp' and hence generates - ;; suboptimal code. - `(or `(t . ,,vpat) (and (pred (not consp)) ,vpat)))) + ;; We used to use `(pred atom)', but `pcase' doesn't understand that + ;; `atom' is equivalent to the negation of `consp' and hence generates + ;; suboptimal code. + `(or `(t . ,,vpat) (and (pred (not consp)) ,vpat))) (defun radix-tree-iter-subtrees (tree fun) "Apply FUN to every immediate subtree of radix TREE. |