From: teranisi Date: Mon, 6 Jan 2003 13:42:08 +0000 (+0000) Subject: * elmo-msgdb.el: Moved global mark handling stuffs to elmo-util.el. X-Git-Tag: merged-trunk-to-elmo-mark-14~44 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=7a8cfb0f5cc56c2888b01a87aa30842a12d3d45f;p=elisp%2Fwanderlust.git * 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. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 327917d..0671793 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 1205733..5baa4b7 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -1561,6 +1561,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. @@ -1617,14 +1660,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."