Commit df147057 authored by David Byers's avatar David Byers
Browse files

Reimplemented lyskom-get-texts-by-to

Added continuous scrolling
Added review-previous-commented-text
Added utilities file.
Removed compiler warnings by cleaning out compatibility code.
parent 7eb72ac8
Thu Apr 4 10:36:06 1996 David Byers <davby@sen2.ida.liu.se>
* lyskom-rest.el (lyskom-insert): Gör lyskom-scroll i lyskom-insert
bara om kom-continuous-scrolling är satt.
* vars.el.in (kom-continuous-scrolling): Ny variabel.
(lyskom-elisp-variables): Lade till kom-continuous-scrolling.
* english-strings.el, swedish-strings.el (lyskom-mode-map): Lade till
kom-review-first.
* swedish-strings.el, english-strings.el (lyskom-strings): Lade till
lyskom-review-how-many.
* review.el (lyskom-get-texts-by-to): Skrev helt om den här funktionen
så den anropar olika funktioner för att göra jobbet beroende på
inputmönster. (lyskom-get-texts-by-and-to): Ny funktion som hämtar
texter av en person till ett möte. (lyskom-get-texts-generic): Ny
funktion som hämtar texter av en person eller till ett möte.
(lyskom-get-texts-by): Ny funktion som hämtar texter av en person.
(lyskom-get-texts-to): Ny funktion som hämtar texter till ett möte.
Wed Apr 3 12:56:19 1996 David Byers <davby@sen2.ida.liu.se>
* english-strings.el, swedish-strings.el (lyskom-strings): Lade till
confusion-what-to-view. (lyskom-mode-map): Lade till tangentbindningar
för lyskom-view-previous-commented-text.
* commands1.el (kom-view-previous-commented-text): Lade till denna
funktion (skriven av Teddy).
* lyskom-rest.el (lyskom-insert): Lade in ett anrop till lyskom-scroll
om point hamnar utanför skärmen. Detta får betraktas som ett
experiment.
* review.el (lyskom-get-texts-by-to): Fixade buggar i David Kågedals
version och tog bort den gamla versionen.
* utilities.el (nfirst): Flyttade från review.el
Tue Apr 2 15:15:11 1996 David Byers <davby@sen2.ida.liu.se> Tue Apr 2 15:15:11 1996 David Byers <davby@sen2.ida.liu.se>
* Blev av med alla kompilatorvarningar genom att ta bort * Blev av med alla kompilatorvarningar genom att ta bort
......
...@@ -90,7 +90,10 @@ lyskom.elc: lyskom.el ...@@ -90,7 +90,10 @@ lyskom.elc: lyskom.el
# Only testing # Only testing
.PHONY: verbose .PHONY: verbose
verbose: $(HEADER-EL) $(SWEDISH-EL) $(PARTS-EL) verbose: verbose-el lyskom.elc
.PHONY: verbose-el
verbose-el: $(HEADER-EL) $(SWEDISH-EL) $(PARTS-EL)
@echo "Building lyskom.el" @echo "Building lyskom.el"
@echo "" > lyskom.el @echo "" > lyskom.el
@for i in $(HEADER-EL) $(SWEDISH-EL) $(PARTS-EL) ; do \ @for i in $(HEADER-EL) $(SWEDISH-EL) $(PARTS-EL) ; do \
......
...@@ -162,36 +162,49 @@ text is shown and a REVIEW list is built to shown the other ones." ...@@ -162,36 +162,49 @@ text is shown and a REVIEW list is built to shown the other ones."
(lyskom-insert-string 'have-to-read))) (lyskom-insert-string 'have-to-read)))
(def-kom-command kom-view-previous-commented-text ()
"View the text the previous text commented.
If the previously viewed text is a comment to (footnote to) several
texts then the first text is shown and a REVIEW list is built to show
the other ones."
(interactive)
(if lyskom-previous-text
(progn
(lyskom-tell-internat 'kom-tell-read)
(lyskom-view-commented-text
(blocking-do 'get-text-stat lyskom-previous-text)))
(lyskom-insert-string 'confusion-what-to-view)))
(defun lyskom-view-commented-text (text-stat) (defun lyskom-view-commented-text (text-stat)
"Handles the return from the initiate-get-text-stat, displays and builds list." "Handles the return from the initiate-get-text-stat, displays and builds list."
(let* ((misc-info-list (and text-stat (let* ((misc-info-list (and text-stat
(text-stat->misc-info-list text-stat))) (text-stat->misc-info-list text-stat)))
(misc-infos (and misc-info-list (misc-infos (and misc-info-list
(append (lyskom-misc-infos-from-list (append (lyskom-misc-infos-from-list
'COMM-TO misc-info-list) 'COMM-TO misc-info-list)
(lyskom-misc-infos-from-list (lyskom-misc-infos-from-list
'FOOTN-TO misc-info-list)))) 'FOOTN-TO misc-info-list))))
(text-nos (and misc-infos (text-nos (and misc-infos
(mapcar (mapcar
(function (function
(lambda (misc-info) (lambda (misc-info)
(if (equal (misc-info->type misc-info) (if (equal (misc-info->type misc-info)
'COMM-TO) 'COMM-TO)
(misc-info->comm-to misc-info) (misc-info->comm-to misc-info)
(misc-info->footn-to misc-info)))) (misc-info->footn-to misc-info))))
misc-infos)))) misc-infos))))
(if text-nos (if text-nos
(progn (progn
(lyskom-format-insert 'review-text-no (lyskom-format-insert 'review-text-no
(car text-nos)) (car text-nos))
(if (cdr text-nos) (if (cdr text-nos)
(read-list-enter-read-info (read-list-enter-read-info
(lyskom-create-read-info (lyskom-create-read-info
'REVIEW nil (lyskom-get-current-priority) 'REVIEW nil (lyskom-get-current-priority)
(lyskom-create-text-list (cdr text-nos)) (lyskom-create-text-list (cdr text-nos))
lyskom-current-text) lyskom-current-text)
lyskom-reading-list t)) lyskom-reading-list t))
(lyskom-view-text (car text-nos))) (lyskom-view-text (car text-nos)))
(lyskom-insert-string 'no-comment-to)))) (lyskom-insert-string 'no-comment-to))))
......
...@@ -245,6 +245,7 @@ Send a letter to %#2P to apply for membership.") ...@@ -245,6 +245,7 @@ Send a letter to %#2P to apply for membership.")
(confusion-who-to-reply-to . "I can't figure out which article you want to write a private reply to.\n") (confusion-who-to-reply-to . "I can't figure out which article you want to write a private reply to.\n")
(confusion-what-to-answer-to . "I can't figure out which article you want write a reply to.") (confusion-what-to-answer-to . "I can't figure out which article you want write a reply to.")
(quit-in-spite-of-unsent . "You have an unsent article. Do you really want to quit? ") (quit-in-spite-of-unsent . "You have an unsent article. Do you really want to quit? ")
(confusion-what-to-view . "I can't figure out which article you want to view.\n")
(really-quit . "Do you really want to quit LysKOM? ") (really-quit . "Do you really want to quit LysKOM? ")
(session-ended . " (session-ended . "
-------------------------------------------- --------------------------------------------
...@@ -522,6 +523,7 @@ Mark the envelope with \"LysKOM bug report\"\n\n") ...@@ -522,6 +523,7 @@ Mark the envelope with \"LysKOM bug report\"\n\n")
(set-session-priority . "Set reading level:") (set-session-priority . "Set reading level:")
; From review.el: ; From review.el:
(review-how-many . "Review how many articles: ")
(latest-n . "last %#1d") (latest-n . "last %#1d")
(first-n . "first %#1d") (first-n . "first %#1d")
(info-by-whom . "%#1s by whom: ") (info-by-whom . "%#1s by whom: ")
...@@ -531,7 +533,7 @@ Mark the envelope with \"LysKOM bug report\"\n\n") ...@@ -531,7 +533,7 @@ Mark the envelope with \"LysKOM bug report\"\n\n")
(no-get-conf . "You are not allowed to access that conferene.\n") (no-get-conf . "You are not allowed to access that conferene.\n")
(no-get-pers . "You are not allowed to access that user.\n") (no-get-pers . "You are not allowed to access that user.\n")
(no-review-info . "You are not allowed to review %#1s\n") (no-review-info . "You are not allowed to review %#1s\n")
(review-info . "Review %#1s\n") (review-info . "Review %#1s")
(you-review . "You are now reviewing %#1s.\n") (you-review . "You are now reviewing %#1s.\n")
(read-text-first . "You must read a article first.\n") (read-text-first . "You must read a article first.\n")
(cannot-read-last-text . "You cannot review the last read article.\n") (cannot-read-last-text . "You cannot review the last read article.\n")
...@@ -895,6 +897,7 @@ Text: ...@@ -895,6 +897,7 @@ Text:
(kom-review-next "Review next") (kom-review-next "Review next")
(kom-find-root "Review original (article)") (kom-find-root "Review original (article)")
(kom-review-by-to "Review last") (kom-review-by-to "Review last")
(kom-review-first "Review first")
(kom-view-commented-text "Review (the) commented (article)") (kom-view-commented-text "Review (the) commented (article)")
(kom-review-stack "Review stack") (kom-review-stack "Review stack")
(kom-review-presentation "Review presentation") (kom-review-presentation "Review presentation")
...@@ -1105,6 +1108,7 @@ Cf. paragraph-start.") ...@@ -1105,6 +1108,7 @@ Cf. paragraph-start.")
(define-key lyskom-mode-map "ru" 'kom-review-noconversion) (define-key lyskom-mode-map "ru" 'kom-review-noconversion)
(define-key lyskom-mode-map "ro" 'kom-find-root) (define-key lyskom-mode-map "ro" 'kom-find-root)
(define-key lyskom-mode-map "rl" 'kom-review-by-to) (define-key lyskom-mode-map "rl" 'kom-review-by-to)
(define-key lyskom-mode-map "rf" 'kom-review-first)
(define-key lyskom-mode-map "rg" 'kom-review-last-normally-read) (define-key lyskom-mode-map "rg" 'kom-review-last-normally-read)
(define-key lyskom-mode-map "B" 'kom-review-backward) (define-key lyskom-mode-map "B" 'kom-review-backward)
(define-key lyskom-mode-map "rs" 'kom-review-stack) (define-key lyskom-mode-map "rs" 'kom-review-stack)
......
No preview for this file type
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
(defun lyskom-intersection (a b) (defun lyskom-intersection (a b)
"Returns as a list the intersection of list A and list B. "Returns as a list the intersection of list A and list B.
The order of the list a is kept." The order of the list a is kept."
(let ((list (list))) (let ((list nil))
(while a (while a
(if (memq (car a) b) (if (memq (car a) b)
(setq list (cons (car a) list))) (setq list (cons (car a) list)))
...@@ -59,9 +59,26 @@ The order of the list a is kept." ...@@ -59,9 +59,26 @@ The order of the list a is kept."
;;; ================================================================ ;;; ================================================================
;;; ]terse av, till - Review by X to Conference Y. ;;; ]terse av, till - Review by X to Conference Y.
;;; Author: Linus Tolke ;;; Author: Linus Tolke, David Kågedal, David Byers
(def-kom-command kom-review-first (&optional count)
"Reviews all articles of author that is written to conference recipient.
If return is given instead of an author then all authors to that conference is
shown. If return is given instead of conference then all conferences for that
person is chosen.
If a negative numeric argument is given then only the last COUNT articles are
chosen. If the argument is positive then the first -COUNT articles are chosen.
If the argument is zero the all articles are chosen.
No argument is equivalent to COUNT 1.
The defaults for this command is the conference that you are in."
(interactive)
(lyskom-tell-internat 'kom-tell-review)
(lyskom-review-by-to (- (or count
(lyskom-read-number
(lyskom-get-string 'review-how-many) 1)))))
(def-kom-command kom-review-by-to (&optional count) (def-kom-command kom-review-by-to (&optional count)
"Reviews all articles of author that is written to conference recipient. "Reviews all articles of author that is written to conference recipient.
...@@ -73,180 +90,295 @@ chosen. If the argument is negative then the first -COUNT articles are chosen. ...@@ -73,180 +90,295 @@ chosen. If the argument is negative then the first -COUNT articles are chosen.
If the argument is zero the all articles are chosen. If the argument is zero the all articles are chosen.
No argument is equivalent to COUNT 1. No argument is equivalent to COUNT 1.
The defaults for this command is the conference that you are in." The defaults for this command is the conference that you are in."
(interactive "p") (interactive "P")
(lyskom-tell-internat 'kom-tell-review) (lyskom-review-by-to (or count
(let* ((info (progn (lyskom-read-number
(if (and (listp count) (lyskom-get-string 'review-how-many) 1))))
(integerp (car count))
(null (cdr count)))
(setq count (car count)))
(cond (defun lyskom-review-by-to (count)
((zerop count) "Common function for kom-review-by-to and kom-review-first"
(setq count nil) (let* ((info (progn (if (and (listp count)
(lyskom-get-string 'everybody)) (integerp (car count))
((> count 0) (null (cdr count)))
(lyskom-format 'latest-n count)) (setq count (car count)))
((< count 0) (cond ((zerop count)
(lyskom-format 'first-n (- count)))))) (setq count nil)
(by (lyskom-read-conf-no (lyskom-format 'info-by-whom info) (lyskom-get-string 'everybody))
'pers 'empty nil t)) ((> count 0)
(to (lyskom-read-conf-no (lyskom-format 'info-to-conf info) (lyskom-format 'latest-n count))
'all ((< count 0)
;; If person is not given we must give (lyskom-format 'first-n
;; conf (- count))))))
(not (zerop by)) (by (lyskom-read-conf-no
(if (zerop lyskom-current-conf) (lyskom-format 'review-info (lyskom-format 'info-by-whom info))
"" 'pers 'empty nil t))
(conf-stat->name (to (lyskom-read-conf-no
(blocking-do 'get-conf-stat (lyskom-format 'review-info
lyskom-current-conf))) (lyskom-format 'info-to-conf info))
t))) 'all
;; If person is not given we must give
;; conf
(not (zerop by))
(if (zerop lyskom-current-conf)
""
(conf-stat->name
(blocking-do 'get-conf-stat
lyskom-current-conf)))
t)))
;; Since we fetch everything anyway we don't need to do this. If ;; Since we fetch everything anyway we don't need to do this. If
;; we later choose to fetch all in small chunks we will have to do ;; we later choose to fetch all in small chunks we will have to do
;; this then. ;; this then.
(if (not (zerop to)) (if (not (zerop to))
(cache-del-conf-stat to)) (cache-del-conf-stat to))
(if (not (zerop by)) (if (not (zerop by))
(cache-del-pers-stat by)) (cache-del-pers-stat by))
(let* ((info-by (if (zerop by) (let* ((info-by (if (zerop by)
(lyskom-get-string 'anybody) (lyskom-get-string 'anybody)
(blocking-do 'get-conf-stat by))) (blocking-do 'get-conf-stat by)))
(info-to (if (zerop to) (info-to (if (zerop to)
(lyskom-get-string 'all-confs) (lyskom-get-string 'all-confs)
(blocking-do 'get-conf-stat to)))) (blocking-do 'get-conf-stat to))))
(lyskom-format-insert 'review-info-by-to (lyskom-format-insert 'review-info-by-to
info info
info-by info-by
info-to)) info-to))
(let ((list (lyskom-get-texts-by-to by to count))) (let ((list (lyskom-get-texts-by-to by to count)))
(if list (if list
(read-list-enter-read-info (lyskom-create-read-info (read-list-enter-read-info (lyskom-create-read-info
'REVIEW 'REVIEW
nil nil
(lyskom-get-current-priority) (lyskom-get-current-priority)
(lyskom-create-text-list list) (lyskom-create-text-list list)
nil t) nil t)
lyskom-reading-list t) lyskom-reading-list t)
(lyskom-insert-string 'no-such-text))))) (lyskom-insert-string 'no-such-text)))))
(defun lyskom-get-texts-by-to (by to count)
"Get a list of COUNT text numbers written by BY in conference TO."
;; THIS FUNCTION DOES NOT WORK AT THE MOMENT ;;; ================================================================
;;; lyskom-get-texts-by-to
;; Now we have ;;; Author: David Byers
;; - the person number in by ;;;
;; - the conf number in to ;;; Call lyskom-get-texts-by, lyskom-get-texts-to or
;; - the number of interesting texts in count (if negative, then ;;; lyskom-get-texts-by-and-to to get NUM texts by person
;; count from the beginning. ;;; BY to conference TO.
;; ;;;
;; What we have to do is fetch and merge the list of texts until we
;; have found count texts.
(defun lyskom-get-texts-by-to (by to num)
;; Lets do the very simple thing: "Get NUM texts writteb by person number BY in conference number TO
;; - Fetch the whole lists. If its to slow, fix it! Args: BY TO NUM"
;; (the calls wont get very big, at least not during get-map (cond ((and (zerop by)
;; because the initiate-get-map itself splits the call) (sure?) (zerop to)) nil)
((zerop to) (lyskom-get-texts-by by num))
;;; I'll finish this some day /davidk ((zerop by) (lyskom-get-texts-to to num))
;;; In the meantime we'll use the old, inefficient code (t (lyskom-get-texts-by-and-to by to num))))
;;;
;;; (let* ((texts nil)
;;; (exhausted nil)
;;; (persstat (if (zerop by) nil (blocking-do 'get-pers-stat by))) ;;; ================================================================
;;; (confstat (if (zerop to) nil (blocking-do 'get-conf-stat to))) ;;; lyskom-get-texts-by-and-to
;;; (phigh (pers-stat->no-of-created-texts persstat)) ;;; Author: David Byers
;;; (plow (pers-stat->first-created-text persstat)) ;;;
;;; (pmark (if persstat (if (< count 0) plow phigh))) ;;; Conceptual algorithm:
;;; (chigh (conf-stat->no-of-texts confstat)) ;;;
;;; (clow (conf-stat->first-local-no confstat)) ;;; Get a segment from the start or end of the person's map of created
;;; (cmark (if confstat (if (< count 0) clow chigh)))) ;;; texts and the conference's map of texts whose intersection
;;; contains at least NUM texts. Calculate the intersection and return
;;; (while (and (not exhausted) ;;; the NUM first or last texts in the intersection.
;;; (not (zerop count))) ;;;
;;; (let* ((found-by (or (zerop by) ;;; Real algorithm:
;;; (lyskom-remove-zeroes ;;;
;;; (listify-vector ;;; In each iteration, get INCREMENT new texts from the person's map
;;; (map->text-nos ;;; (call these BY) and the conference's map (call these TO).
;;; (if (< count 0) ;;; Calculate the intersection between TO and all previous BYs (call
;;; (blocking-do 'get-created-texts by ;;; these BY1, BY2 ... BYi) and prepend this to the result list. Next
;;; pmark (+ pmark 10)) ;;; calculate the intersection between BY and all previous TOs (call
;;; (blocking-do 'get-created-texts by ;;; these TO1, TO2 ... TOi) and concatenate the result to the
;;; (- pmark 10) pmark))))))) ;;; corresponding element in the result list. At this point, the
;;; (found-to (or (zerop to) ;;; concatenation of all elements of the result list will be the
;;; (lyskom-remove-zeroes ;;; intersection between the concatenation of all BYi's and all TOi's.
;;; (listify-vector ;;;
;;; (map->text-nos ;;; When the intersection is large enough, concatenate the results in
;;; (if (< count 0) ;;; the proper order and return NUM texts from the beginning or end of
;;; (blocking-do 'get-map to ;;; the results.
;;; cmark (+ cmark 10)) ;;;
;;; (blocking-do 'get-map to ;;; The tricky iteration ensures that we don't do any redundant
;;; (- cmark 10) cmark))))))) ;;; intersection calculations.
;;; (list (cond ;;;
;;; ((zerop by) found-to)
;;; ((zerop to) found-by) (defun lyskom-get-texts-by-and-to (persno confno num)
;;; ;; This will get them in the correct order "Get NUM texts written by person PERSNO with conference CONFNO as a
;;; (t (lyskom-intersection found-by found-to))))) recipient.
Args: persno confno num"
;;; ;; Cut out the part we want, the beginning or the end... (let* ((persstat (blocking-do 'get-pers-stat persno))
;;; (cond (confstat (blocking-do 'get-conf-stat confno))
;;; ((> count 0) (result-list nil)
;;; (while (> (length list) count) (by-list nil)
;;; (setq list (cdr list))) (to-list nil)
;;; (setq count (- count (length list)) (result-size 0)
;;; pmark (- pmark 10) (by nil)
;;; cmark (- cmark 10) (to nil)
;;; texts (nconc texts list))) (increment 30)
;;; ((< count 0) (plow (pers-stat->first-created-text persstat))
;;; (setq list (nfirst (- count) list)) (phigh (1- (+ plow (pers-stat->no-of-created-texts persstat))))
;;; (setq count (+ count (length list)) (pmark (if (< num 0) plow phigh))
;;; pmark (+ pmark 10) (clow (conf-stat->first-local-no confstat))
;;; cmark (+ cmark 10) (chigh (1- (+ clow (conf-stat->no-of-texts confstat))))
;;; texts (nconc list texts)))) (cmark (if (< num 0) clow chigh)))
;;; (setq exhausted (and (or (< pmark plow) (< phigh pmark))
;;; (or (< cmark clow) (< chigh cmark)))))) (while (and (<= pmark phigh)
;;; texts) (<= cmark chigh)
(>= pmark plow)
(let* ((found-by (or (zerop by) (>= cmark clow)
(lyskom-remove-zeroes (> (abs num) result-size))
(append (setq by (lyskom-remove-zeroes
(map->text-nos (listify-vector
(blocking-do 'get-created-texts by (map->text-nos
0 lyskom-max-int)) nil)))) (blocking-do 'get-created-texts
(found-to (or (zerop to) (pers-stat->pers-no persstat)
(lyskom-remove-zeroes (if (< num 0)
(append pmark
(map->text-nos (- pmark (1- increment)))
(blocking-do 'get-map to increment))))
0 lyskom-max-int)) nil)))) to (lyskom-remove-zeroes
(list (cond (listify-vector
((zerop by) found-to) (map->text-nos
((zerop to) found-by) (blocking-do 'get-map
;; This will get them in the correct order (conf-stat->conf-no confstat)
(t (lyskom-intersection found-by found-to))))) (if (< num 0)
cmark
(if list (- cmark (1- increment)))
(progn increment)))))
;; Cut out the part we want, the beginning or the end... ;;
(cond ;; Add intersection between new TO and old BYs
((> count 0) ;; to the results list.
(while (> (length list) count) ;;
(setq list (cdr list))))
((< count 0) (setq result-list
(setq list (nfirst (- count) list)))) (cons (apply 'nconc
(read-list-enter-read-info (mapcar
(lyskom-create-read-info (function
'REVIEW (lambda (x)
nil (lyskom-intersection to x)))
(lyskom-get-current-priority) by-list))
(lyskom-create-text-list list) result-list))
nil t)
lyskom-reading-list t)) ;;
(lyskom-insert-string 'no-such-text)))) ;; Add new BY and TO to the by-list and to-list
;;
(setq by-list (cons by by-list)
to-list (cons to to-list))
;;
;; Add intersections between new BY and all TOs
;;
(setq result-list
(mapcar2 (function
(lambda (x y)
(lyskom-intersection y
(nconc x by))))
result-list
to-list))
(setq result-size (apply '+ (mapcar 'length result-list)))
;;
;; Adjust the marks
;;
(if (> num 0)
(setq pmark (- pmark increment)
cmark (- cmark increment))
(setq pmark (+ pmark increment)
cmark (+ cmark increment))))
;;
;; Extract results
;;
(setq result-list
(apply 'nconc (if (< num 0)
(nreverse result-list)
result-list)))
(if (> num 0)
(nthcdr (- (length result-list) num) result-list)
(nfirst (- (length result-list) (- num)) result-list))))
;;; ===============================================================