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

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 <davby@ida.liu.se> 2007-11-10 David Byers <davby@ida.liu.se>
* mime.el (lyskom-mime-charset-for-text-xemacs): Better * mime.el (lyskom-mime-charset-for-text-xemacs): Better
...@@ -51,6 +68,12 @@ ...@@ -51,6 +68,12 @@
2007-07-11 <David Byers@GULAG> 2007-07-11 <David Byers@GULAG>
* async.el (lyskom-delete-old-text): Changed text-stat argument to
text-no.
(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 * commands2.el (lyskom-help-get-keylist): Changed name of variable
list to keylist. In Emacs 22.1, map-keymap-internal (which is list to keylist. In Emacs 22.1, map-keymap-internal (which is
called by map-keymap) uses "list" as an internal variable. called by map-keymap) uses "list" as an internal variable.
......
...@@ -240,21 +240,12 @@ this function shall be with current-buffer the BUFFER." ...@@ -240,21 +240,12 @@ this function shall be with current-buffer the BUFFER."
(set-buffer buffer) (set-buffer buffer)
(cache-del-conf-stat conf-no) (cache-del-conf-stat conf-no)
(cache-del-text-stat text-no) (cache-del-text-stat text-no)
;; FIXME: Code here.
;; FIXME: This implementation sucks. There is no need to (let ((membership (lyskom-try-get-membership conf-no)))
;; FIXME: remove the text from the cache. Just modify it. (when (and membership
;; FIXME: If we cache maps somewhere, we'll want to remove (lyskom-visible-membership membership))
;; FIXME: the text from the appropriate map. (read-list-delete-text text-no lyskom-to-do-list)
;; FIXME: If we want to get *really* picky, and the user is (read-list-delete-text text-no lyskom-reading-list)))
;; 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).
(lyskom-ignore misc-type) (lyskom-ignore misc-type)
))) )))
...@@ -765,7 +756,7 @@ converted, before insertion." ...@@ -765,7 +756,7 @@ converted, before insertion."
(cond ((memq type lyskom-recpt-types-list) (cond ((memq type lyskom-recpt-types-list)
(initiate-get-conf-stat 'async 'lyskom-delete-old-text (initiate-get-conf-stat 'async 'lyskom-delete-old-text
(misc-info->recipient-no misc-info) (misc-info->recipient-no misc-info)
text-stat (text-stat->text-no text-stat)
(misc-info->local-no misc-info))) (misc-info->local-no misc-info)))
((eq type 'COMM-TO) ((eq type 'COMM-TO)
(cache-del-text-stat (misc-info->comm-to misc-info))) (cache-del-text-stat (misc-info->comm-to misc-info)))
...@@ -774,15 +765,15 @@ converted, before insertion." ...@@ -774,15 +765,15 @@ converted, before insertion."
(lyskom-run 'async 'lyskom-default-deleted-text-hook text-stat) (lyskom-run 'async 'lyskom-default-deleted-text-hook text-stat)
(lyskom-run 'async 'lyskom-prefetch-and-print-prompt)) (lyskom-run 'async 'lyskom-prefetch-and-print-prompt))
(defun lyskom-delete-old-text (recipient text-stat local-no) (defun lyskom-delete-old-text (recipient text-no local-no)
"RECIPIENT is a conf-stat and previous recipient of TEXT-STAT. "RECIPIENT is a conf-stat and previous recipient of TEXT-NO.
This call is used in response to a deleted text message" This call is used in response to a deleted text message"
(when recipient (when recipient
;; Update the cache ;; Update the cache
(cache-del-text-stat (text-stat->text-no text-stat)) (cache-del-text-stat text-no)
(cache-del-text (text-stat->text-no text-stat)) (cache-del-text text-no)
(set-conf-stat->no-of-texts (set-conf-stat->no-of-texts
recipient recipient
(min (conf-stat->no-of-texts recipient) (min (conf-stat->no-of-texts recipient)
...@@ -795,10 +786,8 @@ This call is used in response to a deleted text message" ...@@ -795,10 +786,8 @@ This call is used in response to a deleted text message"
(conf-stat->conf-no recipient)))) (conf-stat->conf-no recipient))))
(when (and membership (when (and membership
(lyskom-visible-membership membership)) (lyskom-visible-membership membership))
(read-list-delete-text (text-stat->text-no text-stat) (read-list-delete-text text-no lyskom-to-do-list)
lyskom-to-do-list) (read-list-delete-text text-no lyskom-reading-list)))
(read-list-delete-text (text-stat->text-no text-stat)
lyskom-reading-list)))
(lyskom-set-mode-line))) (lyskom-set-mode-line)))
......
...@@ -61,7 +61,7 @@ returns non-nil, no more actions will be applied.") ...@@ -61,7 +61,7 @@ returns non-nil, no more actions will be applied.")
(nreverse (nreverse
(cons t (delq nil (mapcar (cons t (delq nil (mapcar
(lambda (conf-stat) (lambda (conf-stat)
(and (lyskom-i-am-supervisor conf-stat t) (and (or t (lyskom-i-am-supervisor conf-stat t))
conf-stat)) conf-stat))
(collector->value rcpt-confs)))))) (collector->value rcpt-confs))))))
......
...@@ -1742,8 +1742,9 @@ Point must be located on the line where the subject is." ...@@ -1742,8 +1742,9 @@ Point must be located on the line where the subject is."
(t ; Probably not necessary (t ; Probably not necessary
(setq lyskom-dont-change-prompt nil))) (setq lyskom-dont-change-prompt nil)))
(set-buffer edit-buffer) ;Need local variables. (save-excursion
(lyskom-edit-sent-mode 1) (set-buffer edit-buffer) ;Need local variables.
(lyskom-edit-sent-mode 1))
;; Record the text number ;; Record the text number
...@@ -1755,17 +1756,16 @@ Point must be located on the line where the subject is." ...@@ -1755,17 +1756,16 @@ Point must be located on the line where the subject is."
(let ((hnd lyskom-edit-handler) (let ((hnd lyskom-edit-handler)
(dta lyskom-edit-handler-data)) (dta lyskom-edit-handler-data))
(cond (when (get-buffer-window edit-buffer)
((get-buffer-window edit-buffer)
(set-window-configuration lyskom-edit-return-to-configuration) (set-window-configuration lyskom-edit-return-to-configuration)
(set-buffer (window-buffer (selected-window))) (set-buffer (window-buffer (selected-window)))
(goto-char (point-max)))) (goto-char (point-max)))
;; Apply handler. ;; Apply handler.
(set-buffer lyskom-buffer) (lyskom-save-excursion
(if hnd (apply hnd text-no dta))) (set-buffer lyskom-buffer)
(if hnd (apply hnd text-no dta))))
;; Kill the edit-buffer. ;; Kill the edit-buffer.
......
...@@ -79,12 +79,12 @@ ...@@ -79,12 +79,12 @@
(defmacro lyskom-server-call (&rest body) (defmacro lyskom-server-call (&rest body)
"Macro to protect initiate-somethings "Macro to protect initiate-somethings
from being called in the wrong buffer." from being called in the wrong buffer."
(` (let ((initiate-something-saved-buffer (current-buffer))) `(let ((initiate-something-saved-buffer (current-buffer)))
(unwind-protect (unwind-protect
(prog2 (or lyskom-output-queues (set-buffer lyskom-buffer)) (prog2 (or lyskom-output-queues (set-buffer lyskom-buffer))
lyskom-ref-no lyskom-ref-no
(,@ body)) ,@body)
(set-buffer initiate-something-saved-buffer))))) (set-buffer initiate-something-saved-buffer))))
(put 'lyskom-server-call 'lisp-indent-function 0) (put 'lyskom-server-call 'lisp-indent-function 0)
(put 'lyskom-server-call 'edebug-form-spec t) (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." ...@@ -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 ;;; accept-process-output. The most reliable way to detect which
;;; version is in play, is to look at the documentation. ;;; 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 (setq lyskom-apo-timeout-vector
(apply '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)) (defconst lyskom-apo-timeout-vector-max (1- (length lyskom-apo-timeout-vector))
"Maximum index in lyskom-apo-timeout-vector") "Maximum index in lyskom-apo-timeout-vector")
...@@ -2918,3 +2921,82 @@ COMMENTED-TEXTS and has recipients RECIPIENTS." ...@@ -2918,3 +2921,82 @@ COMMENTED-TEXTS and has recipients RECIPIENTS."
(lyskom-traverse-break t))) (lyskom-traverse-break t)))
(setq result (cons author result))))) (setq result (cons author result)))))
result))) 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." ...@@ -546,8 +546,8 @@ lyskom-reading-list."
(let ((text-stat (blocking-do 'get-text-stat no))) (let ((text-stat (blocking-do 'get-text-stat no)))
(if (and text-stat (if (and text-stat
(or review-tree (or review-tree
kom-follow-comments-outside-membership (and (or kom-follow-comments-outside-membership
(and (lyskom-member-of-at-least-one-p (lyskom-text-recipients text-stat)) (lyskom-member-of-at-least-one-p (lyskom-text-recipients text-stat)))
(not (lyskom-text-read-p text-stat t))))) (not (lyskom-text-read-p text-stat t)))))
(setq comments (cons no comments))))) (setq comments (cons no comments)))))
((memq no mx-attachments-in) ((memq no mx-attachments-in)
...@@ -573,9 +573,9 @@ lyskom-reading-list." ...@@ -573,9 +573,9 @@ lyskom-reading-list."
(let ((text-stat (blocking-do 'get-text-stat no))) (let ((text-stat (blocking-do 'get-text-stat no)))
(if (or review-tree (if (or review-tree
(and text-stat (and text-stat
(or kom-follow-comments-outside-membership (or kom-follow-comments-outside-membership
(and (lyskom-member-of-at-least-one-p (lyskom-text-recipients text-stat)) (lyskom-member-of-at-least-one-p (lyskom-text-recipients text-stat)))
(not (lyskom-text-read-p text-stat t)))))) (not (lyskom-text-read-p text-stat t))))
(setq footnotes (cons no footnotes))))) (setq footnotes (cons no footnotes)))))
(if footnotes (if footnotes
(read-list-enter-read-info (read-list-enter-read-info
...@@ -700,7 +700,7 @@ blocking-do." ...@@ -700,7 +700,7 @@ blocking-do."
(setq misc-item (car misc-info-list)) (setq misc-item (car misc-info-list))
(setq type (misc-info->type misc-item)) (setq type (misc-info->type misc-item))
(setq misc-info-list (cdr misc-info-list)) (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 (setq membership (if bg
(lyskom-try-get-membership (lyskom-try-get-membership
(misc-info->recipient-no misc-item) t) (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