From fb6b10c7a75e4b0d4cbf9619c015e68b7d661327 Mon Sep 17 00:00:00 2001 From: hmurata Date: Sun, 5 Sep 2004 07:08:25 +0000 Subject: [PATCH] (wl-summary-get-available-flags): New function. (wl-summary-sync-marks): Use it and simplified. (wl-summary-unset-persistent-mark): Use `wl-summary-get-available-flags'. (wl-summary-set-persistent-mark): Ditto. --- wl/ChangeLog | 8 ++++++++ wl/wl-summary.el | 57 +++++++++++++++--------------------------------------- 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/wl/ChangeLog b/wl/ChangeLog index 8d70ca9..29fea45 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,11 @@ +2004-09-05 Hiroya Murata + + * wl-summary.el (wl-summary-get-available-flags): New function. + (wl-summary-sync-marks): Use it and simplified. + (wl-summary-unset-persistent-mark): Use + `wl-summary-get-available-flags'. + (wl-summary-set-persistent-mark): Ditto. + 2004-09-05 Yuuichi Teranishi * wl-folder.el (wl-folder-entity-assign-id): Fix for folder entity diff --git a/wl/wl-summary.el b/wl/wl-summary.el index ac32be5..38945fc 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1775,6 +1775,15 @@ This function is defined for `window-scroll-functions'" wl-summary-sort-specs) nil t nil nil (symbol-name wl-summary-default-sort-spec)))) +(defun wl-summary-get-available-flags (&optional include-specials) + (if include-specials + (elmo-uniq-list (append elmo-global-flag-list elmo-preserved-flags)) + (delq 'new (delq 'cached + (elmo-uniq-list + (append elmo-global-flag-list + elmo-preserved-flags + nil)))))) + (defun wl-summary-sync-marks () "Update persistent marks in summary." (interactive) @@ -1786,29 +1795,7 @@ This function is defined for `window-scroll-functions'" 'internal)) (message "Updating marks...") - (dolist (flag elmo-global-flag-list) - (unless (memq flag elmo-preserved-flags) - (setq diff (elmo-list-diff (elmo-folder-list-flagged - wl-summary-buffer-elmo-folder - flag) - (elmo-folder-list-flagged - wl-summary-buffer-elmo-folder - flag 'in-msgdb))) - (setq diffs (cadr diff)) ; deletes - (setq mes (concat mes (format "-%d" (length diffs)))) - (while diffs - (wl-summary-remove-flags-internal (car diffs) - (list flag) 'no-server) - (setq diffs (cdr diffs))) - (setq diffs (car diff)) ; appends - (setq mes (concat mes (format "/+%d %s," (length diffs) flag))) - (while diffs - (wl-summary-add-flags-internal (car diffs) - (list flag) 'no-server) - (setq diffs (cdr diffs))))) - - (dolist (flag (delete 'new (delete 'cached - (copy-sequence elmo-preserved-flags)))) + (dolist (flag (wl-summary-get-available-flags)) (setq diff (elmo-list-diff (elmo-folder-list-flagged wl-summary-buffer-elmo-folder flag) @@ -1817,14 +1804,12 @@ This function is defined for `window-scroll-functions'" flag 'in-msgdb))) (setq diffs (cadr diff)) (setq mes (concat mes (format "-%d" (length diffs)))) - (while diffs - (wl-summary-unset-persistent-mark flag (car diffs) 'no-modeline) - (setq diffs (cdr diffs))) + (when diffs + (wl-summary-unset-persistent-mark flag diffs 'no-modeline)) (setq diffs (car diff) mes (concat mes (format "/+%d %s " (length diffs) flag))) - (while diffs - (wl-summary-set-persistent-mark flag (car diffs) 'no-modeline) - (setq diffs (cdr diffs)))) + (when diffs + (wl-summary-set-persistent-mark flag diffs 'no-modeline))) (if (interactive-p) (message "%s" mes))))) (defun wl-summary-sync-update (&optional unset-cursor @@ -3094,12 +3079,7 @@ Return non-nil if the mark is updated" "Flag: " (mapcar (lambda (flag) (list (capitalize (symbol-name flag)))) - (delq - 'cached - (delq 'new - (elmo-uniq-list - (append elmo-global-flag-list - elmo-preserved-flags))))) + (wl-summary-get-available-flags)) nil 'require-match)))))) (wl-summary-set-persistent-mark-internal 'inverse @@ -3119,12 +3099,7 @@ Return non-nil if the mark is updated" "Flag: " (mapcar (lambda (flag) (list (capitalize (symbol-name flag)))) - (delq - 'cached - (delq 'new - (elmo-uniq-list - (append elmo-global-flag-list - elmo-preserved-flags))))) + (wl-summary-get-available-flags)) nil 'require-match)))))) (wl-summary-set-persistent-mark-internal -- 1.7.10.4