sj wrote:
> I'm writing my first major mode to run Nyquist in a buffer. Nyquist is an
> extension of XLISP for audio synthesis and composition. Nyquist-mode
is a
> derivative of inferior-lisp mode, its working pretty well except for one
> annoying side effect. Whenever I issue (nyquist-mode) to start a new
> Nyquist process, whatever buffer I'm currently in gets switched to
> fundamental-mode. I have isolated the problem to the
> kill-all-local-variables statement. Is there some other way I should be
> doing this?
,----[ C-h f define-derived-mode RET ]
| define-derived-mode is a Lisp macro in `derived'.
| (define-derived-mode CHILD PARENT NAME &optional DOCSTRING &rest BODY)
|
| Create a new mode as a variant of an existing mode.
|
| The arguments to this command are as follow:
|
| CHILD: the name of the command for the derived mode.
| PARENT: the name of the command for the parent mode (e.g. `text-mode').
| NAME: a string which will appear in the status line (e.g.
"Hypertext")
| DOCSTRING: an optional documentation string--if you do not supply one,
| the function will attempt to invent something useful.
| BODY: forms to execute just before running the
| hooks for the new mode.
|
| Here is how you could define LaTeX-Thesis mode as a variant of LaTeX mode:
|
| (define-derived-mode LaTeX-thesis-mode LaTeX-mode "LaTeX-Thesis")
|
| You could then make new key bindings for `LaTeX-thesis-mode-map'
| without changing regular LaTeX mode. In this example, BODY is empty,
| and DOCSTRING is generated by default.
|
| On a more complicated level, the following command uses `sgml-mode' as
| the parent, and then sets the variable `case-fold-search' to nil:
|
| (define-derived-mode article-mode sgml-mode "Article"
| "Major mode for editing technical articles."
| (setq case-fold-search nil))
|
| Note that if the documentation string had been left out, it would have
| been generated automatically, with a reference to the keymap.
`----
--
Kevin Rodgers
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs