Commit 9ca3aa62 authored by David Kågedal's avatar David Kågedal
Browse files

Äsch, det var ju den här patchen som gjorde att cachen tömdes, och inte den förra...

parent 3fc24640
Thu Jun 6 02:59:01 1996 David Kgedal <davidk@lysator.liu.se>
* startup.el (kom-start-anew): Anropa clear-all-caches.
* cache.el (cache-clear): Ny funktion.
(cache-add,cache-del): Bytte namn p lokala variabler.
(clear-all-caches): Ny funktion.
(cache-create): Ny funktion.
Wed May 29 13:10:54 1996 David Kgedal <davidk@lysator.liu.se>
* lyskom-rest.el (lyskom-read-number): Lgg till ett mellanslag
......
......@@ -3,6 +3,9 @@ Att g
Buggar
Man kan inte skicka in inlägg med kom-emacs-knows-iso-8859-1 satt
till nil.
LysKOMs completing-read är skit. Den gör fel. Den borde skrivas om.
lyskom-try-complete-partials borde returnera exakta matchar före
......@@ -39,6 +42,8 @@ Buggar
Allmänna förbättringar
Skriv inte ut stora fonoter på en gång.
Definiera faces när man startar klienten istället för när den
laddas.
......
......@@ -340,8 +340,13 @@ ARG: session-info"
;;; ================================================================
;;; Generic cache routines
;;; BUGS: The cache is never emptied. +++
(defvar lyskom-caches nil
"A list of all the caches in use.
This is used to clear all caches with `clear-all-caches'")
(defun cache-create (cache)
(set cache nil)
(setq lyskom-caches (cons cache lyskom-caches)))
(defun cache-assoc (key cache)
"Get data for item with key KEY from CACHE.
......@@ -349,33 +354,40 @@ CACHE is an assoc-list in this implementation."
(cdr-safe (assoc key cache)))
(defun cache-add (__key__ __data__ __cache__)
(defun cache-add (key data cache)
"Add DATA to CACHE under the key KEY.
Args: KEY DATA CACHE.
CACHE is a (the only one) quoted variable pointing to the cache (an alist).
The variable might be changed."
(cond
((null (symbol-value __cache__))
(set __cache__ (list (cons __key__ __data__))))
(t (let ((oldval (assoc __key__ (symbol-value __cache__))))
(cond
((null oldval)
(set __cache__
(cons (cons __key__ __data__)
(if (null (symbol-value cache))
(cache-create cache))
(let ((oldval (assoc key (symbol-value cache))))
(cond
((null oldval)
(set cache
(cons (cons key data)
(symbol-value __cache__))))
(t
(setcdr oldval __data__)))))))
(symbol-value cache))))
(t
(setcdr oldval data)))))
(defun cache-del (__key__ __cache__)
(defun cache-del (key cache)
"Delete item with key KEY from CACHE.
CACHE is the name of the variable that points to the cache."
(let ((oldval (assoc __key__ (symbol-value __cache__))))
(let ((oldval (assoc key (symbol-value cache))))
(if oldval
(setcdr oldval nil)))) ;A pair (key . nil) will remain.
;Fix this bug someday. +++
(defun cache-clear (cache)
(set cache nil)
(setq lyskom-caches (delete cache lyskom-caches)))
(defun clear-all-caches ()
(mapcar (function (lambda (cache) (set cache nil)))
lyskom-caches)
(setq lyskom-caches nil))
;;; ================================================================
;;; lyskom-tell-server (this is also a sort of cache)
......
......@@ -163,6 +163,7 @@ See lyskom-mode for details."
(interactive)
(lyskom-start-of-command 'kom-start-anew)
(lyskom-completing-clear-cache)
(clear-all-caches)
(let ((old-me lyskom-pers-no))
(unwind-protect
(progn
......
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