comparison lisp/gnus/gnus-gl.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents 0d2f883870bc
children d2f30a177268
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
41 ;; warranty. 41 ;; warranty.
42 ;; 42 ;;
43 ;; The copyright holders request that they be notified of 43 ;; The copyright holders request that they be notified of
44 ;; modifications of this code. Please send electronic mail to 44 ;; modifications of this code. Please send electronic mail to
45 ;; grouplens@cs.umn.edu for more information or to announce derived 45 ;; grouplens@cs.umn.edu for more information or to announce derived
46 ;; works. 46 ;; works.
47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
48 ;; Author: Brad Miller 48 ;; Author: Brad Miller
49 ;; 49 ;;
50 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 50 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
51 ;; 51 ;;
54 ;; You must also register a pseudonym with the Better Bit Bureau. 54 ;; You must also register a pseudonym with the Better Bit Bureau.
55 ;; http://www.cs.umn.edu/Research/GroupLens 55 ;; http://www.cs.umn.edu/Research/GroupLens
56 ;; 56 ;;
57 ;; ---------------- For your .emacs or .gnus file ---------------- 57 ;; ---------------- For your .emacs or .gnus file ----------------
58 ;; 58 ;;
59 ;; As of version 2.5, grouplens now works as a minor mode of 59 ;; As of version 2.5, grouplens now works as a minor mode of
60 ;; gnus-summary-mode. To get make that work you just need a couple of 60 ;; gnus-summary-mode. To get make that work you just need a couple of
61 ;; hooks. 61 ;; hooks.
62 ;; (setq gnus-use-grouplens t) 62 ;; (setq gnus-use-grouplens t)
63 ;; (setq grouplens-pseudonym "") 63 ;; (setq grouplens-pseudonym "")
64 ;; (setq grouplens-bbb-host "grouplens.cs.umn.edu") 64 ;; (setq grouplens-bbb-host "grouplens.cs.umn.edu")
74 ;; 74 ;;
75 ;; What if, Gasp, I find a bug??? 75 ;; What if, Gasp, I find a bug???
76 ;; Please type M-x gnus-gl-submit-bug-report. This will set up a 76 ;; Please type M-x gnus-gl-submit-bug-report. This will set up a
77 ;; mail buffer with the state of variables and buffers that will help 77 ;; mail buffer with the state of variables and buffers that will help
78 ;; me debug the problem. A short description up front would help too! 78 ;; me debug the problem. A short description up front would help too!
79 ;; 79 ;;
80 ;; How do I display the prediction for an article: 80 ;; How do I display the prediction for an article:
81 ;; If you set the gnus-summary-line-format as shown above, the score 81 ;; If you set the gnus-summary-line-format as shown above, the score
82 ;; (prediction) will be shown automatically. 82 ;; (prediction) will be shown automatically.
83 ;; 83 ;;
84 ;; 84 ;;
85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
86 ;; Programmer Notes 86 ;; Programmer Notes
87 ;; 10/9/95 87 ;; 10/9/95
88 ;; gnus-scores-articles contains the articles 88 ;; gnus-scores-articles contains the articles
89 ;; When scoring is done, the call tree looks something like: 89 ;; When scoring is done, the call tree looks something like:
90 ;; gnus-possibly-score-headers 90 ;; gnus-possibly-score-headers
91 ;; ==> gnus-score-headers 91 ;; ==> gnus-score-headers
113 ;; 4. Better error handling for token timeouts. 113 ;; 4. Better error handling for token timeouts.
114 ;; 114 ;;
115 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 115 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
116 ;; bugs 116 ;; bugs
117 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 117 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
118 ;; 118 ;;
119 119
120 ;;; Code: 120 ;;; Code:
121 121
122 (require 'gnus-score) 122 (require 'gnus-score)
123 (require 'cl) 123 (require 'cl)
130 (defvar gnus-summary-grouplens-line-format 130 (defvar gnus-summary-grouplens-line-format
131 "%U\%R\%z%l%I\%(%[%4L: %-20,20n%]%) %s\n" 131 "%U\%R\%z%l%I\%(%[%4L: %-20,20n%]%) %s\n"
132 "*The line format spec in summary GroupLens mode buffers.") 132 "*The line format spec in summary GroupLens mode buffers.")
133 133
134 (defvar grouplens-pseudonym "" 134 (defvar grouplens-pseudonym ""
135 "User's pseudonym. 135 "User's pseudonym.
136 This pseudonym is obtained during the registration process") 136 This pseudonym is obtained during the registration process")
137 137
138 (defvar grouplens-bbb-host "grouplens.cs.umn.edu" 138 (defvar grouplens-bbb-host "grouplens.cs.umn.edu"
139 "Host where the bbbd is running" ) 139 "Host where the bbbd is running" )
140 140
141 (defvar grouplens-bbb-port 9000 141 (defvar grouplens-bbb-port 9000
142 "Port where the bbbd is listening" ) 142 "Port where the bbbd is listening" )
143 143
144 (defvar grouplens-newsgroups 144 (defvar grouplens-newsgroups
145 '("comp.groupware" "comp.human-factors" "comp.lang.c++" 145 '("comp.groupware" "comp.human-factors" "comp.lang.c++"
146 "comp.lang.java" "comp.os.linux.admin" "comp.os.linux.advocacy" 146 "comp.lang.java" "comp.os.linux.admin" "comp.os.linux.advocacy"
147 "comp.os.linux.announce" "comp.os.linux.answers" 147 "comp.os.linux.announce" "comp.os.linux.answers"
148 "comp.os.linux.development" "comp.os.linux.development.apps" 148 "comp.os.linux.development" "comp.os.linux.development.apps"
149 "comp.os.linux.development.system" "comp.os.linux.hardware" 149 "comp.os.linux.development.system" "comp.os.linux.hardware"
152 "mn.general" "rec.arts.movies" "rec.arts.movies.current-films" 152 "mn.general" "rec.arts.movies" "rec.arts.movies.current-films"
153 "rec.food.recipes" "rec.humor") 153 "rec.food.recipes" "rec.humor")
154 "*Groups that are part of the GroupLens experiment.") 154 "*Groups that are part of the GroupLens experiment.")
155 155
156 (defvar grouplens-prediction-display 'prediction-spot 156 (defvar grouplens-prediction-display 'prediction-spot
157 "valid values are: 157 "valid values are:
158 prediction-spot -- an * corresponding to the prediction between 1 and 5, 158 prediction-spot -- an * corresponding to the prediction between 1 and 5,
159 confidence-interval -- a numeric confidence interval 159 confidence-interval -- a numeric confidence interval
160 prediction-bar -- |##### | the longer the bar, the better the article, 160 prediction-bar -- |##### | the longer the bar, the better the article,
161 confidence-bar -- | ----- } the prediction is in the middle of the bar, 161 confidence-bar -- | ----- } the prediction is in the middle of the bar,
162 confidence-spot -- ) * | the spot gets bigger with more confidence, 162 confidence-spot -- ) * | the spot gets bigger with more confidence,
163 prediction-num -- plain-old numeric value, 163 prediction-num -- plain-old numeric value,
164 confidence-plus-minus -- prediction +/i confidence") 164 confidence-plus-minus -- prediction +/i confidence")
165 165
166 (defvar grouplens-score-offset 0 166 (defvar grouplens-score-offset 0
167 "Offset the prediction by this value. 167 "Offset the prediction by this value.
168 Setting this variable to -2 would have the following effect on 168 Setting this variable to -2 would have the following effect on
169 GroupLens scores: 169 GroupLens scores:
170 170
171 1 --> -2 171 1 --> -2
172 2 --> -1 172 2 --> -1
173 3 --> 0 173 3 --> 0
174 4 --> 1 174 4 --> 1
175 5 --> 2 175 5 --> 2
176 176
177 The reason is that a user might want to do this is to combine 177 The reason is that a user might want to do this is to combine
178 GroupLens predictions with scores calculated by other score methods.") 178 GroupLens predictions with scores calculated by other score methods.")
179 179
180 (defvar grouplens-score-scale-factor 1 180 (defvar grouplens-score-scale-factor 1
181 "This variable allows the user to magnify the effect of GroupLens scores. 181 "This variable allows the user to magnify the effect of GroupLens scores.
182 The scale factor is applied after the offset.") 182 The scale factor is applied after the offset.")
183 183
184 (defvar gnus-grouplens-override-scoring 'override 184 (defvar gnus-grouplens-override-scoring 'override
185 "Tell GroupLens to override the normal Gnus scoring mechanism. 185 "Tell GroupLens to override the normal Gnus scoring mechanism.
186 GroupLens scores can be combined with gnus scores in one of three ways. 186 GroupLens scores can be combined with gnus scores in one of three ways.
187 'override -- just use grouplens predictions for grouplens groups 187 'override -- just use grouplens predictions for grouplens groups
188 'combine -- combine grouplens scores with gnus scores 188 'combine -- combine grouplens scores with gnus scores
189 'separate -- treat grouplens scores completely separate from gnus") 189 'separate -- treat grouplens scores completely separate from gnus")
190 190
253 (erase-buffer)) 253 (erase-buffer))
254 254
255 ;; open the connection to the server 255 ;; open the connection to the server
256 (catch 'done 256 (catch 'done
257 (condition-case error 257 (condition-case error
258 (setq grouplens-bbb-process 258 (setq grouplens-bbb-process
259 (open-network-stream "BBBD" grouplens-bbb-buffer host port)) 259 (open-network-stream "BBBD" grouplens-bbb-buffer host port))
260 (error (gnus-message 3 "Error: Failed to connect to BBB") 260 (error (gnus-message 3 "Error: Failed to connect to BBB")
261 nil)) 261 nil))
262 (and (null grouplens-bbb-process) 262 (and (null grouplens-bbb-process)
263 (throw 'done nil)) 263 (throw 'done nil))
264 (save-excursion 264 (save-excursion
265 (set-buffer grouplens-bbb-buffer) 265 (set-buffer grouplens-bbb-buffer)
266 (setq bbb-read-point (point-min)) 266 (setq bbb-read-point (point-min))
267 (or (bbb-read-response grouplens-bbb-process) 267 (or (bbb-read-response grouplens-bbb-process)
336 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 336 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
337 ;;;; Get Predictions 337 ;;;; Get Predictions
338 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 338 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
339 339
340 (defun bbb-build-mid-scores-alist (groupname) 340 (defun bbb-build-mid-scores-alist (groupname)
341 "this function can be called as part of the function to return the 341 "this function can be called as part of the function to return the
342 list of score files to use. See the gnus variable 342 list of score files to use. See the gnus variable
343 gnus-score-find-score-files-function. 343 gnus-score-find-score-files-function.
344 344
345 *Note:* If you want to use grouplens scores along with calculated scores, 345 *Note:* If you want to use grouplens scores along with calculated scores,
346 you should see the offset and scale variables. At this point, I don't 346 you should see the offset and scale variables. At this point, I don't
347 recommend using both scores and grouplens predictions together." 347 recommend using both scores and grouplens predictions together."
348 (setq grouplens-current-group groupname) 348 (setq grouplens-current-group groupname)
349 (when (member groupname grouplens-newsgroups) 349 (when (member groupname grouplens-newsgroups)
350 (setq grouplens-previous-article nil) 350 (setq grouplens-previous-article nil)
351 ;; scores-alist should be a list of lists: 351 ;; scores-alist should be a list of lists:
421 421
422 ;; these "get" functions assume that there is an active match lying 422 ;; these "get" functions assume that there is an active match lying
423 ;; around. Where the first parenthesized expression is the 423 ;; around. Where the first parenthesized expression is the
424 ;; message-id, and the second is the prediction, the third and fourth 424 ;; message-id, and the second is the prediction, the third and fourth
425 ;; are the confidence interval 425 ;; are the confidence interval
426 ;; 426 ;;
427 ;; Since gnus assumes that scores are integer values?? we round the 427 ;; Since gnus assumes that scores are integer values?? we round the
428 ;; prediction. 428 ;; prediction.
429 (defun bbb-get-mid () 429 (defun bbb-get-mid ()
430 (buffer-substring (match-beginning 1) (match-end 1))) 430 (buffer-substring (match-beginning 1) (match-end 1)))
431 431
432 (defun bbb-get-pred () 432 (defun bbb-get-pred ()
433 (let ((tpred (string-to-number (buffer-substring (match-beginning 2) 433 (let ((tpred (string-to-number (buffer-substring (match-beginning 2)
434 (match-end 2))))) 434 (match-end 2)))))
435 (if (> tpred 0) 435 (if (> tpred 0)
436 (round (* grouplens-score-scale-factor 436 (round (* grouplens-score-scale-factor
437 (+ grouplens-score-offset tpred))) 437 (+ grouplens-score-offset tpred)))
438 1))) 438 1)))
471 (setq iscore 5)))) 471 (setq iscore 5))))
472 (setq low 0) 472 (setq low 0)
473 (setq high 0)) 473 (setq high 0))
474 (if (and (bbb-valid-score iscore) 474 (if (and (bbb-valid-score iscore)
475 (not (null mid))) 475 (not (null mid)))
476 (cond 476 (cond
477 ;; prediction-spot 477 ;; prediction-spot
478 ((equal grouplens-prediction-display 'prediction-spot) 478 ((equal grouplens-prediction-display 'prediction-spot)
479 (setq rate-string (bbb-fmt-prediction-spot rate-string iscore))) 479 (setq rate-string (bbb-fmt-prediction-spot rate-string iscore)))
480 ;; confidence-interval 480 ;; confidence-interval
481 ((equal grouplens-prediction-display 'confidence-interval) 481 ((equal grouplens-prediction-display 'confidence-interval)
520 (cond ((< pred 0) 520 (cond ((< pred 0)
521 (setq pred 1)) 521 (setq pred 1))
522 ((> pred 5) 522 ((> pred 5)
523 (setq pred 5)))) 523 (setq pred 5))))
524 ;; If no entry in BBB hash mark rate string as NA and return 524 ;; If no entry in BBB hash mark rate string as NA and return
525 (cond 525 (cond
526 ((null hashent) 526 ((null hashent)
527 (aset rate-string 5 ?N) 527 (aset rate-string 5 ?N)
528 (aset rate-string 6 ?A) 528 (aset rate-string 6 ?A)
529 rate-string) 529 rate-string)
530 530
531 ((equal grouplens-prediction-display 'prediction-spot) 531 ((equal grouplens-prediction-display 'prediction-spot)
532 (bbb-fmt-prediction-spot rate-string pred)) 532 (bbb-fmt-prediction-spot rate-string pred))
533 533
534 ((equal grouplens-prediction-display 'confidence-interval) 534 ((equal grouplens-prediction-display 'confidence-interval)
535 (bbb-fmt-confidence-interval pred low high)) 535 (bbb-fmt-confidence-interval pred low high))
536 536
537 ((equal grouplens-prediction-display 'prediction-bar) 537 ((equal grouplens-prediction-display 'prediction-bar)
538 (bbb-fmt-prediction-bar rate-string pred)) 538 (bbb-fmt-prediction-bar rate-string pred))
539 539
540 ((equal grouplens-prediction-display 'confidence-bar) 540 ((equal grouplens-prediction-display 'confidence-bar)
541 (format "| %4.2f |" pred)) 541 (format "| %4.2f |" pred))
542 542
543 ((equal grouplens-prediction-display 'confidence-spot) 543 ((equal grouplens-prediction-display 'confidence-spot)
544 (format "| %4.2f |" pred)) 544 (format "| %4.2f |" pred))
545 545
546 ((equal grouplens-prediction-display 'prediction-num) 546 ((equal grouplens-prediction-display 'prediction-num)
547 (bbb-fmt-prediction-num pred)) 547 (bbb-fmt-prediction-num pred))
548 548
549 ((equal grouplens-prediction-display 'confidence-plus-minus) 549 ((equal grouplens-prediction-display 'confidence-plus-minus)
550 (bbb-fmt-confidence-plus-minus pred low high)) 550 (bbb-fmt-confidence-plus-minus pred low high))
551 551
552 (t 552 (t
553 (gnus-message 3 "Invalid prediction display type") 553 (gnus-message 3 "Invalid prediction display type")
554 (aset rate-string 0 ?|) 554 (aset rate-string 0 ?|)
555 (aset rate-string 11 ?|) 555 (aset rate-string 11 ?|)
556 rate-string))))) 556 rate-string)))))
557 557
607 ;;;; Put Ratings 607 ;;;; Put Ratings
608 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 608 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
609 609
610 (defun bbb-put-ratings () 610 (defun bbb-put-ratings ()
611 (if (and grouplens-bbb-token 611 (if (and grouplens-bbb-token
612 grouplens-rating-alist 612 grouplens-rating-alist
613 (member gnus-newsgroup-name grouplens-newsgroups)) 613 (member gnus-newsgroup-name grouplens-newsgroups))
614 (let ((bbb-process (bbb-connect-to-bbbd grouplens-bbb-host 614 (let ((bbb-process (bbb-connect-to-bbbd grouplens-bbb-host
615 grouplens-bbb-port)) 615 grouplens-bbb-port))
616 (rate-command (bbb-build-rate-command grouplens-rating-alist))) 616 (rate-command (bbb-build-rate-command grouplens-rating-alist)))
617 (if bbb-process 617 (if bbb-process
618 (save-excursion 618 (save-excursion
619 (set-buffer (process-buffer bbb-process)) 619 (set-buffer (process-buffer bbb-process))
620 (gnus-message 5 "Sending Ratings...") 620 (gnus-message 5 "Sending Ratings...")
621 (bbb-send-command bbb-process rate-command) 621 (bbb-send-command bbb-process rate-command)
622 (if (bbb-read-response bbb-process) 622 (if (bbb-read-response bbb-process)
623 (setq grouplens-rating-alist nil) 623 (setq grouplens-rating-alist nil)
624 (gnus-message 1 624 (gnus-message 1
625 "Token timed out: call bbb-login and quit again") 625 "Token timed out: call bbb-login and quit again")
626 (ding)) 626 (ding))
627 (gnus-message 5 "Sending Ratings...Done")) 627 (gnus-message 5 "Sending Ratings...Done"))
628 (gnus-message 3 "No BBB connection"))) 628 (gnus-message 3 "No BBB connection")))
629 (setq grouplens-rating-alist nil))) 629 (setq grouplens-rating-alist nil)))
640 ;; Interactive rating functions. 640 ;; Interactive rating functions.
641 (defun bbb-summary-rate-article (rating &optional midin) 641 (defun bbb-summary-rate-article (rating &optional midin)
642 (interactive "nRating: ") 642 (interactive "nRating: ")
643 (when (member gnus-newsgroup-name grouplens-newsgroups) 643 (when (member gnus-newsgroup-name grouplens-newsgroups)
644 (let ((mid (or midin (bbb-get-current-id)))) 644 (let ((mid (or midin (bbb-get-current-id))))
645 (if (and rating 645 (if (and rating
646 (>= rating grplens-minrating) 646 (>= rating grplens-minrating)
647 (<= rating grplens-maxrating) 647 (<= rating grplens-maxrating)
648 mid) 648 mid)
649 (let ((oldrating (assoc mid grouplens-rating-alist))) 649 (let ((oldrating (assoc mid grouplens-rating-alist)))
650 (if oldrating 650 (if oldrating
666 (when rating 666 (when rating
667 (bbb-summary-rate-article rating)) 667 (bbb-summary-rate-article rating))
668 (gnus-summary-best-unread-article)) 668 (gnus-summary-best-unread-article))
669 669
670 (defun grouplens-summary-catchup-and-exit (rating) 670 (defun grouplens-summary-catchup-and-exit (rating)
671 "Mark all articles not marked as unread in this newsgroup as read, 671 "Mark all articles not marked as unread in this newsgroup as read,
672 then exit. If prefix argument ALL is non-nil, all articles are 672 then exit. If prefix argument ALL is non-nil, all articles are
673 marked as read." 673 marked as read."
674 (interactive "P") 674 (interactive "P")
675 (when rating 675 (when rating
676 (bbb-summary-rate-article rating)) 676 (bbb-summary-rate-article rating))
677 (if (numberp rating) 677 (if (numberp rating)
687 article) 687 article)
688 (while (setq article (pop articles)) 688 (while (setq article (pop articles))
689 (gnus-summary-goto-subject article) 689 (gnus-summary-goto-subject article)
690 (gnus-set-global-variables) 690 (gnus-set-global-variables)
691 (bbb-summary-rate-article score 691 (bbb-summary-rate-article score
692 (mail-header-id 692 (mail-header-id
693 (gnus-summary-article-header article))))) 693 (gnus-summary-article-header article)))))
694 (setq e (point))) 694 (setq e (point)))
695 (let ((gnus-summary-check-current t)) 695 (let ((gnus-summary-check-current t))
696 (or (zerop (gnus-summary-next-subject 1 t)) 696 (or (zerop (gnus-summary-next-subject 1 t))
697 (goto-char e)))) 697 (goto-char e))))
703 (bbb-put-ratings) 703 (bbb-put-ratings)
704 (bbb-renew-hash-table)) 704 (bbb-renew-hash-table))
705 705
706 (defun bbb-get-current-id () 706 (defun bbb-get-current-id ()
707 (if gnus-current-headers 707 (if gnus-current-headers
708 (mail-header-id gnus-current-headers) 708 (mail-header-id gnus-current-headers)
709 (gnus-message 3 "You must select an article before you rate it"))) 709 (gnus-message 3 "You must select an article before you rate it")))
710 710
711 (defun bbb-grouplens-group-p (group) 711 (defun bbb-grouplens-group-p (group)
712 "Say whether GROUP is a GroupLens group." 712 "Say whether GROUP is a GroupLens group."
713 (if (member group grouplens-newsgroups) " (GroupLens Enhanced)" "")) 713 (if (member group grouplens-newsgroups) " (GroupLens Enhanced)" ""))
730 730
731 (defun grouplens-do-time () 731 (defun grouplens-do-time ()
732 (when (member gnus-newsgroup-name grouplens-newsgroups) 732 (when (member gnus-newsgroup-name grouplens-newsgroups)
733 (when grouplens-previous-article 733 (when grouplens-previous-article
734 (let ((elapsed-time (grouplens-elapsed-time)) 734 (let ((elapsed-time (grouplens-elapsed-time))
735 (oldrating (assoc grouplens-previous-article 735 (oldrating (assoc grouplens-previous-article
736 grouplens-rating-alist))) 736 grouplens-rating-alist)))
737 (if (not oldrating) 737 (if (not oldrating)
738 (push `(,grouplens-previous-article . (0 . ,elapsed-time)) 738 (push `(,grouplens-previous-article . (0 . ,elapsed-time))
739 grouplens-rating-alist) 739 grouplens-rating-alist)
740 (setcdr oldrating (cons (cadr oldrating) elapsed-time))))) 740 (setcdr oldrating (cons (cadr oldrating) elapsed-time)))))
804 "Minor mode for providing a GroupLens interface in Gnus summary buffers." 804 "Minor mode for providing a GroupLens interface in Gnus summary buffers."
805 (interactive "P") 805 (interactive "P")
806 (when (and (eq major-mode 'gnus-summary-mode) 806 (when (and (eq major-mode 'gnus-summary-mode)
807 (member gnus-newsgroup-name grouplens-newsgroups)) 807 (member gnus-newsgroup-name grouplens-newsgroups))
808 (make-local-variable 'gnus-grouplens-mode) 808 (make-local-variable 'gnus-grouplens-mode)
809 (setq gnus-grouplens-mode 809 (setq gnus-grouplens-mode
810 (if (null arg) (not gnus-grouplens-mode) 810 (if (null arg) (not gnus-grouplens-mode)
811 (> (prefix-numeric-value arg) 0))) 811 (> (prefix-numeric-value arg) 0)))
812 (when gnus-grouplens-mode 812 (when gnus-grouplens-mode
813 (make-local-hook 'gnus-select-article-hook) 813 (make-local-hook 'gnus-select-article-hook)
814 (gnus-add-hook 'gnus-select-article-hook 'grouplens-do-time nil 'local) 814 (gnus-add-hook 'gnus-select-article-hook 'grouplens-do-time nil 'local)
815 (make-local-hook 'gnus-exit-group-hook) 815 (make-local-hook 'gnus-exit-group-hook)
816 (gnus-add-hook 'gnus-exit-group-hook 'bbb-exit-group nil 'local) 816 (gnus-add-hook 'gnus-exit-group-hook 'bbb-exit-group nil 'local)
817 (make-local-variable 'gnus-score-find-score-files-function) 817 (make-local-variable 'gnus-score-find-score-files-function)
818 818
819 (cond 819 (cond
820 ((eq gnus-grouplens-override-scoring 'combine) 820 ((eq gnus-grouplens-override-scoring 'combine)
821 ;; either add bbb-buld-mid-scores-alist to a list 821 ;; either add bbb-buld-mid-scores-alist to a list
822 ;; or make a list 822 ;; or make a list
823 (if (listp gnus-score-find-score-files-function) 823 (if (listp gnus-score-find-score-files-function)
824 (setq gnus-score-find-score-files-function 824 (setq gnus-score-find-score-files-function
825 (append 'bbb-build-mid-scores-alist 825 (append 'bbb-build-mid-scores-alist
826 gnus-score-find-score-files-function)) 826 gnus-score-find-score-files-function))
827 (setq gnus-score-find-score-files-function 827 (setq gnus-score-find-score-files-function
828 (list gnus-score-find-score-files-function 828 (list gnus-score-find-score-files-function
829 'bbb-build-mid-scores-alist)))) 829 'bbb-build-mid-scores-alist))))
830 ;; leave the gnus-score-find-score-files variable alone 830 ;; leave the gnus-score-find-score-files variable alone
831 ((eq gnus-grouplens-override-scoring 'separate) 831 ((eq gnus-grouplens-override-scoring 'separate)
832 (add-hook 'gnus-select-group-hook 832 (add-hook 'gnus-select-group-hook
833 (lambda () 833 (lambda ()
834 (bbb-get-predictions (bbb-get-all-mids) 834 (bbb-get-predictions (bbb-get-all-mids)
835 gnus-newsgroup-name)))) 835 gnus-newsgroup-name))))
836 ;; default is to override 836 ;; default is to override
837 (t 837 (t
838 (setq gnus-score-find-score-files-function 838 (setq gnus-score-find-score-files-function
839 'bbb-build-mid-scores-alist))) 839 'bbb-build-mid-scores-alist)))
840 840
841 ;; Change how summary lines look 841 ;; Change how summary lines look
842 (make-local-variable 'gnus-summary-line-format) 842 (make-local-variable 'gnus-summary-line-format)
843 (make-local-variable 'gnus-summary-line-format-spec) 843 (make-local-variable 'gnus-summary-line-format-spec)
844 (setq gnus-summary-line-format gnus-summary-grouplens-line-format) 844 (setq gnus-summary-line-format gnus-summary-grouplens-line-format)
845 (setq gnus-summary-line-format-spec nil) 845 (setq gnus-summary-line-format-spec nil)