Gnus development mailing list
 help / color / mirror / Atom feed
From: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
Cc: bmiller@cs.umn.edu (Brad Miller)
Subject: GroupLens
Date: 25 Feb 1996 00:57:17 +0000	[thread overview]
Message-ID: <w8s20nkxlw2.fsf@ylfing.ifi.uio.no> (raw)

I have been fiddling a bit with further integration of the GroupLens
code into Gnus proper to make it as easy as possible to use GroupLens.

I have done the following:

1)  Added a variable `gnus-use-grouplens'.  If it is non-nil, Gnus
will do the `bbb-login' and add `gnus-grouplens-mode' to
`gnus-summary-mode-hook'. 

2)  The GroupLens spec is now part of the default
`gnus-group-line-format'. 

3)  I have added a new variable, `gnus-summary-grouplens-line-format',
that is used as the format in all summary buffers that are GroupLens
enhanced. 

All you have to do now is:

(setq gnus-use-grouplens t)
(setq grouplens-pseudonym "your-pseudonym")

Included below is a patch to gnus-gl.el v2.5.  (I've also added a few
more defvars and stuff to make silence byte-compilation.)

Perhaps all the functions and variables in `gnus-gl' should start with
a common prefix to avoid inadvertantly clobbering other
functions/variables?  "bbb-"?  "gnus-gl-"?  "grouplens-"?

*** gnus-gl.el.old	Sun Feb 25 00:57:41 1996
--- gnus-gl.el	Sun Feb 25 01:48:55 1996
***************
*** 125,130 ****
--- 125,134 ----
  ;;;; User variables
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
+ (defvar gnus-summary-grouplens-line-format
+   "%U%R%z%l%I%(%[%4L: %-20,20n%]%) %s\n"
+   "*The line format spec in summary GroupLens mode buffers.")
+ 
  (defvar grouplens-pseudonym ""
    "User's pseudonym.  This pseudonym is obtained during the registration process")
  
***************
*** 134,140 ****
  (defvar grouplens-bbb-port 9000 
    "Port where the bbbd is listening" )
  
! (defvar grouplens-newsgroups '("comp.lang.c++" "rec.humor" "rec.food.recipes"))
  
  (defvar grouplens-prediction-display 'prediction-spot
    "valid values are: 
--- 138,148 ----
  (defvar grouplens-bbb-port 9000 
    "Port where the bbbd is listening" )
  
! (defvar grouplens-newsgroups 
!   '("comp.lang.c++" "rec.humor" "rec.food.recipes" "comp.groupware"
!     "mn.general" "rec.arts.movies" "rec.arts.movies.current-films"
!     "comp.lang.java")
!   "*Groups that are part of the GroupLens experiment.")
  
  (defvar grouplens-prediction-display 'prediction-spot
    "valid values are: 
***************
*** 201,207 ****
  (defvar elapsed-time 0)
  
  (defvar previous-article nil)
! ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;;  Utility Functions
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (defun connect-to-bbbd (host port)
--- 209,221 ----
  (defvar elapsed-time 0)
  
  (defvar previous-article nil)
! 
! (defvar process-buffer)
! (defvar bbb-read-point)
! (defvar bbb-response-point)
! (defvar login-response)
! 
! ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;;  Utility Functions
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (defun connect-to-bbbd (host port)
***************
*** 336,342 ****
        (if bbb-process
  	  (save-excursion (set-buffer (process-buffer bbb-process))
  			  (bbb-send-command bbb-process predict-command)
! 			  (if (setq response (bbb-read-response bbb-process nil))
  			      (setq predict-list 
  				    (bbb-get-prediction-response bbb-process))
  			    (gnus-message 1 "Invalid Token, login and try again")
--- 350,356 ----
        (if bbb-process
  	  (save-excursion (set-buffer (process-buffer bbb-process))
  			  (bbb-send-command bbb-process predict-command)
! 			  (if (bbb-read-response bbb-process nil)
  			      (setq predict-list 
  				    (bbb-get-prediction-response bbb-process))
  			    (gnus-message 1 "Invalid Token, login and try again")
***************
*** 349,355 ****
  
  (defun get-all-mids ()
    (let ((index (nth 1 (assoc "message-id" gnus-header-index)))
! 	(articles gnus-newsgroup-headers))
      (setq bbb-mid-list nil)
      (while articles
        (progn (setq art (car articles)
--- 363,370 ----
  
  (defun get-all-mids ()
    (let ((index (nth 1 (assoc "message-id" gnus-header-index)))
! 	(articles gnus-newsgroup-headers)
! 	art this)
      (setq bbb-mid-list nil)
      (while articles
        (progn (setq art (car articles)
***************
*** 360,366 ****
    )
  
  (defun build-predict-command (mlist grpname token)
!   (let ((cmd (concat "getpredictions " token " " grpname "\r\n")))
      (while mlist
        (setq art (car mlist)
  	    cmd (concat cmd art "\r\n")
--- 375,382 ----
    )
  
  (defun build-predict-command (mlist grpname token)
!   (let ((cmd (concat "getpredictions " token " " grpname "\r\n"))
! 	art)
      (while mlist
        (setq art (car mlist)
  	    cmd (concat cmd art "\r\n")
***************
*** 443,448 ****
--- 459,467 ----
  (defconst grplens-minrating 1)
  (defconst grplens-predstringsize 12)
  
+ (defalias 'bbb-grouplens-score 'gnus-user-format-function-G)
+ 
+ (defvar gnus-tmp-score)
  (defun gnus-user-format-function-G (header)
    (let* ((rate-string (make-string 12 ? ))
  	 (mid
***************
*** 643,649 ****
  
  (defun build-rate-command (rate-alist)
    (let ((cmd (concat "putratings " grouplens-bbb-token 
! 		     " " grouplens-current-group " \r\n")))
      (while rate-alist
        (setq this (car rate-alist)
  	    cmd (concat cmd (car this) " :rating=" (cadr this) ".00"
--- 662,669 ----
  
  (defun build-rate-command (rate-alist)
    (let ((cmd (concat "putratings " grouplens-bbb-token 
! 		     " " grouplens-current-group " \r\n"))
! 	this)
      (while rate-alist
        (setq this (car rate-alist)
  	    cmd (concat cmd (car this) " :rating=" (cadr this) ".00"
***************
*** 714,720 ****
      (save-excursion
        (while scoring
  	(bbb-summary-rate-article score
! 				  (gnus-header-id
  				   (gnus-get-header-by-number 
  				    (gnus-summary-article-number))))
  	;; ...and go forward until either the buffer ends or the subtree
--- 734,740 ----
      (save-excursion
        (while scoring
  	(bbb-summary-rate-article score
! 				  (mail-header-id
  				   (gnus-get-header-by-number 
  				    (gnus-summary-article-number))))
  	;; ...and go forward until either the buffer ends or the subtree
***************
*** 736,742 ****
      (gnus-message 3 "You must select an article before you rate it")))
  
  
! 
  (defun gnus-user-format-function-I (header)
    (let ((gname (if (string-match "September" gnus-version)
  		   gnus-tmp-group
--- 756,762 ----
      (gnus-message 3 "You must select an article before you rate it")))
  
  
! (defvar gnus-tmp-group)
  (defun gnus-user-format-function-I (header)
    (let ((gname (if (string-match "September" gnus-version)
  		   gnus-tmp-group
***************
*** 746,752 ****
        ""))
  )
  
! ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;          TIME SPENT READING
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
--- 766,778 ----
        ""))
  )
  
! (defun bbb-grouplens-group-p (group)
!   "Say whether GROUP is a GroupLens group."
!   (if (member group grouplens-newsgroups)
!       " (GroupLens Enhanced)"
!     ""))
! 
! ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;          TIME SPENT READING
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
***************
*** 764,785 ****
  	(cadr timeval)))
  
  (defun grouplens-do-time ()
!   (if (member gnus-newsgroup-name grouplens-newsgroups)
!       (progn
! 	(cond ((not (null previous-article))
! 	       (setq  elapsed-time (grouplens-elapsed-time))
! 	       (if (not (setq oldrating (assoc previous-article
! 					       grouplens-rating-alist)))
! 		   (setq grouplens-rating-alist (cons (cons previous-article
! 							   (cons 0
! 								 elapsed-time))
! 						      grouplens-rating-alist))
! 		 (setcdr oldrating (cons (cadr oldrating) elapsed-time)))
! 	       ))
! 	(grouplens-start-timer)
! 	(setq previous-article (get-current-id)))
!     ) ; end if
! )
  
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--- 790,812 ----
  	(cadr timeval)))
  
  (defun grouplens-do-time ()
!   (let (oldrating)
!     (if (member gnus-newsgroup-name grouplens-newsgroups)
! 	(progn
! 	  (cond ((not (null previous-article))
! 		 (setq  elapsed-time (grouplens-elapsed-time))
! 		 (if (not (setq oldrating (assoc previous-article
! 						 grouplens-rating-alist)))
! 		     (setq grouplens-rating-alist (cons (cons previous-article
! 							      (cons 0
! 								    elapsed-time))
! 							grouplens-rating-alist))
! 		   (setcdr oldrating (cons (cadr oldrating) elapsed-time)))
! 		 ))
! 	  (grouplens-start-timer)
! 	  (setq previous-article (get-current-id)))
!       )					; end if
!     ))
  
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
***************
*** 854,872 ****
  	  (if (null arg) (not gnus-grouplens-mode)
  	    (> (prefix-numeric-value arg) 0)))
      (when gnus-grouplens-mode
-       (add-hook 'gnus-startup-hook 'bbb-login)
-       (add-hook 'gnus-exit-gnus-hook 'bbb-logout)
        (make-local-hook 'gnus-select-article-hook)
        (add-hook 'gnus-select-article-hook 'grouplens-do-time)
        (make-local-hook 'bbb-put-ratings)
        (add-hook 'gnus-exit-group-hook 'bbb-put-ratings)
        (setq gnus-score-find-score-files-function 'bbb-build-mid-scores-alist)
  
        ;; Set up the menu.
        (when (and menu-bar-mode
  		 (gnus-visual-p 'grouplens-menu 'menu))
  	(gnus-grouplens-make-menu-bar)
! 	(easy-menu-add gnus-grouplens-menu))
        (unless (assq 'gnus-grouplens-mode minor-mode-alist)
  	(push '(gnus-grouplens-mode " GroupLens") minor-mode-alist))
        (unless (assq 'gnus-grouplens-mode minor-mode-map-alist)
--- 881,900 ----
  	  (if (null arg) (not gnus-grouplens-mode)
  	    (> (prefix-numeric-value arg) 0)))
      (when gnus-grouplens-mode
        (make-local-hook 'gnus-select-article-hook)
        (add-hook 'gnus-select-article-hook 'grouplens-do-time)
        (make-local-hook 'bbb-put-ratings)
        (add-hook 'gnus-exit-group-hook 'bbb-put-ratings)
        (setq gnus-score-find-score-files-function 'bbb-build-mid-scores-alist)
+       (make-local-variable 'gnus-summary-line-format)
+       (setq gnus-summary-line-format gnus-summary-grouplens-line-format)
+       (make-local-variable 'gnus-summary-line-format-spec)
  
        ;; Set up the menu.
        (when (and menu-bar-mode
  		 (gnus-visual-p 'grouplens-menu 'menu))
  	(gnus-grouplens-make-menu-bar)
! 	(easy-menu-add 'gnus-grouplens-menu))
        (unless (assq 'gnus-grouplens-mode minor-mode-alist)
  	(push '(gnus-grouplens-mode " GroupLens") minor-mode-alist))
        (unless (assq 'gnus-grouplens-mode minor-mode-map-alist)


-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@ifi.uio.no * Lars Ingebrigtsen


             reply	other threads:[~1996-02-25  0:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-25  0:57 Lars Magne Ingebrigtsen [this message]
1997-04-22 20:02 GroupLens David L Leppik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=w8s20nkxlw2.fsf@ylfing.ifi.uio.no \
    --to=larsi@ifi.uio.no \
    --cc=bmiller@cs.umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).