From: eugene@amelia.nas.nasa.gov (Eugene N. Miya)
Newsgroups: ca.general,ba.general
Subject: [l/m 6/1/92] Kill files . . . with extreme prejudice
Date: 21 Jan 93 12:01:14 GMT
Reply-To: eugene@amelia.nas.nasa.gov (Eugene N. Miya)
Followup-To: poster
Distribution: ca
Organization: NAS Program, NASA Ames Research Center, Moffett Field, CA

Panel 21

	Table of Contents of this Chain

21	Killfiles (with extreme prejudice)			<This panel>
28	Canceling posted news articles
1	Reminders on use of the *.general news.groups
7	General Help Reading News
14	Posting headers and cross-posting
15	Distribution Fields

Kill files:
	or how to stop reading
		1) people you don't like, or
		2) dated FAQ postings you've already read, or
		3) reading subjects you think dull, or
		4) ...

Not all systems have Kill files.  I personally wish this could be more
general, but I've failed trying to find better strategies, maybe you can write
a better one?  This example uses the rn news reader, but similar commands
can be found on other systems.  Ask your News admin.  Notably lacking is one
for Notefile systems.  While the Kill command exists, it is crude with
problems, and a best strategy or style is needed to surgerically remove
unwanted messages, messengers, or 'bills.'

The best strategy appears to be
	1) creat a Kill file
	2) edit it
Select a message/topic/person to terminate with extreme prejudice,
The 'K' command creates a KILL file in your News directory structure which
mimics the News hierarchy (e.g., News/ba/general); it looks like:

<BOF>
THRU message#
/search strings of articles to junk/j
<EOF>

THRU is just a pointer: all messages checked to that point.  The search
string is usually a portion of the Subject: field.  Next edit using
^K (control-K).  This places one in the editor (setenv using the EDITOR
environment variable, vi is default).  Here you edit
the search string for messages you wish to junk.  There is a search time
cost associated prior to actually reading news, your key is editing this
search string.  You can use '*' as the wildcard (glob, or Kleene star)
character.  You can restrict the search to just message Headers or
search a whole message.  Let's just restrict Headers:, add an 'h' before
the 'j' for junk:
/:fromstring/h:j or
/:subjectstring/h:j
Note the ':' in the string anchors the search to specific fields in the
header body.  Collect and keep or delete j-lines.

So for instance, if you want to stop reading automated posting
FAQ messages, you can K on one
/: Welcome to*/h:j		# for many groups
/: [l/m 8/16] Kill files*/h:j	# for this message
/: *obnoxious*/h:j		# stop reading anything by obnoxious
/: *eugene@*/h:j		# stop reading anything by me in that group

Disadvantages: as said by more than one person: sometimes you want to
resume reading some one or thing.  This is where the l/m comes into the
search field/ it allows you to stay current but avoid old messages. 
Otherwise, you must take some time to edit Kill files.
		This is the end.
					-- Jim Morrison
SEE ALSO
	kill(1).



Here's the information on Gnus. Edit as you wish.

(M-x is Meta-x or ESC <x>)

`M-k'
     Edit a local KILL file applied to the current newsgroup
     (`gnus-Subject-edit-local-kill').  *Note KILL File::, for more
     information.

`M-K'
     Edit a global KILL file applied to all newsgroups
     (`gnus-Subject-edit-local-kill').  *Note KILL File::, for more
     information.


KILL File
*********

  The purpose of a KILL file and its usage are described here.

* Menu:

* What KILL Files Do::          An introduction to a KILL file.
* Making a KILL File::          How to make a KILL file.
* Editing KILL Files::          How to edit KILL files.
* Example of a KILL File::      An example of a KILL file.

* Background Kills::            Background kill processing.
* Advanced Kills::              Advanced kill processing.


What KILL Files Do
==================

  A "KILL" file contains lisp expressions to be applied to a selected
newsgroup.  The purpose is to mark articles as read on the basis of some
set of regexps.

  There are two kinds of KILL files, global and local.  A global KILL
file is applied to every newsgroup, and a local KILL file to a specified
newsgroup.  Since a global KILL file is applied to every newsgroup, for
better performance use a local one.


Making a KILL File
==================

  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'.


Editing KILL Files
==================

  The command `M-K' in Subject Mode and Group Mode
(`gnus-Subject-edit-global-kill' and `gnus-Group-edit-global-kill') pops
up an Emacs buffer for editing a global KILL file.  A global KILL file
is created in the directory specified by the variable
`gnus-article-save-directory' (default to `~/News'), and its file name
is specified by the variable `gnus-kill-file-name' (default to `KILL').

  The command `M-k' in Subject Mode and Group Mode
(`gnus-Subject-edit-local-kill' and `gnus-Group-edit-local-kill') pops
up an Emacs buffer for editing a local KILL file.  A local KILL file for
a newsgroup NEWS.GROUP is created as `NEWS.GROUP.KILL' in the directory
specified by the variable `gnus-article-save-directory' if the variable
`gnus-use-long-file-name' is non-`nil'.  Otherwise, if the variable
`gnus-use-long-file-name' is `nil', the file is created as
`NEWS/GROUP/KILL' under the same directory.

  The major mode of these buffers is "KILL-File Mode".  This mode is
specialized for editing Emacs lisp programs the same as Emacs-Lisp Mode.
In addition to Emacs-Lisp Mode, the following commands are available:

`C-c C-k C-s'
     Insert a template of a kill command on subject
     (`gnus-Kill-file-kill-by-subject').

`C-c C-k C-a'
     Insert a template of a kill command on author
     (`gnus-Kill-file-kill-by-author').

`C-c C-a'
     Apply current buffer being edited to selected newsgroup
     (`gnus-Kill-file-apply-buffer').

`C-c C-e'
     Apply sexp before point in current buffer to selected newsgroup
     (`gnus-Kill-file-apply-last-sexp').

`C-c C-c'
     Save the KILL file and then return to the previous buffer
     (`gnus-Kill-file-exit').

`C-c C-i'
     Read Info on KILL file (`gnus-Info-find-node').  *Note Texinfo
     Manual::, to prepare an Info file of GNUS.

  If KILL-File Mode is invoked from Subject Mode by the command
`gnus-Subject-edit-local-kill' or `gnus-Subject-edit-global-kill', the
commands `C-c C-k C-s' and `C-c C-k C-a'
(`gnus-Kill-file-kill-by-subject' and `gnus-Kill-file-kill-by-author')
insert a kill command on the subject and author of an article where the
point is on, respectively.  Otherwise, a template of a kill command is
inserted.

  The commands `C-c C-a' and `C-c C-e' (`gnus-Kill-file-apply-buffer'
and `gnus-Kill-file-apply-last-sexp') can be used to test kill commands
being edited in current buffer.  The kill commands are applied to
current newsgroup.

Example of a KILL File
======================

  The following is an example of a local KILL file for newsgroup
`control'.  This is currently being used by the author.

     ;; Apply to the newsgroup `control' if the NNTP server is flab.
     (if (string-equal gnus-nntp-server "flab")
         (progn
           (gnus-kill "Subject" "ihave flab\\|sendme")
           (gnus-kill "Subject" "cancel\\|newgroup\\|rmgroup" "d")
           (gnus-expunge "X")))


Background Kill Processing
==========================

  Kill processing may take long time.  If it becomes terribly
frustrating, try background kill processing using the following shell
command:

     emacs -batch -l gnus -f gnus-batch-kill NEWSGROUPS

where NEWSGROUPS argument is newsgroup names separated by either white
spaces or a comma.  `!' preceding a newsgroup name means negation, and
`all' matches anything else.  These interpretations are the same as the
options line of the startup file (*Note Startup File::).


Advanced Kill Processing
========================

  Internally, applying kills means to run the hook
`gnus-Apply-kill-hook'.  It is called after the Subject buffer is
prepared for a selected newsgroup.  The default hook is the function
`gnus-apply-kill-file' which loads a global KILL file and a local KILL
file in this order.  A different style of the kill processing can be
implemented by customizing this hook.

  For example, if you think a global KILL file is unnecessary, you can
use the following hook which applies only a local KILL file.  This
change can save the time for checking the existence of a global KILL
file.

     (setq gnus-Apply-kill-hook
           '(lambda ()
              ;; Apply a local KILL file.
              (load (gnus-newsgroup-kill-file gnus-newsgroup-name) t nil t)))

  On the contrary, the following example enables only a global KILL
file.

     (setq gnus-Apply-kill-hook
           '(lambda ()
              ;; Apply a global KILL file.
              (load (gnus-newsgroup-kill-file nil) t nil t)))

  Here is an advanced example that drastically reduces the time for
applying KILL files.  This hook does the kill processing directly
without loading the KILL files.

     (setq gnus-Apply-kill-hook
           '(lambda ()
              ;; Apply to the newsgroup `control'
              ;; if the NNTP server is flab.
              (and (string-equal gnus-nntp-server "flab")
                   (string-equal gnus-newsgroup-name "control")
                   (progn
                     (gnus-kill "Subject" "ihave flab\\|sendme")
                     (gnus-kill "Subject" "cancel\\|newgroup\\|rmgroup" "d")
                     (gnus-expunge "X")))))
Xref: sparky ca.general:1662 ba.general:5834