Article View: gnu.emacs.gnus
Article #81470Re: Reverse kill?
From: Larry Hunter
Date: Wed, 03 Feb 1993 11:33
Date: Wed, 03 Feb 1993 11:33
91 lines
3338 bytes
3338 bytes
Jason Merrill asks:
I remember seeing a posting here about a year ago, maybe longer, telling
how to set up a kill file for a group so everything is killed EXCEPT for
the articles you specify. Any ideas?
It was last posted here 28 Oct 92. Perhaps this oft-reposted message could
make it into a FAQ...
There are two things you need to do to use this code. One is to put some
function definitions in your .emacs file, and the other goes into the kill file
for the newsgroup you want to effect.
;;; --- begin kill file code ---
;; Simple GNUS method for killing ALL but a desired subset of articles
;;
;; Put the following code in the kill file of the newsgroup you want to effect.
;; Change the following strings to suit your tastes. You can also use a
;; similar method for identifying OK authors, etc.
(setq ok-subjects '("OK Subject 1" "for sale"))
(setq ok-authors '("hunter@nlm" "rms"))
;; First, kill all the articles. I use "Subject" as the first argument so gnus
;; doesn't search the entire text of the message.
(gnus-kill "Subject" "")
;; Then use the "clear mark if killed" function defined below to
;; unkill the desired articles. Change "subject" here for author,
;; etc. to use different fields.
(gnus-kill "subject" (string-list-to-pattern ok-subjects)
'gnus-Subject-clear-mark-if-killed t)
(gnus-kill "author" (string-list-to-pattern ok-authors)
'gnus-Subject-clear-mark-if-killed t)
;;; --- end kill file code ---
Now put the following in your .emacs file. These are the utility functions
used by the above gnus-code.
;;; --- begin .emacs code ---
;; GNUS kill all but ...
;; Written by Lawrence Hunter, National Library of Medicine
;; This code is a government work, and is uncopyrightable.
;;
;; This clears an X mark (i.e. unkills) the current article. Use with
;; gnu-kill.
(defun gnus-Subject-clear-mark-if-killed ()
(if (eq ?X (char-after (save-excursion (beginning-of-line 1) (point))))
(gnus-Subject-clear-mark-forward 1)))
;; creates a single pattern string that is the disjunction ("or") of a
;; list of pattern strings.
(defun string-list-to-pattern (strings)
(let ((pat (car strings))
(rest (cdr strings)))
(while rest
(setq pat (concat pat "\\\|" (car rest)))
(setq rest (cdr rest)))
pat))
;;; --- end .emacs code ---
Hope you enjoy it.
Larry
--
Lawrence Hunter, PhD.
National Library of Medicine
Bldg. 38A, MS-54
Bethesda. MD 20894 USA
tel: +1 (301) 496-9300
fax: +1 (301) 496-0673
internet: hunter@nlm.nih.gov
encryption: PGP 2.1 public key via "finger hunter@work.nlm.nih.gov"
Technical Details
Message-ID:
<HUNTER.93Feb3113313@work.nlm.nih.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!darwin.sura.net!lhc!lhc!hunterReferences:
<JASON.93Feb2212757@it.claremont.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1016f0,fbcd101083c9cf28 X-Google-Attributes: gid1016f0,public X-Google-ArrivalTime: 1993-02-03 23:44:56 PST Newsgroups: gnu.emacs.gnus Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!darwin.sura.net!lhc!lhc!hunter From: hunter@work.nlm.nih.gov (Larry Hunter) Subject: Re: Reverse kill? In-Reply-To: jason@jarthur.claremont.edu's message of 2 Feb 93 21:27:57 Message-ID: <HUNTER.93Feb3113313@work.nlm.nih.gov> Sender: news@nlm.nih.gov Reply-To: Hunter@nlm.nih.gov Organization: National Library of Medicine References: <JASON.93Feb2212757@it.claremont.edu> Date: 3 Feb 93 11:33:13 Lines: 91