From 1c8445a9a7070d3eca885c11934fed6cdfc31f16 Mon Sep 17 00:00:00 2001 From: teranisi Date: Mon, 6 Jan 2003 13:41:39 +0000 Subject: [PATCH] * elmo-msgdb.el: Moved global mark handling stuffs to elmo-util.el. * elmo-util.el: Moved global mark handling stuffs from elmo-msgdb.el. * elmo-util.el (elmo-file-cache-delete): Check whether the cache file is included in the global-mark or not. --- elmo/ChangeLog | 9 ++++++++ elmo/elmo-msgdb.el | 42 ------------------------------------ elmo/elmo-util.el | 61 +++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 62 insertions(+), 50 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index b8d1030..1fd1268 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,12 @@ +2003-01-06 Yuuichi Teranishi + + * elmo-msgdb.el: Moved global mark handling stuffs to elmo-util.el. + + * elmo-util.el: Moved global mark handling stuffs from elmo-msgdb.el. + + * elmo-util.el (elmo-file-cache-delete): Check whether the cache file + is included in the global-mark or not. + 2002-12-23 Yoichi NAKAYAMA * utf7.el (toplevel): Avoid error when the function diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index 7364c5c..3cdf7b2 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -209,48 +209,6 @@ content of MSGDB is changed." ret-val)) ;;; -;; parsistent mark handling -;; (for global!) - -(defvar elmo-msgdb-global-mark-alist nil) - -(defun elmo-msgdb-global-mark-delete (msgid) - (let* ((path (expand-file-name - elmo-msgdb-global-mark-filename - elmo-msgdb-directory)) - (malist (or elmo-msgdb-global-mark-alist - (setq elmo-msgdb-global-mark-alist - (elmo-object-load path)))) - match) - (when (setq match (assoc msgid malist)) - (setq elmo-msgdb-global-mark-alist - (delete match elmo-msgdb-global-mark-alist)) - (elmo-object-save path elmo-msgdb-global-mark-alist)))) - -(defun elmo-msgdb-global-mark-set (msgid mark) - (let* ((path (expand-file-name - elmo-msgdb-global-mark-filename - elmo-msgdb-directory)) - (malist (or elmo-msgdb-global-mark-alist - (setq elmo-msgdb-global-mark-alist - (elmo-object-load path)))) - match) - (if (setq match (assoc msgid malist)) - (setcdr match mark) - (setq elmo-msgdb-global-mark-alist - (nconc elmo-msgdb-global-mark-alist - (list (cons msgid mark))))) - (elmo-object-save path elmo-msgdb-global-mark-alist))) - -(defun elmo-msgdb-global-mark-get (msgid) - (cdr (assoc msgid (or elmo-msgdb-global-mark-alist - (setq elmo-msgdb-global-mark-alist - (elmo-object-load - (expand-file-name - elmo-msgdb-global-mark-filename - elmo-msgdb-directory))))))) - -;;; ;; persistent mark handling ;; (for each folder) (defun elmo-msgdb-mark-alist-set (alist id mark msgdb) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 91ca6b0..ce73b71 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -1563,6 +1563,49 @@ NUMBER-SET is altered." (match-end matchn)) list))) (nreverse list))) +;;; +;; parsistent mark handling +;; (for global!) +;; (FIXME: this should be treated in the msgdb.) + +(defvar elmo-msgdb-global-mark-alist nil) + +(defun elmo-msgdb-global-mark-delete (msgid) + (let* ((path (expand-file-name + elmo-msgdb-global-mark-filename + elmo-msgdb-directory)) + (malist (or elmo-msgdb-global-mark-alist + (setq elmo-msgdb-global-mark-alist + (elmo-object-load path)))) + match) + (when (setq match (assoc msgid malist)) + (setq elmo-msgdb-global-mark-alist + (delete match elmo-msgdb-global-mark-alist)) + (elmo-object-save path elmo-msgdb-global-mark-alist)))) + +(defun elmo-msgdb-global-mark-set (msgid mark) + (let* ((path (expand-file-name + elmo-msgdb-global-mark-filename + elmo-msgdb-directory)) + (malist (or elmo-msgdb-global-mark-alist + (setq elmo-msgdb-global-mark-alist + (elmo-object-load path)))) + match) + (if (setq match (assoc msgid malist)) + (setcdr match mark) + (setq elmo-msgdb-global-mark-alist + (nconc elmo-msgdb-global-mark-alist + (list (cons msgid mark))))) + (elmo-object-save path elmo-msgdb-global-mark-alist))) + +(defun elmo-msgdb-global-mark-get (msgid) + (cdr (assoc msgid (or elmo-msgdb-global-mark-alist + (setq elmo-msgdb-global-mark-alist + (elmo-object-load + (expand-file-name + elmo-msgdb-global-mark-filename + elmo-msgdb-directory))))))) + ;;; File cache. (defmacro elmo-make-file-cache (path status) "PATH is the cache file name. @@ -1619,14 +1662,16 @@ SECTION is the section string." (defun elmo-file-cache-delete (path) "Delete a cache on PATH." - (when (file-exists-p path) - (if (file-directory-p path) - (progn - (dolist (file (directory-files path t "^[^\\.]")) - (delete-file file)) - (delete-directory path)) - (delete-file path)) - t)) + (unless (elmo-msgdb-global-mark-get + (elmo-cache-to-msgid (file-name-nondirectory path))) + (when (file-exists-p path) + (if (file-directory-p path) + (progn + (dolist (file (directory-files path t "^[^\\.]")) + (delete-file file)) + (delete-directory path)) + (delete-file path)) + t))) (defun elmo-file-cache-exists-p (msgid) "Returns 'section or 'entire if a cache which corresponds to MSGID exists." -- 1.7.10.4