From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: John Paul Wallington Newsgroups: gmane.emacs.devel Subject: rmail-spam-filter.el - avoiding cl at runtime Date: Wed, 19 Feb 2003 14:39:28 +0000 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1045665135 31774 80.91.224.249 (19 Feb 2003 14:32:15 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 19 Feb 2003 14:32:15 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18lVGe-0008GA-00 for ; Wed, 19 Feb 2003 15:32:12 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18lVTi-0003jJ-00 for ; Wed, 19 Feb 2003 15:45:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18lVFz-0002VL-02 for emacs-devel@quimby.gnus.org; Wed, 19 Feb 2003 09:31:31 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18lVFc-0002Mv-00 for emacs-devel@gnu.org; Wed, 19 Feb 2003 09:31:08 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18lVFH-0001oV-00 for emacs-devel@gnu.org; Wed, 19 Feb 2003 09:30:57 -0500 Original-Received: from host217-44-221-152.range217-44.btcentralplus.com ([217.44.221.152] helo=china.shootybangbang.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18lVFD-0001Gf-00 for emacs-devel@gnu.org; Wed, 19 Feb 2003 09:30:43 -0500 Original-Received: from jpw by china.shootybangbang.com with local (Exim 3.36 #1 (Debian)) id 18lVNg-0006IJ-00; Wed, 19 Feb 2003 14:39:28 +0000 Original-To: pmr@pajato.com X-Attribution: jpw X-Face: R(_z-rF:grdKO.*u`n); p.i$Eiz=h^CO5eDYv"4:K@#\HN09*Ykx}}B{kF/KH}%f_o^Wp List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:11762 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11762 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)