Article View: news.software.readers
Article #556Re: KILL, unsubscribe, mail
From: Dan_Jacobson
Date: Thu, 05 Sep 1991 23:29
Date: Thu, 05 Sep 1991 23:29
161 lines
6207 bytes
6207 bytes
>>>>> On 4 Sep 91 07:03:58 GMT, danlip@cco.caltech.edu (Daniel Adam Lipofsky) said:
DanLip> 1) I've been making lots of little KILL files all over the place using
DanLip> the K command in rn. They are annoying because they are buried down
DanLip> in multilple sub-directories.
GNUS can also let you have a kill file in your .emacs file. Sample:
;;KILL files equivalent
(setq
gnus-Apply-kill-hook
(function
(lambda ()
(cond
((string-equal gnus-newsgroup-name "chi.places")
(progn
(gnus-kill "Subject" "^Buzz .*Current Events")
(gnus-expunge "X")))
((string-equal gnus-newsgroup-name "chi.weather")
(progn
(gnus-Subject-sort-by-date t) ;well, if interactive
(gnus-kill "Subject" "Rockford\\|Indiana\\|Peoria\\|nearshore")
;;(gnus-expunge "X")
))
;;; special case
((string-match "^ih\\.\\|^att\\.\\|^chi\\." gnus-newsgroup-name)
(progn
(gnus-kill "Subject" "\\(bulls\\|hawks\\|cub\\|sox\\).*ticket")
(gnus-kill
"Subject"
"\\(\\<\\(land\\|car\\|motorcycle\\|home\\|house\\|tires\\|room\\|waterbed\\|sedan\\|condo\\|lot\\|truck\\|van\\|camper\\|boat\\|canoe\\)\\>\\).*\\(for\\|to\\).*\\(sale\\|rent\\|sublet\\)\\|\\3.*\\4:.*\\1")
(gnus-kill "Subject" "open.*house"))
);;; (gnus-expunge "X")))
((string-equal gnus-newsgroup-name "comp.emacs")
(progn
(gnus-kill "Subject" "MicroEmacs")
(gnus-kill "Subject" "Micro-Emacs")
(gnus-expunge "X")))
Fun, huh?
Here's the FTP pointer:
GNU Emacs Lisp Code Directory Apropos -- "gnus"
gnus (3.13) 90-03-01
Masanobu Umeda, <umerin@mse.kyutech.ac.jp>
archive.cis.ohio-state.edu:/pub/gnu/emacs/elisp-archive/packages/gnus-3.13.tar.Z
Net News Reader, Rn + vn with NNTP.
I also have a shell script that will turn your million KILL files
pretty much into the above style single stretch of GNU Emacs lisp.
OK, here it is.
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents: rnKILL2gnus
# Wrapped by danj1@ihlpz on Fri Mar 8 18:20:10 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive."'
if test -f 'rnKILL2gnus' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'rnKILL2gnus'\"
else
echo shar: Extracting \"'rnKILL2gnus'\" \(2178 characters\)
sed "s/^X//" >'rnKILL2gnus' <<'END_OF_FILE'
X: Dan_Jacobson@ATT.COM 9/1990
X#real simple program that reads a tree of "rn" newsreader KILL files
X#and spits out "gnus-Apply-kill-hook" lisp code for use in the GNUS newsreader
X#(a subsystem of GNU Emacs). Sample ("more" output):
X
X# ::::::::::::::
X# rec/food/veg/KILL
X# ::::::::::::::
X# THRU 4429
X# /recipe/j
X# /cookbook/j
X# ::::::::::::::
X# rec/travel/KILL
X# ::::::::::::::
X# THRU 11021
X# /car rental/j
X# /renting a car/j
X#[...]
X
X#becomes
X
X# (setq gnus-Apply-kill-hook
X# '(lambda ()
X# (cond
X# ((string-equal gnus-newsgroup-name "rec.food.veg")
X# (progn
X# (gnus-kill "Subject" "recipe")
X# (gnus-kill "Subject" "cookbook")
X# (gnus-expunge "X")))
X# ((string-equal gnus-newsgroup-name "rec.travel")
X# (progn
X# (gnus-kill "Subject" "car rental")
X# (gnus-kill "Subject" "renting a car")
X# (gnus-expunge "X")))
X#[...]
X
X#You probably want to put that lisp code into your gnus-Startup-hook.
X#Assumes: that your rn KILL files are all simple "/bla bla/j" kind of
X#lines, that your $HOME/News tree has files like alt/wax/KILL (from
X#rn's "-/" option), not e.g., alt.wax/KILL. Naturally double check
X#the output. I just used Masanobu Umeda's (GNUS 3.13)
X#gnus-Apply-kill-hook examples to make the output. I am no lisp pro.
X#It does make (disk) blocks and blocks of KILL files into just a few
X#lines of lisp. Note GNUS also has KILL files if you want them.
X
X#Took only 1/2 hour to whip up. And I've already processed my KILL
X#files, so, er... I don't plan to enhance/fix/maintain this program.
X#Today is also my first day messing with GNUS kill code.
X
X#really should say "function (lambda () " instead of "'(lambda" below
X#[3/1991 -DJ]
X
Xset -e
Xcd $HOME/News #or wherever your personal news tree is at
Xecho "(setq gnus-Apply-kill-hook
X '(lambda ()
X (cond"
Xfor i in `find . -name KILL -print|sort`; do echo XXXX $i; cat $i; done|
Xsed '
X/^XXXX/{
X1!i\
X (gnus-expunge "X")))
X
Xs/^XXXX ..//
Xs/.KILL$//
Xs#/#.#g
Xs/^/ ((string-equal gnus-newsgroup-name "/
Xs/$/")/
Xa\
X (progn
X
Xn
X}
X/^THRU/d
Xs#^/# (gnus-kill "Subject" "#
Xs#/[^/][^/]*$#")#
X$a\
X (gnus-expunge "X"))))))
X'
X#funny: had to put "/^THRU/d" near the end to avoid sed bug[?]
END_OF_FILE
if test 2178 -ne `wc -c <'rnKILL2gnus'`; then
echo shar: \"'rnKILL2gnus'\" unpacked with wrong size!
fi
chmod +x 'rnKILL2gnus'
# end of 'rnKILL2gnus'
fi
echo shar: End of archive.
exit 0
Technical Details
Message-ID:
<1991Sep5Th193029.Dan_Jacobson@ATT.COM>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsh!cbnewse!danj1References:
<1991Sep4.070358.16881@cco.caltech.edu>Show Full Headers
Complete Article Headers
Message-ID: <1991Sep5Th193029.Dan_Jacobson@ATT.COM> Subject: Re: KILL, unsubscribe, mail Date: Thu, 05 Sep 1991 23:29:40 +0000 From: Dan_Jacobson@ATT.COM References: <1991Sep4.070358.16881@cco.caltech.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsh!cbnewse!danj1 Newsgroups: news.newusers.questions,news.software.readers,gnu.emacs.gnus Sender: danj1@cbnewse.cb.att.com (daniel.jacobson) Reply-To: Dan_Jacobson@ihlpz.ATT.COM Organization: AT&T-BL, Naperville IL, USA Lines: 161 In-Reply-To: danlip@cco.caltech.edu's message of 4 Sep 91 07: 03:58 GMT