Introduce an :interactive keyword for `defined-derived-mode'
* doc/lispref/modes.texi (Derived Modes): Document it. * lisp/emacs-lisp/derived.el (define-derived-mode): Introduce a new :interactive keyword.
This commit is contained in:
parent
7f62faf206
commit
43ecde8578
3 changed files with 19 additions and 1 deletions
|
@ -861,6 +861,13 @@ abbrev table as @var{parent}, or @code{fundamental-mode-abbrev-table}
|
|||
if @var{parent} is @code{nil}. (Again, a @code{nil} value is
|
||||
@emph{not} equivalent to not specifying this keyword.)
|
||||
|
||||
@item :interactive
|
||||
Modes are interactive commands by default. If you specify a
|
||||
@code{nil} value, the mode defined here won't be interactive. This is
|
||||
useful for modes that are never meant to be activated by users
|
||||
manually, but are only supposed to be used in some specially-formatted
|
||||
buffer.
|
||||
|
||||
@item :group
|
||||
If this is specified, the value should be the customization group for
|
||||
this mode. (Not all major modes have one.) The command
|
||||
|
|
6
etc/NEWS
6
etc/NEWS
|
@ -2271,6 +2271,12 @@ back in Emacs 23.1. The affected functions are: 'make-obsolete',
|
|||
This permanently buffer-local variable holds a list of currently
|
||||
enabled minor modes in the current buffer (as a list of symbols).
|
||||
|
||||
+++
|
||||
** 'defined-derived-mode' now takes an :interactive argument.
|
||||
This can be used to control whether the defined mode is a command
|
||||
or not, and is useful when defining commands that aren't meant to be
|
||||
used by users directly.
|
||||
|
||||
** The 'values' variable is now obsolete.
|
||||
|
||||
---
|
||||
|
|
|
@ -141,6 +141,9 @@ KEYWORD-ARGS:
|
|||
:after-hook FORM
|
||||
A single lisp form which is evaluated after the mode
|
||||
hooks have been run. It should not be quoted.
|
||||
:interactive BOOLEAN
|
||||
Whether the derived mode should be `interactive' or not.
|
||||
The default is t.
|
||||
|
||||
BODY: forms to execute just before running the
|
||||
hooks for the new mode. Do not use `interactive' here.
|
||||
|
@ -194,6 +197,7 @@ See Info node `(elisp)Derived Modes' for more details.
|
|||
(declare-syntax t)
|
||||
(hook (derived-mode-hook-name child))
|
||||
(group nil)
|
||||
(interactive t)
|
||||
(after-hook nil))
|
||||
|
||||
;; Process the keyword args.
|
||||
|
@ -203,6 +207,7 @@ See Info node `(elisp)Derived Modes' for more details.
|
|||
(:abbrev-table (setq abbrev (pop body)) (setq declare-abbrev nil))
|
||||
(:syntax-table (setq syntax (pop body)) (setq declare-syntax nil))
|
||||
(:after-hook (setq after-hook (pop body)))
|
||||
(:interactive (setq interactive (pop body)))
|
||||
(_ (pop body))))
|
||||
|
||||
(setq docstring (derived-mode-make-docstring
|
||||
|
@ -246,7 +251,7 @@ No problems result if this variable is not bound.
|
|||
|
||||
(defun ,child ()
|
||||
,docstring
|
||||
(interactive)
|
||||
,(and interactive '(interactive))
|
||||
; Run the parent.
|
||||
(delay-mode-hooks
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue