summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2023-02-04 11:23:31 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2023-02-04 11:23:31 -0500
commitc39c26e33f6bb45479bbd1a80df8c97cf750a56a (patch)
tree0632a99a1c20488637fc7fe108c30bab7e3d5055 /lisp/simple.el
parent229d0772e235f51812ed8020a31f9a8de366c7ba (diff)
downloademacs-c39c26e33f6bb45479bbd1a80df8c97cf750a56a.tar.gz
nadvice: Fix bug#61179
Advising interactive forms relies on the ability to distinguish interactive forms that do nothing else than return a function. So, be careful to preserve this info. Furthermore, interactive forms are expected to be evaluated in the lexical context captured by the closure to which they belong, so be careful to preserve that context when manipulating those forms. * lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyze-form) <lambda>: Preserve the info that an interactive form does nothing else than return a function. * lisp/emacs-lisp/nadvice.el (advice--interactive-form-1): New function. (advice--interactive-form): Use it. (advice--make-interactive-form): Refine to also accept function values quoted with `quote`. Remove obsolete TODO. * test/lisp/emacs-lisp/nadvice-tests.el: Don't disallow byte-compilation. (advice-test-bug61179): New test. * lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): Allow the `if` arg to be a form. * lisp/simple.el (oclosure-interactive-form): Adjust accordingly.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 22aa043069f..bed6dfb8292 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2738,7 +2738,8 @@ instead."
nil)
(cl-defmethod oclosure-interactive-form ((f cconv--interactive-helper))
- `(interactive (funcall ',(cconv--interactive-helper--if f))))
+ (let ((if (cconv--interactive-helper--if f)))
+ `(interactive ,(if (functionp if) `(funcall ',if) if))))
(defun command-execute (cmd &optional record-flag keys special)
;; BEWARE: Called directly from the C code.