From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/smie-setup.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 devdocs/elisp/smie-setup.html (limited to 'devdocs/elisp/smie-setup.html') 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 @@ +

SMIE Setup and Features

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 smie-setup which is a function typically called while setting up a major mode.

Function: smie-setup grammar rules-function &rest keywords +
+

Setup SMIE navigation and indentation. grammar is a grammar table generated by smie-prec2->grammar. rules-function is a set of indentation rules for use on smie-rules-function. keywords are additional arguments, which can include the following keywords:

+
  • :forward-token fun: Specify the forward lexer to use.
  • +
  • :backward-token fun: Specify the backward lexer to use.
  • +
+

Calling this function is sufficient to make commands such as forward-sexp, backward-sexp, and transpose-sexps 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, transpose-sexps can correctly transpose the two arguments of a + operator, taking into account the precedence rules of the language.

Calling smie-setup is also sufficient to make TAB indentation work in the expected way, extends blink-matching-paren to apply to elements like begin...end, and provides some commands that you can bind in the major mode keymap.

Command: smie-close-block +

This command closes the most recently opened (and not yet closed) block.

+
Command: smie-down-list &optional arg +

This command is like down-list but it also pays attention to nesting of tokens other than parentheses, such as begin...end.

+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE-setup.html +

+
-- cgit v1.2.3