summaryrefslogtreecommitdiff
path: root/devdocs/elisp/generic-modes.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/generic-modes.html
new repository
Diffstat (limited to 'devdocs/elisp/generic-modes.html')
-rw-r--r--devdocs/elisp/generic-modes.html10
1 files changed, 10 insertions, 0 deletions
diff --git a/devdocs/elisp/generic-modes.html b/devdocs/elisp/generic-modes.html
new file mode 100644
index 00000000..97303121
--- /dev/null
+++ b/devdocs/elisp/generic-modes.html
@@ -0,0 +1,10 @@
+ <h4 class="subsection">Generic Modes</h4> <p><em>Generic modes</em> are simple major modes with basic support for comment syntax and Font Lock mode. To define a generic mode, use the macro <code>define-generic-mode</code>. See the file <samp>generic-x.el</samp> for some examples of the use of <code>define-generic-mode</code>. </p> <dl> <dt id="define-generic-mode">Macro: <strong>define-generic-mode</strong> <em>mode comment-list keyword-list font-lock-list auto-mode-list function-list &amp;optional docstring</em>
+</dt> <dd>
+<p>This macro defines a generic mode command named <var>mode</var> (a symbol, not quoted). The optional argument <var>docstring</var> is the documentation for the mode command. If you do not supply it, <code>define-generic-mode</code> generates one by default. </p> <p>The argument <var>comment-list</var> is a list in which each element is either a character, a string of one or two characters, or a cons cell. A character or a string is set up in the mode’s syntax table as a comment starter. If the entry is a cons cell, the <small>CAR</small> is set up as a comment starter and the <small>CDR</small> as a comment ender. (Use <code>nil</code> for the latter if you want comments to end at the end of the line.) Note that the syntax table mechanism has limitations about what comment starters and enders are actually possible. See <a href="syntax-tables">Syntax Tables</a>. </p> <p>The argument <var>keyword-list</var> is a list of keywords to highlight with <code>font-lock-keyword-face</code>. Each keyword should be a string. Meanwhile, <var>font-lock-list</var> is a list of additional expressions to highlight. Each element of this list should have the same form as an element of <code>font-lock-keywords</code>. See <a href="search_002dbased-fontification">Search-based Fontification</a>. </p> <p>The argument <var>auto-mode-list</var> is a list of regular expressions to add to the variable <code>auto-mode-alist</code>. They are added by the execution of the <code>define-generic-mode</code> form, not by expanding the macro call. </p> <p>Finally, <var>function-list</var> is a list of functions for the mode command to call for additional setup. It calls these functions just before it runs the mode hook variable <code><var>mode</var>-hook</code>. </p>
+</dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Generic-Modes.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Generic-Modes.html</a>
+ </p>
+</div>