home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1926 / rnKILL2gnus
Encoding:
Text File  |  1990-12-28  |  2.0 KB  |  78 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-Apply-kill-hook
  42. #examples to make the output.  I am no lisp pro.  It does make (disk) blocks
  43. #and blocks of KILL files into just a few lines of lisp.  Note GNUS
  44. #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. set -e
  51. cd $HOME/News #or wherever your personal news tree is at
  52. echo "(setq gnus-Apply-kill-hook
  53.  '(lambda ()
  54.   (cond"
  55. for i in `find . -name KILL -print|sort`; do echo XXXX $i; cat $i; done|
  56. sed '
  57. /^XXXX/{
  58. 1!i\
  59.      (gnus-expunge "X")))
  60.  
  61. s/^XXXX ..//
  62. s/.KILL$//
  63. s#/#.#g
  64. s/^/   ((string-equal gnus-newsgroup-name "/
  65. s/$/")/
  66. a\
  67.     (progn
  68.  
  69. n
  70. }
  71. /^THRU/d
  72. s#^/#     (gnus-kill "Subject" "#
  73. s#/[^/][^/]*$#")#
  74. $a\
  75.      (gnus-expunge "X"))))))
  76. '
  77. #funny: had to put "/^THRU/d" near the end to avoid sed bug[?]
  78.