X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=elmo%2Felmo-util.el;h=56ac49f44136da8df69c6d0f6747fa6d57d677a5;hb=c2738fdc4e616fb55973a7e285432f60af6c1c57;hp=d63c5389c76ce1922ca0254923b1d3945ac7bb51;hpb=cb246ff21fd096ecd99541d93c437342a4cf5991;p=elisp%2Fwanderlust.git diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index d63c538..56ac49f 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -1222,6 +1222,23 @@ If optional DELETE-FUNCTION is speficied, it is used as delete procedure." (when (>= new-rate 100) (elmo-progress-clear label)))))) +(put 'elmo-with-progress-display 'lisp-indent-function '2) +(def-edebug-spec elmo-with-progress-display + (form (symbolp form &optional form) &rest form)) + +(defmacro elmo-with-progress-display (condition spec &rest body) + "Evaluate BODY with progress gauge if CONDITION is non-nil. +SPEC is a list as followed (LABEL MAX-VALUE [FORMAT])." + (let ((label (car spec)) + (max-value (cadr spec)) + (fmt (caddr spec))) + `(unwind-protect + (progn + (when ,condition + (elmo-progress-set (quote ,label) ,max-value ,fmt)) + ,@body) + (elmo-progress-clear (quote ,label))))) + (defun elmo-time-expire (before-time diff-time) (let* ((current (current-time)) (rest (when (< (nth 1 current) (nth 1 before-time)) @@ -1585,49 +1602,6 @@ 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. @@ -1685,16 +1659,14 @@ SECTION is the section string." (defun elmo-file-cache-delete (path) "Delete a cache on PATH." - (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))) + (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."