diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-23 16:36:16 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-23 16:36:16 -0400 |
commit | c244d4af57deb96ce399c70c2781c54e14e1f0bd (patch) | |
tree | 6746065f09bb3cabc01a304ede556f6f2aaf3a4d /test/lisp/emacs-lisp/cconv-tests.el | |
parent | 41d39ffc3269db33f35541c94ebf109ffb50681e (diff) | |
download | emacs-c244d4af57deb96ce399c70c2781c54e14e1f0bd.tar.gz emacs-c244d4af57deb96ce399c70c2781c54e14e1f0bd.tar.bz2 emacs-c244d4af57deb96ce399c70c2781c54e14e1f0bd.zip |
cconv.el: Fix interactive closure bug#51695
Make cconv.el detect when a closure's interactive form needs to
capture variables from the context and tweak the code accordingly
if so.
* lisp/emacs-lisp/cconv.el (cconv--interactive-form-funs): New var.
(cconv-convert): Handle the case where the interactive form captures
vars from the surrounding context. Remove left over handling of
`declare` which was already removed from the cconv-analyze` phase.
(cconv-analyze-form): Adjust analysis of interactive forms accordingly.
* lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): New type and
function.
* lisp/simple.el (function-documentation, oclosure-interactive-form):
Add methods for it.
* test/lisp/emacs-lisp/cconv-tests.el
(cconv-tests-interactive-closure-bug51695): New test.
Diffstat (limited to 'test/lisp/emacs-lisp/cconv-tests.el')
-rw-r--r-- | test/lisp/emacs-lisp/cconv-tests.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el index 9904c6a969c..37470f863f3 100644 --- a/test/lisp/emacs-lisp/cconv-tests.el +++ b/test/lisp/emacs-lisp/cconv-tests.el @@ -347,5 +347,15 @@ (list x (funcall g closed-x) (funcall h closed-x)))))))) ) +(ert-deftest cconv-tests-interactive-closure-bug51695 () + (let ((f (let ((d 51695)) + (lambda (data) + (interactive (progn (setq d (1+ d)) (list d))) + (list (called-interactively-p 'any) data))))) + (should (equal (list (call-interactively f) + (funcall f 51695) + (call-interactively f)) + '((t 51696) (nil 51695) (t 51697)))))) + (provide 'cconv-tests) ;;; cconv-tests.el ends here |