🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
1 messages
1 total messages Started by Dan_Jacobson Thu, 20 Jun 1991 14:55
rnKILL2gnus [Re: Questions about regexps and Kill files]
#91
Author: Dan_Jacobson
Date: Thu, 20 Jun 1991 14:55
128 lines
5162 bytes
>>>>> "Charles" == Charles D. Roten <croten@ltpsun.gsfc.nasa.gov> writes:

Charles> I'm in the process of converting my Kill files, among other
Charles> things, from 'rn' to 'gnus' syntax.

Time for a real simple program that reads a tree of "rn" newsreader
KILL files and spits out "gnus-Apply-kill-hook" lisp code for use in
the GNUS newsreader (a subsystem of GNU Emacs).

#! /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



Charles> Now [GNU] Emacs info *suggests* a similar syntax for 'gnus'
Charles> entries .. as in the line

Charles> (gnus-kill "Subject" "cancel\\|newgroup\\|rmgroup" "d")

Charles> Now my (probably dumb) question .. why *two* backslashes
Charles> before the '|' ?

That's a Frequently Asked Question.  I has to do with the
interpretation of strings, where a \ needs to be quoted upon reading.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads