home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3520 / rnKILL2gnus
Encoding:
Text File  |  1991-06-21  |  2.1 KB  |  81 lines

  1. : Dan_Jacobson@ATT.COM 9/1990
  2. #real simple program that reads a tree of "rn" newsreader KILL files
  3. #and spits out "gnus-Apply-kill-hook" lisp code for use in the GNUS newsreader
  4. #(a subsystem of GNU Emacs).  Sample ("more" output):
  5.  
  6. #    ::::::::::::::
  7. #    rec/food/veg/KILL
  8. #    ::::::::::::::
  9. #    THRU 4429
  10. #    /recipe/j
  11. #    /cookbook/j
  12. #    ::::::::::::::
  13. #    rec/travel/KILL
  14. #    ::::::::::::::
  15. #    THRU 11021
  16. #    /car rental/j
  17. #    /renting a car/j
  18. #[...]
  19.  
  20. #becomes
  21.  
  22. #    (setq gnus-Apply-kill-hook
  23. #      '(lambda ()
  24. #         (cond
  25. #          ((string-equal gnus-newsgroup-name "rec.food.veg")
  26. #           (progn
  27. #         (gnus-kill "Subject" "recipe")
  28. #         (gnus-kill "Subject" "cookbook")
  29. #         (gnus-expunge "X")))
  30. #          ((string-equal gnus-newsgroup-name "rec.travel")
  31. #           (progn
  32. #         (gnus-kill "Subject" "car rental")
  33. #         (gnus-kill "Subject" "renting a car")
  34. #         (gnus-expunge "X")))
  35. #[...]
  36.  
  37. #You probably want to put that lisp code into your gnus-Startup-hook.
  38. #Assumes: that your rn KILL files are all simple "/bla bla/j" kind of
  39. #lines, that your $HOME/News tree has files like alt/wax/KILL (from
  40. #rn's "-/" option), not e.g., alt.wax/KILL.  Naturally double check
  41. #the output.  I just used Masanobu Umeda's (GNUS 3.13)
  42. #gnus-Apply-kill-hook examples to make the output.  I am no lisp pro.
  43. #It does make (disk) blocks and blocks of KILL files into just a few
  44. #lines of lisp.  Note GNUS also has KILL files if you want them.
  45.  
  46. #Took only 1/2 hour to whip up.  And I've already processed my KILL
  47. #files, so, er... I don't plan to enhance/fix/maintain this program.
  48. #Today is also my first day messing with GNUS kill code.
  49.  
  50. #really should say "function (lambda () " instead of "'(lambda" below
  51. #[3/1991 -DJ]
  52.  
  53. set -e
  54. cd $HOME/News #or wherever your personal news tree is at
  55. echo "(setq gnus-Apply-kill-hook
  56.  '(lambda ()
  57.   (cond"
  58. for i in `find . -name KILL -print|sort`; do echo XXXX $i; cat $i; done|
  59. sed '
  60. /^XXXX/{
  61. 1!i\
  62.      (gnus-expunge "X")))
  63.  
  64. s/^XXXX ..//
  65. s/.KILL$//
  66. s#/#.#g
  67. s/^/   ((string-equal gnus-newsgroup-name "/
  68. s/$/")/
  69. a\
  70.     (progn
  71.  
  72. n
  73. }
  74. /^THRU/d
  75. s#^/#     (gnus-kill "Subject" "#
  76. s#/[^/][^/]*$#")#
  77. $a\
  78.      (gnus-expunge "X"))))))
  79. '
  80. #funny: had to put "/^THRU/d" near the end to avoid sed bug[?]
  81.