Commit 896bc0ae authored by David Byers's avatar David Byers
Browse files

Speed up lyskom-get-membership (a lot)

Detailed changes:
> 	* reading.el (lyskom-add-memberships-to-membership): Use
> 	lyskom-membership-table.
> 	(lyskom-insert-memberships-in-membership): Ditto.
> 	(lyskom-do-insert-membership): Ditto.
> 	(lyskom-do-remove-membership): Ditto.
>
> 	Speed up lyskom-get-membership (a lot):
> 	* lyskom-rest.el (lyskom-membership-table): New variable
> 	(lyskom-membership-table-add): New function.
> 	(lyskom-membership-table-del): New function.
> 	(lyskom-try-get-membership): Use lyskom-membership-table.
>
parent f5ac77cc
2004-06-26 David Byers <byers@lysator.liu.se>
* reading.el (lyskom-add-memberships-to-membership): Use
lyskom-membership-table.
(lyskom-insert-memberships-in-membership): Ditto.
(lyskom-do-insert-membership): Ditto.
(lyskom-do-remove-membership): Ditto.
Speed up lyskom-get-membership (a lot):
* lyskom-rest.el (lyskom-membership-table): New variable
(lyskom-membership-table-add): New function.
(lyskom-membership-table-del): New function.
(lyskom-try-get-membership): Use lyskom-membership-table.
Fix Emacs 19.34 compatibility problems:
* compatibility.el (map-keymap): Bug fix-
......
......@@ -956,6 +956,26 @@ CONF can be a a conf-stat or a string."
;;; +++Where should this be moved???
(def-kom-var lyskom-membership-table nil
"Association list mapping conferences to memberships."
local)
(defun lyskom-membership-table-add (membership)
(let ((tmp (assq (membership->conf-no membership) lyskom-membership-table)))
(if tmp
(setcdr tmp membership)
(setq lyskom-membership-table
(cons (cons (membership->conf-no membership) membership)
lyskom-membership-table)))))
(defun lyskom-membership-table-del (conf-no)
(setq lyskom-membership-table
(delq (assq conf-no lyskom-membership-table)
lyskom-membership-table)))
(defun lyskom-try-get-membership (conf-no &optional want-passive)
"Returns non-nil if conference CONF-NO is present on lyskom-membership.
The value is actually the membership for the conference.
......@@ -969,7 +989,7 @@ Optional argument mship-list is the membership list to look in."
(save-excursion
(set-buffer lyskom-buffer)
(let ((list lyskom-membership)
(found nil))
(found (cdr (assq conf-no lyskom-membership-table))))
(while (and (not found) (not (null list)))
(if (= conf-no (membership->conf-no (car list)))
(setq found (car list)))
......
......@@ -84,6 +84,7 @@ lyskom-membership list then this item is not entered."
(mapcar (function membership->conf-no) lyskom-membership))
nil
(setq lyskom-membership (append lyskom-membership (list (car list)))))
(lyskom-membership-table-add (car list))
(setq list (cdr list))))))
(defun lyskom-insert-memberships-in-membership (memberships)
......@@ -95,6 +96,7 @@ lyskom-membership list then this item is not entered."
(if (memq (membership->conf-no (car list))
(mapcar (function membership->conf-no) lyskom-membership))
nil
(lyskom-membership-table-add (car list))
(setq lyskom-membership (cons (car list) lyskom-membership)))
(setq list (cdr list))))
(lyskom-sort-membership)))
......@@ -125,7 +127,10 @@ lyskom-membership list then this item is not entered."
found t))
(setq mship-list (cdr mship-list)))
(unless found (setq lyskom-membership
(nconc lyskom-membership (list membership)))))))
(nconc lyskom-membership (list membership))))))
(lyskom-membership-table-add membership))
(defun lyskom-insert-membership (membership)
"Add MEMBERSHIP into lyskom-membership, sorted by priority."
......@@ -157,7 +162,9 @@ replace it with MEMBERSHIP into lyskom-membership."
(setcar list nil)
(setq list nil))
(setq list (cdr list)))))
(setq lyskom-membership (delq nil lyskom-membership)))
(setq lyskom-membership (delq nil lyskom-membership))
(lyskom-membership-table-del conf-no))
(defun lyskom-remove-membership (conf-no)
"Remove the membership for CONF-NO from lyskom-membership."
......
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