branch: externals/compat commit c445418968537d2c99ad01c66f7c9d7f86494a66 Author: Philip Kaludercic <phil...@posteo.net> Commit: Philip Kaludercic <phil...@posteo.net>
Fix named-let implementation The previous version inserted a quoted symbol into the funcall generated by the macro. Since letrec binds the variable directly, the value couldn't be seen and the generated code threw an error when evaluated. Thanks again to Mattias EngdegÄrd for noticing this. --- compat-28.1.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compat-28.1.el b/compat-28.1.el index d2ff192..93d3699 100644 --- a/compat-28.1.el +++ b/compat-28.1.el @@ -321,15 +321,15 @@ Like `let', bind variables in BINDINGS and then evaluate BODY, but with the twist that BODY can evaluate itself recursively by calling NAME, where the arguments passed to NAME are used as the new values of the bound variables in the recursive invocation." - ;; :feature subr-x + :feature subr-x (declare (indent 2) (debug (symbolp (&rest (symbolp form)) body))) (let* ((fargs (mapcar (lambda (b) (if (consp b) (car b) b)) bindings)) (aargs (mapcar (lambda (b) (if (consp b) (cadr b))) bindings)) (fn (make-symbol "self")) - (macro (lambda (&rest args) `(apply ',fn (list ,@args))))) - `(letrec ((,fn (lambda ,fargs . ,(macroexpand-all - (macroexp-progn body) - (list (cons name macro)))))) + (macro (lambda (&rest args) `(apply ,fn (list ,@args))))) + `(letrec ((,fn (lambda ,fargs ,(macroexpand-all + (macroexp-progn body) + (list (cons name macro)))))) (apply ,fn (list ,@aargs))))) ;;;; Defined in files.el