projects
/
elisp
/
gnus.git-
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Synch to No Gnus 200510111141.
[elisp/gnus.git-]
/
lisp
/
gnus-score.el
diff --git
a/lisp/gnus-score.el
b/lisp/gnus-score.el
index
5afed33
..
47bb7c0
100644
(file)
--- a/
lisp/gnus-score.el
+++ b/
lisp/gnus-score.el
@@
-1,6
+1,7
@@
;;; gnus-score.el --- scoring code for Gnus
;;; gnus-score.el --- scoring code for Gnus
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-;; Free Software Foundation, Inc.
+
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+;; 2004, 2005 Free Software Foundation, Inc.
;; Author: Per Abrahamsen <amanda@iesd.auc.dk>
;; Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Author: Per Abrahamsen <amanda@iesd.auc.dk>
;; Lars Magne Ingebrigtsen <larsi@gnus.org>
@@
-20,8
+21,8
@@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;; Commentary:
@@
-146,9
+147,15
@@
will be expired along with non-matching score entries."
:type 'boolean)
(defcustom gnus-decay-scores nil
:type 'boolean)
(defcustom gnus-decay-scores nil
- "*If non-nil, decay non-permanent scores."
+ "*If non-nil, decay non-permanent scores.
+
+If it is a regexp, only decay score files matching regexp."
:group 'gnus-score-decay
:group 'gnus-score-decay
- :type 'boolean)
+ :type `(choice (const :tag "never" nil)
+ (const :tag "always" t)
+ (const :tag "adaptive score files"
+ ,(concat "\\." gnus-adaptive-file-suffix "\\'"))
+ (regexp)))
(defcustom gnus-decay-score-function 'gnus-decay-score
"*Function called to decay a score.
(defcustom gnus-decay-score-function 'gnus-decay-score
"*Function called to decay a score.
@@
-235,9
+242,10
@@
This variable allows the same syntax as `gnus-home-score-file'."
(defcustom gnus-adaptive-word-length-limit nil
"*Words of a length lesser than this limit will be ignored when doing adaptive scoring."
(defcustom gnus-adaptive-word-length-limit nil
"*Words of a length lesser than this limit will be ignored when doing adaptive scoring."
+ :version "22.1"
:group 'gnus-score-adapt
:type '(radio (const :format "Unlimited " nil)
:group 'gnus-score-adapt
:type '(radio (const :format "Unlimited " nil)
- (integer :format "Maximum length: %v\n" :size 0)))
+ (integer :format "Maximum length: %v")))
(defcustom gnus-ignored-adaptive-words nil
"List of words to be ignored when doing adaptive word scoring."
(defcustom gnus-ignored-adaptive-words nil
"List of words to be ignored when doing adaptive word scoring."
@@
-305,6
+313,13
@@
If this variable is nil, exact matching will always be used."
:group 'gnus-score-files
:type 'regexp)
:group 'gnus-score-files
:type 'regexp)
+(defcustom gnus-adaptive-pretty-print nil
+ "If non-nil, adaptive score files fill are pretty printed."
+ :group 'gnus-score-files
+ :group 'gnus-score-adapt
+ :version "23.0" ;; No Gnus
+ :type 'boolean)
+
(defcustom gnus-score-default-header nil
"Default header when entering new scores.
(defcustom gnus-score-default-header nil
"Default header when entering new scores.
@@
-682,7
+697,7
@@
file for the command instead of the current score file."
(intern ; need symbol
(gnus-completing-read-with-default
(symbol-name (car gnus-extra-headers)) ; default response
(intern ; need symbol
(gnus-completing-read-with-default
(symbol-name (car gnus-extra-headers)) ; default response
- "Score extra header:" ; prompt
+ "Score extra header" ; prompt
(mapcar (lambda (x) ; completion list
(cons (symbol-name x) x))
gnus-extra-headers)
(mapcar (lambda (x) ; completion list
(cons (symbol-name x) x))
gnus-extra-headers)
@@
-857,7
+872,7
@@
If optional argument `EXTRA' is non-nil, it's a non-standard overview header."
;; If this is an integer comparison, we transform from string to int.
(if (eq (nth 2 (assoc header gnus-header-index)) 'gnus-score-integer)
(if (stringp match)
;; If this is an integer comparison, we transform from string to int.
(if (eq (nth 2 (assoc header gnus-header-index)) 'gnus-score-integer)
(if (stringp match)
- (setq match (string-to-int match)))
+ (setq match (string-to-number match)))
(set-text-properties 0 (length match) nil match))
(unless (eq date 'now)
(set-text-properties 0 (length match) nil match))
(unless (eq date 'now)
@@
-922,7
+937,7
@@
EXTRA is the possible non-standard header."
t)
(read-string "Match: ")
(if (y-or-n-p "Use regexp match? ") 'r 's)
t)
(read-string "Match: ")
(if (y-or-n-p "Use regexp match? ") 'r 's)
- (string-to-int (read-string "Score: "))))
+ (string-to-number (read-string "Score: "))))
(save-excursion
(unless (and (stringp match) (> (length match) 0))
(error "No match"))
(save-excursion
(unless (and (stringp match) (> (length match) 0))
(error "No match"))
@@
-976,7
+991,7
@@
EXTRA is the possible non-standard header."
"Automatically mark articles with score below SCORE as read."
(interactive
(list (or (and current-prefix-arg (prefix-numeric-value current-prefix-arg))
"Automatically mark articles with score below SCORE as read."
(interactive
(list (or (and current-prefix-arg (prefix-numeric-value current-prefix-arg))
- (string-to-int (read-string "Mark below: ")))))
+ (string-to-number (read-string "Mark below: ")))))
(setq score (or score gnus-summary-default-score 0))
(gnus-score-set 'mark (list score))
(gnus-score-set 'touched '(t))
(setq score (or score gnus-summary-default-score 0))
(gnus-score-set 'mark (list score))
(gnus-score-set 'touched '(t))
@@
-1010,7
+1025,7
@@
EXTRA is the possible non-standard header."
"Automatically expunge articles with score below SCORE."
(interactive
(list (or (and current-prefix-arg (prefix-numeric-value current-prefix-arg))
"Automatically expunge articles with score below SCORE."
(interactive
(list (or (and current-prefix-arg (prefix-numeric-value current-prefix-arg))
- (string-to-int (read-string "Set expunge below: ")))))
+ (string-to-number (read-string "Set expunge below: ")))))
(setq score (or score gnus-summary-default-score 0))
(gnus-score-set 'expunge (list score))
(gnus-score-set 'touched '(t)))
(setq score (or score gnus-summary-default-score 0))
(gnus-score-set 'expunge (list score))
(gnus-score-set 'touched '(t)))
@@
-1124,7
+1139,11
@@
EXTRA is the possible non-standard header."
"Edit the all.SCORE file."
(interactive)
(find-file (gnus-score-file-name "all"))
"Edit the all.SCORE file."
(interactive)
(find-file (gnus-score-file-name "all"))
- (gnus-score-mode))
+ (gnus-score-mode)
+ (setq gnus-score-edit-exit-function 'gnus-score-edit-done)
+ (gnus-message
+ 4 (substitute-command-keys
+ "\\<gnus-score-mode-map>\\[gnus-score-edit-exit] to save edits")))
(defun gnus-score-edit-file (file)
"Edit a score file."
(defun gnus-score-edit-file (file)
"Edit a score file."
@@
-1236,7
+1255,9
@@
If FORMAT, also format the current score file."
(decay (car (gnus-score-get 'decay alist)))
(eval (car (gnus-score-get 'eval alist))))
;; Perform possible decays.
(decay (car (gnus-score-get 'decay alist)))
(eval (car (gnus-score-get 'eval alist))))
;; Perform possible decays.
- (when (and gnus-decay-scores
+ (when (and (if (stringp gnus-decay-scores)
+ (string-match gnus-decay-scores file)
+ gnus-decay-scores)
(or cached (file-exists-p file))
(or (not decay)
(gnus-decay-scores alist decay)))
(or cached (file-exists-p file))
(or (not decay)
(gnus-decay-scores alist decay)))
@@
-1438,17
+1459,18
@@
If FORMAT, also format the current score file."
(setq score (setcdr entry (gnus-delete-alist 'touched score)))
(erase-buffer)
(let (emacs-lisp-mode-hook)
(setq score (setcdr entry (gnus-delete-alist 'touched score)))
(erase-buffer)
(let (emacs-lisp-mode-hook)
- (if (string-match
- (concat (regexp-quote gnus-adaptive-file-suffix) "$")
- file)
- ;; This is an adaptive score file, so we do not run
- ;; it through `pp'. These files can get huge, and
- ;; are not meant to be edited by human hands.
+ (if (and (not gnus-adaptive-pretty-print)
+ (string-match
+ (concat (regexp-quote gnus-adaptive-file-suffix) "$")
+ file))
+ ;; This is an adaptive score file, so we do not run it through
+ ;; `pp' unless requested. These files can get huge, and are
+ ;; not meant to be edited by human hands.
(gnus-prin1 score)
;; This is a normal score file, so we print it very
;; prettily.
(let ((lisp-mode-syntax-table score-mode-syntax-table))
(gnus-prin1 score)
;; This is a normal score file, so we print it very
;; prettily.
(let ((lisp-mode-syntax-table score-mode-syntax-table))
- (pp score (current-buffer)))))
+ (gnus-pp score))))
(gnus-make-directory (file-name-directory file))
;; If the score file is empty, we delete it.
(if (zerop (buffer-size))
(gnus-make-directory (file-name-directory file))
;; If the score file is empty, we delete it.
(if (zerop (buffer-size))