SMIE Indentation Example (GNU Emacs Lisp Reference Manual)

Next: , Previous: , Up: Simple Minded Indentation Engine [Contents][Index]


24.8.1.8 Sample Indentation Rules

Here is an example of an indentation function:

(defun sample-smie-rules (kind token)
 (pcase (cons kind token)
 (`(:elem . basic) sample-indent-basic)
 (`(,_ . ",") (smie-rule-separator kind))
 (`(:after . ":=") sample-indent-basic)
 (`(:before . ,(or `"begin" `"(" `"{"))
 (if (smie-rule-hanging-p) (smie-rule-parent)))
 (`(:before . "if")
 (and (not (smie-rule-bolp)) (smie-rule-prev-p "else")
 (smie-rule-parent)))))

A few things to note:


Next: Customizing Indentation, Previous: Helper Functions for Indentation Rules, Up: Simple Minded Indentation Engine [Contents][Index]

AltStyle によって変換されたページ (->オリジナル) /