Commit 96e76618 authored by David Byers's avatar David Byers
Browse files

Various fixes to prioritize and review functions. Some new buttons and fixes...

Various fixes to prioritize and review functions. Some new buttons and fixes to auxiliary functions.
parent 51606e4b
Mon Apr 29 09:24:16 1996 David Byers <davby@sen2.ida.liu.se>
* review-new.el (lyskom-get-texts-by): Fixade s inte information om
hemliga texter returneras.
Mon Apr 29 02:26:14 1996 David Kgedal <davidk@lysator.liu.se> Mon Apr 29 02:26:14 1996 David Kgedal <davidk@lysator.liu.se>
* lyskom-rest.el (lyskom-format-aux-help): Hantera mte 0 fr sig. * lyskom-rest.el (lyskom-format-aux-help): Hantera mte 0 fr sig.
...@@ -17,6 +22,11 @@ Sat Apr 27 02:48:51 1996 David K ...@@ -17,6 +22,11 @@ Sat Apr 27 02:48:51 1996 David K
* startup.el (kom-start-anew): Tm completion-cachen. * startup.el (kom-start-anew): Tm completion-cachen.
Thu Apr 25 14:04:26 1996 David Byers <davby@sen2.ida.liu.se>
* prioritize.el (kom-prioritize-set-priority): Stt mark nr man
trycker "p".
Fri Apr 26 00:01:14 1996 David Kgedal <davidk@lysator.liu.se> Fri Apr 26 00:01:14 1996 David Kgedal <davidk@lysator.liu.se>
* view-text.el (lyskom-print-delayed-header-comm): Nu borde den * view-text.el (lyskom-print-delayed-header-comm): Nu borde den
...@@ -56,6 +66,40 @@ Thu Apr 25 01:42:29 1996 David K ...@@ -56,6 +66,40 @@ Thu Apr 25 01:42:29 1996 David K
* view-text.el (lyskom-print-header-comm): Dito. * view-text.el (lyskom-print-header-comm): Dito.
Wed Apr 24 17:49:29 1996 David Byers <davby@sen2.ida.liu.se>
* review.el (lyskom-get-texts-by-and-to): Fixade bug som gjorde att
man kunde missa de allra frsta texterna i ett mte om man tersg
senaste.
Tue Apr 23 00:47:17 1996 David Kgedal <davidk@lysator.liu.se>
* lyskom-rest.el (lyskom-start-of-command): Anta att
lyskom-first-time-around r definierad.
Tue Apr 23 11:26:57 1996 David Byers <davby@sen2.ida.liu.se>
* startup.el (kom-start-anew): Rensa completing-read-cachen innan
frsk att konvertera det inmatade anvndarnamnet.
* english-strings.el (lyskom-button-actions): Lade till hints fr
sista inlggsnumret som skrivs ut.
* swedish-strings.el (lyskom-button-actions): Lade till hints fr
sista inlggsnumret som skrivs ut.
* vars.el.in (kom-inhibit-typeahead): Lade till kom-inhibit-typeahead.
* lyskom-rest.el (lyskom-end-of-command): terimplementerade
bortkastning av typeahead.
* view-text.el (lyskom-print-text): Lade till sttning av
lyskom-current-function och lyskom-current-function-phase.
* lyskom-buttons.el (lyskom-get-button-hint): Ny funktion.
(lyskom-generate-button): Anvnd lyskom-get-button-hint fr att hitta
hinten.
Wed Apr 24 03:44:31 1996 David Kgedal <davidk@lysator.liu.se> Wed Apr 24 03:44:31 1996 David Kgedal <davidk@lysator.liu.se>
* view-text.el (lyskom-print-header-comm): Delade upp den s att * view-text.el (lyskom-print-header-comm): Delade upp den s att
...@@ -86,7 +130,7 @@ Mon Apr 22 05:57:27 1996 David K ...@@ -86,7 +130,7 @@ Mon Apr 22 05:57:27 1996 David K
bara den frdiga strngen. bara den frdiga strngen.
(lyskom-format-insert-before-prompt,lyskom-format-insert), (lyskom-format-insert-before-prompt,lyskom-format-insert),
(lyskom-format): Justerade drefter. (lyskom-format): Justerade drefter.
Wed Apr 17 17:32:23 1996 David Kgedal <davidk@lysator.liu.se> Wed Apr 17 17:32:23 1996 David Kgedal <davidk@lysator.liu.se>
* parse.el (lyskom-parse-error): Gr s att en bug inte blir s * parse.el (lyskom-parse-error): Gr s att en bug inte blir s
...@@ -102,10 +146,27 @@ Sun Apr 14 23:44:45 1996 David K ...@@ -102,10 +146,27 @@ Sun Apr 14 23:44:45 1996 David K
* view-text.el (lyskom-follow-comments): Felaktiga parametrar i * view-text.el (lyskom-follow-comments): Felaktiga parametrar i
ett anrop till lyskom-view-text. ett anrop till lyskom-view-text.
Wed Apr 10 10:16:20 1996 David Byers <davby@sen2.ida.liu.se>
* prioritize.el (kom-prioritize): En numera avrttad bug gjorde att
medlemskapslistan blev reverserad.
Mon Apr 8 18:42:12 1996 David Byers <davby@sen2.ida.liu.se>
* prioritize.el: Skrev om frn scratch.
Sat Apr 6 18:13:25 1996 David Byers <davby@sen2.ida.liu.se>
* lyskom-rest.el (lyskom-insert): Fixade lyskom-insert s den ger
rtt beteende om kom-continuous-scrolling inte r satt.
Thu Apr 4 10:36:06 1996 David Byers <davby@sen2.ida.liu.se> Thu Apr 4 10:36:06 1996 David Byers <davby@sen2.ida.liu.se>
* lyskom-rest.el (lyskom-insert): Gr lyskom-scroll i lyskom-insert * lyskom-rest.el (lyskom-insert): Gr lyskom-scroll i lyskom-insert
bara om kom-continuous-scrolling r satt. bara om kom-continuous-scrolling r satt. (lyskom-start-of-command):
Tilldela nil till lyskom-is-waiting varje gng ett nytt kommando
startas. (lyskom-print-prompt): Tog bort tilldelningar av
lyskom-is-waiting.
* vars.el.in (kom-continuous-scrolling): Ny variabel. * vars.el.in (kom-continuous-scrolling): Ny variabel.
(lyskom-elisp-variables): Lade till kom-continuous-scrolling. (lyskom-elisp-variables): Lade till kom-continuous-scrolling.
......
...@@ -1378,6 +1378,14 @@ If MARK-NO == 0, review all marked texts." ...@@ -1378,6 +1378,14 @@ If MARK-NO == 0, review all marked texts."
;;; ================================================================ ;;; ================================================================
;;; (Se) Tiden - display time and date. ;;; (Se) Tiden - display time and date.
(defconst lyskom-times
'(((nil 12 24 nil nil nil) . xmaseve)
((nil 12 25 nil nil nil) . xmasday)
((nil 1 1 nil nil nil) . newyearday)
((nil 12 31 11 nil nil) . newyearevelate)
((nil 12 31 nil nil nil) . newyeareve)))
(def-kom-command kom-display-time () (def-kom-command kom-display-time ()
"Ask server about time and date." "Ask server about time and date."
...@@ -1390,14 +1398,42 @@ If MARK-NO == 0, review all marked texts." ...@@ -1390,14 +1398,42 @@ If MARK-NO == 0, review all marked texts."
(time->hour time) (time->hour time)
(time->min time) (time->min time)
(time->sec time) (time->sec time)
; Kult: ;; Kult:
(if (and (= (time->hour time) (if (and (= (time->hour time)
(+ (/ (time->sec time) 10) (+ (/ (time->sec time) 10)
(* (% (time->sec time) 10) 10))) (* (% (time->sec time) 10) 10)))
(= (/ (time->min time) 10) (= (/ (time->min time) 10)
(% (time->min time) 10))) (% (time->min time) 10)))
(lyskom-get-string 'palindrome) (lyskom-get-string 'palindrome)
"")))) ""))
;; Mera kult
(mapcar (function
(lambda (el)
(let ((x (car el))
(y (cdr el)))
(if (and (or (null (elt x 0))
(= (+ (time->year time) 1900) (elt x 0)))
(or (null (elt x 1))
(= (1+ (time->mon time)) (elt x 1)))
(or (null (elt x 2))
(= (time->mday time) (elt x 2)))
(or (null (elt x 3))
(= (time->hour time) (elt x 3)))
(or (null (elt x 4))
(= (time->min time) (elt x 4)))
(or (null (elt x 5))
(= (time->sec time) (elt x 5))))
(progn
(lyskom-insert " ")
(lyskom-format-insert (cdr el)
(+ (time->year time) 1900)
(1+ (time->mon time))
(time->mday time)
(time->hour time)
(time->min time)
(time->sec time)))))))
lyskom-times))
(lyskom-insert "\n"))
;;; ================================================================ ;;; ================================================================
......
...@@ -764,7 +764,7 @@ Format is 23:29 if the text is written today. Otherwise 04-01." ...@@ -764,7 +764,7 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
;; We split the rest between author and subject ;; We split the rest between author and subject
(namelen (/ (- (lyskom-window-width) 22) 3)) (namelen (/ (- (lyskom-window-width) 22) 3))
(subjlen (/ (* (- (lyskom-window-width) 22) 2) 3)) (subjlen (/ (* (- (lyskom-window-width) 22) 2) 3))
(author-name (lyskom-format "%#1:M" (text-stat->author text-stat)))) (author-name (lyskom-format "%#1:P" (text-stat->author text-stat))))
(lyskom-format-insert 'summary-line (lyskom-format-insert 'summary-line
text-no text-no
time time
......
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
(setq lyskom-clientversion-long (setq lyskom-clientversion-long
(concat lyskom-clientversion-long (concat lyskom-clientversion-long
"$Id$")) "$Id$"))
;;; ================================================================ ;;; ================================================================
...@@ -329,8 +330,14 @@ and you have finished reading. Please come back later. ...@@ -329,8 +330,14 @@ and you have finished reading. Please come back later.
(no-marked-texts . "You have not marked any articles.\n") (no-marked-texts . "You have not marked any articles.\n")
(no-marked-texts-mark . (no-marked-texts-mark .
"You have not marked any articles with mark %#1d.\n") "You have not marked any articles with mark %#1d.\n")
(time-is . "The time is %4#1d %02#3d/%02#2d %02#4d:%02#5d:%02#6d %#7s(according to the server).\n") (time-is . "The time is %4#1d %02#3d/%02#2d %02#4d:%02#5d:%02#6d %#7s(according to the server).")
;; (time-is . "The time is %4#1d-%02#2d-%02#3d %02#4d:%02#5d:%02#6d %#7s(according to the server).\n")
(xmaseve . "Christmas eve!")
(xmasday . "Christmas day.\nDid you get any nice gifts this year?")
(newyearday . "\nMay %#1d be a prosperous and good year for you!")
(newyeareve . "Happy New Year!")
(newyearevelate . "Less than an hour to go...")
(total-users . " A total of %#1d users.\n") (total-users . " A total of %#1d users.\n")
(who-to-add-q . "Add who/what as a recipient: ") (who-to-add-q . "Add who/what as a recipient: ")
(who-to-add-copy-q . "Add which conference/user as recipient of a carbon copy: ") (who-to-add-copy-q . "Add which conference/user as recipient of a carbon copy: ")
...@@ -523,7 +530,6 @@ Mark the envelope with \"LysKOM bug report\"\n\n") ...@@ -523,7 +530,6 @@ 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: ")
...@@ -533,7 +539,7 @@ Mark the envelope with \"LysKOM bug report\"\n\n") ...@@ -533,7 +539,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") (review-info . "Review %#1s\n")
(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")
...@@ -654,6 +660,16 @@ Group message to %#3M from %#2P (%#4s): ...@@ -654,6 +660,16 @@ Group message to %#3M from %#2P (%#4s):
(person-or-conf-no-regexp . "\\`[ \t]*[mpMP]\\w*[ \t]+\\([0-9]+\\)\\'") (person-or-conf-no-regexp . "\\`[ \t]*[mpMP]\\w*[ \t]+\\([0-9]+\\)\\'")
; From prioritize.el: ; From prioritize.el:
(cant-move-nothing-nowhere . "Can't move nothing anywhere.")
(priority-prompt . "New priority: ")
(beginning-of-list . "Beginning of list")
(end-of-list . "End of list")
(reprioritize-from . "Reprioritize from: ")
(reprioritize-to . "Reprioritize to: ")
(no-selection . "No selection")
(selection . "%d selected")
(cannot-get-membership . "Cannot retrieve your membership list.") (cannot-get-membership . "Cannot retrieve your membership list.")
(cannot-get-pers-stat . "Cannot retrieve your personal status.") (cannot-get-pers-stat . "Cannot retrieve your personal status.")
(your-membship . "Your memberships: (your-membship . "Your memberships:
...@@ -897,7 +913,6 @@ Text: ...@@ -897,7 +913,6 @@ 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-view-previous-commented-text (kom-view-previous-commented-text
"Review (the) previouls commented (article)") "Review (the) previouls commented (article)")
...@@ -1102,6 +1117,7 @@ Cf. paragraph-start.") ...@@ -1102,6 +1117,7 @@ Cf. paragraph-start.")
(define-key lyskom-mode-map "r8" 'kom-initial-digit-view) (define-key lyskom-mode-map "r8" 'kom-initial-digit-view)
(define-key lyskom-mode-map "r9" 'kom-initial-digit-view) (define-key lyskom-mode-map "r9" 'kom-initial-digit-view)
(define-key lyskom-mode-map "rc" 'kom-view-commented-text) (define-key lyskom-mode-map "rc" 'kom-view-commented-text)
(define-key lyskom-mode-map "rC" 'kom-view-previous-commented-text)
(define-key lyskom-mode-map "ra?" 'lyskom-help) (define-key lyskom-mode-map "ra?" 'lyskom-help)
(define-key lyskom-mode-map "rac" 'kom-review-comments) (define-key lyskom-mode-map "rac" 'kom-review-comments)
(define-key lyskom-mode-map "rar" 'kom-review-tree) (define-key lyskom-mode-map "rar" 'kom-review-tree)
...@@ -1110,7 +1126,6 @@ Cf. paragraph-start.") ...@@ -1110,7 +1126,6 @@ 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)
...@@ -1177,21 +1192,61 @@ Cf. paragraph-start.") ...@@ -1177,21 +1192,61 @@ Cf. paragraph-start.")
"Keymap used in lyskom-prioritize-mode.") "Keymap used in lyskom-prioritize-mode.")
(if lyskom-prioritize-mode-map ;;;(if lyskom-prioritize-mode-map
;;; nil
;;; (setq lyskom-prioritize-mode-map (make-keymap))
;;; (suppress-keymap lyskom-prioritize-mode-map)
;;; (define-key lyskom-prioritize-mode-map "\C-?" 'previous-line)
;;; (define-key lyskom-prioritize-mode-map " " 'next-line)
;;; (define-key lyskom-prioritize-mode-map "\C-k" 'kom-prioritize-kill)
;;; (define-key lyskom-prioritize-mode-map "\C-y" 'kom-prioritize-yank)
;;; (define-key lyskom-prioritize-mode-map "p" 'kom-prioritize-set-priority)
;;; (define-key lyskom-prioritize-mode-map "\C-c\C-c" 'kom-prioritize-quit)
;;; (define-key lyskom-prioritize-mode-map "q" 'kom-prioritize-quit)
;;; (define-key lyskom-prioritize-mode-map "Q" 'kom-prioritize-quit)
;;; (define-key lyskom-prioritize-mode-map "u" 'kom-prioritize-move-up)
;;; (define-key lyskom-prioritize-mode-map "d" 'kom-prioritize-move-down)
;;;)
(if lyskom-prioritize-mode-map
nil nil
(setq lyskom-prioritize-mode-map (make-keymap)) (setq lyskom-prioritize-mode-map (make-keymap))
(suppress-keymap lyskom-prioritize-mode-map) (suppress-keymap lyskom-prioritize-mode-map)
(define-key lyskom-prioritize-mode-map "\C-?" 'previous-line) (define-key lyskom-prioritize-mode-map [mouse-2] 'kom-mouse-2)
(define-key lyskom-prioritize-mode-map " " 'next-line) (define-key lyskom-prioritize-mode-map [down-mouse-3] 'kom-mouse-3)
(define-key lyskom-prioritize-mode-map "\C-k" 'kom-prioritize-kill) (define-key lyskom-prioritize-mode-map [mouse-3] 'kom-mouse-null)
(define-key lyskom-prioritize-mode-map "\C-y" 'kom-prioritize-yank) (define-key lyskom-prioritize-mode-map "*" 'kom-key-mouse-2)
(define-key lyskom-prioritize-mode-map "p" 'kom-prioritize-set-priority) (define-key lyskom-prioritize-mode-map "\C-m" 'kom-prioritize-select)
(define-key lyskom-prioritize-mode-map "\C-c\C-c" 'kom-prioritize-quit) (define-key lyskom-prioritize-mode-map "\C-j" 'kom-prioritize-select)
(define-key lyskom-prioritize-mode-map "q" 'kom-prioritize-quit) (define-key lyskom-prioritize-mode-map " " 'kom-prioritize-select)
(define-key lyskom-prioritize-mode-map "Q" 'kom-prioritize-quit) (define-key lyskom-prioritize-mode-map [down] 'kom-prioritize-next-line)
(define-key lyskom-prioritize-mode-map "u" 'kom-prioritize-move-up) (define-key lyskom-prioritize-mode-map "\C-n" 'kom-prioritize-next-line)
(define-key lyskom-prioritize-mode-map "d" 'kom-prioritize-move-down) (define-key lyskom-prioritize-mode-map [up] 'kom-prioritize-previous-line)
) (define-key lyskom-prioritize-mode-map "\C-p" 'kom-prioritize-previous-line)
(define-key lyskom-prioritize-mode-map "p" 'kom-prioritize-previous-line)
(define-key lyskom-prioritize-mode-map [M-up] 'kom-prioritize-move-up)
(define-key lyskom-prioritize-mode-map "\M-p" 'kom-prioritize-move-up)
(define-key lyskom-prioritize-mode-map "u" 'kom-prioritize-move-up)
(define-key lyskom-prioritize-mode-map [M-down] 'kom-prioritize-move-down)
(define-key lyskom-prioritize-mode-map "\M-n" 'kom-prioritize-move-down)
(define-key lyskom-prioritize-mode-map "d" 'kom-prioritize-move-down)
(define-key lyskom-prioritize-mode-map "\M-<" 'kom-prioritize-beginning)
(define-key lyskom-prioritize-mode-map "\M->" 'kom-prioritize-end)
(define-key lyskom-prioritize-mode-map "r" 'kom-prioritize-reprioritize)
(define-key lyskom-prioritize-mode-map "g" 'kom-prioritize-goto-priority)
(define-key lyskom-prioritize-mode-map "p" 'kom-prioritize-set-priority)
(define-key lyskom-prioritize-mode-map "s" 'kom-prioritize-save)
(define-key lyskom-prioritize-mode-map "q" 'kom-prioritize-quit)
(define-key lyskom-prioritize-mode-map "\C-y" 'kom-prioritize-yank))
(defvar lyskom-prioritize-header-lines 2
"Number of lines in the header of the prioritization buffer")
(defvar lyskom-prioritize-header
" Prio Conference
-----------------------------------------------------------------------------
"
"Header for the reprioritization buffer")
;;;; ============================================================ ;;;; ============================================================
...@@ -1224,7 +1279,7 @@ This variable is stored in the LysKOM server.") ...@@ -1224,7 +1279,7 @@ This variable is stored in the LysKOM server.")
("Write personal reply" . lyskom-button-private-comment-text) ("Write personal reply" . lyskom-button-private-comment-text)
("Mark article" . lyskom-button-mark-text) ("Mark article" . lyskom-button-mark-text)
("Unmark article" . lyskom-button-unmark-text)) ("Unmark article" . lyskom-button-unmark-text))
nil) ((nil lyskom-print-text footer lyskom-button-comment-text)))
(conf (conf
conf-text conf-text
lyskom-button-view-conf-presentation lyskom-button-view-conf-presentation
......
...@@ -239,6 +239,32 @@ the current match-data." ...@@ -239,6 +239,32 @@ the current match-data."
(elt el 4)) (elt el 4))
(defun lyskom-get-button-hint (hints)
"Get the hint to be used right now (if any) from HINTS"
(let ((result nil)
(hint nil))
(while (and hints (null result))
(setq hint (car hints))
(setq hints (cdr hints))
(cond ((null (car hint))
(if (and (eq lyskom-current-function
(elt hint 1))
(or (null (elt hint 2))
(eq lyskom-current-function-phase
(elt hint 2))))
(setq result (elt hint 3))))
((listp (car hint))
(if (and lyskom-executing-command
(memq lyskom-current-command (car hint)))
(setq result (cdr hint))))
((symbolp (car hint))
(if (and lyskom-executing-command
lyskom-current-command
(eq lyskom-current-command (car hint)))
(setq result (cdr hint))))))
result))
(defun lyskom-generate-button (type arg &optional text face) (defun lyskom-generate-button (type arg &optional text face)
"Generate the properties for a button of type TYPE with argument ARG. "Generate the properties for a button of type TYPE with argument ARG.
...@@ -255,6 +281,7 @@ FACE is the default text face for the button." ...@@ -255,6 +281,7 @@ FACE is the default text face for the button."
(t nil))) (t nil)))
(data (assq type lyskom-button-actions)) (data (assq type lyskom-button-actions))
(hints (and data (elt data 4))) (hints (and data (elt data 4)))
(the-hint (lyskom-get-button-hint hints))
(props (props
(cond ((and (or (eq type 'conf) (cond ((and (or (eq type 'conf)
(eq type 'pers)) (eq type 'pers))
...@@ -290,12 +317,10 @@ FACE is the default text face for the button." ...@@ -290,12 +317,10 @@ FACE is the default text face for the button."
'lyskom-button-type type 'lyskom-button-type type
'lyskom-button-arg arg 'lyskom-button-arg arg
'lyskom-buffer lyskom-buffer))))) 'lyskom-buffer lyskom-buffer)))))
(if (and lyskom-executing-command
lyskom-current-command (if the-hint
(assq lyskom-current-command hints))
(cons 'lyskom-button-hint (cons 'lyskom-button-hint
(cons (cdr (assq lyskom-current-command hints)) (cons the-hint props))
props))
props))) props)))
......
No preview for this file type
This diff is collapsed.
...@@ -44,12 +44,13 @@ ...@@ -44,12 +44,13 @@
(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 nil)) (if (or a b)
(while a (let ((list nil))
(if (memq (car a) b) (while a
(setq list (cons (car a) list))) (if (memq (car a) b)
(setq a (cdr a))) (setq list (cons (car a) list)))
(nreverse list))) (setq a (cdr a)))
(nreverse list))))
(defun lyskom-remove-zeroes (a) (defun lyskom-remove-zeroes (a)
"Returns a copy of list where all zeroes are removed." "Returns a copy of list where all zeroes are removed."
...@@ -181,42 +182,58 @@ Args: BY TO NUM" ...@@ -181,42 +182,58 @@ Args: BY TO NUM"
;;; ================================================================ ;;; ================================================================
;;; lyskom-get-texts-by-and-to ;;; lyskom-get-texts-by-and-to
;;; Author: David K}gedal ;;; Author: David Byers
;;;
(defmacro lyskom-bat-advance-by-list () ;;; Note: We can't assume that the conference's map of texts is
(` (if (cdr by-list) ;;; sorted. If we could, it would be possible to simplify this
(setq by-list (cdr by-list)) ;;; function considerably without making it slower.
(setq by-list (nreverse ;;;
(lyskom-remove-zeroes ;;; Problem: Construct part of the intersection between the user's
(listify-vector ;;; created texts (the by-list) and the texts in a conference (the
(map->text-nos ;;; to-list) without bogging down the client, server or network and
(blocking-do 'get-created-texts ;;; do it quickly!
(pers-stat->pers-no persstat) ;;;
(if (< num 0) ;;; Idea: Construct the intersection incrementally without doing more
pmark ;;; work comparing things than we would if we had the full maps to
(- pmark (1- increment))) ;;; start with.
increment)))))) ;;;
(if (> num 0) ;;; Solution: Get one segment of the by-list (call the nth segment
(setq pmark (- pmark increment)) ;;; by_n) and to-list (call the nth segment to_n) at a time until we
(setq pmark (+ pmark increment)))))) ;;; are done or until both are exhausted.
;;;
(defmacro lyskom-bat-advance-to-list () ;;; In each iteration do the following: Calculate the intersection
(` (if (cdr to-list) ;;; between to_n with each of the previous by_i leaving r_n:
(setq to-list (cdr to-list)) ;;; r_n = \prod_{i=1}^{n-1} by_i \cap to_n
(setq to-list (nreverse ;;; where \prod denotes list concatenation. Next calculate the
(lyskom-remove-zeroes ;;; intersection of by_n with each to_i 0<i<n in turn, concatenating
(listify-vector ;;; the result to the corresponding r_i:
(map->text-nos ;;; r_i \larrow r_i * (by_n \cap to_i) ; 0<i<n
(blocking-do 'get-map ;;; At this point, the concatenation of all r_n, \prod r_n, is the
(conf-stat->conf-no confstat) ;;; result of the intersection between the segments of the by-list and
(if (< num 0) ;;; to-list we have retreived so far.
cmark ;;;
(- cmark (1- increment))) ;;; If the total size of the result equals or exceeds the size we
increment)))))) ;;; requested, finish the loop and return the results.
(if (> num 0) ;;;
(setq cmark (- cmark increment)) ;;;
(setq cmark (+ cmark increment)))))) ;;; Althogh the solution may seem a bit complicated, it's really not
;;; that bad once you think about how it's done. The good thing about
;;; it is that it does as little work as possible comparing elements.
;;; The bad part is that it constructs a little too many new cons
;;; cells, although reversing most of the lists does help.
;;;
;;;
;;; +++ FIXME: In some cases this function can take a long time. If
;;; the total number of texts in the conference is low, but they were
;;; written a long time ago, we'll be scanning the user's map
;;; uselessly for a long time. The same is true if the user's map is
;;; small and the conference gets lots of traffic. In some cases it
;;; maight actually be faster to look at and filter the text-stats in
;;; the smaller map. The fact that the user's map _is_ sorted in
;;; ascending order might also be a source for some sort of
;;; optimization.
;;;
;;;
(defun lyskom-get-texts-by-and-to (persno confno num) (defun lyskom-get-texts-by-and-to (persno confno num)
"Get NUM texts written by person PERSNO with conference CONFNO as a "Get NUM texts written by person PERSNO with conference CONFNO as a
...@@ -237,41 +254,93 @@ Args: persno confno num" ...@@ -237,41 +254,93 @@ Args: persno confno num"
(clow (conf-stat->first-local-no confstat)) (clow (conf-stat->first-local-no confstat))
(chigh (1- (+ clow (conf-stat->no-of-texts confstat)))) (chigh (1- (+ clow (conf-stat->no-of-texts confstat))))
(cmark (if (< num 0) clow chigh))) (cmark (if (< num 0) clow chigh)))
;; Initialize by-list and to-list
(lyskom-bat-advance-to-list) (while (and (or (and (<= pmark phigh)
(lyskom-bat-advance-by-list) (>= pmark plow))