diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/basic-major-modes.html | |
new repository
Diffstat (limited to 'devdocs/elisp/basic-major-modes.html')
| -rw-r--r-- | devdocs/elisp/basic-major-modes.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/elisp/basic-major-modes.html b/devdocs/elisp/basic-major-modes.html new file mode 100644 index 00000000..fba3e060 --- /dev/null +++ b/devdocs/elisp/basic-major-modes.html @@ -0,0 +1,18 @@ + <h4 class="subsection">Basic Major Modes</h4> <p>Apart from Fundamental mode, there are three major modes that other major modes commonly derive from: Text mode, Prog mode, and Special mode. While Text mode is useful in its own right (e.g., for editing files ending in <samp>.txt</samp>), Prog mode and Special mode exist mainly to let other modes derive from them. </p> <p>As far as possible, new major modes should be derived, either directly or indirectly, from one of these three modes. One reason is that this allows users to customize a single mode hook (e.g., <code>prog-mode-hook</code>) for an entire family of relevant modes (e.g., all programming language modes). </p> <dl> <dt id="text-mode">Command: <strong>text-mode</strong> +</dt> <dd> +<p>Text mode is a major mode for editing human languages. It defines the ‘<samp>"</samp>’ and ‘<samp>\</samp>’ characters as having punctuation syntax (see <a href="syntax-class-table">Syntax Class Table</a>), and binds <kbd>M-<span class="key">TAB</span></kbd> to <code>ispell-complete-word</code> (see <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Spelling.html#Spelling">Spelling</a> in <cite>The GNU Emacs Manual</cite>). </p> <p>An example of a major mode derived from Text mode is HTML mode. See <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/HTML-Mode.html#HTML-Mode">SGML and HTML Modes</a> in <cite>The GNU Emacs Manual</cite>. </p> +</dd> +</dl> <dl> <dt id="prog-mode">Command: <strong>prog-mode</strong> +</dt> <dd> +<p>Prog mode is a basic major mode for buffers containing programming language source code. Most of the programming language major modes built into Emacs are derived from it. </p> <p>Prog mode binds <code>parse-sexp-ignore-comments</code> to <code>t</code> (see <a href="motion-via-parsing">Motion via Parsing</a>) and <code>bidi-paragraph-direction</code> to <code>left-to-right</code> (see <a href="bidirectional-display">Bidirectional Display</a>). </p> +</dd> +</dl> <dl> <dt id="special-mode">Command: <strong>special-mode</strong> +</dt> <dd> +<p>Special mode is a basic major mode for buffers containing text that is produced specially by Emacs, rather than directly from a file. Major modes derived from Special mode are given a <code>mode-class</code> property of <code>special</code> (see <a href="major-mode-conventions">Major Mode Conventions</a>). </p> <p>Special mode sets the buffer to read-only. Its keymap defines several common bindings, including <kbd>q</kbd> for <code>quit-window</code> and <kbd>g</kbd> for <code>revert-buffer</code> (see <a href="reverting">Reverting</a>). </p> <p>An example of a major mode derived from Special mode is Buffer Menu mode, which is used by the <samp>*Buffer List*</samp> buffer. See <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/List-Buffers.html#List-Buffers">Listing Existing Buffers</a> in <cite>The GNU Emacs Manual</cite>. </p> +</dd> +</dl> <p>In addition, modes for buffers of tabulated data can inherit from Tabulated List mode, which is in turn derived from Special mode. See <a href="tabulated-list-mode">Tabulated List Mode</a>. </p><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 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/Basic-Major-Modes.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Basic-Major-Modes.html</a> + </p> +</div> |
