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> Wed May 29 13:10:54 1996 David Kgedal <davidk@lysator.liu.se>
* lyskom-rest.el (lyskom-read-number): Lgg till ett mellanslag * lyskom-rest.el (lyskom-read-number): Lgg till ett mellanslag
......
...@@ -3,6 +3,9 @@ Att g ...@@ -3,6 +3,9 @@ Att g
Buggar 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. LysKOMs completing-read är skit. Den gör fel. Den borde skrivas om.
lyskom-try-complete-partials borde returnera exakta matchar före lyskom-try-complete-partials borde returnera exakta matchar före
...@@ -39,6 +42,8 @@ Buggar ...@@ -39,6 +42,8 @@ Buggar
Allmänna förbättringar 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 Definiera faces när man startar klienten istället för när den
laddas. laddas.
......
...@@ -340,8 +340,13 @@ ARG: session-info" ...@@ -340,8 +340,13 @@ ARG: session-info"
;;; ================================================================ ;;; ================================================================
;;; Generic cache routines ;;; 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) (defun cache-assoc (key cache)
"Get data for item with key KEY from CACHE. "Get data for item with key KEY from CACHE.
...@@ -349,33 +354,40 @@ CACHE is an assoc-list in this implementation." ...@@ -349,33 +354,40 @@ CACHE is an assoc-list in this implementation."
(cdr-safe (assoc key cache))) (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. "Add DATA to CACHE under the key KEY.
Args: KEY DATA CACHE. Args: KEY DATA CACHE.
CACHE is a (the only one) quoted variable pointing to the cache (an alist). CACHE is a (the only one) quoted variable pointing to the cache (an alist).
The variable might be changed." The variable might be changed."
(cond (if (null (symbol-value cache))
((null (symbol-value __cache__)) (cache-create cache))
(set __cache__ (list (cons __key__ __data__)))) (let ((oldval (assoc key (symbol-value cache))))
(t (let ((oldval (assoc __key__ (symbol-value __cache__)))) (cond
(cond ((null oldval)
((null oldval) (set cache
(set __cache__ (cons (cons key data)
(cons (cons __key__ __data__)
(symbol-value __cache__)))) (symbol-value cache))))
(t (t
(setcdr oldval __data__))))))) (setcdr oldval data)))))
(defun cache-del (__key__ __cache__) (defun cache-del (key cache)
"Delete item with key KEY from CACHE. "Delete item with key KEY from CACHE.
CACHE is the name of the variable that points to the 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 (if oldval
(setcdr oldval nil)))) ;A pair (key . nil) will remain. (setcdr oldval nil)))) ;A pair (key . nil) will remain.
;Fix this bug someday. +++ ;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) ;;; lyskom-tell-server (this is also a sort of cache)
......
...@@ -163,6 +163,7 @@ See lyskom-mode for details." ...@@ -163,6 +163,7 @@ See lyskom-mode for details."
(interactive) (interactive)
(lyskom-start-of-command 'kom-start-anew) (lyskom-start-of-command 'kom-start-anew)
(lyskom-completing-clear-cache) (lyskom-completing-clear-cache)
(clear-all-caches)
(let ((old-me lyskom-pers-no)) (let ((old-me lyskom-pers-no))
(unwind-protect (unwind-protect
(progn (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