Ok folks,
I had some spare time and I cooked up a simple procmail
minor mode. There is code linting capability built in,
but the procmail syntax seems to be very difficult to parse. Don't
expect it to trigger all errors. Please send me code
examples where the internal lint lint fails or some
piece of procmail code that it should have detected.
I'd encourage all interested people to get the complete
tgz kit and delete the files that you're not interested.
ftp://cs.uta.fi/pub/ssjaaa/tiny-tools.tar.gz
See file TinyPm.el (400K lisp code module), but you
also need other modules in order to use it.
I haven't tested the module extensively, so keep Emacs
debug on all the time and send me *Backtrace* and call
M-x tipm-submit-bug-report function. Below you find the
doc section from the module.
Cheers!
jari
Tinypm.el -- (p)roc(m)ail minor mode
Preface, Sep 1997
The 1997 was a turning point in my daily email management. I started
receiving 10-25 UBE messages per week to my private account and that
raised my body temper by couple of Celsius degrees. I wanted to nail
down those idiots, or at least get rid of the UBE so that it never
landed to my promary inbox $MAIL. The I met procmail and that solved
the mail handling for me. It also made possible to subscribe to
several mailing lists without bloating the $MAIL: procmail filed
the incoming mail to defined mailing list inboxes.
I also started using Gnus to read the mailing lists, but the mail
splitting work was best handled by procmail. Why? because procmail
is always running, while your Emacs and Gnus isn't. Procmail
always listens the incoming messages and takes care f them, like
forwarding those UBE messages to appropriate postmasters.
To get more info about procmail, send following email and
request pm-* (Procmail) shar archive.
To: jari(_dot_)aalto(_at_)poboxes(_dot_)com
Subject: send help
Procmail installation kit can be found at
ftp://ftp.informatik.rwth-aachen.de:/pub/packages/procmail/
What is Procmail?
[from procmail faq http://www.iki.fi/~era/procmail/]
Procmail is a mail processing utility, which can help you
filter your mail; sort incoming mail according to sender,
Subject line, length of message, keywords in the message, etc;
implement an ftp-by-mail server, and much more. Procmail is
also a complete drop-in replacement for your MDA. (If this
doesn't mean anything to you, you don't want to know.)
Terms
[from Email Abuse FAQ]
._UBE_ = Unsolicited Bulk Email.
._UCE_ = (subset of UBE) Unsolicited Commercial Email.
_Spam_ = Spam describes a particular kind of Usenet posting (and
canned spiced ham), but is now often used to describe many kinds of
inappropriate activities, including some email-related events. It
is technically incorrect to use "spam" to describe email abuse,
although attempting to correct the practice would amount to tilting
at windmills
Overview of features
o minor mode for writing Procmail receipes (simple code tab)
o Linting procmail code
o Font-lock supported.
Writing the procmail code
The coding functions are provided by other modules. Your tab
advances 4 characters at a time, and some minimalistic
brace alignment is supported if you press tab before the ending
brace.
TAB tit-tab-key tinytab.el
The RET autoindents, but this can be turned off by calling
C-c ' RET tit-return-key-mode tinytab.el
Whole regions can be adjusted with commands
C-TAB tit-indent-by-div-factor tinytab.el -->
A-S-TAB tit-indent-by-div-factor-back tinytab.el <--
C-c TAB tit-indent-region-dynamically tinytab.el <-->
Jumping o matching brace or matching paren
% timy-vi-type-paren-match tinymy.el
Aligning the lines that have backslashes.
In procmail, you use backslashes a lot, like in following example.
The backslashes here are put after each line, but this construct is
error prone, because if you later on add new `echo' commands or
otherwise modif the content, you may forget to update the
backslashed.
:0 fh
* condition
| (formail -rt | \
cat -; \
echo "Error: you requested file"; \
echo "that does not exist";\
) | $SENDMAIL -t
If the following code hashas spaces around this code block, you
can use command C-c ' \ or `tipm-fix-backslashes-region' to refermat it
so that the backslashes are lined up to the right. It would have
been enough to write the first backslash and then call C-c ' \ and
the rest of the backslashes would ave been added.
:0 fh
* condition
| (formail -rt | \
cat -; \
echo "Error: you requested file"; \
echo "that does not exist"; \
) | $SENDMAIL -t
Linting procmail code
Writing procmail receipes is very demanding, because you have to
watch your writing all the time. Forgetting flag or two, or adding
non needed flag may cause your procmail code to work inproperly.
To help *Linting* you procmail code, there are two functions
C-c ' l tipm-lint-forward
C-c ' L tipm-lint-buffer
If you call these functions, they check every receipe and offer
corrective actions if anything suspeicious is found. If you don't
want to correct the receipes, you can pass prefix argument, which
gathers the Lint run to separate buffer. In parenthesis you
see the buffer that was tested and to the right you see the program
and version number.
*** 1997-10-19 19:37 (pm-test.rc) tinypm.el 1.10
cd /users/foo/pm/
pm-test.rc:2: Error: Invalid or extra flags.
pm-test.rc:10: Error: Invalid or extra flags.
pm-test.rc:10: Error: Redundant `Wc:' because `c:' already implies
W.
pm-test.rc:11: String `>' found, receipe should have `w' flag.
In this buffer you can press Mouse-2 or RET to jump to the line.