35 |
;; |
;; |
36 |
;; Each generic mode can define the following: |
;; Each generic mode can define the following: |
37 |
;; |
;; |
38 |
;; * List of comment-characters. The entries in this list should be |
;; * List of comment-characters. The elements of this list should be |
39 |
;; either a character, a one or two character string or a cons pair. |
;; either a character, a one or two character string, or a cons |
40 |
;; If the entry is a character or a string, it is added to the |
;; cell. If the entry is a character or a string, it is added to |
41 |
;; mode's syntax table with `comment-start' syntax. If the entry is |
;; the mode's syntax table with "comment starter" syntax. If the |
42 |
;; a cons pair, the elements of the pair are considered to be |
;; entry is a cons cell, the `car' and `cdr' of the pair are |
43 |
;; `comment-start' and `comment-end' respectively. (The latter |
;; considered the "comment starter" and "comment ender" |
44 |
;; should be nil if you want comments to end at end of line.) |
;; respectively. (The latter should be nil if you want comments to |
45 |
;; LIMITATIONS: Emacs does not support comment strings of more than |
;; end at the end of the line.) Emacs does not support comment |
46 |
;; two characters in length. |
;; strings of more than two characters in length. |
47 |
;; |
;; |
48 |
;; * List of keywords to font-lock. Each keyword should be a string. |
;; * List of keywords to font-lock. Each keyword should be a string. |
49 |
;; If you have additional keywords which should be highlighted in a |
;; If you have additional keywords which should be highlighted in a |
121 |
&rest custom-keyword-args) |
&rest custom-keyword-args) |
122 |
"Create a new generic mode MODE. |
"Create a new generic mode MODE. |
123 |
|
|
124 |
MODE is the name of the command for the generic mode; it need not |
MODE is the name of the command for the generic mode; don't quote |
125 |
be quoted. The optional DOCSTRING is the documentation for the |
it. The optional DOCSTRING is the documentation for the mode |
126 |
mode command. If you do not supply it, a default documentation |
command. If you do not supply it, `define-generic-mode' uses a |
127 |
string will be used instead. |
default documentation string instead. |
128 |
|
|
129 |
COMMENT-LIST is a list, whose entries are either a single |
COMMENT-LIST is a list in which each element is either a |
130 |
character, a one or two character string or a cons pair. If the |
character, a string of one or two characters, or a cons cell. A |
131 |
entry is a character or a string, it is added to the mode's |
character or a string is set up in the mode's syntax table as a |
132 |
syntax table with \"comment starter\" syntax. If the entry is a |
\"comment starter\". If the entry is a cons cell, the `car' is |
133 |
cons pair, the elements of the pair are considered to be |
set up as a \"comment starter\" and the `cdr' as a \"comment |
134 |
\"comment starter\" and \"comment ender\" respectively. (The |
ender\". (Use nil for the latter if you want comments to end at |
135 |
latter should be nil if you want comments to end at end of line.) |
the end of the line.) Note that the syntax table has limitations |
136 |
Note that Emacs has limitations regarding comment characters. |
about what comment starters and enders are actually possible. |
137 |
|
|
138 |
KEYWORD-LIST is a list of keywords to highlight with |
KEYWORD-LIST is a list of keywords to highlight with |
139 |
`font-lock-keyword-face'. Each keyword should be a string. |
`font-lock-keyword-face'. Each keyword should be a string. |
140 |
|
|
141 |
FONT-LOCK-LIST is a list of additional expressions to highlight. |
FONT-LOCK-LIST is a list of additional expressions to highlight. |
142 |
Each entry in the list should have the same form as an entry in |
Each element of this list should have the same form as an element |
143 |
`font-lock-keywords'. |
of `font-lock-keywords'. |
144 |
|
|
145 |
AUTO-MODE-LIST is a list of regular expressions to add to |
AUTO-MODE-LIST is a list of regular expressions to add to |
146 |
`auto-mode-alist'. These regular expressions are added as soon |
`auto-mode-alist'. These regular expressions are added when |
147 |
as `define-generic-mode' is called. |
Emacs runs the macro expansion. |
148 |
|
|
149 |
FUNCTION-LIST is a list of functions to call to do some |
FUNCTION-LIST is a list of functions to call to do some |
150 |
additional setup. The mode command calls these functions just |
additional setup. The mode command calls these functions just |
151 |
before it runs the mode hook. |
before it runs the mode hook. |
152 |
|
|
153 |
The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and |
The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and values |
154 |
values. They are passed to the generated `defcustom' form of the |
to include in the generated `defcustom' form for the mode hook |
155 |
mode hook variable MODE-hook. The default value for the `:group' |
variable `MODE-hook'. The default value for the `:group' keyword |
156 |
keyword is MODE without the possible trailing \"-mode\". (Don't |
is MODE with the final \"-mode\" (if any) removed. (Don't use |
157 |
use this default group name unless you have written a `defgroup' |
this default group name unless you have written a `defgroup' to |
158 |
to define that group properly.) You can specify keyword |
define that group properly.) You can specify keyword arguments |
159 |
arguments without specifying a docstring. |
without specifying a docstring. |
160 |
|
|
161 |
See the file generic-x.el for some examples of `define-generic-mode'." |
See the file generic-x.el for some examples of `define-generic-mode'." |
162 |
(declare (debug (sexp def-form def-form def-form form def-form |
(declare (debug (sexp def-form def-form def-form form def-form |
180 |
|
|
181 |
(unless (plist-get custom-keyword-args :group) |
(unless (plist-get custom-keyword-args :group) |
182 |
(setq custom-keyword-args |
(setq custom-keyword-args |
183 |
(plist-put custom-keyword-args |
(plist-put custom-keyword-args |
184 |
:group `',(intern (replace-regexp-in-string |
:group `',(intern (replace-regexp-in-string |
185 |
"-mode\\'" "" name))))) |
"-mode\\'" "" name))))) |
186 |
|
|