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

Bug fixes:

Slow commands work better.
kom-next-unread-kom works better.
lyskom-ignoring-async works
More tolerance in lyskom-get-tell-string
Membership sorting updates positions
Sorting the membership also sorts the to do list
parent 6b7c0373
1999-08-25 David Byers <davby@ida.liu.se>
* reading.el (lyskom-sort-to-do-list): New function.
(lyskom-read-info-<): New function.
* lyskom-rest.el (lyskom-set-mode-line): Compute total-unread even
if we are not in any conference.
* commands2.el (lyskom-next-kom): Removed references to
lyskom-buffer-list.
1999-08-24 David Byers <davby@ida.liu.se>
* reading.el (lyskom-update-membership-positions): New function.
* utilities.el (lyskom-move-in-list): New function.
* reading.el (lyskom-sort-membership): Set the position of
elements in the list and sort the to-do-list after sorting the
membership list.
* lyskom-rest.el (lyskom-leave-current-conf): New function.
* commands1.el (lyskom-sub-member): Use lyskom-leave-current-conf.
* async.el (lyskom-async-forced-leave-conf): Use
lyskom-leave-current-conf.
(lyskom-async-new-membership): Same here.
1999-08-23 David Byers <davby@ida.liu.se>
* slow.el (kom-expand-slow-command): Test for exact matches if
optional TRY-EXACT is non-nil.
* lyskom-rest.el (lyskom-format-aux): Typo fix.
* language.el (lyskom-tell-string): Return the empty string if the
key we're looking for is not in kom-tell-phrases.
1999-08-22 David Byers <davby@ida.liu.se>
* mship-edit.el (lp--create-buffer): Sort the membership list
before creating the buffer.
(lp--toggle-entry-expansion): New function.
* reading.el (lyskom-insert-membership): Use
lyskom-sort-membership.
(lyskom-sort-membership): New function.
(lyskom-insert-memberships-in-membership): Use it.
* mship-edit.el (lp--previous-entry): New function.
(lp--next-entry): New function.
(lp--first-entry): New function.
(lp--last-entry): New function.
(lp--goto-priority): New function.
(lp--update-membership): New function.
(lp--set-priority): Made this function work.
* commands2.el (kom-set-unread): Fixed bug when not in any
conference.
Mon Aug 23 13:03:27 1999 David Byers <davby@sen2.ida.liu.se>
* Released 0.46-BETA-6
......
......@@ -36,7 +36,7 @@
# makefile too!
#
CLIENTVERSION = 0.46-BETA-6
CLIENTVERSION = 0.46-BETA-7
DOCFILES=NEWS-0.46
FTPDIR=/home/davby/www-pub
......
......@@ -7,6 +7,18 @@ Att g
listan, glöm inte att ta bort det från listan!
I lyskom-sort-membership måste man ordna om lyskom-to-do-list för att
matcha den nya medlemskapslistan. Det skulle antagligen vara rätt
enkelt att skriva en lyskom-sort-to-do-list. Den skulle sortera
elementen efter mötesprioritet och position för CONF och existerande
prioritet för REVIEW och REVIEW-TREE (som antas vara först inom sin
prioritet.) Kanske skulle man behöva gå in och uppdatera alla
prioriteter innan man sorterar.
Som det ser ut just nu, om man gör hantera medlemskap och sedan loggar
in som en ny person i LysKOM-bufferten så blir det fel saatan eftersom
prioriterabufferten använder lyskom-pers-no.
När man har kört prefetchen får man en skum kö i lyskom-prefetch-stack
som inte innehåller något annat än element som är köer vars sista
element är FINISHED. Ibland verkar köerna bli cirkulära.
......@@ -1225,6 +1237,8 @@ Jag inser dock att det kan vara jobbigt att bygga, om klienten inte
råkar hålla reda på att man skrivit en kommentar senare än man läst en
text.
FIX BY: 0.46 KLART.
......
......@@ -40,9 +40,11 @@
"$Id$\n"))
(defun lyskom-is-ignoring-async (message &rest args)
(let ((tmp (assq message lyskom-ignoring-async-list)))
(and tmp (equal args (cdr tmp)))))
(defun lyskom-is-ignoring-async (buffer message &rest args)
(save-excursion
(set-buffer buffer)
(let ((tmp (assq message lyskom-ignoring-async-list)))
(and tmp (equal args (cdr tmp))))))
(defun lyskom-parse-async (tokens buffer)
"Parse an asynchronous message from the server.
......@@ -139,7 +141,7 @@ this function shall be with current-buffer the BUFFER."
((eq msg-no 8) ; Forced leave conference
(let ((conf-no (lyskom-parse-num)))
(unless (lyskom-is-ignoring-async 8 conf-no)
(unless (lyskom-is-ignoring-async buffer 8 conf-no)
(lyskom-save-excursion
(set-buffer buffer)
(initiate-get-conf-stat 'follow
......@@ -254,7 +256,7 @@ this function shall be with current-buffer the BUFFER."
((eq msg-no 18) ; New membership
(let ((pers-no (lyskom-parse-num))
(conf-no (lyskom-parse-num)))
(unless (lyskom-is-ignoring-async 18 pers-no conf-no)
(unless (lyskom-is-ignoring-async buffer 18 pers-no conf-no)
(lyskom-save-excursion
(set-buffer buffer)
(cache-del-pers-stat pers-no)
......
......@@ -581,12 +581,8 @@ of the person."
conf)
(lyskom-insert-string 'done)
(lyskom-format-insert 'passivate-done conf)
(if (= (conf-stat->conf-no conf) lyskom-current-conf)
(progn
(set-read-list-empty lyskom-reading-list)
(lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf 0)
(setq lyskom-current-conf 0)))
(when (= (conf-stat->conf-no conf) lyskom-current-conf)
(lyskom-leave-current-conf))
(read-list-delete-read-info (conf-stat->conf-no conf)
lyskom-to-do-list)))
(t
......@@ -611,14 +607,9 @@ of the person."
(conf-stat->name pers))
conf)
(lyskom-insert-string 'done)
(if (and self
(= (conf-stat->conf-no conf)
lyskom-current-conf))
(progn
(set-read-list-empty lyskom-reading-list)
(lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf 0)
(setq lyskom-current-conf 0)))
(when (and self (= (conf-stat->conf-no conf)
lyskom-current-conf))
(lyskom-leave-current-conf))
(read-list-delete-read-info (conf-stat->conf-no conf)
lyskom-to-do-list))))))
......
......@@ -670,7 +670,7 @@ send. If DONTSHOW is non-nil, don't display the sent message."
"Set number of unread articles in current conference."
(interactive "P")
(setq conf-no (or conf-no lyskom-current-conf))
(if (and (zerop lyskom-current-conf) (null conf-no))
(if (zerop conf-no)
(progn
(lyskom-insert-string 'not-present-anywhere)
(lyskom-insert-string "\n"))
......@@ -1666,11 +1666,11 @@ Return-value: 'no-session if there is no suitable session to switch to
;; switch from the current buffer. If unlisted, list it.
((lyskom-buffer-p current)
(unless (memq current buffer-list)
(setq lyskom-buffer-list (cons current lyskom-buffer-list))))
(setq buffer-list (cons current buffer-list))))
;; If we are in a non-LysKOM buffer, the start buffer is the
;; last one in the list
(t (setq current (car lyskom-buffer-list))))
(t (setq current (car buffer-list))))
;; Rotate the buffer list so the target buffer is first
......@@ -1678,7 +1678,7 @@ Return-value: 'no-session if there is no suitable session to switch to
(cond ((eq direction 'forward)
(setq buffer-list
(lyskom-rotate-list buffer-list
(car (cdr (memq current lyskom-buffer-list))))))
(car (cdr (memq current buffer-list))))))
(t
(setq buffer-list
(lyskom-rotate-list buffer-list
......
......@@ -167,7 +167,9 @@ create. ALIST is a mapping from symbols to strings."
(defsubst lyskom-tell-string (key)
"Retrieve the phrase indexed by the key from the kom-tell-phrases
assoc list."
(lyskom-get-string key 'kom-tell-phrases))
(condition-case nil
(lyskom-get-string key 'kom-tell-phrases)
(lyskom-internal-error (message "Bad kom-tell-phrases") "")))
(defsubst lyskom-get-string-internal (symbol category)
(cdr (assq lyskom-language (get symbol category))))
......
......@@ -579,6 +579,13 @@ Args: CONF-STAT READ-INFO"
conf-stat
num-unread)))
(defun lyskom-leave-current-conf ()
"Leave the current conference without going to another one."
(set-read-list-empty lyskom-reading-list)
(lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf 0)
(setq lyskom-current-conf 0)
(initiate-pepsi 'main nil 0))
;;;================================================================
......@@ -608,38 +615,33 @@ CONF can be a a conf-stat or a string."
((lyskom-conf-stat-p conf)
(conf-stat->name conf))
(t "")))
(conf-no (if (null conf) 0 (conf-stat->conf-no conf)))
(unread -1)
(total-unread 0)
(letters 0)
(len 0)
(read-info-list nil))
(if (null name)
nil ; We didn't have the name.
;; Set unread to the number of unread texts in CONF.
(if (lyskom-conf-stat-p conf)
(progn
(setq read-info-list
(read-list->all-entries lyskom-to-do-list))
(setq read-info-list (read-list->all-entries lyskom-to-do-list))
;; This was weird. Someone had begun to write an if, but
;; this was all there was: (if
(while read-info-list
(if (read-info->conf-stat (car read-info-list))
(progn
(setq len (text-list->length
(read-info->text-list (car read-info-list))))
(if (= (conf-stat->conf-no conf)
(conf-stat->conf-no
(read-info->conf-stat (car read-info-list))))
(setq unread len))
(if (= lyskom-pers-no
(conf-stat->conf-no
(read-info->conf-stat (car read-info-list))))
(setq letters len))
(setq total-unread (+ total-unread len))))
(setq read-info-list (cdr read-info-list)))))
;; This was weird. Someone had begun to write an if, but
;; this was all there was: (if
(while read-info-list
(if (read-info->conf-stat (car read-info-list))
(progn
(setq len (text-list->length
(read-info->text-list (car read-info-list))))
(if (= conf-no
(conf-stat->conf-no
(read-info->conf-stat (car read-info-list))))
(setq unread len))
(if (= lyskom-pers-no
(conf-stat->conf-no
(read-info->conf-stat (car read-info-list))))
(setq letters len))
(setq total-unread (+ total-unread len))))
(setq read-info-list (cdr read-info-list)))
(if (= unread -1)
(setq unread 0))
......@@ -670,7 +672,7 @@ CONF can be a a conf-stat or a string."
(delq lyskom-buffer lyskom-sessions-with-unread-letters))
(or (memq lyskom-buffer lyskom-sessions-with-unread-letters)
(setq lyskom-sessions-with-unread-letters
(cons lyskom-buffer lyskom-sessions-with-unread-letters)))))
(cons lyskom-buffer lyskom-sessions-with-unread-letters))))
(force-mode-line-update)))
......@@ -1089,7 +1091,7 @@ Note that it is not allowed to use deferred insertions in the text."
(match-beginning 2))
?0))
?0
? )
?\ )
allow-defer))))))
(lyskom-tweak-format-state format-state))
......@@ -1254,7 +1256,7 @@ Note that it is not allowed to use deferred insertions in the text."
(let ((face (conf-stat-find-aux arg 9))
(string (copy-sequence "X")))
(lyskom-maybe-add-face-to-string face string))
"!!!")))
" ")))
;;
;; Format a conference or person name by retreiving information
......
This diff is collapsed.
......@@ -56,6 +56,21 @@ also means modifying the lyskom-reading-list. The zero text-nos are skipped."
lyskom-to-do-list))))
(defun lyskom-sort-membership ()
"Sort the internal membership list."
(setq lyskom-membership (sort lyskom-membership 'lyskom-membership-<))
(lyskom-update-membership-positions))
(defun lyskom-update-membership-positions ()
"Update all the position fields in the memberships in the membership list."
(let ((mship lyskom-membership)
(num 0))
(while mship
(set-membership->position (car mship) num)
(setq num (1+ num) mship (cdr mship)))
;; FIXME: If something changed, tell the server.
(lyskom-sort-to-do-list)))
(defun lyskom-add-memberships-to-membership (memberships)
"Adds a newly fetched MEMBERSHIP-PART to the list in lyskom-membership.
If an item of the membership is already read and entered in the
......@@ -78,18 +93,18 @@ lyskom-membership list then this item is not entered."
nil
(setq lyskom-membership (cons (car list) lyskom-membership)))
(setq list (cdr list))))
(setq lyskom-membership (sort lyskom-membership 'lyskom-membership-<)))
(lyskom-sort-membership))
(defun lyskom-insert-membership (membership membership-list)
"Add MEMBERSHIP into MEMBERSHIP-LIST, sorted by priority."
(setq lyskom-membership (sort (cons membership lyskom-membership)
'lyskom-membership-<)))
(setq lyskom-membership (cons membership lyskom-membership))
(lyskom-sort-membership))
(defun lyskom-replace-membership (membership membership-list)
"Find the membership for the same conference as MEMBERSHIP, and
replaceit with MEMBERSHIP into MEMBERSHIP-LIST."
replace it with MEMBERSHIP into MEMBERSHIP-LIST."
(let ((conf-no (membership->conf-no membership))
(list lyskom-membership))
(while list
......@@ -102,7 +117,7 @@ replaceit with MEMBERSHIP into MEMBERSHIP-LIST."
membership
membership-list))
(defun lyskom-remove-membership (conf-no membership-list)
p(defun lyskom-remove-membership (conf-no membership-list)
"Remove the membership for CONF-NO from MEMBERSHIP-LIST."
(let ((list lyskom-membership))
(while list
......@@ -115,3 +130,57 @@ replaceit with MEMBERSHIP into MEMBERSHIP-LIST."
(lyskom-run-hook-with-args 'lyskom-remove-membership-hook
conf-no membership-list))
(defun lyskom-membership-position (conf-no)
"Return the position of the membership for CONF-NO."
(let ((mship (lyskom-get-membership conf-no t)))
(or (membership->position mship)
(- (length (memq mship lyskom-membership))
(length lyskom-membership)))))
(defun lyskom-sort-to-do-list ()
"Sort lyskom-to-do-list in order of membership priorities.
The priorities for CONF elements are updated to match the membership
priorities. Elements that are not of type CONF appear first on the list
within their priority. This may not be totally accurate, but it's a
reasonable guess."
(let ((todo (read-list->all-entries lyskom-to-do-list))
(info nil))
;; Update the priorities in the read list
(while todo
(setq info (car todo))
(setq todo (cdr todo))
(when (eq (read-info->type info) 'CONF)
(let ((mship
(lyskom-get-membership
(conf-stat->conf-no (read-info->conf-stat info)) t)))
(when mship
(set-read-info->priority info
(membership->priority mship))))))
;; Sort the todo list
(setq lyskom-to-do-list (cons 'READ-LIST
(sort (read-list->all-entries lyskom-to-do-list)
'lyskom-read-info-<)))
(lyskom-update-prompt)))
(defun lyskom-read-info-< (a b)
(cond ((< (read-info->priority a) (read-info->priority b)) nil)
((> (read-info->priority a) (read-info->priority b)) t)
;; Both are confs of equal priority; check position in mship
((and (eq (read-info->type a) 'CONF)
(eq (read-info->type b) 'CONF))
(>= (lyskom-membership-position
(conf-stat->conf-no (read-info->conf-stat a)))
(lyskom-membership-position
(conf-stat->conf-no (read-info->conf-stat b)))))
;; A is a CONF and B is not; B is greater.
((eq (read-info->type a) 'CONF) nil)
;; Both are not CONF, so A is not less than B
(t t)))
......@@ -65,8 +65,10 @@ If no text is entered, nil is returned."
nil
(buffer-substring (point) (point-max))))
(defun kom-expand-slow-command ()
(defun kom-expand-slow-command (&optional try-exact)
"Tries to complete the command at point.
If optional TRY-EXACT is non-nil, look for an exact match.
If the completion was exact return a pair `(COMMAND . POINT)' where
COMMAND is the command and POINT is the point where the command text
starts.
......@@ -79,6 +81,7 @@ If the completion was not exact it returns nil."
(cons (cdr pair) (car pair))))
(lyskom-get-strings
lyskom-commands 'lyskom-command)))
(exact (and try-exact text (lyskom-string-assoc text alternatives)))
(completes (and text (all-completions text alternatives)))
(command nil))
(cond
......@@ -87,6 +90,8 @@ If the completion was not exact it returns nil."
((null completes)
(lyskom-insert-before-prompt (lyskom-get-string 'no-such-command))
(lyskom-beep t))
(exact
(setq command (cons (cdr exact) (point))))
((= (length completes) 1)
(setq command (cons (cdr (assq (car completes) alternatives))
(point)))
......@@ -109,12 +114,12 @@ If the completion was not exact it returns nil."
command))
(defun kom-expand-slow-or-next-command ()
(defun kom-expand-slow-or-next-command (&optional try-exact)
"If any part of a slow command has been entered, call
`kom-expand-slow-command'. Otherwise, do `kom-next-command'."
(interactive)
(if (lyskom-get-entered-slow-command)
(kom-expand-slow-command)
(kom-expand-slow-command try-exact)
(buffer-disable-undo)
(kom-next-command)))
......@@ -123,7 +128,7 @@ If the completion was not exact it returns nil."
"Reads a command from the last line in the buffer and executes it."
(interactive)
(let* ((text (lyskom-get-entered-slow-command))
(command (and text (kom-expand-slow-command))))
(command (and text (kom-expand-slow-command t))))
(buffer-disable-undo)
(cond
((null text)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment