emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rmail-spam-filter.el - avoiding cl at runtime


From: John Paul Wallington
Subject: rmail-spam-filter.el - avoiding cl at runtime
Date: Wed, 19 Feb 2003 14:39:28 +0000

How about the following patch to avoid loading cl at runtime?

--- rmail-spam-filter.el        19 Feb 2003 02:51:22 -0000      1.2
+++ rmail-spam-filter.el        19 Feb 2003 14:20:50 -0000
@@ -49,7 +49,7 @@
 ;;; (*) Block future mail with the subject or sender of a message
 ;;; while reading it in RMAIL: just click on the "Spam" item on the
 ;;; menubar, and add the subject or sender to the list of spam
-;;; definitions using the mouse and the appropriate menu item. Â  You
+;;; definitions using the mouse and the appropriate menu item.  You
 ;;; need to later also save the list of spam definitions using the
 ;;; same menu item, or alternatively, see variable
 ;;; `rmail-spam-filter-autosave-newly-added-spam-definitions'.
@@ -77,8 +77,8 @@
 
 (require 'rmail)
 
-;; For find-if and other cool common lisp functions we may want to use. (EDB)
-(require 'cl)                          
+(eval-when-compile
+  (require 'cl))
 
 (defgroup rmail-spam-filter nil
   "Spam filter for RMAIL, the mail reader for Emacs."
@@ -234,27 +234,29 @@
                                            rmail-spam-definitions-alist))
 
        ;;; do we want to ignore case in spam definitions:
-         (setq case-fold-search rmail-spam-filter-ignore-case)
+       (setq case-fold-search rmail-spam-filter-ignore-case)
        
        ;; Check for blind CC condition.  Set vars such that while
        ;; loop will be bypassed and spam condition will trigger (EDB)
        (if (and rmail-spam-no-blind-cc
                 (null message-recipients))
-           (progn
-             (setq exit-while-loop t)
-             (setq maybe-spam t)
-             (setq this-is-a-spam-email t)))
+           (setq exit-while-loop t
+                 maybe-spam t
+                 this-is-a-spam-email t))
+       
+       ;; Check white list, and likewise cause while loop
+       ;;  bypass. (EDB)
+       (if (let ((white-list rmail-spam-white-list)
+                 (found nil))
+             (while (and (not found) white-list)
+               (if (string-match (car white-list) message-sender)
+                   (setq found t)
+                 (setq white-list (cdr white-list))))
+             found)
+           (setq exit-while-loop t
+                 maybe-spam nil
+                 this-is-a-spam-email nil))
        
-         ;; Check white list, and likewise cause while loop
-         ;;  bypass. (EDB)
-         (if (find-if '(lambda (white-str)
-                         (string-match white-str message-sender))
-                      rmail-spam-white-list)
-             (progn
-               (setq exit-while-loop t)
-               (setq maybe-spam nil)
-               (setq this-is-a-spam-email nil)))
-           
        ;; scan all elements of the list rmail-spam-definitions-alist
        (while (and
                (< num-element num-spam-definition-elements)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]