Extend the syntax of `interactive' to list applicable modes
* doc/lispref/commands.texi (Using Interactive): Document the extended `interactive' form. * doc/lispref/loading.texi (Autoload): Document list-of-modes form. * lisp/emacs-lisp/autoload.el (make-autoload): Pick the list of modes from `interactive' out of the functions. * lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Allow for the extended `interactive' form. * src/callint.c (Finteractive): Document the extended form. * src/data.c (Finteractive_form): Return the interactive form in the old format (even when there's an extended `interactive') to avoid having other parts of Emacs be aware of this. (Fcommand_modes): New defun. * src/emacs-module.c (GCALIGNED_STRUCT): Allow for modules to return command modes. * src/lisp.h: New function module_function_command_modes.
This commit is contained in:
parent
8d517daf77
commit
58e0c8ee86
11 changed files with 179 additions and 28 deletions
|
@ -141,9 +141,12 @@ expression, in which case we want to handle forms differently."
|
|||
((stringp (car-safe rest)) (car rest))))
|
||||
;; Look for an interactive spec.
|
||||
(interactive (pcase body
|
||||
((or `((interactive . ,_) . ,_)
|
||||
`(,_ (interactive . ,_) . ,_))
|
||||
t))))
|
||||
((or `((interactive . ,iargs) . ,_)
|
||||
`(,_ (interactive . ,iargs) . ,_))
|
||||
;; List of modes or just t.
|
||||
(if (nthcdr 1 iargs)
|
||||
(list 'quote (nthcdr 1 iargs))
|
||||
t)))))
|
||||
;; Add the usage form at the end where describe-function-1
|
||||
;; can recover it.
|
||||
(when (consp args) (setq doc (help-add-fundoc-usage doc args)))
|
||||
|
@ -207,7 +210,11 @@ expression, in which case we want to handle forms differently."
|
|||
easy-mmode-define-minor-mode
|
||||
define-minor-mode))
|
||||
t)
|
||||
(eq (car-safe (car body)) 'interactive))
|
||||
(and (eq (car-safe (car body)) 'interactive)
|
||||
;; List of modes or just t.
|
||||
(or (if (nthcdr 1 (car body))
|
||||
(list 'quote (nthcdr 1 (car body)))
|
||||
t))))
|
||||
,(if macrop ''macro nil))))
|
||||
|
||||
;; For defclass forms, use `eieio-defclass-autoload'.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue