;;; gnus-score.el --- scoring code for Gnus
-;; Copyright (C) 1995,96,97 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
+;; Free Software Foundation, Inc.
;; Author: Per Abrahamsen <amanda@iesd.auc.dk>
-;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news
;; This file is part of GNU Emacs.
;;; Code:
+(eval-when-compile (require 'cl))
+
(require 'gnus)
(require 'gnus-sum)
(require 'gnus-range)
+(require 'message)
+(require 'score-mode)
(defcustom gnus-global-score-files nil
"List of global score files and directories.
by itself what score files are applicable to which group.
Say you want to use the single score file
-\"/ftp.ifi.uio.no@ftp:/pub/larsi/ding/score/soc.motss.SCORE\" and all
+\"/ftp.gnus.org@ftp:/pub/larsi/ding/score/soc.motss.SCORE\" and all
score files in the \"/ftp.some-where:/pub/score\" directory.
(setq gnus-global-score-files
- '(\"/ftp.ifi.uio.no:/pub/larsi/ding/score/soc.motss.SCORE\"
+ '(\"/ftp.gnus.org:/pub/larsi/ding/score/soc.motss.SCORE\"
\"/ftp.some-where:/pub/score\"))"
- :group 'gnus-score
+ :group 'gnus-score-files
:type '(repeat file))
(defcustom gnus-score-file-single-match-alist nil
These score files are loaded in addition to any files returned by
gnus-score-find-score-files-function (which see)."
- :group 'gnus-score
+ :group 'gnus-score-files
:type '(repeat (cons regexp (repeat file))))
(defcustom gnus-score-file-multiple-match-alist nil
These score files are loaded in addition to any files returned by
gnus-score-find-score-files-function (which see)."
- :group 'gnus-score
+ :group 'gnus-score-files
:type '(repeat (cons regexp (repeat file))))
(defcustom gnus-score-file-suffix "SCORE"
"Suffix of the score files."
- :group 'gnus-score
+ :group 'gnus-score-files
:type 'string)
(defcustom gnus-adaptive-file-suffix "ADAPT"
"Suffix of the adaptive score files."
- :group 'gnus-score
+ :group 'gnus-score-files
+ :group 'gnus-score-adapt
:type 'string)
(defcustom gnus-score-find-score-files-function 'gnus-score-find-bnews
See the documentation to these functions for more information.
This variable can also be a list of functions to be called. Each
-function should either return a list of score files, or a list of
-score alists."
- :group 'gnus-score
+function is given the group name as argument and should either return
+a list of score files, or a list of score alists.
+
+If functions other than these pre-defined functions are used,
+the `a' symbolic prefix to the score commands will always use
+\"all.SCORE\"."
+ :group 'gnus-score-files
:type '(radio (function-item gnus-score-find-single)
(function-item gnus-score-find-hierarchical)
(function-item gnus-score-find-bnews)
- (function :tag "Other")))
+ (repeat :tag "List of functions"
+ (choice (function :tag "Other" :value 'ignore)
+ (function-item gnus-score-find-single)
+ (function-item gnus-score-find-hierarchical)
+ (function-item gnus-score-find-bnews)))
+ (function :tag "Other" :value 'ignore)))
(defcustom gnus-score-interactive-default-score 1000
"*Scoring commands will raise/lower the score with this number as the default."
- :group 'gnus-score
+ :group 'gnus-score-default
:type 'integer)
(defcustom gnus-score-expiry-days 7
"*Number of days before unused score file entries are expired.
If this variable is nil, no score file entries will be expired."
- :group 'gnus-score
+ :group 'gnus-score-expire
:type '(choice (const :tag "never" nil)
number))
"*In non-nil, update matching score entry dates.
If this variable is nil, then score entries that provide matches
will be expired along with non-matching score entries."
- :group 'gnus-score
+ :group 'gnus-score-expire
:type 'boolean)
-(defcustom gnus-orphan-score nil
- "*All orphans get this score added. Set in the score file."
- :group 'gnus-score
- :type 'integer)
-
(defcustom gnus-decay-scores nil
"*If non-nil, decay non-permanent scores."
- :group 'gnus-score
+ :group 'gnus-score-decay
:type 'boolean)
(defcustom gnus-decay-score-function 'gnus-decay-score
"*Function called to decay a score.
It is called with one parameter -- the score to be decayed."
- :group 'gnus-score
+ :group 'gnus-score-decay
:type '(radio (function-item gnus-decay-score)
(function :tag "Other")))
(defcustom gnus-score-decay-constant 3
"*Decay all \"small\" scores with this amount."
- :group 'gnus-score
+ :group 'gnus-score-decay
:type 'integer)
(defcustom gnus-score-decay-scale .05
"*Decay all \"big\" scores with this factor."
- :group 'gnus-score
+ :group 'gnus-score-decay
:type 'number)
(defcustom gnus-home-score-file nil
* A function.
If the function returns non-nil, the result will be used
- as the home score file. The function will be passed the
+ as the home score file. The function will be passed the
name of the group as its parameter.
* A string. Use the string as the home score file.
The list will be traversed from the beginning towards the end looking
for matches."
- :group 'gnus-score
+ :group 'gnus-score-files
:type '(choice string
(repeat (choice string
(cons regexp (repeat file))
- function))
- function))
+ (function :value fun)))
+ (function-item gnus-hierarchial-home-score-file)
+ (function-item gnus-current-home-score-file)
+ (function :value fun)))
(defcustom gnus-home-adapt-file nil
"Variable to control where new adaptive score entries are to go.
This variable allows the same syntax as `gnus-home-score-file'."
- :group 'gnus-score
+ :group 'gnus-score-adapt
+ :group 'gnus-score-files
:type '(choice string
(repeat (choice string
(cons regexp (repeat file))
- function))
- function))
+ (function :value fun)))
+ (function :value fun)))
-(defcustom gnus-default-adaptive-score-alist
+(defcustom gnus-default-adaptive-score-alist
'((gnus-kill-file-mark)
(gnus-unread-mark)
(gnus-read-mark (from 3) (subject 30))
(gnus-catchup-mark (subject -10))
(gnus-killed-mark (from -1) (subject -20))
(gnus-del-mark (from -2) (subject -15)))
-"Alist of marks and scores."
-:group 'gnus-score
-:type '(repeat (cons (symbol :tag "Mark")
- (repeat (list (choice :tag "Header"
- (const from)
- (const subject)
- (symbol :tag "other"))
- (integer :tag "Score"))))))
+ "*Alist of marks and scores."
+ :group 'gnus-score-adapt
+ :type '(repeat (cons (symbol :tag "Mark")
+ (repeat (list (choice :tag "Header"
+ (const from)
+ (const subject)
+ (symbol :tag "other"))
+ (integer :tag "Score"))))))
(defcustom gnus-ignored-adaptive-words nil
"List of words to be ignored when doing adaptive word scoring."
- :group 'gnus-score
+ :group 'gnus-score-adapt
:type '(repeat string))
(defcustom gnus-default-ignored-adaptive-words
"being" "current" "back" "still" "go" "point" "value" "each" "did"
"both" "true" "off" "say" "another" "state" "might" "under" "start"
"try" "re")
- "Default list of words to be ignored when doing adaptive word scoring."
- :group 'gnus-score
+ "*Default list of words to be ignored when doing adaptive word scoring."
+ :group 'gnus-score-adapt
:type '(repeat string))
-(defcustom gnus-default-adaptive-word-score-alist
+(defcustom gnus-default-adaptive-word-score-alist
`((,gnus-read-mark . 30)
(,gnus-catchup-mark . -10)
(,gnus-killed-mark . -20)
(,gnus-del-mark . -15))
-"Alist of marks and scores."
-:group 'gnus-score
-:type '(repeat (cons (character :tag "Mark")
- (integer :tag "Score"))))
+ "*Alist of marks and scores."
+ :group 'gnus-score-adapt
+ :type '(repeat (cons (character :tag "Mark")
+ (integer :tag "Score"))))
+
+(defcustom gnus-adaptive-word-minimum nil
+ "If a number, this is the minimum score value that can be assigned to a word."
+ :group 'gnus-score-adapt
+ :type '(choice (const nil) integer))
+
+(defcustom gnus-adaptive-word-no-group-words nil
+ "If t, don't adaptively score words included in the group name."
+ :group 'gnus-score-adapt
+ :type 'boolean)
(defcustom gnus-score-mimic-keymap nil
"*Have the score entry functions pretend that they are a keymap."
- :group 'gnus-score
+ :group 'gnus-score-default
:type 'boolean)
(defcustom gnus-score-exact-adapt-limit 10
than this variable, exact matching will be used.
If this variable is nil, exact matching will always be used."
- :group 'gnus-score
+ :group 'gnus-score-adapt
:type '(choice (const nil) integer))
(defcustom gnus-score-uncacheable-files "ADAPT$"
"All score files that match this regexp will not be cached."
- :group 'gnus-score
+ :group 'gnus-score-adapt
+ :group 'gnus-score-files
:type 'regexp)
(defcustom gnus-score-default-header nil
i: message-id
t: references
x: xref
+ e: `extra' (non-standard overview)
l: lines
d: date
f: followup
If nil, the user will be asked for a header."
- :group 'gnus-score
+ :group 'gnus-score-default
:type '(choice (const :tag "from" a)
(const :tag "subject" s)
(const :tag "body" b)
(const :tag "message-id" i)
(const :tag "references" t)
(const :tag "xref" x)
+ (const :tag "extra" e)
(const :tag "lines" l)
(const :tag "date" d)
- (const :tag "followup" f)))
+ (const :tag "followup" f)
+ (const :tag "ask" nil)))
(defcustom gnus-score-default-type nil
"Default match type when entering new scores.
f: fuzzy string
r: regexp string
b: before date
- a: at date
+ a: after date
n: this date
<: less than number
>: greater than number
=: equal to number
If nil, the user will be asked for a match type."
- :group 'gnus-score
+ :group 'gnus-score-default
:type '(choice (const :tag "substring" s)
(const :tag "exact string" e)
(const :tag "fuzzy string" f)
(const :tag "regexp string" r)
(const :tag "before date" b)
- (const :tag "at date" a)
+ (const :tag "after date" a)
(const :tag "this date" n)
(const :tag "less than number" <)
(const :tag "greater than number" >)
- (const :tag "equal than number" =)))
+ (const :tag "equal than number" =)
+ (const :tag "ask" nil)))
(defcustom gnus-score-default-fold nil
"Use case folding for new score file entries iff not nil."
- :group 'gnus-score
+ :group 'gnus-score-default
:type 'boolean)
(defcustom gnus-score-default-duration nil
i: immediate
If nil, the user will be asked for a duration."
- :group 'gnus-score
+ :group 'gnus-score-default
:type '(choice (const :tag "temporary" t)
(const :tag "permanent" p)
- (const :tag "immediate" i)))
+ (const :tag "immediate" i)
+ (const :tag "ask" nil)))
(defcustom gnus-score-after-write-file-function nil
"Function called with the name of the score file just written to disk."