diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-04-26 10:36:52 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-04-26 10:36:52 -0400 |
commit | bffc4cb39dc7b83fc4a1bffd23eeed2774b79444 (patch) | |
tree | 103b22b517aafd70b16fe2d1dea06cb4673668f5 /lisp/kmacro.el | |
parent | 756b7cf5d9a817503437b3e8a9e8d912b7ee6c75 (diff) | |
download | emacs-bffc4cb39dc7b83fc4a1bffd23eeed2774b79444.tar.gz emacs-bffc4cb39dc7b83fc4a1bffd23eeed2774b79444.tar.bz2 emacs-bffc4cb39dc7b83fc4a1bffd23eeed2774b79444.zip |
New generic function `oclosure-interactive-form`
It's used by `interactive-form` when it encounters an OClosure.
This lets one compute the `interactive-form` of OClosures
dynamically by adding appropriate methods.
This does not include support for `command-modes` for Oclosures.
* lisp/simple.el (oclosure-interactive-form): New generic function.
* src/data.c (Finteractive_form): Delegate to
`oclosure-interactive-form` if the arg is an OClosure.
(syms_of_data): New symbol `Qoclosure_interactive_form`.
* src/eval.c (Fcommandp): Delegate to `interactive-form` if the arg is
an OClosure.
* src/lisp.h (VALID_DOCSTRING_P): New function, extracted from
`store_function_docstring`.
* src/doc.c (store_function_docstring): Use it.
* lisp/kmacro.el (kmacro): Don't carry any interactive form.
(oclosure-interactive-form) <kmacro>: New method, instead.
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-interactive-form)
<oclosure-test>: New method.
(oclosure-test-interactive-form): New test.
* doc/lispref/commands.texi (Using Interactive):
Document `oclosure-interactive-form`.
Diffstat (limited to 'lisp/kmacro.el')
-rw-r--r-- | lisp/kmacro.el | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 8a9d89929eb..5476c2395ca 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -820,13 +820,14 @@ KEYS should be a vector or a string that obeys `key-valid-p'." (counter (or counter 0)) (format (or format "%d"))) (&optional arg) - (interactive "p") ;; Use counter and format specific to the macro on the ring! (let ((kmacro-counter counter) (kmacro-counter-format-start format)) (execute-kbd-macro keys arg #'kmacro-loop-setup-function) (setq counter kmacro-counter)))) +(cl-defmethod oclosure-interactive-form ((_ kmacro)) '(interactive "p")) + ;;;###autoload (defun kmacro-lambda-form (mac &optional counter format) ;; Apparently, there are two different ways this is called: |