Commit 47b73b35 authored by Glenn Morris's avatar Glenn Morris

Try to document some smie changes

* doc/lispref/modes.texi (SMIE Customization): New section.

* doc/lispref/elisp.texi (Top): Update detailed menu.

* etc/NEWS: Related edits.
parent 65cdacb5
2014-03-05 Glenn Morris <rgm@gnu.org>
* modes.texi (SMIE Customization): New section.
* elisp.texi (Top): Update detailed menu.
2014-03-04 Martin Rudalics <rudalics@gmx.at> 2014-03-04 Martin Rudalics <rudalics@gmx.at>
* windows.texi (Windows and Frames): Add some missing &optional * windows.texi (Windows and Frames): Add some missing &optional
......
...@@ -903,6 +903,7 @@ Simple Minded Indentation Engine ...@@ -903,6 +903,7 @@ Simple Minded Indentation Engine
* SMIE Indentation:: Specifying indentation rules. * SMIE Indentation:: Specifying indentation rules.
* SMIE Indentation Helpers:: Helper functions for indentation rules. * SMIE Indentation Helpers:: Helper functions for indentation rules.
* SMIE Indentation Example:: Sample indentation rules. * SMIE Indentation Example:: Sample indentation rules.
* SMIE Customization:: Customizing indentation.
Documentation Documentation
......
...@@ -3383,6 +3383,7 @@ resorting to some special tricks (@pxref{SMIE Tricks}). ...@@ -3383,6 +3383,7 @@ resorting to some special tricks (@pxref{SMIE Tricks}).
* SMIE Indentation:: Specifying indentation rules. * SMIE Indentation:: Specifying indentation rules.
* SMIE Indentation Helpers:: Helper functions for indentation rules. * SMIE Indentation Helpers:: Helper functions for indentation rules.
* SMIE Indentation Example:: Sample indentation rules. * SMIE Indentation Example:: Sample indentation rules.
* SMIE Customization:: Customizing indentation.
@end menu @end menu
@node SMIE setup @node SMIE setup
...@@ -3961,6 +3962,52 @@ the previous @code{"else"}, rather than going all the way back to the ...@@ -3961,6 +3962,52 @@ the previous @code{"else"}, rather than going all the way back to the
first @code{"if"} of the sequence. first @code{"if"} of the sequence.
@end itemize @end itemize
@c In some sense this belongs more in the Emacs manual.
@node SMIE Customization
@subsubsection Customizing Indentation
If you are using a mode whose indentation is provided by SMIE, you can
customize the indentation to suit your preferences. You can do this
on a per-mode basis (using the option @code{smie-config}), or a
per-file basis (using the function @code{smie-config-local} in a
file-local variable specification).
@defopt smie-config
This option lets you customize indentation on a per-mode basis.
It is an alist with elements of the form @code{(@var{mode} . @var{rules})}.
For the precise form of rules, see the variable's documentation; but
you may find it easier to use the command @code{smie-config-guess}.
@end defopt
@deffn Command smie-config-guess
This command tries to work out appropriate settings to produce
your preferred style of indentation. Simply call the command while
visiting a file that is indented with your style.
@end deffn
@deffn Command smie-config-save
Call this command after using @code{smie-config-guess}, to save your
settings for future sessions.
@end deffn
@deffn Command smie-config-show-indent &optional move
This command displays the rules that are used to indent the current
line.
@end deffn
@deffn Command smie-config-set-indent
This command adds a local rule to adjust the indentation of the current line.
@end deffn
@defun smie-config-local rules
This function adds @var{rules} as indentation rules for the current buffer.
These add to any mode-specific rules defined by the @code{smie-config} option.
To specify custom indentation rules for a specific file, add an entry
to the file's local variables of the form:
@code{eval: (smie-config-local '(@var{rules}))}.
@end defun
@node Desktop Save Mode @node Desktop Save Mode
@section Desktop Save Mode @section Desktop Save Mode
@cindex desktop save mode @cindex desktop save mode
......
...@@ -904,11 +904,17 @@ All non-ancient Bash versions support this option. ...@@ -904,11 +904,17 @@ All non-ancient Bash versions support this option.
** SMIE ** SMIE
*** You can customize the indentation of modes that use SMIE via `smie-config'. +++
*** You can customize the SMIE indentation of a mode via `smie-config'.
The command `smie-config-guess' can help you derive the appropriate The command `smie-config-guess' can help you derive the appropriate
indentation settings, if you provide it with an indented sample file. indentation settings, if you provide it with an indented sample file.
Use `smie-config-save' to save the result. Use `smie-config-save' to save the result.
+++
*** You can customize the SMIE indentation of a file by adding an entry to
the file's local variables of the form: `eval: (smie-config-local '(RULES)'.
+++
*** New commands `smie-config-show-indent' and `smie-config-set-indent'. *** New commands `smie-config-show-indent' and `smie-config-set-indent'.
--- ---
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment