From: teranisi Date: Mon, 21 Jul 2003 13:15:22 +0000 (+0000) Subject: * wl-summary.el (wl-summary-mode-map): Bind wl-summary-mark-as-answered to "&". X-Git-Tag: elmo-mark-restart~17 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=c48ffa5f534e9abc52ed8fb14ef12f510b928cd3;p=elisp%2Fwanderlust.git * wl-summary.el (wl-summary-mode-map): Bind wl-summary-mark-as-answered to "&". (wl-summary-mark-as-answered-internal): New inline function. (wl-summary-mark-as-answered): New function. (wl-summary-sync-marks): Modified for answered-mark synching. * elmo-msgdb.el (elmo-msgdb-set-flag): Overwrite answered flag. (elmo-msgdb-unset-flag): Ditto. * elmo-imap4.el (elmo-imap4-fetch-callback-1-subr): Precedes Seen flag. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 6994e42..c1aec9b 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,10 @@ +2003-07-21 Yuuichi Teranishi + + * elmo-msgdb.el (elmo-msgdb-set-flag): Overwrite answered flag. + (elmo-msgdb-unset-flag): Ditto. + + * elmo-imap4.el (elmo-imap4-fetch-callback-1-subr): Precedes Seen flag. + 2003-07-19 Yuuichi Teranishi * elmo-pipe.el (elmo-folder-msgdb-create): Don't define. diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 2827172..aedfef4 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -791,20 +791,23 @@ If CHOP-LENGTH is not specified, message set is not chopped." (setq mark (or (if (elmo-file-cache-status (elmo-file-cache-get (car entity))) ;; cached. - (if (elmo-string-member-ignore-case - "\\Answered" flags) - elmo-msgdb-answered-cached-mark - (if (and use-flag - (member "\\Seen" flags)) - nil - elmo-msgdb-unread-cached-mark)) + (if (and use-flag (member "\\Seen" flags)) + (if (elmo-string-member-ignore-case + "\\Answered" flags) + elmo-msgdb-answered-cached-mark + nil) + elmo-msgdb-unread-cached-mark) + ;; uncached. (if (elmo-string-member-ignore-case "\\Answered" flags) elmo-msgdb-answered-uncached-mark (if (and use-flag (elmo-string-member-ignore-case "\\Seen" flags)) - (if elmo-imap4-use-cache - elmo-msgdb-read-uncached-mark) + (if (elmo-string-member-ignore-case + "\\Answered" flags) + elmo-msgdb-answered-uncached-mark + (if elmo-imap4-use-cache + elmo-msgdb-read-uncached-mark)) elmo-msgdb-new-mark)))))) (setq elmo-imap4-current-msgdb (elmo-msgdb-append diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index 5edcac5..940c253 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -278,7 +278,7 @@ FLAG is a symbol which is one of the following: (case flag (read (case cur-flag - ((read important answered)) + ((read important)) ; answered mark is overriden. (t (elmo-msgdb-set-mark msgdb number (if (and use-cache (not cur-cached)) elmo-msgdb-read-uncached-mark)) @@ -319,7 +319,7 @@ FLAG is a symbol which is one of the following: mark-modified) (case flag (read - (when (eq cur-flag 'read) + (when (or (eq cur-flag 'read) (eq cur-flag 'answered)) (elmo-msgdb-set-mark msgdb number (if cur-cached elmo-msgdb-unread-cached-mark @@ -1317,7 +1317,7 @@ Return the updated INDEX." (unread (setq mark-regexp (elmo-regexp-opt (elmo-msgdb-unread-marks)))) (answered - (setq mark-regexp (elmo-regexp-opt (elmo-msgdb-unread-marks)))) + (setq mark-regexp (elmo-regexp-opt (elmo-msgdb-answered-marks)))) (important (setq mark-regexp (regexp-quote elmo-msgdb-important-mark))) (read diff --git a/wl/ChangeLog b/wl/ChangeLog index 242ecc5..62466e1 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,11 @@ +2003-07-21 Yuuichi Teranishi + + * wl-summary.el (wl-summary-mode-map): Bind wl-summary-mark-as-answered + to "&". + (wl-summary-mark-as-answered-internal): New inline function. + (wl-summary-mark-as-answered): New function. + (wl-summary-sync-marks): Modified for answered-mark synching. + 2003-07-20 Hiroya Murata * wl-action.el (wl-summary-set-mark): Fixed last change. diff --git a/wl/wl-score.el b/wl/wl-score.el index 93c888d..aeb8834 100644 --- a/wl/wl-score.el +++ b/wl/wl-score.el @@ -164,13 +164,12 @@ Remove Re, Was, Fwd etc." ;; (defun wl-score-overview-entity-get-lines (entity) - (let ((lines - (elmo-msgdb-overview-entity-get-extra-field entity "lines"))) + (let ((lines (elmo-message-entity-field entity 'lines))) (and lines (string-to-int lines)))) (defun wl-score-overview-entity-get-xref (entity) - (or (elmo-msgdb-overview-entity-get-extra-field entity "xref") + (or (elmo-message-entity-field entity 'xref) "")) (defun wl-score-overview-entity-get-extra (entity header &optional decode) @@ -1237,25 +1236,22 @@ Set `wl-score-cache' nil." (when dels (let ((marks dels)) (while marks - (elmo-msgdb-set-mark (wl-summary-buffer-msgdb) - (pop marks) nil))) - (elmo-folder-mark-as-read wl-summary-buffer-elmo-folder - dels) + (elmo-message-set-flag wl-summary-buffer-elmo-folder + (pop marks) 'read))) + ;; XXX Does this work?? XXX + ;; XXX should it be in the killed list? (wl-summary-delete-messages-on-buffer dels)) (when (and update update-unread) - (let ((num-db (elmo-msgdb-get-number-alist - (wl-summary-buffer-msgdb))) - (mark-alist (elmo-msgdb-get-mark-alist - (wl-summary-buffer-msgdb)))) - ;; Update Folder mode - (wl-folder-set-folder-updated (wl-summary-buffer-folder-name) - (list - 0 - (let ((pair - (wl-summary-count-unread))) - (+ (car pair) (cdr pair))) - (length num-db))) - (wl-summary-update-modeline))) + ;; Update Folder mode + (wl-folder-set-folder-updated (wl-summary-buffer-folder-name) + (list + 0 + (let ((pair + (wl-summary-count-unread))) + (+ (car pair) (cdr pair))) + (elmo-folder-length + wl-summary-buffer-elmo-folder))) + (wl-summary-update-modeline)) (message "Updating score...done") dels))) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 8a70180..59e6cd7 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -405,6 +405,7 @@ See also variable `wl-use-petname'." (define-key wl-summary-mode-map "\eE" 'wl-summary-resend-bounced-mail) (define-key wl-summary-mode-map "f" 'wl-summary-forward) (define-key wl-summary-mode-map "$" 'wl-summary-mark-as-important) + (define-key wl-summary-mode-map "&" 'wl-summary-mark-as-answered) (define-key wl-summary-mode-map "@" 'wl-summary-edit-addresses) (define-key wl-summary-mode-map "y" 'wl-summary-save) @@ -1787,24 +1788,14 @@ If ARG is non-nil, checking is omitted." (let ((last-progress 0) (folder wl-summary-buffer-elmo-folder) (i 0) - answereds importants unreads answereds-in-db - importants-in-db unreads-in-db diff diffs + answereds importants unreads diff diffs mes progress) ;; synchronize marks. (when (not (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder) 'internal)) (message "Updating marks...") - (setq importants-in-db (elmo-folder-list-flagged - wl-summary-buffer-elmo-folder - 'important 'in-msgdb) - unreads-in-db (elmo-folder-list-flagged - wl-summary-buffer-elmo-folder - 'unread 'in-msgdb) - answereds-in-db (elmo-folder-list-flagged - wl-summary-buffer-elmo-folder - 'answered 'in-msgdb) - importants (elmo-uniq-list + (setq importants (elmo-uniq-list (nconc (elmo-folder-list-importants wl-summary-buffer-elmo-folder) @@ -1812,8 +1803,13 @@ If ARG is non-nil, checking is omitted." wl-summary-buffer-elmo-folder elmo-msgdb-important-mark))) unreads (elmo-folder-list-unreads - wl-summary-buffer-elmo-folder)) - (setq diff (elmo-list-diff importants importants-in-db)) + wl-summary-buffer-elmo-folder) + answereds (elmo-folder-list-answereds + wl-summary-buffer-elmo-folder)) + (setq diff (elmo-list-diff importants + (elmo-folder-list-flagged + wl-summary-buffer-elmo-folder + 'important 'in-msgdb))) (setq diffs (cadr diff)) ; important-deletes (setq mes (format "Updated (-%d" (length diffs))) (while diffs @@ -1826,7 +1822,26 @@ If ARG is non-nil, checking is omitted." (while diffs (wl-summary-mark-as-important (car diffs) " " 'no-server) (setq diffs (cdr diffs))) - (setq diff (elmo-list-diff unreads unreads-in-db)) + + (setq diff (elmo-list-diff answereds + (elmo-folder-list-flagged + wl-summary-buffer-elmo-folder + 'answered 'in-msgdb))) + (setq diffs (cadr diff)) + (setq mes (concat mes (format "(-%d" (length diffs)))) + (while diffs + (wl-summary-mark-as-unanswered (car diffs) 'no-modeline) + (setq diffs (cdr diffs))) + (setq diffs (car diff)) ; unread-appends + (setq mes (concat mes (format "/+%d) answered mark(s)." (length diffs)))) + (while diffs + (wl-summary-mark-as-answered (car diffs) 'no-modeline) + (setq diffs (cdr diffs))) + + (setq diff (elmo-list-diff unreads + (elmo-folder-list-flagged + wl-summary-buffer-elmo-folder + 'unread 'in-msgdb))) (setq diffs (cadr diff)) (setq mes (concat mes (format "(-%d" (length diffs)))) (while diffs @@ -3028,6 +3043,60 @@ If ARG, exit virtual folder." no-folder-mark no-modeline-update)) +(defsubst wl-summary-mark-as-answered-internal (inverse + number-or-numbers + no-modeline-update) + (save-excursion + (let ((inhibit-read-only t) + (buffer-read-only nil) + (folder wl-summary-buffer-elmo-folder) + (case-fold-search nil) + number number-list mark visible new-mark) + (setq number-list (cond ((numberp number-or-numbers) + (list number-or-numbers)) + ((and (not (null number-or-numbers)) + (listp number-or-numbers)) + number-or-numbers) + ((setq number (wl-summary-message-number)) + ;; interactive + (list number)))) + (if (null number-list) + (message "No message.") + (if inverse + (elmo-folder-unmark-answered folder number-list) + (elmo-folder-mark-as-answered folder number-list)) + (dolist (number number-list) + (setq visible (wl-summary-jump-to-msg number) + new-mark (elmo-message-mark folder number)) + ;; set mark on buffer + (when visible + (unless (string= (wl-summary-persistent-mark) (or new-mark " ")) + (delete-backward-char 1) + (insert (or new-mark " "))) + (if (and visible wl-summary-highlight) + (wl-highlight-summary-current-line)) + (set-buffer-modified-p nil))) + (unless no-modeline-update + ;; Update unread numbers. + ;; should elmo-folder-mark-as-read return unread numbers? + (wl-summary-count-unread) + (wl-summary-update-modeline) + (wl-folder-update-unread + (wl-summary-buffer-folder-name) + (+ wl-summary-buffer-unread-count + wl-summary-buffer-new-count))))))) + +(defun wl-summary-mark-as-answered (&optional number-or-numbers + no-modeline-update) + (interactive) + (wl-summary-mark-as-answered-internal + (and (interactive-p) + (member (elmo-message-mark wl-summary-buffer-elmo-folder + (wl-summary-message-number)) + (elmo-msgdb-answered-marks))) + number-or-numbers + no-modeline-update)) + (defun wl-summary-mark-as-important (&optional number mark no-server-update)