From: hmurata Date: Sat, 15 Nov 2003 13:20:01 +0000 (+0000) Subject: (toplevel): Don't require path-util. X-Git-Tag: wl-2_11_21~6 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=6648a0c3f1e9b706ec3df1184bd9d5d1fd45f814;p=elisp%2Fwanderlust.git (toplevel): Don't require path-util. (elmo-spam-bogofilter-program): Don't use `exec-installed-p'. (elmo-spam-bogofilter-header): Abolish. (elmo-spam-bogofilter-bogosity-positive-spam-header): Ditto. (elmo-spam-bogofilter-args): New user option. (elsp-bogofilter-call-bogofilter): New internal function. (elmo-spam-buffer-spam-p): Use it. (elsp-bogofilter-register-buffer): Renamed from `elmo-spam-bogofilter-register-buffer'; Use `elsp-bogofilter-call-bogofilter'. (elmo-spam-register-spam-buffer): Follow the change above. (elmo-spam-register-good-buffer): Ditto. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 108bc31..07c66f7 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,18 @@ +2003-11-15 Hiroya Murata + + * elsp-bogofilter.el (toplevel): Don't require path-util. + (elmo-spam-bogofilter-program): Don't use `exec-installed-p'. + (elmo-spam-bogofilter-header): Abolish. + (elmo-spam-bogofilter-bogosity-positive-spam-header): Ditto. + (elmo-spam-bogofilter-args): New user option. + (elsp-bogofilter-call-bogofilter): New internal function. + (elmo-spam-buffer-spam-p): Use it. + (elsp-bogofilter-register-buffer): Renamed from + `elmo-spam-bogofilter-register-buffer'; + Use `elsp-bogofilter-call-bogofilter'. + (elmo-spam-register-spam-buffer): Follow the change above. + (elmo-spam-register-good-buffer): Ditto. + 2003-11-11 Hiroya Murata * modb-standard.el (elmo-msgdb-append-entity): If entity or diff --git a/elmo/elsp-bogofilter.el b/elmo/elsp-bogofilter.el index 05a71e5..e4eec9c 100644 --- a/elmo/elsp-bogofilter.el +++ b/elmo/elsp-bogofilter.el @@ -30,42 +30,34 @@ ;;; Code: ;; (require 'elmo-spam) - (require 'luna) -(require 'path-util) (defgroup elmo-spam-bogofilter nil "Spam bogofilter configuration." :group 'elmo-spam) -(defcustom elmo-spam-bogofilter-program (exec-installed-p "bogofilter") - "File path of the Bogofilter executable program." - :type '(choice (file :tag "Location of bogofilter") - (const :tag "Bogofilter is not installed")) +(defcustom elmo-spam-bogofilter-program "bogofilter" + "*Program name of the Bogofilter." + :type '(string :tag "Program name of the bogofilter") :group 'elmo-spam-bogofilter) -(defcustom elmo-spam-bogofilter-header "X-Bogosity" - "The header that Bogofilter inserts in messages." - :type 'string +(defcustom elmo-spam-bogofilter-args nil + "*Argument list for bogofilter." + :type '(repeat string) :group 'elmo-spam-bogofilter) (defcustom elmo-spam-bogofilter-spam-switch "-s" - "The switch that Bogofilter uses to register spam messages." + "*The switch that Bogofilter uses to register spam messages." :type 'string :group 'elmo-spam-bogofilter) (defcustom elmo-spam-bogofilter-good-switch "-n" - "The switch that Bogofilter uses to register non spam messages." + "*The switch that Bogofilter uses to register non spam messages." :type 'string :group 'elmo-spam-bogofilter) -(defcustom elmo-spam-bogofilter-bogosity-positive-spam-header "^\\(Yes\\|Spam\\)" - "The regexp on `elmo-spam-bogofilter' for positive spam identification." - :type 'regexp - :group 'elmo-spam-bogofilter) - (defcustom elmo-spam-bogofilter-database-directory nil - "Directory path of the Bogofilter databases." + "*Directory path of the Bogofilter databases." :type '(choice (directory :tag "Location of the Bogofilter database directory") (const :tag "Use the default")) :group 'elmo-spam-bogofilter) @@ -73,39 +65,41 @@ (eval-and-compile (luna-define-class elsp-bogofilter (elsp-generic))) +(defsubst elsp-bogofilter-call-bogofilter (&rest args) + (apply #'call-process-region + (point-min) (point-max) + elmo-spam-bogofilter-program + nil nil nil + (append elmo-spam-bogofilter-args + (delq nil (elmo-flatten args))))) + (luna-define-method elmo-spam-buffer-spam-p ((processor elsp-bogofilter) buffer &optional register) - (let ((args `("-v" "-2" - ,@(if register (list "-u")) - ,@(if elmo-spam-bogofilter-database-directory - (list "-d" elmo-spam-bogofilter-database-directory))))) - (with-current-buffer buffer - (= 0 (apply #'call-process-region - (point-min) (point-max) - elmo-spam-bogofilter-program - nil nil nil args))))) - -(defsubst elmo-spam-bogofilter-register-buffer (buffer spam restore) - (let ((args `("-v" - ,(if spam - elmo-spam-bogofilter-spam-switch - elmo-spam-bogofilter-good-switch) - ,@(if restore (list (if spam "-N" "-S"))) - ,@(if elmo-spam-bogofilter-database-directory - (list "-d" elmo-spam-bogofilter-database-directory))))) - (with-current-buffer buffer - (apply #'call-process-region - (point-min) (point-max) - elmo-spam-bogofilter-program - nil nil nil args)))) + (with-current-buffer buffer + (= 0 (elsp-bogofilter-call-bogofilter + "-v" "-2" + (if register "-u") + (if elmo-spam-bogofilter-database-directory + (list "-d" elmo-spam-bogofilter-database-directory)))))) + +(defsubst elsp-bogofilter-register-buffer (buffer spam restore) + (with-current-buffer buffer + (elsp-bogofilter-call-bogofilter + "-v" + (if spam + elmo-spam-bogofilter-spam-switch + elmo-spam-bogofilter-good-switch) + (if restore (if spam "-N" "-S")) + (if elmo-spam-bogofilter-database-directory + (list "-d" elmo-spam-bogofilter-database-directory))))) (luna-define-method elmo-spam-register-spam-buffer ((processor elsp-bogofilter) buffer &optional restore) - (elmo-spam-bogofilter-register-buffer buffer t restore)) + (elsp-bogofilter-register-buffer buffer t restore)) (luna-define-method elmo-spam-register-good-buffer ((processor elsp-bogofilter) buffer &optional restore) - (elmo-spam-bogofilter-register-buffer buffer nil restore)) + (elsp-bogofilter-register-buffer buffer nil restore)) (require 'product) (product-provide (provide 'elsp-bogofilter) (require 'elmo-version))