unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Newbie major-mode and elisp question
Date: Thu, 08 Sep 2005 11:12:03 -0600	[thread overview]
Message-ID: <dfprd6$jfi$1@sea.gmane.org> (raw)
In-Reply-To: <fmRTe.1984$7D1.862@newssvr12.news.prodigy.com>

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

  parent reply	other threads:[~2005-09-08 17:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-08  7:02 Newbie major-mode and elisp question sj
2005-09-08 16:21 ` rgb
2005-09-08 17:12 ` Kevin Rodgers [this message]
2005-09-09  5:07 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='dfprd6$jfi$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).