unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lute Kamstra <Lute.Kamstra.lists@xs4all.nl>
Cc: emacs-devel@gnu.org
Subject: Re: Documenting define-generic-mode.
Date: Thu, 28 Apr 2005 15:50:54 +0200	[thread overview]
Message-ID: <87ekcvxb5t.fsf@xs4all.nl> (raw)
In-Reply-To: <E1DPT2e-0003aA-1l@fencepost.gnu.org> (Richard Stallman's message of "Sat, 23 Apr 2005 18:24:00 -0400")

Richard Stallman <rms@gnu.org> writes:

>     Shall I document define-generic-mode in lispref/modes.texi?  I think
>     its own node "Generic Modes", right after the node "Derived Modes",
>     would be appropriate.
>
> You can try drafting something, and I will tell you what I think of
> it.

There you go...

Lute.


Index: lispref/modes.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/lispref/modes.texi,v
retrieving revision 1.98
diff -c -r1.98 modes.texi
*** lispref/modes.texi	28 Apr 2005 11:32:54 -0000	1.98
--- lispref/modes.texi	28 Apr 2005 13:49:05 -0000
***************
*** 103,108 ****
--- 103,110 ----
  * Mode Help::               Finding out how to use a mode.
  * Derived Modes::           Defining a new major mode based on another major
                                mode.
+ * Generic Modes::           Defining a simple major mode that supports
+                               comment syntax and Font Lock mode.
  * Mode Hooks::              Hooks run at the end of major mode functions.
  @end menu
  
***************
*** 798,803 ****
--- 800,806 ----
  
  @node Derived Modes
  @subsection Defining Derived Modes
+ @cindex derived mode
  
    It's often useful to define a new major mode in terms of an existing
  one.  An easy way to do this is to use @code{define-derived-mode}.
***************
*** 860,865 ****
--- 863,918 ----
  @code{define-derived-mode} does that automatically.
  @end defmac
  
+ @node Generic Modes
+ @subsection Generic Modes
+ @cindex generic mode
+ 
+ @dfn{Generic modes} are simple major modes with basic support for
+ comment syntax and Font Lock mode.  They are primarily useful for
+ configuration files.  The macro @code{define-generic-mode} defines a
+ generic mode.  See the file @file{generic-x.el} for some examples of
+ the use of @code{define-generic-mode}.
+ 
+ @defmac define-generic-mode mode comment-list keyword-list font-lock-list auto-mode-list function-list &optional docstring &rest custom-keyword-args
+ This macro creates a new generic mode.  The argument @var{mode} is the
+ name of the command for the generic mode; it need not be quoted.  The
+ optional argument @var{docstring} is the documentation for the mode
+ command.  If you do not supply it, a default documentation string will
+ be used instead.
+ 
+ @var{comment-list} is a list, whose entries are either a single
+ character, a one or two character string or a cons pair.  If the entry
+ is a character or a string, it is added to the mode's syntax table
+ with ``comment starter'' syntax.  If the entry is a cons pair, the
+ elements of the pair are considered to be ``comment starter'' and
+ ``comment ender'' respectively.  (The latter should be @code{nil} if
+ you want comments to end at the end of the line.)  Note that Emacs has
+ limitations regarding comment characters.  @xref{Syntax Tables}.
+ 
+ @var{keyword-list} is a list of keywords to highlight with
+ @code{font-lock-keyword-face}.  Each keyword should be a string.
+ @var{font-lock-list} is a list of additional expressions to highlight.
+ Each entry in this list should have the same form as an entry in
+ @code{font-lock-keywords}.  @xref{Search-based Fontification}.
+ 
+ @var{auto-mode-list} is a list of regular expressions to add to the
+ variable @code{auto-mode-alist}.  These regular expressions are added
+ as soon as @code{define-generic-mode} is called.
+ 
+ @var{function-list} is a list of functions to call to do some
+ additional setup.  The mode command calls these functions just before
+ it runs the mode hook.
+ 
+ The optional @var{custom-keyword-args} are pairs of keywords and
+ values.  They are passed to the generated @code{defcustom} form of the
+ mode hook variable @var{mode}-hook.  The default value for the
+ @samp{:group} keyword is @var{mode} without the possible trailing
+ @samp{-mode}.  Don't use this default group name unless you have
+ written a @code{defgroup} to define that group properly (@pxref{Group
+ Definitions}).  You can specify keyword arguments without specifying a
+ docstring.
+ @end defmac
+ 
  @node Mode Hooks
  @subsection Mode Hooks

  reply	other threads:[~2005-04-28 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-22 15:56 Documenting define-generic-mode Lute Kamstra
2005-04-23 22:24 ` Richard Stallman
2005-04-28 13:50   ` Lute Kamstra [this message]
2005-04-29  0:15     ` Luc Teirlinck
2005-04-29  6:58       ` Lute Kamstra
2005-04-29 13:37         ` Luc Teirlinck
2005-05-01 12:06           ` Richard Stallman
2005-05-01 12:23             ` Lute Kamstra
2005-04-29 13:46         ` Luc Teirlinck

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=87ekcvxb5t.fsf@xs4all.nl \
    --to=lute.kamstra.lists@xs4all.nl \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).