Please comment on the following with any hints, tips
          or pointers?...



;; sa-spam-removal.el
;;
;; Copyright (c) 2003, 2004 Trevis J. Rothwell <tjr at gnu dot org>
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

;; WHAT THIS PROGRAM DOES
;;
;; This program goes through your currently-loaded Emacs RMAIL file,
;; looking for messages labeled as spam by SpamAssassin.  When it finds
;; one, it will ask you if you want to delete it or not; you either type
;; 'y' or 'n', depending on your decision.  The program will then
;; proceed to the next message labeled as spam.
;;
;; All deleted messages are copied to the file specified internall
;; as `rmail-spam-file', which defaults to RMAIL-SPAM.  This way, just
;; a message is accidentally deleted that you want to keep, you still
;; have a backup of it.
;;
;; I highly recommend that you back up your main RMAIL file before
;; using this program on it, just in case it does something that you
;; didn't expect.  I am not responsible for the loss of any valuable
;; information, just the loss of useless spam.  :-)
;;
;;
;; PROGRAM SETUP
;;
;; Just add a line such as this to your .emacs file:
;;
;;     (load "~/sa-spam-removal.el")
;;
;; Adjust the path to match where you have the program stored, of
;; course!  Then, when in Rmail in Emacs, type:
;;
;;     Esc-x sa-spam-removal
;;
;; to run the program.


;; Before deleting a spam, this program copies it
;; to the file specified by `rmail-spam-file'.
(setq rmail-spam-file "RMAIL-SPAM")

(defun sa-spam-removal ()
  (interactive)
  (progn
    (rmail-first-message)
    (setq rtm rmail-total-messages)
    (while (< rmail-current-message rtm)
      (sa-spam-removal-main))))

(defun sa-spam-removal-main ()
  (setq spam-stat (mail-fetch-field "X-Spam-Status"))

  (if (not (eq spam-stat nil))
      (if (and (eq (compare-strings spam-stat 0 2 "Yes" 0 2) t)
               (y-or-n-p "Delete message? (C-g to quit) "))
          (progn
            (rmail-output-to-rmail-file rmail-spam-file)
            (rmail-delete-message)
            (rmail-next-undeleted-message 1))
        (rmail-next-undeleted-message 1))
    (rmail-next-undeleted-message 1)))


_________________________________________________________________

;; .emacs


;; SpamAssassin spam removal
(load "~/lisp/sa-spam-removal.el")


;; etach program for handling MIME attachments
;; in Rmail
(load "~/lisp/etach.el")


;; Auto-archive all sent mail
(setq mail-archive-file-name "RMAIL-SENT")

;; version control turned on/off
;; (setq version-control t)

(display-time-mode 1)

Reply via email to