Commit 2fe457ae authored by David Byers's avatar David Byers

Fix bug 1646. Fix repeated recomputation of timeouts. Be a little more...

Fix bug 1646. Fix repeated recomputation of timeouts. Be a little more conservative about buffer changes.
parent 37e256d2
2007-11-10 <David Byers@GULAG>
* view-text.el (lyskom-follow-comments): Only look at
kom-follow-comments-outside membership if we actually aren't a
member of any of the recipients.
2007-07-12 <David Byers@GULAG>
* edit-text.el (lyskom-create-text-handler): Be a bit more
conservative when changing buffers.
* services.el (lyskom-server-call): Changed old-style backquotes
to new-style backquotes.
* utilities.el: Recompute timeouts only once, not each time the
client is loaded.
2007-11-10 David Byers <>
* mime.el (lyskom-mime-charset-for-text-xemacs): Better
......@@ -51,6 +68,12 @@
2007-07-11 <David Byers@GULAG>
* async.el (lyskom-delete-old-text): Changed text-stat argument to
(lyskom-async-deleted-text): Changed the caller too.
(lyskom-parse-async): Remove text from readling lists if a
recipient is removed.
* commands2.el (lyskom-help-get-keylist): Changed name of variable
list to keylist. In Emacs 22.1, map-keymap-internal (which is
called by map-keymap) uses "list" as an internal variable.
......@@ -240,21 +240,12 @@ this function shall be with current-buffer the BUFFER."
(set-buffer buffer)
(cache-del-conf-stat conf-no)
(cache-del-text-stat text-no)
;; FIXME: Code here.
;; FIXME: This implementation sucks. There is no need to
;; FIXME: remove the text from the cache. Just modify it.
;; FIXME: If we cache maps somewhere, we'll want to remove
;; FIXME: the text from the appropriate map.
;; FIXME: If we want to get *really* picky, and the user is
;; FIXME: doing a review texts to conference, and this text
;; FIXME: has been found, remove this text from those
;; FIXME: lists too (probably not worth the effort).
;; FIXME: The text should be removed from the reading lists
;; FIXME: if it is there because we are reading the conf
;; FIXME: that is being removed. Take care not to lose
;; FIXME: any comments to it though...
;; FIXME: The unread counter for the conference should be
;; FIXME: decreased like it is in async-deleted-text (i hope).
(let ((membership (lyskom-try-get-membership conf-no)))
(when (and membership
(lyskom-visible-membership membership))
(read-list-delete-text text-no lyskom-to-do-list)
(read-list-delete-text text-no lyskom-reading-list)))
(lyskom-ignore misc-type)
......@@ -765,7 +756,7 @@ converted, before insertion."
(cond ((memq type lyskom-recpt-types-list)
(initiate-get-conf-stat 'async 'lyskom-delete-old-text
(misc-info->recipient-no misc-info)
(text-stat->text-no text-stat)
(misc-info->local-no misc-info)))
((eq type 'COMM-TO)
(cache-del-text-stat (misc-info->comm-to misc-info)))
......@@ -774,15 +765,15 @@ converted, before insertion."
(lyskom-run 'async 'lyskom-default-deleted-text-hook text-stat)
(lyskom-run 'async 'lyskom-prefetch-and-print-prompt))
(defun lyskom-delete-old-text (recipient text-stat local-no)
"RECIPIENT is a conf-stat and previous recipient of TEXT-STAT.
(defun lyskom-delete-old-text (recipient text-no local-no)
"RECIPIENT is a conf-stat and previous recipient of TEXT-NO.
This call is used in response to a deleted text message"
(when recipient
;; Update the cache
(cache-del-text-stat (text-stat->text-no text-stat))
(cache-del-text (text-stat->text-no text-stat))
(cache-del-text-stat text-no)
(cache-del-text text-no)
(min (conf-stat->no-of-texts recipient)
......@@ -795,10 +786,8 @@ This call is used in response to a deleted text message"
(conf-stat->conf-no recipient))))
(when (and membership
(lyskom-visible-membership membership))
(read-list-delete-text (text-stat->text-no text-stat)
(read-list-delete-text (text-stat->text-no text-stat)
(read-list-delete-text text-no lyskom-to-do-list)
(read-list-delete-text text-no lyskom-reading-list)))
......@@ -61,7 +61,7 @@ returns non-nil, no more actions will be applied.")
(cons t (delq nil (mapcar
(lambda (conf-stat)
(and (lyskom-i-am-supervisor conf-stat t)
(and (or t (lyskom-i-am-supervisor conf-stat t))
(collector->value rcpt-confs))))))
......@@ -1742,8 +1742,9 @@ Point must be located on the line where the subject is."
(t ; Probably not necessary
(setq lyskom-dont-change-prompt nil)))
(set-buffer edit-buffer) ;Need local variables.
(lyskom-edit-sent-mode 1)
(set-buffer edit-buffer) ;Need local variables.
(lyskom-edit-sent-mode 1))
;; Record the text number
......@@ -1755,17 +1756,16 @@ Point must be located on the line where the subject is."
(let ((hnd lyskom-edit-handler)
(dta lyskom-edit-handler-data))
((get-buffer-window edit-buffer)
(when (get-buffer-window edit-buffer)
(set-window-configuration lyskom-edit-return-to-configuration)
(set-buffer (window-buffer (selected-window)))
(goto-char (point-max))))
(goto-char (point-max)))
;; Apply handler.
(set-buffer lyskom-buffer)
(if hnd (apply hnd text-no dta)))
(set-buffer lyskom-buffer)
(if hnd (apply hnd text-no dta))))
;; Kill the edit-buffer.
......@@ -79,12 +79,12 @@
(defmacro lyskom-server-call (&rest body)
"Macro to protect initiate-somethings
from being called in the wrong buffer."
(` (let ((initiate-something-saved-buffer (current-buffer)))
(prog2 (or lyskom-output-queues (set-buffer lyskom-buffer))
(,@ body))
(set-buffer initiate-something-saved-buffer)))))
`(let ((initiate-something-saved-buffer (current-buffer)))
(prog2 (or lyskom-output-queues (set-buffer lyskom-buffer))
(set-buffer initiate-something-saved-buffer))))
(put 'lyskom-server-call 'lisp-indent-function 0)
(put 'lyskom-server-call 'edebug-form-spec t)
......@@ -328,10 +328,13 @@ Returns t if the feature is loaded or can be loaded, and nil otherwise."
;;; accept-process-output. The most reliable way to detect which
;;; version is in play, is to look at the documentation.
(when (string-match "milliseconds" (documentation 'accept-process-output))
(defvar lyskom-recomputed-apo-timeout nil)
(when (and (not lyskom-recomputed-apo-timeout)
(string-match "milliseconds" (documentation 'accept-process-output)))
(setq lyskom-apo-timeout-vector
(apply 'vector
(mapcar (lambda (x) (/ x 1000)) lyskom-apo-timeout-vector))))
(mapcar (lambda (x) (/ x 1000)) lyskom-apo-timeout-vector))
lyskom-recomputed-apo-timeout t))
(defconst lyskom-apo-timeout-vector-max (1- (length lyskom-apo-timeout-vector))
"Maximum index in lyskom-apo-timeout-vector")
......@@ -2918,3 +2921,82 @@ COMMENTED-TEXTS and has recipients RECIPIENTS."
(lyskom-traverse-break t)))
(setq result (cons author result)))))
;;; ================================================================
;;; MULE utilities
;;; (defun lyskom-safe-encode-string (string coding-system)
;;; "Encode STRING using CODING-SYSTEM.
;;; Return the encoded string if the encoding could be safely performed,
;;; or nil if it seems there are replacement characters in the encoded
;;; string"
;;; (let ((res (encode-coding-string string coding-system)))
;;; (and (lyskom-encoding-is-safe string res) res)))
;;; (defun lyskom-encoding-is-safe-xemacs (from to)
;;; (let ((len1 (length from))
;;; (len2 (length to))
;;; (i 0)
;;; (res t))
;;; (and (= len1 len2)
;;; (progn (while (< i len1)
;;; (when (and (eq (aref to i) ?~)
;;; (not (eq (aref from i) ?~)))
;;; (setq i len1 res nil))
;;; (setq i (1+ i)))
;;; res))))
;;; (defun lyskom-encoding-is-safe-gnu (from to)
;;; (let ((len1 (length from))
;;; (len2 (length to))
;;; (i 0)
;;; (res t))
;;; (and (= len1 len2)
;;; (progn (while (< i len1)
;;; (when (and (eq (aref to i) ??)
;;; (not (eq (aref from i) ??)))
;;; (setq i len1 res nil))
;;; (setq i (1+ i)))
;;; res))))
;;; ================================================================
;;; Other utilities
;;; An llist is a list with a limited size, used for a fast FIFO
;;; cache. One use is to keep track of the N most recently read
;;; texts.
;;; (defun lyskom-llist-create (size)
;;; (let ((list (make-list size nil)))
;;; (cons list list)))
;;; (defsubst lyskom-llist->head (llist) (car llist))
;;; (defsubst set-lyskom-llist->head (llist c) (setcar llist c))
;;; (defsubst lyskom-llist->tail (llist) (cdr llist))
;;; (defsubst set-lyskom-llist->tail (llist c) (setcdr llist c))
;;; (defun lyskom-llist-add (llist el)
;;; (cond ((null (cdr (lyskom-llist->tail llist)))
;;; (setcar (lyskom-llist->tail llist) el)
;;; (setcdr (lyskom-llist->tail llist) (lyskom-llist->head llist))
;;; (set-lyskom-llist->tail llist (lyskom-llist->head llist))
;;; (set-lyskom-llist->head llist (cdr (lyskom-llist->head llist)))
;;; (setcdr (lyskom-llist->tail llist) nil))
;;; (t (setcar (lyskom-llist->tail llist) el)
;;; (set-lyskom-llist->tail llist (cdr (lyskom-llist->tail llist)))))
;;; (lyskom-llist->head llist))
;;; (defun lyskom-llist-remove (el llist)
;;; (let ((cur (lyskom-llist->head llist)))
;;; (while cur
;;; (when (eq el (car cur))
;;; (setcar cur nil))
;;; (setq cur (cdr cur)))))
;;; (defun lyskom-llist-memq (el llist)
;;; (memq el (lyskom-llist->list head)))
;;; result)))
......@@ -546,8 +546,8 @@ lyskom-reading-list."
(let ((text-stat (blocking-do 'get-text-stat no)))
(if (and text-stat
(or review-tree
(and (lyskom-member-of-at-least-one-p (lyskom-text-recipients text-stat))
(and (or kom-follow-comments-outside-membership
(lyskom-member-of-at-least-one-p (lyskom-text-recipients text-stat)))
(not (lyskom-text-read-p text-stat t)))))
(setq comments (cons no comments)))))
((memq no mx-attachments-in)
......@@ -573,9 +573,9 @@ lyskom-reading-list."
(let ((text-stat (blocking-do 'get-text-stat no)))
(if (or review-tree
(and text-stat
(or kom-follow-comments-outside-membership
(and (lyskom-member-of-at-least-one-p (lyskom-text-recipients text-stat))
(not (lyskom-text-read-p text-stat t))))))
(or kom-follow-comments-outside-membership
(lyskom-member-of-at-least-one-p (lyskom-text-recipients text-stat)))
(not (lyskom-text-read-p text-stat t))))
(setq footnotes (cons no footnotes)))))
(if footnotes
......@@ -700,7 +700,7 @@ blocking-do."
(setq misc-item (car misc-info-list))
(setq type (misc-info->type misc-item))
(setq misc-info-list (cdr misc-info-list))
(cond ((memq type '(RECPT BCC-RECPT CC-RECPT))
(cond ((memq type lyskom-recpt-types-list)
(setq membership (if bg
(misc-info->recipient-no misc-item) t)
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