summaryrefslogtreecommitdiff
path: root/devdocs/elisp/smie-setup.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/smie-setup.html
new repository
Diffstat (limited to 'devdocs/elisp/smie-setup.html')
-rw-r--r--devdocs/elisp/smie-setup.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/devdocs/elisp/smie-setup.html b/devdocs/elisp/smie-setup.html
new file mode 100644
index 00000000..1cd4aa88
--- /dev/null
+++ b/devdocs/elisp/smie-setup.html
@@ -0,0 +1,16 @@
+ <h4 class="subsubsection">SMIE Setup and Features</h4> <p>SMIE is meant to be a one-stop shop for structural navigation and various other features which rely on the syntactic structure of code, in particular automatic indentation. The main entry point is <code>smie-setup</code> which is a function typically called while setting up a major mode. </p> <dl> <dt id="smie-setup">Function: <strong>smie-setup</strong> <em>grammar rules-function &amp;rest keywords</em>
+</dt> <dd>
+<p>Setup SMIE navigation and indentation. <var>grammar</var> is a grammar table generated by <code>smie-prec2-&gt;grammar</code>. <var>rules-function</var> is a set of indentation rules for use on <code>smie-rules-function</code>. <var>keywords</var> are additional arguments, which can include the following keywords: </p>
+<ul> <li> <code>:forward-token</code> <var>fun</var>: Specify the forward lexer to use. </li>
+<li> <code>:backward-token</code> <var>fun</var>: Specify the backward lexer to use. </li>
+</ul> </dd>
+</dl> <p>Calling this function is sufficient to make commands such as <code>forward-sexp</code>, <code>backward-sexp</code>, and <code>transpose-sexps</code> be able to properly handle structural elements other than just the paired parentheses already handled by syntax tables. For example, if the provided grammar is precise enough, <code>transpose-sexps</code> can correctly transpose the two arguments of a <code>+</code> operator, taking into account the precedence rules of the language. </p> <p>Calling <code>smie-setup</code> is also sufficient to make <tt class="key">TAB</tt> indentation work in the expected way, extends <code>blink-matching-paren</code> to apply to elements like <code>begin...end</code>, and provides some commands that you can bind in the major mode keymap. </p> <dl> <dt id="smie-close-block">Command: <strong>smie-close-block</strong>
+</dt> <dd><p>This command closes the most recently opened (and not yet closed) block. </p></dd>
+</dl> <dl> <dt id="smie-down-list">Command: <strong>smie-down-list</strong> <em>&amp;optional arg</em>
+</dt> <dd><p>This command is like <code>down-list</code> but it also pays attention to nesting of tokens other than parentheses, such as <code>begin...end</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/SMIE-setup.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE-setup.html</a>
+ </p>
+</div>