summaryrefslogtreecommitdiff
path: root/devdocs/elisp/smie-indentation-helpers.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/smie-indentation-helpers.html')
-rw-r--r--devdocs/elisp/smie-indentation-helpers.html24
1 files changed, 24 insertions, 0 deletions
diff --git a/devdocs/elisp/smie-indentation-helpers.html b/devdocs/elisp/smie-indentation-helpers.html
new file mode 100644
index 00000000..c2376325
--- /dev/null
+++ b/devdocs/elisp/smie-indentation-helpers.html
@@ -0,0 +1,24 @@
+ <h4 class="subsubsection">Helper Functions for Indentation Rules</h4> <p>SMIE provides various functions designed specifically for use in the indentation rules function (several of those functions break if used in another context). These functions all start with the prefix <code>smie-rule-</code>. </p> <dl> <dt id="smie-rule-bolp">Function: <strong>smie-rule-bolp</strong>
+</dt> <dd><p>Return non-<code>nil</code> if the current token is the first on the line. </p></dd>
+</dl> <dl> <dt id="smie-rule-hanging-p">Function: <strong>smie-rule-hanging-p</strong>
+</dt> <dd><p>Return non-<code>nil</code> if the current token is <em>hanging</em>. A token is <em>hanging</em> if it is the last token on the line and if it is preceded by other tokens: a lone token on a line is not hanging. </p></dd>
+</dl> <dl> <dt id="smie-rule-next-p">Function: <strong>smie-rule-next-p</strong> <em>&amp;rest tokens</em>
+</dt> <dd><p>Return non-<code>nil</code> if the next token is among <var>tokens</var>. </p></dd>
+</dl> <dl> <dt id="smie-rule-prev-p">Function: <strong>smie-rule-prev-p</strong> <em>&amp;rest tokens</em>
+</dt> <dd><p>Return non-<code>nil</code> if the previous token is among <var>tokens</var>. </p></dd>
+</dl> <dl> <dt id="smie-rule-parent-p">Function: <strong>smie-rule-parent-p</strong> <em>&amp;rest parents</em>
+</dt> <dd><p>Return non-<code>nil</code> if the current token’s parent is among <var>parents</var>. </p></dd>
+</dl> <dl> <dt id="smie-rule-sibling-p">Function: <strong>smie-rule-sibling-p</strong>
+</dt> <dd><p>Return non-<code>nil</code> if the current token’s parent is actually a sibling. This is the case for example when the parent of a <code>","</code> is just the previous <code>","</code>. </p></dd>
+</dl> <dl> <dt id="smie-rule-parent">Function: <strong>smie-rule-parent</strong> <em>&amp;optional offset</em>
+</dt> <dd><p>Return the proper offset to align the current token with the parent. If non-<code>nil</code>, <var>offset</var> should be an integer giving an additional offset to apply. </p></dd>
+</dl> <dl> <dt id="smie-rule-separator">Function: <strong>smie-rule-separator</strong> <em>method</em>
+</dt> <dd>
+<p>Indent current token as a <em>separator</em>. </p> <p>By <em>separator</em>, we mean here a token whose sole purpose is to separate various elements within some enclosing syntactic construct, and which does not have any semantic significance in itself (i.e., it would typically not exist as a node in an abstract syntax tree). </p> <p>Such a token is expected to have an associative syntax and be closely tied to its syntactic parent. Typical examples are <code>","</code> in lists of arguments (enclosed inside parentheses), or <code>";"</code> in sequences of instructions (enclosed in a <code>{...}</code> or <code>begin...end</code> block). </p> <p><var>method</var> should be the method name that was passed to <code>smie-rules-function</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-Indentation-Helpers.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE-Indentation-Helpers.html</a>
+ </p>
+</div>