A KILL file can contain any kind of Emacs lisp expressions expected to be evaluated in the Subject buffer. Writing lisp programs for this purpose is not easy because the internal working of GNUS must be well-known. For this reason, GNUS provides a general function which does this easily for non-lisp programmers.
(gnus-kill field regexp &optional command all)
The gnus-kill
function executes commands available in Subject
Mode by their key sequences. gnus-kill
must be called with
field, regexp, and optional command and all.
Field is a string representing the header field or an empty
string. If field is an empty string, the entire article body is
searched for. Regexp is a string which is compared with
field value. Command is a string representing a valid key
sequence in Subject Mode or a lisp expression. Command is default
to (gnus-Subject-mark-as-read nil "X")
. Make sure that
command is executed in the Subject buffer. If the second optional
argument all is non-nil
, the command is applied to
articles which are already marked as read or unread. Articles which are
marked are skipped over by default.
For example, if you want to mark articles of which subjects contain the string `AI' as read, a possible KILL file may look like:
(gnus-kill "Subject" "AI")
If you want to mark articles with `D' instead of `X', you can use the following expression:
(gnus-kill "Subject" "AI" "d")
In this example it is assumed that the command
gnus-Subject-mark-as-read-forward
is assigned to d in
Subject Mode.
It is possible to delete unnecessary headers which are marked with
`X' in a KILL file by using the function gnus-expunge
as
follows:
(gnus-expunge "X")
If the Subject buffer is empty after applying KILL files, GNUS will exit the selected newsgroup normally. If headers which are marked with `D' are deleted in a KILL file, it is impossible to read articles which are marked as read in the previous GNUS sessions. Marks other than `D' should be used for articles which should really be deleted.
All sorts of searches in Subject Mode normally ignore the case of the
text they are searching through. If you do not want to ignore the case,
set the variable case-fold-search
to nil
.