From 181d72e3e2643a32b4a9754a6fac439a61a6a1e0 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 29 May 2007 12:31:42 +0000 Subject: Update git-svn-id: file:///svnroot/mailfromd/trunk@1482 7a8a7f39-df28-0410-adc6-e0d955640f24 --- doc/mailfromd.texi | 98 +++++++++++++++++++++++++++++++++++++++++++++++++----- elisp/mfl-mode.el | 2 +- 2 files changed, 90 insertions(+), 10 deletions(-) diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi index bc76dbe9..503dcf7f 100644 --- a/doc/mailfromd.texi +++ b/doc/mailfromd.texi @@ -9653,19 +9653,40 @@ file (either system-wide @file{site-start.el}, or your personal one, @group (autoload 'mfl-mode "mfl-mode") (setq auto-mode-alist (append auto-mode-alist - '(("/usr/local/etc/mailfromd.rc" . mfl-mode) + '(("/etc/mailfromd.rc" . mfl-mode) ("\\.mf$" . mfl-mode)))) @end group @end smalllisp The first line loads the @acronym{MFL} mode, and the second one -tells Emacs to apply it to the file @file{/usr/local/etc/mailfromd.rc} -(of course, you should replace @file{/usr/local/etc/} with the exact -location, where your main filter script file is installed), and to any -file whose name ends with a @samp{.mf} suffix. +tells Emacs to apply it to any file whose name ends in +@file{/etc/mailfromd.rc}@footnote{This will match most existing +installations. In the unlikely case that your @code{$sysconfdir} does +not end in @file{/etc}, you will have to edit the first line +accordingly.} or in a @samp{.mf} suffix. +@cindex indentation, @acronym{MFL}, default @acronym{MFL} mode provides automatic indentation and syntax -highlighting for @acronym{MFL} sources. +highlighting for @acronym{MFL} sources. The default indentation setup +is the same as the one used throughout this book: + +@itemize @bullet +@item Handler and function definitions start at column 1; +@item A block statement, i.e. @samp{do}, @samp{done}, @samp{if}, +@samp{else}, @samp{elif} and @samp{fi}, occupies a line by itself, +with the only exception that @samp{do} after an @samp{on} statement is +located on the same line with it; +@item A @samp{do} statement that follows function or handler +definition is placed in column 1. +@item Each subsequent level of nesting is indented two columns to the +right (@pxref{mfl-basic-offset}). +@item A closing statement (@samp{done}, @samp{else}, @samp{elif}, +@samp{fi}) is placed at the same column as the corresponding opening +statement; +@item Branch statements (@samp{case} and @samp{when}) are placed in +the same column as their controlling keyword (@samp{switch} and +@samp{on}, correspondingly (@pxref{mfl-case-line-offset}). +@end itemize @cindex Finding function definition @cindex Navigating through function definitions @@ -9689,14 +9710,73 @@ pressing @kbd{C-M-a} will visit all the definitions in the opposite direction (from the last up to the very first one). @cindex Verifying script syntax - Another special command, @kbd{C-c C-c}, allows to to verify the + Another special command, @kbd{C-c C-c}, allows to verify the syntax of your script file. This command runs @command{mailfromd} in syntax check mode (@pxref{Testing Filter Scripts}) and displays its output in a secondary window, which allows to navigate through -eventual diagnostic messages and to jump to the source locations +eventual diagnostic messages and to jump to source locations described by them. - +@cindex customization, Emacs +@cindex customization, @acronym{MFL} mode + All @acronym{MFL} mode settings are customizable. To change any of +them, press @kbd{M-x customize} and visit @samp{Environment/Unix/Mfl} +customization group. This group offers two subgroups: @samp{Mfl Lint +group} and @samp{Mfl Indentation group}. + +@samp{Mfl Lint group} controls invocation of mailfromd by @kbd{C-c +C-c}. This group contains two variables: + +@defvr {MFL-mode setting} mfl-mailfromd-command +The @command{mailfromd} to be invoked. By default, it is +@samp{mailfromd}. You will have to change it, if @command{mailfromd} +cannot be found using @env{PATH} environment variable, or if you wish +to pass it some special options. However, do not include +@option{--lint} or @option{-I} options in this variable. The +@option{--lint} option is given automatically, and include paths are +controlled by @code{mfl-include-path} variable (see below). +@end defvr + +@defvr {MFL-mode setting} mfl-include-path +A list of directories to be appended to @command{mailfromd} include +search path (@pxref{include search path}). By default it is empty. +@end defvr + +@samp{Mfl Indentation group} controls automatic indentation of +@acronym{MFL} scripts. This group contains the following settings: + +@anchor{mfl-basic-offset} +@defvr {MFL-mode setting} mfl-basic-offset +This variable sets the basic indentation increment. It is set to 2, +by default, which corresponds to the following indentation style: + +@smallexample +prog envfrom +do + if $f = "" + accept + else + @dots{} + fi +done +@end smallexample +@end defvr + +@anchor{mfl-case-line-offset} +@defvr {MFL-mode setting} mfl-case-line-offset +Indentation offset for @code{case} and @code{when} lines, relative to +the column of their controlling keyword. The default is 0, i.e.: + +@smallexample +switch %x +do +case 0: + @dots{} +default: + @dots{} +done +@end smallexample +@end defvr @node Mailfromd Configuration, Sendmail Configuration, Using MFL Mode, Top @chapter Configuring @command{mailfromd} diff --git a/elisp/mfl-mode.el b/elisp/mfl-mode.el index eb0bceb1..e9488001 100644 --- a/elisp/mfl-mode.el +++ b/elisp/mfl-mode.el @@ -234,7 +234,7 @@ keywords: else, elif, fi, done, when, case. (beginning-of-line) (skip-chars-forward " \t") (looking-at (regexp-opt - '("else" "elif" "fi" "done" "when" "case") + '("else" "elif" "fi" "done" "when" "case" "default") 'words))) (mfl-indent-line)) (newline-and-indent)) -- cgit v1.2.1