1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

(cl-block, cl-return-from): Fix bug#75498

* lisp/emacs-lisp/cl-macs.el (cl-block, cl-return-from):
Change encoding so it obeys variable coping (i.e. lexical scoping when
`lexical-binding` is non-nil).
(cl--block-wrapper, cl--block-throw): Adjust accordingly.

* test/lisp/emacs-lisp/cl-macs-tests.el
(cl-macs--test-cl-block-lexbind-bug-75498): New test.
This commit is contained in:
Stefan Monnier 2025-01-16 17:48:21 -05:00
parent 8fc5001ba5
commit dace7fa2ab
3 changed files with 36 additions and 16 deletions

View file

@ -728,6 +728,15 @@ collection clause."
(cons (f1 7) 8)))
'(7 . 8))))
(ert-deftest cl-macs--test-cl-block-lexbind-bug-75498 ()
(should (equal
(let ((ret (lambda (f)
(cl-block a (funcall f) (cl-return-from a :ret)))))
(cl-block a
(list :oops
(funcall ret (lambda () (cl-return-from a :clo))))))
:clo)))
(ert-deftest cl-flet/edebug ()
"Check that we can instrument `cl-flet' forms (bug#65344)."
(with-temp-buffer