$buffer-indent - Current buffer indentation scheme.
$buffer-indent indentNum; Default is 0
0 <= indentNum <= 255
$buffer-indent sets the current buffers indentation scheme. indentNum is the identity of the indentation scheme, as defined by indent(2), which is typically the same value as the buffers hilighting scheme number (see $buffer-hilight(5)).
The default setting is 0 which specifies no indentation scheme is present (with the exception of cmode(2m)). When non-zero, the value identifies the indentation scheme.
A buffer assigned an indentation method, MicroEmacs performs automatic line re-styling, by moving the left indentation, according to the defined indentation method. The tab key is typically disabled. This behavior can be altered using bit 0x1000 of the $system(5) variable, which can be changed using user-setup(3).
The use of tab characters to create the required indentation is determined by the setting of the buffers tab(2m) mode. If the mode is disabled tab characters are used wherever possible, otherwise spaces are always used.
The commands restyle-region(3) and restyle-buffer(3) use the indentation method when defined.
The buffer indentation scheme is typically assigned in the fhook macro, see Language Templates.
The following example sets up an indentation scheme for a buffer within the fhook macro.
!if &sequal .hilight.foo "ERROR" set-variable .hilight.foo &pinc .hilight.next 1 !endif .... ; Define the indentation scheme 0 indent .hilight.foo 2 10 indent .hilight.foo n "then" 4 indent .hilight.foo s "else" -4 indent .hilight.foo o "endif" -4 .... ; File hook - called when new file is loaded. define-macro fhook-foo ; if arg is 0 this is a new file so add template !if ¬ @# etfinsrt "foo" !endif ; Assign the hilighting set-variable $buffer-hilight .hilight.foo ; Assign the buffer indentation set-variable $buffer-indent .hilight.foo ; Set the abbreviation file buffer-abbrev-file "foo" ; Temporary comment to make sure that it works. ml-write "Loaded a foo file" !emacro
This provides an indentation of the form:-
if condition then XXXX else if condition then XXXX endif endif
indent(2), tab(2m), $system(5), user-setup(3), restyle-buffer(3), restyle-region(3), $buffer-hilight(5).
(c) Copyright JASSPA 1999
Last Modified: 1999/02/27
Generated On: 1999/12/01