From: teranisi Date: Thu, 12 Dec 2002 02:00:22 +0000 (+0000) Subject: Revert last commit (I'm sorry it was my mistake). X-Git-Tag: wl-2_11_1~9 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ddac14c0b5daa5f6226bb422c36d16b2ccac5e9;p=elisp%2Fwanderlust.git Revert last commit (I'm sorry it was my mistake). --- diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 06fb518..5d86809 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -607,7 +607,8 @@ TYPE specifies the archiver's symbol." nil)))))) (luna-define-method elmo-folder-append-messages :around - ((folder elmo-archive-folder) src-folder numbers &optional same-number) + ((folder elmo-archive-folder) src-folder numbers unread-marks + &optional same-number) (let ((prefix (elmo-archive-folder-archive-prefix-internal folder))) (cond ((and same-number @@ -900,7 +901,9 @@ TYPE specifies the archiver's symbol." (elmo-archive-msgdb-create-entity-subr number)))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-archive-folder) - numbers seen-list) + numbers new-mark + already-mark seen-mark + important-mark seen-list) (when numbers (save-excursion ;; 981005 (if (and elmo-archive-use-izip-agent @@ -908,11 +911,17 @@ TYPE specifies the archiver's symbol." (elmo-archive-folder-archive-type-internal folder) 'cat-headers)) (elmo-archive-msgdb-create-as-numlist-subr2 - folder numbers seen-list) + folder numbers new-mark already-mark seen-mark important-mark + seen-list) (elmo-archive-msgdb-create-as-numlist-subr1 - folder numbers seen-list))))) + folder numbers new-mark already-mark seen-mark important-mark + seen-list))))) -(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder numlist seen-list) +(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder + numlist new-mark + already-mark seen-mark + important-mark + seen-list) (let* ((type (elmo-archive-folder-archive-type-internal folder)) (file (elmo-archive-get-archive-name folder)) (method (elmo-archive-get-method type 'cat)) @@ -945,10 +954,10 @@ TYPE specifies the archiver's symbol." (elmo-file-cache-get message-id)) (if seen nil - elmo-msgdb-unread-cached-mark) + already-mark) (if seen - elmo-msgdb-read-uncached-mark - elmo-msgdb-new-mark)))) + seen-mark + new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -966,7 +975,9 @@ TYPE specifies the archiver's symbol." ;;; info-zip agent (defun elmo-archive-msgdb-create-as-numlist-subr2 (folder - numlist + numlist new-mark + already-mark seen-mark + important-mark seen-list) (let* ((delim1 elmo-mmdf-delimiter) ;; MMDF (delim2 elmo-unixmail-delimiter) ;; UNIX Mail @@ -1000,7 +1011,10 @@ TYPE specifies the archiver's symbol." (goto-char (point-min)) (cond ((looking-at delim1) ;; MMDF - (setq result (elmo-archive-parse-mmdf msgs seen-list)) + (setq result (elmo-archive-parse-mmdf msgs + new-mark + already-mark seen-mark + seen-list)) (setq overview (append overview (nth 0 result))) (setq number-alist (append number-alist (nth 1 result))) (setq mark-alist (append mark-alist (nth 2 result)))) @@ -1019,7 +1033,10 @@ TYPE specifies the archiver's symbol." percent)))) (list overview number-alist mark-alist))) -(defun elmo-archive-parse-mmdf (msgs seen-list) +(defun elmo-archive-parse-mmdf (msgs new-mark + already-mark + seen-mark + seen-list) (let ((delim elmo-mmdf-delimiter) number sp ep rest entity overview number-alist mark-alist ret-val message-id seen gmark) @@ -1052,17 +1069,16 @@ TYPE specifies the archiver's symbol." (elmo-file-cache-get message-id)) (if seen nil - elmo-msgdb-unread-cached-mark) + already-mark) (if seen - elmo-msgdb-read-uncached-mark - elmo-msgdb-new-mark)))) + seen-mark + new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist (elmo-msgdb-overview-entity-get-number entity) gmark))) - (setq ret-val (append ret-val (list overview number-alist - mark-alist))) + (setq ret-val (append ret-val (list overview number-alist mark-alist))) (widen))) (forward-line 1) (setq rest (cdr rest))) diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index 5efac75..67d80b7 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -87,7 +87,10 @@ (elmo-cache-folder-directory-internal folder))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-cache-folder) - numbers seen-list) + numbers new-mark + already-mark seen-mark + important-mark + seen-list) (let ((i 0) (len (length numbers)) overview number-alist mark-alist entity message-id @@ -109,8 +112,7 @@ num message-id)) (if (setq mark (or (elmo-msgdb-global-mark-get message-id) - (if (member message-id seen-list) nil - elmo-msgdb-new-mark))) + (if (member message-id seen-list) nil new-mark))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -168,6 +170,27 @@ (luna-define-method elmo-message-file-p ((folder elmo-cache-folder) number) t) +;;; To override elmo-map-folder methods. +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-cache-folder) unread-marks &optional mark-alist) + t) + +(luna-define-method elmo-folder-unmark-important ((folder elmo-cache-folder) + numbers) + t) + +(luna-define-method elmo-folder-mark-as-important ((folder elmo-cache-folder) + numbers) + t) + +(luna-define-method elmo-folder-unmark-read ((folder elmo-cache-folder) + numbers) + t) + +(luna-define-method elmo-folder-mark-as-read ((folder elmo-cache-folder) + numbers) + t) + (require 'product) (product-provide (provide 'elmo-cache) (require 'elmo-version)) diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index b826d07..2ea9ebd 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -66,9 +66,7 @@ Automatically loaded/saved.") '(elmo-folder-mark-as-read elmo-folder-unmark-read elmo-folder-mark-as-important - elmo-folder-unmark-important - elmo-folder-mark-as-answered - elmo-folder-unmark-answered)) + elmo-folder-unmark-important)) (defvar elmo-dop-queue-method-name-alist '((elmo-folder-append-buffer-dop-delayed . "Append") @@ -77,8 +75,6 @@ Automatically loaded/saved.") (elmo-folder-create-dop-delayed . "Create") (elmo-folder-mark-as-read . "Read") (elmo-folder-unmark-read . "Unread") - (elmo-folder-mark-as-answered . "Answered") - (elmo-folder-unmark-answered . "Unanswered") (elmo-folder-mark-as-important . "Important") (elmo-folder-unmark-important . "Unimportant"))) @@ -278,12 +274,6 @@ FOLDER is the folder structure." (defsubst elmo-folder-unmark-important-dop (folder numbers) (elmo-dop-queue-append folder 'elmo-folder-unmark-important (list numbers))) -(defsubst elmo-folder-mark-as-answered-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-mark-as-answered (list numbers))) - -(defsubst elmo-folder-unmark-answered-dop (folder numbers) - (elmo-dop-queue-append folder 'elmo-folder-unmark-answered (list numbers))) - ;;; Execute as subsutitute for plugged operation. (defun elmo-folder-status-dop (folder) (let* ((number-alist (elmo-msgdb-number-load diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 7852793..11b4cbd 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -33,7 +33,7 @@ ;;; ELMO filter folder (eval-and-compile (luna-define-class elmo-filter-folder (elmo-folder) - (condition target require-msgdb)) + (condition target)) (luna-define-internal-accessors 'elmo-filter-folder)) (luna-define-method elmo-folder-initialize ((folder elmo-filter-folder) @@ -47,41 +47,17 @@ folder (elmo-make-folder (elmo-match-string 1 (cdr pair)))) (error "Folder syntax error `%s'" (elmo-folder-name-internal folder))) - (elmo-filter-folder-set-require-msgdb-internal - folder - (elmo-folder-search-requires-msgdb-p - (elmo-filter-folder-target-internal folder) - (elmo-filter-folder-condition-internal folder))) folder)) -;(luna-define-method elmo-folder-open-internal ((folder elmo-filter-folder)) -; (elmo-folder-open-internal (elmo-filter-folder-target-internal folder))) - -(luna-define-method elmo-folder-msgdb :around ((folder elmo-filter-folder)) - ;; Load target's msgdb if required. - (if (elmo-filter-folder-require-msgdb-internal folder) - (elmo-folder-msgdb (elmo-filter-folder-target-internal folder))) - ;; Load msgdb of itself. - (luna-call-next-method)) +(luna-define-method elmo-folder-open-internal ((folder elmo-filter-folder)) + (elmo-folder-open-internal (elmo-filter-folder-target-internal folder))) (luna-define-method elmo-folder-check ((folder elmo-filter-folder)) - (elmo-folder-synchronize (elmo-filter-folder-target-internal folder))) + (elmo-folder-check (elmo-filter-folder-target-internal folder))) (luna-define-method elmo-folder-close-internal ((folder elmo-filter-folder)) (elmo-folder-close-internal (elmo-filter-folder-target-internal folder))) -(luna-define-method elmo-folder-close :around ((folder elmo-filter-folder)) - ;; Save target msgdb if it is used. - (if (elmo-filter-folder-require-msgdb-internal folder) - (elmo-folder-close (elmo-filter-folder-target-internal folder))) - (luna-call-next-method)) - -(luna-define-method elmo-folder-commit :around ((folder elmo-filter-folder)) - ;; Save target msgdb if it is used. - (if (elmo-filter-folder-require-msgdb-internal folder) - (elmo-folder-commit (elmo-filter-folder-target-internal folder))) - (luna-call-next-method)) - (luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-filter-folder)) (expand-file-name @@ -108,30 +84,51 @@ type)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-filter-folder) - numlist seen-list) - (let* ((target-folder (elmo-filter-folder-target-internal folder)) - (len (length numlist)) - (msgdb (elmo-folder-msgdb target-folder)) - overview number-alist mark-alist message-id entity) - (when (> len elmo-display-progress-threshold) - (elmo-progress-set 'elmo-folder-msgdb-create - len "Creating msgdb...")) - (unwind-protect - (dolist (number numlist) - (setq entity (elmo-msgdb-overview-get-entity number msgdb)) - (when entity - (setq overview (elmo-msgdb-append-element overview entity) - message-id (elmo-msgdb-overview-entity-get-id entity) - number-alist (elmo-msgdb-number-add number-alist - number - message-id) - mark-alist (elmo-msgdb-mark-append - mark-alist - number - (elmo-msgdb-get-mark msgdb number)))) - (elmo-progress-notify 'elmo-folder-msgdb-create)) - (elmo-progress-clear 'elmo-folder-msgdb-create)) - (list overview number-alist mark-alist))) + numlist new-mark already-mark + seen-mark important-mark + seen-list) + (let ((target-folder (elmo-filter-folder-target-internal folder))) + (if (elmo-folder-plugged-p target-folder) + (elmo-folder-msgdb-create target-folder + numlist + new-mark + already-mark + seen-mark important-mark seen-list) + ;; Copy from msgdb of target folder if it is unplugged. + (let ((len (length numlist)) + (msgdb (elmo-folder-msgdb target-folder)) + overview number-alist mark-alist + message-id seen gmark) + (when (> len elmo-display-progress-threshold) + (elmo-progress-set 'elmo-folder-msgdb-create + len "Creating msgdb...")) + (unwind-protect + (dolist (number numlist) + (let ((entity (elmo-msgdb-overview-get-entity number msgdb))) + (when entity + (setq entity (elmo-msgdb-copy-overview-entity entity) + overview (elmo-msgdb-append-element overview entity) + message-id (elmo-msgdb-overview-entity-get-id entity) + number-alist (elmo-msgdb-number-add number-alist + number + message-id) + seen (member message-id seen-list)) + (if (setq gmark (or (elmo-msgdb-global-mark-get message-id) + (if (elmo-file-cache-exists-p message-id) + (if seen + nil + already-mark) + (if seen + nil ;;seen-mark + new-mark)))) + (setq mark-alist + (elmo-msgdb-mark-append + mark-alist + number + gmark))))) + (elmo-progress-notify 'elmo-folder-msgdb-create)) + (elmo-progress-clear 'elmo-folder-msgdb-create)) + (list overview number-alist mark-alist))))) (luna-define-method elmo-folder-append-buffer ((folder elmo-filter-folder) unread &optional number) @@ -163,27 +160,48 @@ ;; not available t))) -(defsubst elmo-filter-folder-list-unreads (folder) - (elmo-list-filter - (elmo-folder-list-messages folder nil 'in-msgdb) - (elmo-folder-list-unreads - (elmo-filter-folder-target-internal folder)))) - -(luna-define-method elmo-folder-list-unreads ((folder elmo-filter-folder)) - (elmo-filter-folder-list-unreads folder)) - -(defsubst elmo-filter-folder-list-importants (folder) - (elmo-uniq-list - (nconc +(defsubst elmo-filter-folder-list-unreads-internal (folder unread-marks + mark-alist) + (let ((unreads (elmo-folder-list-unreads-internal + (elmo-filter-folder-target-internal folder) + unread-marks + (or mark-alist + (elmo-msgdb-get-mark-alist + (elmo-folder-msgdb folder)))))) + (unless (listp unreads) + (setq unreads + (delq nil + (mapcar + (function + (lambda (x) + (if (member (cadr x) unread-marks) + (car x)))) + (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder)))))) (elmo-list-filter - (elmo-folder-list-messages folder nil 'in-msgdb) - (elmo-folder-list-importants - (elmo-filter-folder-target-internal folder))) - (elmo-folder-list-messages-with-global-mark - folder elmo-msgdb-important-mark)))) + (mapcar 'car (elmo-msgdb-get-number-alist + (elmo-folder-msgdb folder))) + unreads))) + +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-filter-folder) + unread-marks &optional mark-alist) + (elmo-filter-folder-list-unreads-internal folder unread-marks mark-alist)) + +(defsubst elmo-filter-folder-list-importants-internal (folder important-mark) + (let ((importants (elmo-folder-list-importants-internal + (elmo-filter-folder-target-internal folder) + important-mark))) + (if (listp importants) + (elmo-list-filter + (mapcar 'car (elmo-msgdb-get-number-alist + (elmo-folder-msgdb folder))) + importants) + t))) -(luna-define-method elmo-folder-list-importants ((folder elmo-filter-folder)) - (elmo-filter-folder-list-importants folder)) +(luna-define-method elmo-folder-list-importants-internal + ((folder elmo-filter-folder) + important-mark) + (elmo-filter-folder-list-importants-internal folder important-mark)) (luna-define-method elmo-folder-list-subfolders ((folder elmo-filter-folder) &optional one-level) @@ -259,49 +277,26 @@ (elmo-message-file-name (elmo-filter-folder-target-internal folder) number)) -(luna-define-method elmo-folder-mark-as-read :around ((folder - elmo-filter-folder) - numbers) +(luna-define-method elmo-folder-mark-as-read ((folder elmo-filter-folder) + numbers) (elmo-folder-mark-as-read (elmo-filter-folder-target-internal folder) - numbers) - (luna-call-next-method)) + numbers)) -(luna-define-method elmo-folder-unmark-read :around ((folder - elmo-filter-folder) - numbers) +(luna-define-method elmo-folder-unmark-read ((folder elmo-filter-folder) + numbers) (elmo-folder-unmark-read (elmo-filter-folder-target-internal folder) - numbers) - (luna-call-next-method)) + numbers)) -(luna-define-method elmo-folder-mark-as-important :around ((folder - elmo-filter-folder) - numbers) +(luna-define-method elmo-folder-mark-as-important ((folder elmo-filter-folder) + numbers) (elmo-folder-mark-as-important (elmo-filter-folder-target-internal folder) - numbers) - (luna-call-next-method)) + numbers)) - -(luna-define-method elmo-folder-unmark-important :around ((folder - elmo-filter-folder) - numbers) +(luna-define-method elmo-folder-unmark-important ((folder elmo-filter-folder) + numbers) (elmo-folder-unmark-important (elmo-filter-folder-target-internal folder) - numbers) - (luna-call-next-method)) - -(luna-define-method elmo-folder-mark-as-answered :around ((folder - elmo-filter-folder) - numbers) - (elmo-folder-mark-as-answered (elmo-filter-folder-target-internal folder) - numbers) - (luna-call-next-method)) - - -(luna-define-method elmo-folder-unmark-answered :around ((folder - elmo-filter-folder) - numbers) - (elmo-folder-unmark-answered (elmo-filter-folder-target-internal folder) - numbers) - (luna-call-next-method)) + numbers)) + (require 'product) (product-provide (provide 'elmo-filter) (require 'elmo-version)) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 17e24ec..f0d1f7a 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -770,16 +770,18 @@ If CHOP-LENGTH is not specified, message set is not chopped." ;; ;; app-data: -;; cons of seen-list and result of use-flag-p. +;; cons of list +;; 0: new-mark 1: already-mark 2: seen-mark 3: important-mark +;; 4: seen-list +;; and result of use-flag-p. (defsubst elmo-imap4-fetch-callback-1-subr (entity flags app-data) "A msgdb entity callback function." (let* ((use-flag (cdr app-data)) (app-data (car app-data)) - (seen (member (car entity) app-data)) + (seen (member (car entity) (nth 4 app-data))) mark) (if (member "\\Flagged" flags) - (elmo-msgdb-global-mark-set (car entity) - elmo-msgdb-important-mark)) + (elmo-msgdb-global-mark-set (car entity) (nth 3 app-data))) (if (setq mark (elmo-msgdb-global-mark-get (car entity))) (unless (member "\\Seen" flags) (setq elmo-imap4-seen-messages @@ -792,13 +794,13 @@ If CHOP-LENGTH is not specified, message set is not chopped." (and use-flag (member "\\Seen" flags))) nil - elmo-msgdb-unread-cached-mark) + (nth 1 app-data)) (if (or seen (and use-flag (member "\\Seen" flags))) (if elmo-imap4-use-cache - elmo-msgdb-read-uncached-mark) - elmo-msgdb-new-mark))))) + (nth 2 app-data)) + (nth 0 app-data)))))) (setq elmo-imap4-current-msgdb (elmo-msgdb-append elmo-imap4-current-msgdb @@ -1859,10 +1861,6 @@ Return nil if no complete line has arrived." ((folder elmo-imap4-folder)) (elmo-imap4-list folder "flagged")) -(luna-define-method elmo-folder-list-answereds-plugged - ((folder elmo-imap4-folder)) - (elmo-imap4-list folder "answered")) - (luna-define-method elmo-folder-use-flag-p ((folder elmo-imap4-folder)) (not (string-match elmo-imap4-disuse-server-flag-mailbox-regexp (elmo-imap4-folder-mailbox-internal folder)))) @@ -2077,7 +2075,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (defun elmo-imap4-search-internal-primitive (folder session filter from-msgs) (let ((search-key (elmo-filter-key filter)) (imap-search-keys '("bcc" "body" "cc" "from" "subject" "to" - "larger" "smaller" "status")) + "larger" "smaller")) (total 0) (length (length from-msgs)) charset set-list end results) @@ -2095,12 +2093,6 @@ If optional argument REMOVE is non-nil, remove FLAG." numbers))) (mapcar '(lambda (x) (delete x numbers)) rest) numbers)) - ((string= "status" search-key) - (cond - ((string= "unread" (elmo-filter-value filter)) - (elmo-folder-list-unreads folder)) - ((string= "unread" (elmo-filter-value filter)) - (elmo-folder-list-importants folder)))) ((or (string= "since" search-key) (string= "before" search-key)) (setq search-key (concat "sent" search-key) @@ -2228,7 +2220,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (luna-call-next-method))) (luna-define-method elmo-folder-msgdb-create-plugged - ((folder elmo-imap4-folder) numbers seen-list) + ((folder elmo-imap4-folder) numbers &rest args) (when numbers (let ((session (elmo-imap4-get-session folder)) (headers @@ -2253,7 +2245,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (setq elmo-imap4-current-msgdb nil elmo-imap4-seen-messages nil elmo-imap4-fetch-callback 'elmo-imap4-fetch-callback-1 - elmo-imap4-fetch-callback-data (cons seen-list + elmo-imap4-fetch-callback-data (cons args (elmo-folder-use-flag-p folder))) (while set-list @@ -2293,14 +2285,6 @@ If optional argument REMOVE is non-nil, remove FLAG." ((folder elmo-imap4-folder) numbers) (elmo-imap4-set-flag folder numbers "\\Seen")) -(luna-define-method elmo-folder-unmark-answered-plugged - ((folder elmo-imap4-folder) numbers) - (elmo-imap4-set-flag folder numbers "\\Answered" 'remove)) - -(luna-define-method elmo-folder-mark-as-answered-plugged - ((folder elmo-imap4-folder) numbers) - (elmo-imap4-set-flag folder numbers "\\Answered")) - (luna-define-method elmo-message-use-cache-p ((folder elmo-imap4-folder) number) elmo-imap4-use-cache) @@ -2509,7 +2493,8 @@ If optional argument REMOVE is non-nil, remove FLAG." (elmo-net-folder-user-internal (, folder2))))))) (luna-define-method elmo-folder-append-messages :around - ((folder elmo-imap4-folder) src-folder numbers &optional same-number) + ((folder elmo-imap4-folder) src-folder numbers unread-marks + &optional same-number) (if (and (eq (elmo-folder-type-internal src-folder) 'imap4) (elmo-imap4-identical-system-p folder src-folder) (elmo-folder-plugged-p folder)) @@ -2600,10 +2585,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (goto-char (point-min)) (std11-field-body (symbol-name field))))) -(luna-define-method elmo-folder-search-requires-msgdb-p ((folder - elmo-imap4-folder) - condition) - nil) + (require 'product) (product-provide (provide 'elmo-imap4) (require 'elmo-version)) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 4907de0..2fa24e5 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -140,6 +140,10 @@ (luna-define-method elmo-folder-msgdb-create ((folder elmo-localdir-folder) numbers + new-mark + already-mark + seen-mark + important-mark seen-list) (when numbers (let ((dir (elmo-localdir-folder-directory-internal folder)) @@ -168,10 +172,10 @@ (if (elmo-file-cache-exists-p message-id) ; XXX (if seen nil - elmo-msgdb-unread-cached-mark) + already-mark) (if seen nil ;;seen-mark - elmo-msgdb-new-mark)))) + new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -223,7 +227,7 @@ (luna-define-method elmo-folder-append-messages :around ((folder elmo-localdir-folder) - src-folder numbers &optional same-number) + src-folder numbers unread-marks &optional same-number) (if (elmo-folder-message-file-p src-folder) (let ((dir (elmo-localdir-folder-directory-internal folder)) (succeeds numbers) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 37ed43a..6fe8c22 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -132,7 +132,8 @@ LOCATION." (elmo-maildir-folder-flagged-locations-internal folder)) (luna-define-method elmo-folder-msgdb-create - ((folder elmo-maildir-folder) numbers seen-list) + ((folder elmo-maildir-folder) + numbers new-mark already-mark seen-mark important-mark seen-list) (let* ((unread-list (elmo-maildir-folder-unread-locations-internal folder)) (flagged-list (elmo-maildir-folder-flagged-locations-internal folder)) (len (length numbers)) @@ -158,9 +159,9 @@ LOCATION." entity))) (cond ((member location unread-list) - (setq mark elmo-msgdb-new-mark)) ; unread! + (setq mark new-mark)) ; unread! ((member location flagged-list) - (setq mark elmo-msgdb-important-mark))) + (setq mark important-mark))) (if (setq mark (or (elmo-msgdb-global-mark-get (elmo-msgdb-overview-entity-get-id entity)) @@ -396,7 +397,7 @@ file name for maildir directories." (luna-define-method elmo-folder-append-messages :around ((folder elmo-maildir-folder) - src-folder numbers &optional same-number) + src-folder numbers unread-marks &optional same-number) (if (elmo-folder-message-file-p src-folder) (let ((dir (elmo-maildir-folder-directory-internal folder)) (succeeds numbers) diff --git a/elmo/elmo-map.el b/elmo/elmo-map.el index 69ab1c9..cb13519 100644 --- a/elmo/elmo-map.el +++ b/elmo/elmo-map.el @@ -291,21 +291,18 @@ (elmo-map-message-location folder number) strategy section unread)) -(luna-define-method elmo-folder-list-unreads ((folder elmo-map-folder)) - (let ((locations (elmo-map-folder-list-unreads folder))) - (if (listp locations) - (elmo-map-folder-locations-to-numbers - folder - (elmo-map-folder-list-unreads folder))))) +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-map-folder) unread-marks &optional mark-alist) + (elmo-map-folder-locations-to-numbers + folder + (elmo-map-folder-list-unreads folder))) -(luna-define-method elmo-folder-list-importants ((folder elmo-map-folder)) +(luna-define-method elmo-folder-list-importants-internal + ((folder elmo-map-folder) important-mark) (let ((locations (elmo-map-folder-list-importants folder))) (if (listp locations) - (elmo-uniq-list - (nconc (elmo-map-folder-locations-to-numbers folder locations) - (elmo-folder-list-messages-with-global-mark - folder elmo-msgdb-important-mark))) - (luna-call-next-method)))) + (elmo-map-folder-locations-to-numbers folder locations) + t))) (luna-define-method elmo-folder-delete-messages ((folder elmo-map-folder) numbers) @@ -321,6 +318,7 @@ folder)) (elmo-map-folder-location-alist-internal folder)))) t) ; success + (require 'product) (product-provide (provide 'elmo-map) (require 'elmo-version)) diff --git a/elmo/elmo-mark.el b/elmo/elmo-mark.el index cc2cc44..02cdde2 100644 --- a/elmo/elmo-mark.el +++ b/elmo/elmo-mark.el @@ -84,10 +84,15 @@ (elmo-map-message-location folder number))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-mark-folder) - numbers seen-list) - (elmo-mark-folder-msgdb-create folder numbers)) - -(defun elmo-mark-folder-msgdb-create (folder numbers) + numbers new-mark + already-mark seen-mark + important-mark + seen-list) + (elmo-mark-folder-msgdb-create folder numbers new-mark already-mark + seen-mark important-mark)) + +(defun elmo-mark-folder-msgdb-create (folder numbers new-mark already-mark + seen-mark important-mark) (let ((i 0) (len (length numbers)) overview number-alist mark-alist entity message-id @@ -160,6 +165,10 @@ t) ;;; To override elmo-map-folder methods. +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-mark-folder) unread-marks &optional mark-alist) + t) + (luna-define-method elmo-folder-unmark-important ((folder elmo-mark-folder) numbers) t) diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index bf29c73..7364c5c 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -38,42 +38,6 @@ (require 'std11) (require 'mime) -(defcustom elmo-msgdb-new-mark "N" - "Mark for new message." - :type '(string :tag "Mark") - :group 'elmo) - -(defcustom elmo-msgdb-unread-uncached-mark "U" - "Mark for unread and uncached message." - :type '(string :tag "Mark") - :group 'elmo) - -(defcustom elmo-msgdb-unread-cached-mark "!" - "Mark for unread but already cached message." - :type '(string :tag "Mark") - :group 'elmo) - -(defcustom elmo-msgdb-read-uncached-mark "u" - "Mark for read but uncached message." - :type '(string :tag "Mark") - :group 'elmo) - -;; Not implemented yet. -(defcustom elmo-msgdb-answered-cached-mark "&" - "Mark for answered and cached message." - :type '(string :tag "Mark") - :group 'elmo) - -(defcustom elmo-msgdb-answered-uncached-mark "A" - "Mark for answered but cached message." - :type '(string :tag "Mark") - :group 'elmo) - -(defcustom elmo-msgdb-important-mark"$" - "Mark for important message." - :type '(string :tag "Mark") - :group 'elmo) - ;;; MSGDB interface. (defun elmo-load-msgdb (path) "Load the MSGDB from PATH." @@ -96,175 +60,25 @@ (defsubst elmo-msgdb-set-mark (msgdb number mark) "Set MARK of the message with NUMBER in the MSGDB. if MARK is nil, mark is removed." - (let ((elem (elmo-get-hash-val (format "#%d" number) - (elmo-msgdb-get-mark-hashtb msgdb)))) - (if elem - (if mark - ;; Set mark of the elem - (setcar (cdr elem) mark) - ;; Delete elem from mark-alist - (elmo-msgdb-set-mark-alist - msgdb - (delq elem (elmo-msgdb-get-mark-alist msgdb))) - (elmo-clear-hash-val (format "#%d" number) - (elmo-msgdb-get-mark-hashtb msgdb))) - (when mark - ;; Append new element. - (elmo-msgdb-set-mark-alist - msgdb - (nconc - (elmo-msgdb-get-mark-alist msgdb) - (list (setq elem (list number mark))))) - (elmo-set-hash-val (format "#%d" number) elem - (elmo-msgdb-get-mark-hashtb msgdb)))))) - -(defun elmo-msgdb-set-cached (msgdb number cached) - "Set message cache status." - (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) - (cur-status (cond - ((string= cur-mark elmo-msgdb-important-mark) - 'important) - ((member cur-mark (elmo-msgdb-answered-marks)) - 'answered) - ((not (member cur-mark (elmo-msgdb-unread-marks))) - 'read))) - (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks))))) - (unless (eq (not cached) (not cur-cached)) - (case cur-status - (read - (elmo-msgdb-set-mark msgdb number - (unless cached - elmo-msgdb-read-uncached-mark))) - (important nil) - (answered - (elmo-msgdb-set-mark msgdb number - (if cached - elmo-msgdb-answered-cached-mark - elmo-msgdb-answered-uncached-mark))) - (t - (elmo-msgdb-set-mark msgdb number - (if cached - elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark))))))) - -(defun elmo-msgdb-set-status (msgdb folder number status) - "Set message status. -MSGDB is the ELMO msgdb. -FOLDER is a ELMO folder structure. -NUMBER is a message number to be set status. -STATUS is a symbol which is one of the following: -`read' ... Messages which are already read. -`important' ... Messages which are marked as important. -`answered' ... Messages which are marked as answered." - (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) - (use-cache (elmo-message-use-cache-p folder number)) - (cur-status (cond - ((string= cur-mark elmo-msgdb-important-mark) - 'important) - ((member cur-mark (elmo-msgdb-answered-marks)) - 'answered) - ((not (member cur-mark (elmo-msgdb-unread-marks))) - 'read))) - (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks)))) - mark-modified) - (case status - (read - (case cur-status - ((read important answered)) - (t (elmo-msgdb-set-mark msgdb number - (if (and use-cache cur-cached) - (elmo-msgdb-set-mark - msgdb number - elmo-msgdb-read-uncached-mark))) - (setq mark-modified t)))) - (important - (unless (eq cur-status 'important) - (elmo-msgdb-set-mark msgdb number elmo-msgdb-important-mark) - (setq mark-modified t))) - (answered - (unless (or (eq cur-status 'answered) (eq cur-status 'important)) - (elmo-msgdb-set-mark msgdb number - (if cur-cached - (if use-cache - elmo-msgdb-answered-cached-mark - elmo-msgdb-answered-uncached-mark) - elmo-msgdb-answered-uncached-mark))) - (setq mark-modified t))) - (if mark-modified (elmo-folder-set-mark-modified-internal folder t)))) - -(defun elmo-msgdb-unset-status (msgdb folder number status) - "Unset message status. -MSGDB is the ELMO msgdb. -FOLDER is a ELMO folder structure. -NUMBER is a message number to be set status. -STATUS is a symbol which is one of the following: -`read' ... Messages which are already read. -`important' ... Messages which are marked as important. -`answered' ... Messages which are marked as answered." - (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) - (use-cache (elmo-message-use-cache-p folder number)) - (cur-status (cond - ((string= cur-mark elmo-msgdb-important-mark) - 'important) - ((member cur-mark (elmo-msgdb-answered-marks)) - 'answered) - ((not (member cur-mark (elmo-msgdb-unread-marks))) - 'read))) - (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks))))) - (case status - (read - (if (eq cur-status 'read) - (elmo-msgdb-set-mark msgdb number - (if (and cur-cached use-cache) - elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark)))) - (important - (if (eq cur-status 'important) - (elmo-msgdb-set-mark msgdb number nil))) - (answered - (if (eq cur-status 'answered) - (elmo-msgdb-set-mark msgdb number - (if (and cur-cached (not use-cache)) - elmo-msgdb-read-uncached-mark))))))) - -(defvar elmo-msgdb-unread-marks-internal nil) -(defsubst elmo-msgdb-unread-marks () - "Return an unread mark list" - (or elmo-msgdb-unread-marks-internal - (setq elmo-msgdb-unread-marks-internal - (list elmo-msgdb-new-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-unread-cached-mark)))) - -(defvar elmo-msgdb-answered-marks-internal nil) -(defsubst elmo-msgdb-answered-marks () - "Return an answered mark list" - (or elmo-msgdb-answered-marks-internal - (setq elmo-msgdb-answered-marks-internal - (list elmo-msgdb-answered-cached-mark - elmo-msgdb-answered-uncached-mark)))) - -(defvar elmo-msgdb-uncached-marks-internal nil) -(defsubst elmo-msgdb-uncached-marks () - (or elmo-msgdb-uncached-marks-internal - (setq elmo-msgdb-uncached-marks-internal - (list elmo-msgdb-answered-uncached-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-read-uncached-mark)))) - -(defsubst elmo-msgdb-count-marks (msgdb) + (elmo-msgdb-set-mark-alist + msgdb + (elmo-msgdb-mark-alist-set (elmo-msgdb-get-mark-alist msgdb) + number + mark msgdb)) + (unless mark + (elmo-clear-hash-val (format "#%d" number) + (elmo-msgdb-get-mark-hashtb msgdb)))) + +(defsubst elmo-msgdb-count-marks (msgdb new-mark unread-marks) (let ((new 0) - (unreads 0) - (answered 0)) + (unreads 0)) (dolist (elem (elmo-msgdb-get-mark-alist msgdb)) (cond - ((string= (cadr elem) elmo-msgdb-new-mark) + ((string= (cadr elem) new-mark) (incf new)) - ((member (cadr elem) (elmo-msgdb-unread-marks)) - (incf unreads)) - ((member (cadr elem) (elmo-msgdb-answered-marks)) - (incf answered)))) - (list new unreads answered))) + ((member (cadr elem) unread-marks) + (incf unreads)))) + (cons new unreads))) (defsubst elmo-msgdb-get-number (msgdb message-id) "Get number of the message which corrensponds to MESSAGE-ID from MSGDB." @@ -439,13 +253,30 @@ content of MSGDB is changed." ;;; ;; persistent mark handling ;; (for each folder) +(defun elmo-msgdb-mark-alist-set (alist id mark msgdb) + (let ((ret-val alist) + entity) + (setq entity (assq id alist)) + (if entity + (if (eq mark nil) + ;; delete this entity + (setq ret-val (delq entity alist)) + ;; set mark + (setcar (cdr entity) mark)) + (when mark + (setq ret-val (elmo-msgdb-append-element ret-val + (setq entity + (list id mark)))) + (elmo-set-hash-val (format "#%d" id) entity + (elmo-msgdb-get-mark-hashtb msgdb)))) + ret-val)) (defun elmo-msgdb-mark-append (alist id mark) "Append mark." (setq alist (elmo-msgdb-append-element alist (list id mark)))) -(defun elmo-msgdb-seen-list (msgdb) +(defun elmo-msgdb-seen-list (msgdb seen-marks) "Get SEEN-MSGID-LIST from MSGDB." (let ((ov (elmo-msgdb-get-overview msgdb)) mark seen-list) @@ -453,8 +284,7 @@ content of MSGDB is changed." (if (setq mark (elmo-msgdb-get-mark msgdb (elmo-msgdb-overview-entity-get-number (car ov)))) - (if (and mark (member mark (list elmo-msgdb-important-mark - elmo-msgdb-read-uncached-mark))) + (if (and mark (member mark seen-marks)) (setq seen-list (cons (elmo-msgdb-overview-entity-get-id (car ov)) seen-list))) @@ -919,12 +749,12 @@ header separator." elmo-msgdb-directory) alist)) -(defun elmo-msgdb-add-msgs-to-seen-list (msgs msgdb seen-list) +(defun elmo-msgdb-add-msgs-to-seen-list (msgs msgdb unread-marks seen-list) ;; Add to seen list. (let (mark) (while msgs (if (setq mark (elmo-msgdb-get-mark msgdb (car msgs))) - (unless (member mark (elmo-msgdb-unread-marks)) ;; not unread mark + (unless (member mark unread-marks) ;; not unread mark (setq seen-list (cons (elmo-msgdb-get-field msgdb (car msgs) 'message-id) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index 3090237..a4d0da5 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -65,16 +65,12 @@ (luna-define-method elmo-folder-check ((folder elmo-multi-folder)) (dolist (fld (elmo-multi-folder-children-internal folder)) - (elmo-folder-synchronize fld))) + (elmo-folder-check fld))) (luna-define-method elmo-folder-close-internal ((folder elmo-multi-folder)) (dolist (fld (elmo-multi-folder-children-internal folder)) (elmo-folder-close-internal fld))) -(luna-define-method elmo-folder-close :around ((folder elmo-multi-folder)) - (dolist (fld (elmo-multi-folder-children-internal folder)) - (elmo-folder-close fld))) - (luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-multi-folder)) (expand-file-name (elmo-replace-string-as-filename @@ -156,7 +152,9 @@ numbers-list)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-multi-folder) - numbers seen-list) + numbers new-mark already-mark + seen-mark important-mark + seen-list) (let* ((folders (elmo-multi-folder-children-internal folder)) overview number-alist mark-alist entity numbers-list @@ -173,6 +171,8 @@ (elmo-multi-msgdb (elmo-folder-msgdb-create (nth cur-number folders) (nth cur-number numbers-list) + new-mark already-mark + seen-mark important-mark seen-list) (* (elmo-multi-folder-divide-number-internal folder) (1+ cur-number)))))) @@ -385,53 +385,70 @@ (setq result (nconc result (list one-alist)))) result)) -(luna-define-method elmo-folder-list-unreads ((folder elmo-multi-folder)) - (let ((cur-number 0) - unreads) - (dolist (child (elmo-multi-folder-children-internal folder)) - (setq cur-number (+ cur-number 1)) - (setq unreads - (nconc - unreads - (mapcar (lambda (x) - (+ x (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - (elmo-folder-list-unreads child))))) - unreads)) - -(luna-define-method elmo-folder-list-answereds ((folder elmo-multi-folder)) - (let ((cur-number 0) - answereds) - (dolist (child (elmo-multi-folder-children-internal folder)) +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-multi-folder) unread-marks &optional mark-alist) + (elmo-multi-folder-list-unreads-internal folder unread-marks)) + +(defun elmo-multi-folder-list-unreads-internal (folder unread-marks) + (let ((folders (elmo-multi-folder-children-internal folder)) + (mark-alists (elmo-multi-split-mark-alist + folder + (elmo-msgdb-get-mark-alist + (elmo-folder-msgdb folder)))) + (cur-number 0) + unreads + all-unreads) + (while folders (setq cur-number (+ cur-number 1)) - (setq answereds - (nconc - answereds - (mapcar (lambda (x) - (+ x (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - (elmo-folder-list-answereds child))))) - answereds)) - -(luna-define-method elmo-folder-list-importants ((folder elmo-multi-folder)) - (let ((cur-number 0) - importants) - (dolist (child (elmo-multi-folder-children-internal folder)) + (unless (listp (setq unreads + (elmo-folder-list-unreads-internal + (car folders) unread-marks (car mark-alists)))) + (setq unreads (delq nil + (mapcar + (lambda (x) + (if (member (cadr x) unread-marks) + (car x))) + (car mark-alists))))) + (setq all-unreads + (nconc all-unreads + (mapcar + (lambda (x) + (+ x + (* cur-number + (elmo-multi-folder-divide-number-internal + folder)))) + unreads))) + (setq mark-alists (cdr mark-alists) + folders (cdr folders))) + all-unreads)) + +(luna-define-method elmo-folder-list-importants-internal + ((folder elmo-multi-folder) important-mark) + (let ((folders (elmo-multi-folder-children-internal folder)) + (mark-alists (elmo-multi-split-mark-alist + folder + (elmo-msgdb-get-mark-alist + (elmo-folder-msgdb folder)))) + (cur-number 0) + importants + all-importants) + (while folders (setq cur-number (+ cur-number 1)) - (setq importants - (nconc - importants - (mapcar (lambda (x) - (+ x (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - (elmo-folder-list-importants child))))) - (elmo-uniq-list - (nconc importants - (elmo-folder-list-messages-with-global-mark - folder elmo-msgdb-important-mark))))) + (when (listp (setq importants + (elmo-folder-list-importants-internal + (car folders) important-mark))) + (setq all-importants + (nconc all-importants + (mapcar + (lambda (x) + (+ x + (* cur-number + (elmo-multi-folder-divide-number-internal + folder)))) + importants)))) + (setq mark-alists (cdr mark-alists) + folders (cdr folders))) + all-importants)) (luna-define-method elmo-folder-list-messages-internal ((folder elmo-multi-folder) &optional nohide) @@ -585,53 +602,33 @@ (setq msg-list (cdr msg-list))) ret-val)) -(luna-define-method elmo-folder-mark-as-important :around ((folder - elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-mark-as-important ((folder elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-important (car folder-numbers) (cdr folder-numbers))) - (luna-call-next-method)) + t) -(luna-define-method elmo-folder-unmark-important :around ((folder - elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-unmark-important ((folder elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-important (car folder-numbers) (cdr folder-numbers))) - (luna-call-next-method)) + t) -(luna-define-method elmo-folder-mark-as-read :around ((folder - elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-mark-as-read ((folder elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-read (car folder-numbers) (cdr folder-numbers))) - (luna-call-next-method)) + t) -(luna-define-method elmo-folder-unmark-read :around ((folder - elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-unmark-read ((folder elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-read (car folder-numbers) (cdr folder-numbers))) - (luna-call-next-method)) - -(luna-define-method elmo-folder-mark-as-answered :around ((folder - elmo-multi-folder) - numbers) - (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) - (elmo-folder-mark-as-answered (car folder-numbers) - (cdr folder-numbers))) - (luna-call-next-method)) - -(luna-define-method elmo-folder-unmark-answered :around ((folder - elmo-multi-folder) - numbers) - (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) - (elmo-folder-unmark-answered (car folder-numbers) - (cdr folder-numbers))) - (luna-call-next-method)) + t) (require 'product) (product-provide (provide 'elmo-multi) (require 'elmo-version)) diff --git a/elmo/elmo-net.el b/elmo/elmo-net.el index 1b824fe..009dcae 100644 --- a/elmo/elmo-net.el +++ b/elmo/elmo-net.el @@ -393,30 +393,19 @@ Returned value is searched from `elmo-network-stream-type-alist'." (elmo-dop-spool-folder-list-messages folder)))) t)) -(luna-define-method elmo-folder-list-unreads :around ((folder - elmo-net-folder)) +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-net-folder) unread-marks &optional mark-alist) (if (and (elmo-folder-plugged-p folder) (elmo-folder-use-flag-p folder)) (elmo-folder-send folder 'elmo-folder-list-unreads-plugged) - (luna-call-next-method))) - -(luna-define-method elmo-folder-list-importants :around ((folder - elmo-net-folder)) - (if (and (elmo-folder-plugged-p folder) - (elmo-folder-use-flag-p folder)) - (elmo-uniq-list - (nconc - (elmo-folder-send folder 'elmo-folder-list-importants-plugged) - (elmo-folder-list-messages-with-global-mark - folder elmo-msgdb-important-mark))) - (luna-call-next-method))) + t)) -(luna-define-method elmo-folder-list-answereds :around ((folder - elmo-net-folder)) +(luna-define-method elmo-folder-list-importants-internal + ((folder elmo-net-folder) important-mark) (if (and (elmo-folder-plugged-p folder) (elmo-folder-use-flag-p folder)) - (elmo-folder-send folder 'elmo-folder-list-answereds-plugged) - (luna-call-next-method))) + (elmo-folder-send folder 'elmo-folder-list-importants-plugged) + t)) (luna-define-method elmo-folder-list-unreads-plugged ((folder elmo-net-folder)) @@ -426,10 +415,6 @@ Returned value is searched from `elmo-network-stream-type-alist'." ((folder elmo-net-folder)) t) -(luna-define-method elmo-folder-list-answereds-plugged - ((folder elmo-net-folder)) - t) - (luna-define-method elmo-folder-delete-messages ((folder elmo-net-folder) numbers) (if (elmo-folder-plugged-p folder) @@ -442,21 +427,34 @@ Returned value is searched from `elmo-network-stream-type-alist'." (elmo-folder-delete-messages-dop folder numbers)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-net-folder) - numbers seen-list) + numbers new-mark + already-mark seen-mark + important-mark seen-list) (if (elmo-folder-plugged-p folder) (elmo-folder-send folder 'elmo-folder-msgdb-create-plugged - numbers seen-list) + numbers + new-mark + already-mark seen-mark + important-mark seen-list) (elmo-folder-send folder 'elmo-folder-msgdb-create-unplugged - numbers seen-list))) + numbers + new-mark already-mark seen-mark + important-mark seen-list))) (luna-define-method elmo-folder-msgdb-create-unplugged ((folder elmo-net-folder) numbers + new-mark already-mark + seen-mark + important-mark seen-list) ;; XXXX should be appended to already existing msgdb. (elmo-dop-msgdb (elmo-folder-msgdb-create (elmo-dop-spool-folder folder) (mapcar 'abs numbers) + new-mark already-mark + seen-mark + important-mark seen-list))) (luna-define-method elmo-folder-unmark-important ((folder elmo-net-folder) @@ -496,26 +494,6 @@ Returned value is searched from `elmo-network-stream-type-alist'." folder 'elmo-folder-mark-as-read-unplugged numbers)) t)) -(luna-define-method elmo-folder-unmark-answered ((folder elmo-net-folder) - numbers) - (if (elmo-folder-use-flag-p folder) - (if (elmo-folder-plugged-p folder) - (elmo-folder-send folder 'elmo-folder-unmark-answered-plugged - numbers) - (elmo-folder-send folder - 'elmo-folder-unmark-answered-unplugged numbers)) - (luna-call-next-method))) - -(luna-define-method elmo-folder-mark-as-answered ((folder elmo-net-folder) - numbers) - (if (elmo-folder-use-flag-p folder) - (if (elmo-folder-plugged-p folder) - (elmo-folder-send folder 'elmo-folder-mark-as-answered-plugged - numbers) - (elmo-folder-send folder 'elmo-folder-mark-as-answered-unplugged - numbers)) - (luna-call-next-method))) - (luna-define-method elmo-folder-mark-as-read-unplugged ((folder elmo-net-folder) numbers) @@ -535,15 +513,6 @@ Returned value is searched from `elmo-network-stream-type-alist'." numbers) (elmo-folder-unmark-important-dop folder numbers)) -(luna-define-method elmo-folder-mark-as-answered-unplugged ((folder - elmo-net-folder) - numbers) - (elmo-folder-mark-as-answered-dop folder numbers)) - -(luna-define-method elmo-folder-unmark-answered-unplugged - ((folder elmo-net-folder) numbers) - (elmo-folder-unmark-answered-dop folder numbers)) - (luna-define-method elmo-message-encache :around ((folder elmo-net-folder) number &optional read) (if (elmo-folder-plugged-p folder) diff --git a/elmo/elmo-nmz.el b/elmo/elmo-nmz.el index 4459d24..bc46e71 100644 --- a/elmo/elmo-nmz.el +++ b/elmo/elmo-nmz.el @@ -117,7 +117,10 @@ If the value is a list, all elements are used as index paths for namazu." entity)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-nmz-folder) - numlist seen-list) + numlist new-mark + already-mark seen-mark + important-mark + seen-list) (let* (overview number-alist mark-alist entity i percent num pair) (setq num (length numlist)) @@ -145,7 +148,7 @@ If the value is a list, all elements are used as index paths for namazu." (or (elmo-msgdb-global-mark-get (elmo-msgdb-overview-entity-get-id entity)) - elmo-msgdb-new-mark)))) + new-mark)))) (when (> num elmo-display-progress-threshold) (setq i (1+ i)) (setq percent (/ (* i 100) num)) @@ -251,6 +254,25 @@ If the value is a list, all elements are used as index paths for namazu." (luna-define-method elmo-folder-exists-p ((folder elmo-nmz-folder)) t) +;;; To override elmo-map-folder methods. +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-nmz-folder) unread-marks &optional mark-alist) + t) + +(luna-define-method elmo-folder-unmark-important ((folder elmo-nmz-folder) + numbers) + t) + +(luna-define-method elmo-folder-mark-as-important ((folder elmo-nmz-folder) + numbers) + t) + +(luna-define-method elmo-folder-unmark-read ((folder elmo-nmz-folder) numbers) + t) + +(luna-define-method elmo-folder-mark-as-read ((folder elmo-nmz-folder) numbers) + t) + (require 'product) (product-provide (provide 'elmo-nmz) (require 'elmo-version)) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index fd1e85c..74030a8 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -703,6 +703,10 @@ Don't cache if nil.") ("xref" . 8))) (defun elmo-nntp-create-msgdb-from-overview-string (str + new-mark + already-mark + seen-mark + important-mark seen-list &optional numlist) (let (ov-list gmark message-id seen @@ -764,11 +768,11 @@ Don't cache if nil.") (elmo-file-cache-get message-id)) (if seen nil - elmo-msgdb-unread-cached-mark) + already-mark) (if seen (if elmo-nntp-use-cache - elmo-msgdb-read-uncached-mark) - elmo-msgdb-new-mark)))) + seen-mark) + new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist num gmark)))) @@ -776,10 +780,16 @@ Don't cache if nil.") (list overview number-alist mark-alist))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-nntp-folder) - numbers seen-list) - (elmo-nntp-folder-msgdb-create folder numbers seen-list)) - -(defun elmo-nntp-folder-msgdb-create (folder numbers seen-list) + numbers new-mark already-mark + seen-mark important-mark + seen-list) + (elmo-nntp-folder-msgdb-create folder numbers new-mark already-mark + seen-mark important-mark + seen-list)) + +(defun elmo-nntp-folder-msgdb-create (folder numbers new-mark already-mark + seen-mark important-mark + seen-list) (let ((filter numbers) (session (elmo-nntp-get-session folder)) beg-num end-num cur length @@ -808,6 +818,10 @@ Don't cache if nil.") ret-val (elmo-nntp-create-msgdb-from-overview-string ov-str + new-mark + already-mark + seen-mark + important-mark seen-list filter ))))) @@ -829,7 +843,8 @@ Don't cache if nil.") 'elmo-nntp-msgdb-create "Getting overview..." 100))) (if (not use-xover) (setq ret-val (elmo-nntp-msgdb-create-by-header - session numbers seen-list)) + session numbers + new-mark already-mark seen-mark seen-list)) (with-current-buffer (elmo-network-session-buffer session) (if ov-str (setq ret-val @@ -837,6 +852,10 @@ Don't cache if nil.") ret-val (elmo-nntp-create-msgdb-from-overview-string ov-str + new-mark + already-mark + seen-mark + important-mark seen-list filter)))))) (elmo-folder-set-killed-list-internal @@ -897,11 +916,13 @@ Don't cache if nil.") (nconc number-alist (list (cons max-number nil)))))))))) -(defun elmo-nntp-msgdb-create-by-header (session numbers seen-list) +(defun elmo-nntp-msgdb-create-by-header (session numbers + new-mark already-mark + seen-mark seen-list) (with-temp-buffer (elmo-nntp-retrieve-headers session (current-buffer) numbers) (elmo-nntp-msgdb-create-message - (length numbers) seen-list))) + (length numbers) new-mark already-mark seen-mark seen-list))) (defun elmo-nntp-parse-xhdr-response (string) (let (response) @@ -1380,7 +1401,8 @@ Returns a list of cons cells like (NUMBER . VALUE)" ;; end of from Gnus -(defun elmo-nntp-msgdb-create-message (len seen-list) +(defun elmo-nntp-msgdb-create-message (len new-mark + already-mark seen-mark seen-list) (save-excursion (let (beg overview number-alist mark-alist entity i num gmark seen message-id) @@ -1419,11 +1441,11 @@ Returns a list of cons cells like (NUMBER . VALUE)" (elmo-file-cache-get message-id)) (if seen nil - elmo-msgdb-unread-cached-mark) + already-mark) (if seen (if elmo-nntp-use-cache - elmo-msgdb-read-uncached-mark) - elmo-msgdb-new-mark)))) + seen-mark) + new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -1556,12 +1578,19 @@ Returns a list of cons cells like (NUMBER . VALUE)" elmo-crosspost-message-alist))) (elmo-nntp-folder-set-reads-internal folder reads))) -(luna-define-method elmo-folder-list-unreads :around ((folder - elmo-nntp-folder)) +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-nntp-folder) unread-marks mark-alist) ;; 2.3. elmo-folder-list-unreads return unread message list according to ;; `reads' slot. - (elmo-living-messages (luna-call-next-method) - (elmo-nntp-folder-reads-internal folder))) + (let ((mark-alist (or mark-alist (elmo-msgdb-get-mark-alist + (elmo-folder-msgdb folder))))) + (elmo-living-messages (delq nil + (mapcar + (lambda (x) + (if (member (nth 1 x) unread-marks) + (car x))) + mark-alist)) + (elmo-nntp-folder-reads-internal folder)))) (require 'product) (product-provide (provide 'elmo-nntp) (require 'elmo-version)) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index 678ec41..e2dfc04 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -66,15 +66,20 @@ (elmo-folder-contains-type (elmo-pipe-folder-dst-internal folder) type))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-pipe-folder) - numlist seen-list) + numlist new-mark already-mark + seen-mark important-mark + seen-list) (elmo-folder-msgdb-create (elmo-pipe-folder-dst-internal folder) - numlist seen-list)) + numlist new-mark already-mark + seen-mark important-mark seen-list)) (luna-define-method elmo-folder-append-messages ((folder elmo-pipe-folder) src-folder numbers + unread-marks &optional same-number) (elmo-folder-append-messages (elmo-pipe-folder-dst-internal folder) src-folder numbers + unread-marks same-number)) (luna-define-method elmo-folder-append-buffer ((folder elmo-pipe-folder) @@ -172,14 +177,15 @@ (elmo-folder-list-messages-internal (elmo-pipe-folder-dst-internal folder) nohide)) -(luna-define-method elmo-folder-list-unreads ((folder elmo-pipe-folder)) - (elmo-folder-list-unreads (elmo-pipe-folder-dst-internal folder))) +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-pipe-folder) unread-marks &optional mark-alist) + (elmo-folder-list-unreads-internal (elmo-pipe-folder-dst-internal folder) + unread-marks mark-alist)) -(luna-define-method elmo-folder-list-importants ((folder elmo-pipe-folder)) - (elmo-folder-list-importants (elmo-pipe-folder-dst-internal folder))) - -(luna-define-method elmo-folder-list-answereds ((folder elmo-pipe-folder)) - (elmo-folder-list-answereds (elmo-pipe-folder-dst-internal folder))) +(luna-define-method elmo-folder-list-importants-internal + ((folder elmo-pipe-folder) important-mark) + (elmo-folder-list-importants-internal (elmo-pipe-folder-dst-internal folder) + important-mark)) (luna-define-method elmo-folder-status ((folder elmo-pipe-folder)) (elmo-folder-open-internal (elmo-pipe-folder-src-internal folder)) diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index 0192041..d594e93 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -677,7 +677,9 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." (copy-to-buffer tobuffer (point-min) (point-max))))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-pop3-folder) - numlist seen-list) + numlist new-mark + already-mark seen-mark + important-mark seen-list) (let ((process (elmo-network-session-process-internal (elmo-pop3-get-session folder)))) (with-current-buffer (process-buffer process) @@ -686,7 +688,8 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." (elmo-pop3-msgdb-create-by-header process numlist - seen-list + new-mark already-mark + seen-mark seen-list (if (elmo-pop3-folder-use-uidl-internal folder) (elmo-pop3-folder-location-alist-internal folder))))))) @@ -724,6 +727,8 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." elmo-pop3-size-hash)) (defun elmo-pop3-msgdb-create-by-header (process numlist + new-mark already-mark + seen-mark seen-list loc-alist) (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*"))) @@ -744,13 +749,14 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." process (length numlist) numlist - seen-list loc-alist) + new-mark already-mark seen-mark seen-list loc-alist) (kill-buffer tmp-buffer))))) (defun elmo-pop3-msgdb-create-message (buffer process num - numlist + numlist new-mark already-mark + seen-mark seen-list loc-alist) (save-excursion @@ -801,11 +807,11 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." (elmo-file-cache-get message-id)) (if seen nil - elmo-msgdb-unread-cached-mark) + already-mark) (if seen (if elmo-pop3-use-cache - elmo-msgdb-read-uncached-mark) - elmo-msgdb-new-mark)))) + seen-mark) + new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist diff --git a/elmo/elmo-sendlog.el b/elmo/elmo-sendlog.el index de753f8..3cf0bc5 100644 --- a/elmo/elmo-sendlog.el +++ b/elmo/elmo-sendlog.el @@ -81,7 +81,10 @@ (elmo-map-message-location folder number))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-sendlog-folder) - numbers seen-list) + numbers new-mark + already-mark seen-mark + important-mark + seen-list) (let ((i 0) (len (length numbers)) overview number-alist mark-alist entity message-id @@ -107,8 +110,7 @@ num message-id)) (if (setq mark (or (elmo-msgdb-global-mark-get message-id) - (if (member message-id seen-list) nil - elmo-msgdb-new-mark))) + (if (member message-id seen-list) nil new-mark))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -150,6 +152,27 @@ (luna-define-method elmo-message-file-p ((folder elmo-sendlog-folder) number) t) +;;; To override elmo-map-folder methods. +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-sendlog-folder) unread-marks &optional mark-alist) + t) + +(luna-define-method elmo-folder-unmark-important ((folder elmo-sendlog-folder) + numbers) + t) + +(luna-define-method elmo-folder-mark-as-important ((folder elmo-sendlog-folder) + numbers) + t) + +(luna-define-method elmo-folder-unmark-read ((folder elmo-sendlog-folder) + numbers) + t) + +(luna-define-method elmo-folder-mark-as-read ((folder elmo-sendlog-folder) + numbers) + t) + (require 'product) (product-provide (provide 'elmo-sendlog) (require 'elmo-version)) diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index 25bf6d0..1e2bf02 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -341,7 +341,10 @@ update overview when message is fetched." (list (cons "xref" (shimbun-header-xref header))))))))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-shimbun-folder) - numlist seen-list) + numlist new-mark + already-mark seen-mark + important-mark + seen-list) (let* (overview number-alist mark-alist entity i percent number length pair msgid gmark seen) (setq length (length numlist)) @@ -364,11 +367,11 @@ update overview when message is fetched." (if (setq gmark (or (elmo-msgdb-global-mark-get msgid) (if (elmo-file-cache-status (elmo-file-cache-get msgid)) - (if seen nil elmo-msgdb-unread-cached-mark) + (if seen nil already-mark) (if seen (if elmo-shimbun-use-cache - elmo-msgdb-read-uncached-mark) - elmo-msgdb-new-mark)))) + seen-mark) + new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist number gmark)))) @@ -506,6 +509,27 @@ update overview when message is fetched." folder)))) t)) +;;; To override elmo-map-folder methods. +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-shimbun-folder) unread-marks &optional mark-alist) + t) + +(luna-define-method elmo-folder-unmark-important ((folder elmo-shimbun-folder) + numbers) + t) + +(luna-define-method elmo-folder-mark-as-important ((folder elmo-shimbun-folder) + numbers) + t) + +(luna-define-method elmo-folder-unmark-read ((folder elmo-shimbun-folder) + numbers) + t) + +(luna-define-method elmo-folder-mark-as-read ((folder elmo-shimbun-folder) + numbers) + t) + (require 'product) (product-provide (provide 'elmo-shimbun) (require 'elmo-version)) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 384d976..1205733 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -232,7 +232,7 @@ Return value is a cons cell of (STRUCTURE . REST)" (goto-char (match-end 0)))) ;; search-key ::= [A-Za-z-]+ ;; ;; "since" / "before" / "last" / "first" / -;; ;; "body" / "status" / field-name +;; ;; "body" / field-name ((looking-at "\\(!\\)? *\\([A-Za-z-]+\\) *: *") (goto-char (match-end 0)) (let ((search-key (vector diff --git a/elmo/elmo.el b/elmo/elmo.el index ef66b76..a59b76e 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -148,13 +148,11 @@ If optional argument NON-PERSISTENT is non-nil, folder is treated as (save-match-data (elmo-folder-send folder 'elmo-folder-initialize name)))) -(luna-define-generic elmo-folder-msgdb (folder) - "Return the msgdb of FOLDER (on-demand loading).") - -(luna-define-method elmo-folder-msgdb ((folder elmo-folder)) - (or (elmo-folder-msgdb-internal folder) - (elmo-folder-set-msgdb-internal folder - (elmo-msgdb-load folder)))) +(defmacro elmo-folder-msgdb (folder) + "Return the msgdb of FOLDER (on-demand loading)." + (` (or (elmo-folder-msgdb-internal (, folder)) + (elmo-folder-set-msgdb-internal (, folder) + (elmo-msgdb-load (, folder)))))) (luna-define-generic elmo-folder-open (folder &optional load-msgdb) "Open and setup (load saved status) FOLDER. @@ -206,72 +204,56 @@ Return value is cons cell or list: (luna-define-generic elmo-folder-reserve-status-p (folder) "If non-nil, the folder should not close folder after `elmo-folder-status'.") -(defun elmo-folder-list-messages (folder &optional visible-only in-msgdb) +(defun elmo-folder-list-messages (folder &optional visible-only) "Return a list of message numbers contained in FOLDER. -If optional VISIBLE-ONLY is non-nil, killed messages are not listed. -If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed." - (let ((list (if in-msgdb - t - (elmo-folder-list-messages-internal folder visible-only)))) - (elmo-living-messages - (if (listp list) - list - ;; Use current list. - (mapcar - 'car - (elmo-msgdb-get-number-alist (elmo-folder-msgdb folder)))) - (elmo-folder-killed-list-internal folder)))) - -(luna-define-generic elmo-folder-list-unreads (folder) - "Return a list of unread message numbers contained in FOLDER.") -(luna-define-generic elmo-folder-list-importants (folder) - "Return a list of important message numbers contained in FOLDER.") -(luna-define-generic elmo-folder-list-answereds (folder) - "Return a list of answered message numbers contained in FOLDER.") - -(luna-define-method elmo-folder-list-unreads ((folder elmo-folder)) - (delq nil - (mapcar - (lambda (x) - (if (member (cadr x) (elmo-msgdb-unread-marks)) - (car x))) - (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))))) - -;; TODO: Should reconsider the structure of global mark. -(defun elmo-folder-list-messages-with-global-mark (folder mark) - (let (entity msgs) +If optional VISIBLE-ONLY is non-nil, killed messages are not listed." + (let ((list (elmo-folder-list-messages-internal folder visible-only)) + (killed (elmo-folder-killed-list-internal folder)) + numbers) + (setq numbers + (if (listp list) + list + ;; Not available, use current list. + (mapcar + 'car + (elmo-msgdb-get-number-alist (elmo-folder-msgdb folder))))) + (elmo-living-messages numbers killed))) + +(defun elmo-folder-list-unreads (folder unread-marks) + "Return a list of unread message numbers contained in FOLDER. +UNREAD-MARKS is the unread marks." + (let ((list (elmo-folder-list-unreads-internal folder + unread-marks))) + (if (listp list) + list + ;; Not available, use current mark. + (delq nil + (mapcar + (function + (lambda (x) + (if (member (cadr x) unread-marks) + (car x)))) + (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))))))) + +(defun elmo-folder-list-importants (folder important-mark) + "Returns a list of important message numbers contained in FOLDER. +IMPORTANT-MARK is the important mark." + (let ((importants (elmo-folder-list-importants-internal folder important-mark)) + (number-alist (elmo-msgdb-get-number-alist + (elmo-folder-msgdb folder))) + num-pair result) (dolist (mark-pair (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))))) - (if (and (string= mark (cdr mark-pair)) - (setq entity - (elmo-msgdb-overview-get-entity (car mark-pair) - (elmo-folder-msgdb - folder)))) - (setq msgs (cons (elmo-msgdb-overview-entity-get-number entity) - msgs)))) - msgs)) - -(luna-define-method elmo-folder-list-importants ((folder elmo-folder)) - (elmo-uniq-list - (nconc - (elmo-folder-list-messages-with-global-mark folder - elmo-msgdb-important-mark) - (elmo-folder-list-messages-mark-match folder - (regexp-quote - elmo-msgdb-important-mark))))) - -(luna-define-method elmo-folder-list-answereds ((folder elmo-folder)) - (delq nil - (mapcar - (function - (lambda (x) - (if (member (cadr x) (elmo-msgdb-answered-marks)) - (car x)))) - (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))))) + (if (and (string= important-mark (cdr mark-pair)) + (setq num-pair (rassoc (car mark-pair) number-alist))) + (setq result (cons (car num-pair) result)))) + (if (listp importants) + (elmo-uniq-list (nconc result importants)) + result))) (luna-define-generic elmo-folder-list-messages-internal (folder &optional visible-only) @@ -279,10 +261,24 @@ If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed." ;; Return t if the message list is not available. ) +(luna-define-generic elmo-folder-list-unreads-internal (folder + unread-marks + &optional mark-alist) + ;; Return a list of unread message numbers contained in FOLDER. + ;; If optional MARK-ALIST is set, it is used as mark-alist. + ;; Return t if this feature is not available. + ) + +(luna-define-generic elmo-folder-list-importants-internal (folder + important-mark) + ;; Return a list of important message numbers contained in FOLDER. + ;; Return t if this feature is not available. + ) + (luna-define-generic elmo-folder-list-subfolders (folder &optional one-level) "Returns a list of subfolders contained in FOLDER. If optional argument ONE-LEVEL is non-nil, only children of FOLDER is returned. -\(a folder which have children is returned as a list\) +(a folder which have children is returned as a list) Otherwise, all descendent folders are returned.") (luna-define-generic elmo-folder-have-subfolder-p (folder) @@ -332,10 +328,13 @@ CONDITION is a condition structure for testing. NUMBERS is a list of message numbers, use to be test for \"last\" and \"first\" predicates.") -(luna-define-generic elmo-folder-msgdb-create (folder numbers seen-list) +(luna-define-generic elmo-folder-msgdb-create + (folder numbers new-mark already-mark seen-mark important-mark seen-list) "Create a message database (implemented in each backends). FOLDER is the ELMO folder structure. NUMBERS is a list of message numbers to create msgdb. +NEW-MARK, ALREADY-MARK, SEEN-MARK, and IMPORTANT-MARK are mark string for +new message, unread but cached message, read message and important message. SEEN-LIST is a list of message-id string which should be treated as read.") (luna-define-generic elmo-folder-unmark-important (folder numbers) @@ -358,34 +357,6 @@ NUMBERS is a list of message numbers to be processed.") FOLDER is the ELMO folder structure. NUMBERS is a list of message numbers to be processed.") -(luna-define-generic elmo-folder-unmark-answered (folder numbers) - "Un-mark messages as answered. -FOLDER is the ELMO folder structure. -NUMBERS is a list of message numbers to be processed.") - -(luna-define-generic elmo-folder-mark-as-answered (folder numbers) - "Mark messages as answered. -FOLDER is the ELMO folder structure. -NUMBERS is a list of message numbers to be processed.") - -(luna-define-generic elmo-folder-set-status (folder numbers status) - "Set message status. -FOLDER is the ELMO folder structure. -NUMBERS is a list of message numbers to be set status. -STATUS is a symbol which is one of the following: -`read' ... Messages which are already read. -`important' ... Messages which are marked as important. -`answered' ... Messages which are marked as answered.") - -(luna-define-generic elmo-folder-unset-status (folder numbers status) - "Unset message status. -FOLDER is the ELMO folder structure. -NUMBERS is a list of message numbers to be unset status. -STATUS is a symbol which is one of the following: -`read' ... Messages which are already read. -`important' ... Messages which are marked as important. -`answered' ... Messages which are marked as answered.") - (luna-define-generic elmo-folder-append-buffer (folder unread &optional number) "Append current buffer as a new message. FOLDER is the destination folder(ELMO folder structure). @@ -396,6 +367,7 @@ If optional argument NUMBER is specified, the new message number is set (luna-define-generic elmo-folder-append-messages (folder src-folder numbers + unread-marks &optional same-number) "Append messages from folder. @@ -404,6 +376,7 @@ Caller should make sure FOLDER is `writable'. (Can be checked with `elmo-folder-writable-p'). SRC-FOLDER is the source ELMO folder structure. NUMBERS is the message numbers to be appended in the SRC-FOLDER. +UNREAD-MARKS is a list of unread mark string. If second optional argument SAME-NUMBER is specified, message number is preserved (if possible).") @@ -548,6 +521,14 @@ Return newly created temporary directory name which contains temporary files.") ((folder elmo-folder) &optional visible-only) t) +(luna-define-method elmo-folder-list-unreads-internal + ((folder elmo-folder) unread-marks &optional mark-alist) + t) + +(luna-define-method elmo-folder-list-importants-internal + ((folder elmo-folder) important-mark) + t) + (defun elmo-folder-encache (folder numbers &optional unread) "Encache messages in the FOLDER with NUMBERS. If UNREAD is non-nil, messages are not marked as read." @@ -635,22 +616,6 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (luna-define-generic elmo-folder-newsgroups (folder) "Return list of newsgroup name of FOLDER.") -(luna-define-generic elmo-folder-search-requires-msgdb-p (folder condition) - "Return non-nil if searching in FOLDER by CONDITION requires msgdb fetch.") - -(defun elmo-folder-search-requires-msgdb-p-internal (folder condition) - (if (listp condition) - (or (elmo-folder-search-requires-msgdb-p-internal - folder (nth 1 condition)) - (elmo-folder-search-requires-msgdb-p-internal - folder (nth 2 condition))) - (and (not (string= (elmo-filter-key condition) "last")) - (not (string= (elmo-filter-key condition) "first"))))) - -(luna-define-method elmo-folder-search-requires-msgdb-p ((folder elmo-folder) - condition) - (elmo-folder-search-requires-msgdb-p-internal folder condition)) - (luna-define-method elmo-folder-newsgroups ((folder elmo-folder)) nil) @@ -660,7 +625,8 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (defun elmo-generic-folder-open (folder load-msgdb) (let ((inhibit-quit t)) - (if load-msgdb (elmo-folder-msgdb folder)) + (if load-msgdb + (elmo-folder-set-msgdb-internal folder (elmo-msgdb-load folder))) (elmo-folder-set-killed-list-internal folder (elmo-msgdb-killed-list-load (elmo-folder-msgdb-path folder)))) @@ -748,34 +714,20 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (defsubst elmo-folder-search-fast (folder condition numbers) (when (and numbers (vectorp condition) - (member (elmo-filter-key condition) '("first" "last" "mark"))) - (if (string= (elmo-filter-key condition) "mark") - (let ((msgdb (elmo-folder-msgdb folder))) - ;; msgdb should be synchronized at this point. - (cond - ((string= (elmo-filter-value condition) "unread") - (elmo-folder-list-unreads folder)) - ((string= (elmo-filter-value condition) "important") - (elmo-folder-list-importants folder)) - ((string= (elmo-filter-value condition) "answered") - (elmo-folder-list-answereds folder)) - ((string= (elmo-filter-value condition) "any") - (nconc (elmo-folder-list-unreads folder) - (elmo-folder-list-importants folder) - (elmo-folder-list-answereds folder))))) - (let ((len (length numbers)) - (lastp (string= (elmo-filter-key condition) "last")) - (value (string-to-number (elmo-filter-value condition)))) - (when (eq (elmo-filter-type condition) 'unmatch) - (setq lastp (not lastp) - value (- len value))) - (if lastp - (nthcdr (max (- len value) 0) numbers) - (when (> value 0) - (let ((last (nthcdr (1- value) numbers))) - (when last - (setcdr last nil)) - numbers))))))) + (member (elmo-filter-key condition) '("first" "last"))) + (let ((len (length numbers)) + (lastp (string= (elmo-filter-key condition) "last")) + (value (string-to-number (elmo-filter-value condition)))) + (when (eq (elmo-filter-type condition) 'unmatch) + (setq lastp (not lastp) + value (- len value))) + (if lastp + (nthcdr (max (- len value) 0) numbers) + (when (> value 0) + (let ((last (nthcdr (1- value) numbers))) + (when last + (setcdr last nil)) + numbers)))))) (luna-define-method elmo-folder-search ((folder elmo-folder) condition @@ -1002,13 +954,14 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (luna-define-method elmo-folder-append-messages ((folder elmo-folder) src-folder numbers + unread-marks &optional same-number) (elmo-generic-folder-append-messages folder src-folder numbers - same-number)) + unread-marks same-number)) (defun elmo-generic-folder-append-messages (folder src-folder numbers - same-number) + unread-marks same-number) (let (unseen seen-list succeed-numbers failure cache) (with-temp-buffer (set-buffer-multibyte nil) @@ -1042,7 +995,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") folder (setq unseen (member (elmo-message-mark src-folder (car numbers)) - (elmo-msgdb-unread-marks))) + unread-marks)) (if same-number (car numbers)))))) (error (setq failure t))) ;; FETCH & APPEND finished @@ -1068,6 +1021,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") no-delete-info no-delete same-number + unread-marks save-unread) (save-excursion (let* ((messages msgs) @@ -1085,6 +1039,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (unless (setq succeeds (elmo-folder-append-messages dst-folder src-folder messages + unread-marks same-number)) (error "move: append message to %s failed" (elmo-folder-name-internal dst-folder))) @@ -1097,7 +1052,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (setq seen-list (elmo-msgdb-add-msgs-to-seen-list msgs (elmo-folder-msgdb src-folder) - seen-list)) + unread-marks seen-list)) (elmo-msgdb-seen-save dir seen-list)))) (if (and (not no-delete) succeeds) (progn @@ -1155,7 +1110,7 @@ FIELD is a symbol of the field." (elmo-msgdb-get-field (elmo-folder-msgdb folder) number field)) (defun elmo-message-set-mark (folder number mark) - ;; Set mark for the message in the FOLDER with NUMBER as MARK. + "Set mark for the message in the FOLDER with NUMBER as MARK." (elmo-msgdb-set-mark (elmo-folder-msgdb folder) number mark)) @@ -1166,55 +1121,18 @@ FIELD is a symbol of the field." (luna-define-method elmo-message-folder ((folder elmo-folder) number) folder) ; default is folder -(luna-define-method elmo-folder-unmark-important ((folder elmo-folder) - numbers) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (elmo-msgdb-unset-status (elmo-folder-msgdb folder) - folder - number - 'important)))) +(luna-define-method elmo-folder-unmark-important ((folder elmo-folder) numbers) + t) (luna-define-method elmo-folder-mark-as-important ((folder elmo-folder) numbers) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (elmo-msgdb-set-status (elmo-folder-msgdb folder) - folder - number - 'important)))) + t) (luna-define-method elmo-folder-unmark-read ((folder elmo-folder) numbers) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (elmo-msgdb-unset-status (elmo-folder-msgdb folder) - folder - number - 'read)))) + t) (luna-define-method elmo-folder-mark-as-read ((folder elmo-folder) numbers) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (elmo-msgdb-set-status (elmo-folder-msgdb folder) - folder - number - 'read)))) - -(luna-define-method elmo-folder-unmark-answered ((folder elmo-folder) numbers) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (elmo-msgdb-unset-status (elmo-folder-msgdb folder) - folder - number - 'answered)))) - -(luna-define-method elmo-folder-mark-as-answered ((folder elmo-folder) numbers) - (when (elmo-folder-msgdb-internal folder) - (dolist (number numbers) - (elmo-msgdb-set-status (elmo-folder-msgdb folder) - folder - number - 'answered)))) + t) (luna-define-method elmo-folder-process-crosspost ((folder elmo-folder) &optional @@ -1222,6 +1140,19 @@ FIELD is a symbol of the field." ;; Do nothing. ) +(defsubst elmo-folder-replace-marks (folder alist) + "Replace marks of the FOLDER according to ALIST." + (let (pair) + (dolist (elem (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))) + (when (setq pair (assoc (cadr elem) alist)) + (if (elmo-message-use-cache-p folder (car elem)) + (elmo-msgdb-set-mark (elmo-folder-msgdb folder) + (car elem) + (cdr pair)) + (elmo-msgdb-set-mark (elmo-folder-msgdb folder) + (car elem) + nil)))))) + (defun elmo-generic-folder-append-msgdb (folder append-msgdb) (if append-msgdb (let* ((number-alist (elmo-msgdb-get-number-alist append-msgdb)) @@ -1233,10 +1164,6 @@ FIELD is a symbol of the field." pair overview to-be-deleted mark-alist) - (elmo-folder-set-msgdb-internal folder - (elmo-msgdb-append - (elmo-folder-msgdb folder) - append-msgdb)) (while cur (setq all-alist (delq (car cur) all-alist)) ;; same message id exists. @@ -1262,6 +1189,10 @@ FIELD is a symbol of the field." (t ;; Do nothing. (setq to-be-deleted nil))) + (elmo-folder-set-msgdb-internal folder + (elmo-msgdb-append + (elmo-folder-msgdb folder) + append-msgdb)) (length to-be-deleted)) 0)) @@ -1354,17 +1285,29 @@ FIELD is a symbol of the field." (elmo-folder-set-msgdb-internal folder (elmo-msgdb-clear))) (defun elmo-folder-synchronize (folder + new-mark ;"N" + unread-uncached-mark ;"U" + unread-cached-mark ;"!" + read-uncached-mark ;"u" + important-mark ;"$" &optional ignore-msgdb no-check) "Synchronize the folder data to the newest status. FOLDER is the ELMO folder structure. +NEW-MARK, UNREAD-CACHED-MARK, READ-UNCACHED-MARK, and IMPORTANT-MARK +are mark strings for new messages, unread but cached messages, +read but not cached messages, and important messages. If optional IGNORE-MSGDB is non-nil, current msgdb is thrown away except read mark status. If IGNORE-MSGDB is 'visible-only, only visible messages \(the messages which are not in the killed-list\) are thrown away and synchronized. If NO-CHECK is non-nil, rechecking folder is skipped. -Return a list of a cross-posted message number. +Return a list of +\(NEW-MSGDB DELETE-LIST CROSSED\) +NEW-MSGDB is the newly appended msgdb. +DELETE-LIST is a list of deleted message number. +CROSSED is cross-posted message number. If update process is interrupted, return nil." (let ((killed-list (elmo-folder-killed-list-internal folder)) (before-append t) @@ -1380,9 +1323,11 @@ If update process is interrupted, return nil." (elmo-folder-msgdb folder))) (if ignore-msgdb (progn - (setq seen-list (nconc (elmo-msgdb-seen-list - (elmo-folder-msgdb folder)) - seen-list)) + (setq seen-list (nconc + (elmo-msgdb-seen-list + (elmo-folder-msgdb folder) + (list important-mark read-uncached-mark)) + seen-list)) (elmo-folder-clear folder (eq ignore-msgdb 'visible-only)))) (unless no-check (elmo-folder-check folder)) (condition-case nil @@ -1413,16 +1358,19 @@ If update process is interrupted, return nil." (progn (elmo-folder-update-number folder) (elmo-folder-process-crosspost folder) - 0 ; no updates. + (list nil nil nil) ; no updates. ) (if delete-list (elmo-msgdb-delete-msgs (elmo-folder-msgdb folder) delete-list)) (when new-list (setq new-msgdb (elmo-folder-msgdb-create - folder new-list seen-list)) + folder + new-list + new-mark unread-cached-mark + read-uncached-mark important-mark + seen-list)) (elmo-msgdb-change-mark (elmo-folder-msgdb folder) - elmo-msgdb-new-mark - elmo-msgdb-unread-uncached-mark) + new-mark unread-uncached-mark) ;; Clear seen-list. (if (elmo-folder-persistent-p folder) (setq seen-list (elmo-msgdb-seen-save @@ -1435,7 +1383,7 @@ If update process is interrupted, return nil." (elmo-folder-set-message-modified-internal folder t) (elmo-folder-set-mark-modified-internal folder t)) ;; return value. - (or crossed 0))) + (list new-msgdb delete-list crossed))) (quit ;; Resume to the original status. (if before-append @@ -1449,6 +1397,7 @@ If update process is interrupted, return nil." (elmo-msgdb-get-number-alist (elmo-folder-msgdb folder)))) +;;; (defun elmo-msgdb-load (folder &optional silent) (unless silent (message "Loading msgdb for %s..." (elmo-folder-name-internal folder))) diff --git a/wl/wl-expire.el b/wl/wl-expire.el index d3f2b94..165e07e 100644 --- a/wl/wl-expire.el +++ b/wl/wl-expire.el @@ -149,6 +149,7 @@ t copy preserve-number + nil wl-expire-add-seen-list) (progn (wl-expire-append-log @@ -204,6 +205,7 @@ If REFILE-LIST includes reserve mark message, so copy." t copy-reserve-message preserve-number + nil wl-expire-add-seen-list)) (error "Expire: move msgs to %s failed" (elmo-folder-name-internal dst-folder))) @@ -811,7 +813,7 @@ ex. +ml/wl/1999_11/, +ml/wl/1999_12/." (interactive "P") (let* ((folder (or folder wl-summary-buffer-elmo-folder)) (msgdb (or (wl-summary-buffer-msgdb) - (elmo-folder-msgdb folder))) + (elmo-msgdb-load folder))) (msgs (if (not nolist) (elmo-folder-list-messages folder) (mapcar 'car (elmo-msgdb-get-number-alist msgdb)))) diff --git a/wl/wl-folder.el b/wl/wl-folder.el index 4099f3b..ea911f4 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -816,20 +816,19 @@ Optional argument ARG is repeart count." (defun wl-folder-check-one-entity (entity &optional biff) (let* ((folder (wl-folder-get-elmo-folder entity biff)) - (nums ;(condition-case err + (nums (condition-case err (progn (if biff (elmo-folder-set-biff-internal folder t)) (if (wl-string-match-member entity wl-strict-diff-folders) (elmo-strict-folder-diff folder) (elmo-folder-diff folder))) - ; (error + (error ;; maybe not exist folder. - ; (if (and (not (memq 'elmo-open-error - ; (get (car err) 'error-conditions))) - ; (not (elmo-folder-exists-p folder))) - ; (wl-folder-create-subr folder) - ; (signal (car err) (cdr err)))))) - ) + (if (and (not (memq 'elmo-open-error + (get (car err) 'error-conditions))) + (not (elmo-folder-exists-p folder))) + (wl-folder-create-subr folder) + (signal (car err) (cdr err)))))) (new (elmo-diff-new nums)) (unread (elmo-diff-unread nums)) (all (elmo-diff-all nums)) diff --git a/wl/wl-highlight.el b/wl/wl-highlight.el index 9cbfd21..4391cf5 100644 --- a/wl/wl-highlight.el +++ b/wl/wl-highlight.el @@ -777,14 +777,14 @@ (defun wl-highlight-summary-line-string (line mark temp-mark indent) (let (fsymbol) (cond ((and (string= temp-mark "+") - (member mark (list elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-new-mark))) + (member mark (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark + wl-summary-new-mark))) (setq fsymbol 'wl-highlight-summary-high-unread-face)) ((and (string= temp-mark "-") - (member mark (list elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-new-mark))) + (member mark (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark + wl-summary-new-mark))) (setq fsymbol 'wl-highlight-summary-low-unread-face)) ((string= temp-mark "o") (setq fsymbol 'wl-highlight-summary-refiled-face)) @@ -794,12 +794,12 @@ (setq fsymbol 'wl-highlight-summary-deleted-face)) ((string= temp-mark "*") (setq fsymbol 'wl-highlight-summary-temp-face)) - ((string= mark elmo-msgdb-new-mark) + ((string= mark wl-summary-new-mark) (setq fsymbol 'wl-highlight-summary-new-face)) - ((member mark (list elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark)) + ((member mark (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark)) (setq fsymbol 'wl-highlight-summary-unread-face)) - ((or (string= mark elmo-msgdb-important-mark)) + ((or (string= mark wl-summary-important-mark)) (setq fsymbol 'wl-highlight-summary-important-face)) ((string= temp-mark "-") (setq fsymbol 'wl-highlight-summary-low-read-face)) @@ -842,21 +842,21 @@ (if (not fsymbol) (cond ((and (string= temp-mark "+") - (member status-mark (list elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-new-mark))) + (member status-mark (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark + wl-summary-new-mark))) (setq fsymbol 'wl-highlight-summary-high-unread-face)) ((and (string= temp-mark "-") - (member status-mark (list elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-new-mark))) + (member status-mark (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark + wl-summary-new-mark))) (setq fsymbol 'wl-highlight-summary-low-unread-face)) - ((string= status-mark elmo-msgdb-new-mark) + ((string= status-mark wl-summary-new-mark) (setq fsymbol 'wl-highlight-summary-new-face)) - ((member status-mark (list elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark)) + ((member status-mark (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark)) (setq fsymbol 'wl-highlight-summary-unread-face)) - ((string= status-mark elmo-msgdb-important-mark) + ((string= status-mark wl-summary-important-mark) (setq fsymbol 'wl-highlight-summary-important-face)) ;; score mark ((string= temp-mark "-") diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 3c6bd28..cd546eb 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -83,7 +83,6 @@ (defvar wl-summary-buffer-current-msg nil) (defvar wl-summary-buffer-unread-count 0) (defvar wl-summary-buffer-new-count 0) -(defvar wl-summary-buffer-answered-count 0) (defvar wl-summary-buffer-mime-charset nil) (defvar wl-summary-buffer-weekday-name-lang nil) (defvar wl-summary-buffer-thread-indent-set-alist nil) @@ -148,7 +147,6 @@ (make-variable-buffer-local 'wl-summary-buffer-last-displayed-msg) (make-variable-buffer-local 'wl-summary-buffer-unread-count) (make-variable-buffer-local 'wl-summary-buffer-new-count) -(make-variable-buffer-local 'wl-summary-buffer-answered-count) (make-variable-buffer-local 'wl-summary-buffer-mime-charset) (make-variable-buffer-local 'wl-summary-buffer-weekday-name-lang) (make-variable-buffer-local 'wl-summary-buffer-thread-indent-set) @@ -197,6 +195,11 @@ (defvar wl-temp-mark) (defvar wl-persistent-mark) +;; internal functions (dummy) +(unless (fboundp 'wl-summary-append-message-func-internal) + (defun wl-summary-append-message-func-internal (entity msgdb update + &optional force-insert))) + (defmacro wl-summary-sticky-buffer-name (name) (` (concat wl-summary-buffer-name ":" (, name)))) @@ -570,12 +573,15 @@ See also variable `wl-use-petname'." (wl-summary-redisplay))) (defun wl-summary-count-unread () - (let ((lst (elmo-msgdb-count-marks (wl-summary-buffer-msgdb)))) + (let ((pair + (elmo-msgdb-count-marks (wl-summary-buffer-msgdb) + wl-summary-new-mark + (list wl-summary-unread-uncached-mark + wl-summary-unread-cached-mark)))) (if (eq major-mode 'wl-summary-mode) - (setq wl-summary-buffer-new-count (car lst) - wl-summary-buffer-unread-count (nth 1 lst) - wl-summary-buffer-answered-count (nth 2 lst))) - lst)) + (setq wl-summary-buffer-new-count (car pair) + wl-summary-buffer-unread-count (cdr pair))) + pair)) (defun wl-summary-message-string (&optional use-cache) "Return full body string of current message. @@ -945,6 +951,8 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (inhibit-read-only t) (buffer-read-only nil) expunged) + (fset 'wl-summary-append-message-func-internal + (wl-summary-get-append-message-func)) (erase-buffer) (message "Re-scanning...") (setq i 0) @@ -971,7 +979,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (elmo-kill-buffer wl-summary-search-buf-name) (while curp (setq entity (car curp)) - (wl-summary-insert-message entity msgdb nil) + (wl-summary-append-message-func-internal entity msgdb nil) (setq curp (cdr curp)) (when (> num elmo-display-progress-threshold) (setq i (+ i 1)) @@ -985,7 +993,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (caar wl-summary-delayed-update) (elmo-msgdb-overview-entity-get-number (cdar wl-summary-delayed-update))) - (wl-summary-insert-message + (wl-summary-append-message-func-internal (cdar wl-summary-delayed-update) msgdb nil t) (setq wl-summary-delayed-update (cdr wl-summary-delayed-update)))) (message "Constructing summary structure...done") @@ -994,7 +1002,8 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (progn (message "Inserting thread...") (wl-thread-insert-top) - (message "Inserting thread...done"))) + (message "Inserting thread...done")) + (wl-summary-make-number-list)) (when wl-use-scoring (setq wl-summary-scored nil) (wl-summary-score-headers nil msgdb @@ -1428,15 +1437,15 @@ If ARG is non-nil, checking is omitted." (setq new-mark (cond ((string= mark - elmo-msgdb-unread-uncached-mark) - elmo-msgdb-unread-cached-mark) - ((string= mark elmo-msgdb-new-mark) + wl-summary-unread-uncached-mark) + wl-summary-unread-cached-mark) + ((string= mark wl-summary-new-mark) (setq wl-summary-buffer-new-count (- wl-summary-buffer-new-count 1)) (setq wl-summary-buffer-unread-count (+ wl-summary-buffer-unread-count 1)) - elmo-msgdb-unread-cached-mark) - ((string= mark elmo-msgdb-read-uncached-mark) + wl-summary-unread-cached-mark) + ((string= mark wl-summary-read-uncached-mark) nil) (t mark))) (elmo-msgdb-set-mark msgdb number new-mark) @@ -1450,9 +1459,9 @@ If ARG is non-nil, checking is omitted." new-mark))))))) ;;(defvar wl-summary-message-uncached-marks -;; (list elmo-msgdb-new-mark -;; elmo-msgdb-unread-uncached-mark -;; elmo-msgdb-read-uncached-mark)) +;; (list wl-summary-new-mark +;; wl-summary-unread-uncached-mark +;; wl-summary-read-uncached-mark)) (defun wl-summary-prefetch-region (beg end &optional prefetch-marks) (interactive "r") @@ -1499,8 +1508,8 @@ If ARG is non-nil, checking is omitted." (wl-summary-prefetch)) (wl-summary-prefetch-msg (car targets)))) (if (if prefetch-marks - (string= mark elmo-msgdb-unread-cached-mark) - (or (string= mark elmo-msgdb-unread-cached-mark) + (string= mark wl-summary-unread-cached-mark) + (or (string= mark wl-summary-unread-cached-mark) (string= mark " "))) (message "Prefetching... %d/%d message(s)" (setq count (+ 1 count)) length)) @@ -1673,36 +1682,39 @@ If ARG is non-nil, checking is omitted." (message "Setting all msgs as read...") (elmo-folder-mark-as-read folder (elmo-folder-list-unreads - folder)) + folder + (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark + wl-summary-new-mark))) (save-excursion (goto-char (point-min)) (while (not (eobp)) (setq msg (wl-summary-message-number)) (setq mark (wl-summary-persistent-mark)) (when (and (not (string= mark " ")) - (not (string= mark elmo-msgdb-important-mark)) - (not (string= mark elmo-msgdb-read-uncached-mark))) + (not (string= mark wl-summary-important-mark)) + (not (string= mark wl-summary-read-uncached-mark))) (delete-backward-char 1) (if (or (not (elmo-message-use-cache-p folder msg)) - (string= mark elmo-msgdb-unread-cached-mark)) + (string= mark wl-summary-unread-cached-mark)) (progn (insert " ") (elmo-msgdb-set-mark msgdb msg nil)) ;; New mark and unread-uncached mark - (insert elmo-msgdb-read-uncached-mark) + (insert wl-summary-read-uncached-mark) (elmo-msgdb-set-mark - msgdb msg elmo-msgdb-read-uncached-mark)) + msgdb msg wl-summary-read-uncached-mark)) (if wl-summary-highlight (wl-highlight-summary-current-line nil nil t))) (forward-line 1))) -; (elmo-folder-replace-marks -; folder -; (list (cons elmo-msgdb-unread-cached-mark -; nil) -; (cons elmo-msgdb-unread-uncached-mark -; elmo-msgdb-read-uncached-mark) -; (cons elmo-msgdb-new-mark -; elmo-msgdb-read-uncached-mark))) + (elmo-folder-replace-marks + folder + (list (cons wl-summary-unread-cached-mark + nil) + (cons wl-summary-unread-uncached-mark + wl-summary-read-uncached-mark) + (cons wl-summary-new-mark + wl-summary-read-uncached-mark))) (wl-summary-set-mark-modified) (wl-folder-update-unread (wl-summary-buffer-folder-name) 0) (setq wl-summary-buffer-unread-count 0) @@ -1724,15 +1736,15 @@ If ARG is non-nil, checking is omitted." mark number unread new-mark) (setq mark (wl-summary-persistent-mark)) (cond - ((or (string= mark elmo-msgdb-new-mark) - (string= mark elmo-msgdb-unread-uncached-mark) - (string= mark elmo-msgdb-important-mark)) + ((or (string= mark wl-summary-new-mark) + (string= mark wl-summary-unread-uncached-mark) + (string= mark wl-summary-important-mark)) ;; noop ) - ((string= mark elmo-msgdb-unread-cached-mark) - (setq new-mark elmo-msgdb-unread-uncached-mark)) + ((string= mark wl-summary-unread-cached-mark) + (setq new-mark wl-summary-unread-uncached-mark)) (t - (setq new-mark elmo-msgdb-read-uncached-mark))) + (setq new-mark wl-summary-read-uncached-mark))) (when new-mark (setq number (wl-summary-message-number)) (delete-backward-char 1) @@ -1769,16 +1781,16 @@ If ARG is non-nil, checking is omitted." (setq set-mark nil) (if (elmo-file-cache-exists-p msgid) (if (or - (string= mark elmo-msgdb-unread-uncached-mark) ; U -> ! - (string= mark elmo-msgdb-new-mark) ; N -> ! + (string= mark wl-summary-unread-uncached-mark) ; U -> ! + (string= mark wl-summary-new-mark) ; N -> ! ) - (setq set-mark elmo-msgdb-unread-cached-mark) - (if (string= mark elmo-msgdb-read-uncached-mark) ; u -> ' ' + (setq set-mark wl-summary-unread-cached-mark) + (if (string= mark wl-summary-read-uncached-mark) ; u -> ' ' (setq set-mark " "))) (if (string= mark " ") - (setq set-mark elmo-msgdb-read-uncached-mark) ;' ' -> u - (if (string= mark elmo-msgdb-unread-cached-mark) - (setq set-mark elmo-msgdb-unread-uncached-mark) ; ! -> U + (setq set-mark wl-summary-read-uncached-mark) ;' ' -> u + (if (string= mark wl-summary-unread-cached-mark) + (setq set-mark wl-summary-unread-uncached-mark) ; ! -> U ))) (when set-mark (delete-backward-char 1) @@ -1852,25 +1864,6 @@ If ARG is non-nil, checking is omitted." (wl-highlight-summary-current-line))) (forward-line 1))))) -(defun wl-summary-update-status-marks () - "Synchronize status marks on current buffer to the msgdb." - (interactive) - (save-excursion - (goto-char (point-min)) - (let ((inhibit-read-only t) - (buffer-read-only nil) - mark) - (while (not (eobp)) - (unless (string= (wl-summary-persistent-mark) - (setq mark (or (elmo-message-mark - wl-summary-buffer-elmo-folder - (wl-summary-message-number)) - " "))) - (delete-backward-char 1) - (insert mark) - (if wl-summary-highlight (wl-highlight-summary-current-line))) - (forward-line 1))))) - (defun wl-summary-get-delete-folder (folder) (if (string= folder wl-trash-folder) 'null @@ -1890,10 +1883,10 @@ If ARG is non-nil, checking is omitted." (error "Trash Folder is not created")))) wl-trash-folder))))) -(defun wl-summary-insert-message (&rest args) +(defun wl-summary-get-append-message-func () (if (eq wl-summary-buffer-view 'thread) - (apply 'wl-summary-insert-thread-entity args) - (apply 'wl-summary-insert-sequential args))) + 'wl-summary-insert-thread-entity + 'wl-summary-insert-sequential)) (defun wl-summary-sort () (interactive) @@ -1909,9 +1902,8 @@ If ARG is non-nil, checking is omitted." "Update marks in summary." (interactive) (let ((last-progress 0) - (folder wl-summary-buffer-elmo-folder) (i 0) - importants unreads + unread-marks importants unreads importants-in-db unreads-in-db diff diffs mes progress) ;; synchronize marks. @@ -1919,22 +1911,27 @@ If ARG is non-nil, checking is omitted." wl-summary-buffer-elmo-folder) 'internal)) (message "Updating marks...") - (setq importants-in-db (elmo-folder-list-messages-mark-match + (setq unread-marks (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark + wl-summary-new-mark) + importants-in-db (elmo-folder-list-messages-mark-match wl-summary-buffer-elmo-folder - (regexp-quote elmo-msgdb-important-mark)) + (regexp-quote wl-summary-important-mark)) unreads-in-db (elmo-folder-list-messages-mark-match wl-summary-buffer-elmo-folder - (wl-regexp-opt (elmo-msgdb-unread-marks))) + (wl-regexp-opt unread-marks)) importants (elmo-folder-list-importants - wl-summary-buffer-elmo-folder) + wl-summary-buffer-elmo-folder + wl-summary-important-mark) unreads (elmo-folder-list-unreads - wl-summary-buffer-elmo-folder)) + wl-summary-buffer-elmo-folder + unread-marks)) (setq diff (elmo-list-diff importants importants-in-db)) (setq diffs (cadr diff)) ; important-deletes (setq mes (format "Updated (-%d" (length diffs))) (while diffs (wl-summary-mark-as-important (car diffs) - elmo-msgdb-important-mark + wl-summary-important-mark 'no-server) (setq diffs (cdr diffs))) (setq diffs (car diff)) ; important-appends @@ -1965,22 +1962,34 @@ If ARG is non-nil, checking is omitted." (buffer-read-only nil) gc-message overview number-alist - curp num i diff + curp num i new-msgdb append-list delete-list crossed update-thread update-top-list - expunged mes entity) + expunged mes sync-result entity) (unwind-protect (progn (unless wl-summary-buffer-elmo-folder (error "(Internal error) Folder is not set:%s" (buffer-name (current-buffer)))) + (fset 'wl-summary-append-message-func-internal + (wl-summary-get-append-message-func)) ;; Flush pending append operations (disconnected operation). ;;(setq seen-list ;;(wl-summary-flush-pending-append-operations seen-list)) (goto-char (point-max)) (wl-folder-confirm-existence folder (elmo-folder-plugged-p folder)) - (setq crossed (elmo-folder-synchronize folder sync-all no-check)) - (if crossed + (setq sync-result (elmo-folder-synchronize + folder + wl-summary-new-mark + wl-summary-unread-uncached-mark + wl-summary-unread-cached-mark + wl-summary-read-uncached-mark + wl-summary-important-mark + sync-all no-check)) + (setq new-msgdb (nth 0 sync-result)) + (setq delete-list (nth 1 sync-result)) + (setq crossed (nth 2 sync-result)) + (if sync-result (progn ;; Setup sync-all (if sync-all (wl-summary-sync-all-init)) @@ -1991,24 +2000,19 @@ If ARG is non-nil, checking is omitted." ; (wl-summary-delete-canceled-msgs-from-list ; delete-list ; (wl-summary-buffer-msgdb)))) - (setq diff (elmo-list-diff (elmo-folder-list-messages - folder - 'visible-only - 'in-msgdb) - wl-summary-buffer-number-list)) - (setq append-list (car diff)) - (setq delete-list (cadr diff)) - (when delete-list - (wl-summary-delete-messages-on-buffer - delete-list "Deleting...") + (wl-summary-delete-messages-on-buffer delete-list "Deleting...") (message "Deleting...done")) - (wl-summary-update-status-marks) + (when new-msgdb + (wl-summary-replace-status-marks + wl-summary-new-mark + wl-summary-unread-uncached-mark)) + (setq append-list (elmo-msgdb-get-overview new-msgdb)) (setq curp append-list) (setq num (length curp)) (when append-list (setq i 0) - + ;; set these value for append-message-func (setq overview (elmo-msgdb-get-overview (elmo-folder-msgdb folder))) @@ -2018,10 +2022,9 @@ If ARG is non-nil, checking is omitted." (setq wl-summary-delayed-update nil) (elmo-kill-buffer wl-summary-search-buf-name) (while curp - (setq entity (elmo-msgdb-overview-get-entity - (car curp) (elmo-folder-msgdb folder))) + (setq entity (car curp)) (when (setq update-thread - (wl-summary-insert-message + (wl-summary-append-message-func-internal entity (elmo-folder-msgdb folder) (not sync-all))) (wl-append update-top-list update-thread)) @@ -2034,10 +2037,7 @@ If ARG is non-nil, checking is omitted." (setq i (+ i 1)) (if (or (zerop (% i 5)) (= i num)) (elmo-display-progress - 'wl-summary-sync-update - (if (eq wl-summary-buffer-view 'thread) - "Making thread..." - "Inserting message...") + 'wl-summary-sync-update "Updating thread..." (/ (* i 100) num))))) (when wl-summary-delayed-update (while wl-summary-delayed-update @@ -2046,7 +2046,7 @@ If ARG is non-nil, checking is omitted." (elmo-msgdb-overview-entity-get-number (cdar wl-summary-delayed-update))) (when (setq update-thread - (wl-summary-insert-message + (wl-summary-append-message-func-internal (cdar wl-summary-delayed-update) (elmo-folder-msgdb folder) (not sync-all) t)) @@ -2057,16 +2057,16 @@ If ARG is non-nil, checking is omitted." update-top-list) (wl-thread-update-indent-string-thread (elmo-uniq-list update-top-list))) - (message (if (eq wl-summary-buffer-view 'thread) - "Making thread...done" - "Inserting message...done"))) + (message "Updating thread...done")) + (unless (eq wl-summary-buffer-view 'thread) + (wl-summary-make-number-list)) (wl-summary-set-message-modified) (wl-summary-set-mark-modified) (when (and sync-all (eq wl-summary-buffer-view 'thread)) (elmo-kill-buffer wl-summary-search-buf-name) - (message "Inserting message...") + (message "Inserting thread...") (wl-thread-insert-top) - (message "Inserting message...done")) + (message "Inserting thread...done")) (if elmo-use-database (elmo-database-close)) (run-hooks 'wl-summary-sync-updated-hook) @@ -2080,7 +2080,7 @@ If ARG is non-nil, checking is omitted." (length delete-list) num)))) (setq mes "Quit updating."))) ;; synchronize marks. - (if (and crossed wl-summary-auto-sync-marks) + (if (and wl-summary-auto-sync-marks sync-result) (wl-summary-sync-marks)) ;; scoring (when wl-use-scoring @@ -2105,8 +2105,8 @@ If ARG is non-nil, checking is omitted." (wl-folder-set-folder-updated (elmo-folder-name-internal folder) (list 0 - (let ((lst (wl-summary-count-unread))) - (+ (car lst) (nth 1 lst))) + (let ((pair (wl-summary-count-unread))) + (+ (car pair) (cdr pair))) (elmo-folder-messages folder))) (wl-summary-update-modeline) ;; @@ -2383,15 +2383,10 @@ If ARG, without confirm." (get-buffer-create wl-summary-buffer-name)))) (defun wl-summary-make-number-list () - (save-excursion - (goto-char (point-min)) - (while (not (eobp)) - (setq wl-summary-buffer-number-list - (cons (wl-summary-message-number) - wl-summary-buffer-number-list)) - (forward-line 1)) - (setq wl-summary-buffer-number-list - (nreverse wl-summary-buffer-number-list)))) + (setq wl-summary-buffer-number-list + (mapcar + (lambda (x) (elmo-msgdb-overview-entity-get-number x)) + (elmo-msgdb-get-overview (wl-summary-buffer-msgdb))))) (defun wl-summary-auto-select-msg-p (unread-msg) (and unread-msg @@ -2399,7 +2394,7 @@ If ARG, without confirm." (elmo-msgdb-get-mark (wl-summary-buffer-msgdb) unread-msg) - elmo-msgdb-important-mark)))) + wl-summary-important-mark)))) (defsubst wl-summary-open-folder (folder) ;; Select folder @@ -2645,11 +2640,7 @@ If ARG, without confirm." (elmo-msgdb-get-mark msgdb (elmo-msgdb-overview-entity-get-number - entity)))) - (setq wl-summary-buffer-number-list - (wl-append wl-summary-buffer-number-list - (list (elmo-msgdb-overview-entity-get-number entity)))) - nil)) + entity)))))) (defun wl-summary-default-subject-filter (subject) (let ((case-fold-search t)) @@ -2861,7 +2852,7 @@ If ARG, without confirm." (folder wl-summary-buffer-elmo-folder) (msgdb (wl-summary-buffer-msgdb)) ;;; (number-alist (elmo-msgdb-get-number-alist msgdb)) - new-mark visible mark cur-mark entity) + new-mark visible mark cur-mark) (if number (progn (setq visible (wl-summary-jump-to-msg number)) @@ -2882,20 +2873,22 @@ If ARG, without confirm." ;; visible. (setq cur-mark (wl-summary-persistent-mark)) (or (string= cur-mark " ") - (string= cur-mark elmo-msgdb-read-uncached-mark)))) + (string= cur-mark wl-summary-read-uncached-mark)))) (progn (setq number (or number (wl-summary-message-number))) (setq mark (or mark cur-mark)) (save-match-data (setq new-mark (if (string= mark - elmo-msgdb-read-uncached-mark) - elmo-msgdb-unread-uncached-mark + wl-summary-read-uncached-mark) + wl-summary-unread-uncached-mark (if (elmo-message-use-cache-p folder number) - elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark)))) + wl-summary-unread-mark + wl-summary-unread-uncached-mark)))) ;; server side mark (unless no-server-update - (elmo-folder-unmark-read folder (list number))) + (save-match-data + (unless (elmo-folder-unmark-read folder (list number)) + (error "Setting mark failed")))) (when visible (delete-backward-char 1) (insert new-mark)) @@ -3031,9 +3024,9 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (let ((del-fld (wl-summary-get-delete-folder (wl-summary-buffer-folder-name))) (start (point)) - (unread-marks (list elmo-msgdb-unread-cached-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-new-mark)) + (unread-marks (list wl-summary-unread-cached-mark + wl-summary-unread-uncached-mark + wl-summary-new-mark)) (refiles (append moves dels)) (refile-failures 0) (copy-failures 0) @@ -3072,6 +3065,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (not (null (cdr dst-msgs))) nil ; no-delete nil ; same-number + unread-marks t)) (error nil)) (if result ; succeeded. @@ -3104,6 +3098,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (not (null (cdr dst-msgs))) t ; t is no-delete (copy) nil ; same number + unread-marks t)) (error nil)) (if result ; succeeded. @@ -4007,13 +4002,13 @@ If ARG, exit virtual folder." t) mark (elmo-msgdb-get-mark msgdb number)) (cond - ((string= mark elmo-msgdb-new-mark) ; N + ((string= mark wl-summary-new-mark) ; N (setq stat 'new)) - ((string= mark elmo-msgdb-unread-uncached-mark) ; U + ((string= mark wl-summary-unread-uncached-mark) ; U (setq stat 'unread)) - ((string= mark elmo-msgdb-unread-cached-mark) ; ! + ((string= mark wl-summary-unread-cached-mark) ; ! (setq stat 'unread)) - ((string= mark elmo-msgdb-read-uncached-mark) ; u + ((string= mark wl-summary-read-uncached-mark) ; u (setq stat 'read)) (t ;; no need to mark server. @@ -4024,34 +4019,35 @@ If ARG, exit virtual folder." (not (elmo-file-cache-exists-p (elmo-message-field wl-summary-buffer-elmo-folder number 'message-id)))) - elmo-msgdb-read-uncached-mark + wl-summary-read-uncached-mark nil)) ;; folder mark. (unless no-folder-mark - (elmo-folder-mark-as-read folder (list number))) - (cond ((eq stat 'unread) - (setq wl-summary-buffer-unread-count - (1- wl-summary-buffer-unread-count))) - ((eq stat 'new) - (setq wl-summary-buffer-new-count - (1- wl-summary-buffer-new-count)))) - (wl-summary-update-modeline) - (wl-folder-update-unread - (wl-summary-buffer-folder-name) - (+ wl-summary-buffer-unread-count - wl-summary-buffer-new-count)) - (when stat - ;; set mark on buffer - (when visible - (unless (string= (wl-summary-persistent-mark) new-mark) - (delete-backward-char 1) - (insert (or new-mark " ")))) - ;; set msgdb mark. - (unless (string= mark new-mark) - (elmo-msgdb-set-mark msgdb number new-mark)) - (wl-summary-set-mark-modified)) - (if (and visible wl-summary-highlight) - (wl-highlight-summary-current-line nil nil t)) + (setq marked (elmo-folder-mark-as-read folder (list number)))) + (when (or no-folder-mark marked) + (cond ((eq stat 'unread) + (setq wl-summary-buffer-unread-count + (1- wl-summary-buffer-unread-count))) + ((eq stat 'new) + (setq wl-summary-buffer-new-count + (1- wl-summary-buffer-new-count)))) + (wl-summary-update-modeline) + (wl-folder-update-unread + (wl-summary-buffer-folder-name) + (+ wl-summary-buffer-unread-count + wl-summary-buffer-new-count)) + (when stat + ;; set mark on buffer + (when visible + (unless (string= (wl-summary-persistent-mark) new-mark) + (delete-backward-char 1) + (insert (or new-mark " ")))) + ;; set msgdb mark. + (unless (string= mark new-mark) + (elmo-msgdb-set-mark msgdb number new-mark)) + (wl-summary-set-mark-modified)) + (if (and visible wl-summary-highlight) + (wl-highlight-summary-current-line nil nil t))) (set-buffer-modified-p nil) (if stat (run-hooks 'wl-summary-unread-message-hook)) @@ -4097,7 +4093,7 @@ If ARG, exit virtual folder." wl-summary-buffer-elmo-folder number 'message-id)) - (if (string= mark elmo-msgdb-important-mark) + (if (string= mark wl-summary-important-mark) (progn ;; server side mark (save-match-data @@ -4120,16 +4116,16 @@ If ARG, exit virtual folder." (elmo-folder-mark-as-important folder (list number)))) (when visible (delete-backward-char 1) - (insert elmo-msgdb-important-mark)) + (insert wl-summary-important-mark)) (elmo-msgdb-set-mark msgdb number - elmo-msgdb-important-mark) + wl-summary-important-mark) (if (eq (elmo-file-cache-exists-p message-id) 'entire) (elmo-folder-mark-as-read folder (list number)) ;; Force cache message. (elmo-message-encache folder number 'read)) (unless no-server-update (elmo-msgdb-global-mark-set message-id - elmo-msgdb-important-mark))) + wl-summary-important-mark))) (wl-summary-set-mark-modified))) (if (and visible wl-summary-highlight) (wl-highlight-summary-current-line nil nil t)))) @@ -4301,25 +4297,25 @@ If ARG, exit virtual folder." (defvar wl-summary-move-spec-plugged-alist (` ((new . ((t . nil) - (p . (, elmo-msgdb-new-mark)) + (p . (, wl-summary-new-mark)) (p . (, (wl-regexp-opt - (list elmo-msgdb-unread-uncached-mark - elmo-msgdb-unread-cached-mark)))) - (p . (, (regexp-quote elmo-msgdb-important-mark))))) + (list wl-summary-unread-uncached-mark + wl-summary-unread-cached-mark)))) + (p . (, (regexp-quote wl-summary-important-mark))))) (unread . ((t . nil) (p . (, (wl-regexp-opt - (list elmo-msgdb-new-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-unread-cached-mark)))) - (p . (, (regexp-quote elmo-msgdb-important-mark)))))))) + (list wl-summary-new-mark + wl-summary-unread-uncached-mark + wl-summary-unread-cached-mark)))) + (p . (, (regexp-quote wl-summary-important-mark)))))))) (defvar wl-summary-move-spec-unplugged-alist (` ((new . ((t . nil) - (p . (, elmo-msgdb-unread-cached-mark)) - (p . (, (regexp-quote elmo-msgdb-important-mark))))) + (p . (, wl-summary-unread-cached-mark)) + (p . (, (regexp-quote wl-summary-important-mark))))) (unread . ((t . nil) - (p . (, elmo-msgdb-unread-cached-mark)) - (p . (, (regexp-quote elmo-msgdb-important-mark)))))))) + (p . (, wl-summary-unread-cached-mark)) + (p . (, (regexp-quote wl-summary-important-mark)))))))) (defsubst wl-summary-next-message (num direction hereto) (if wl-summary-buffer-next-message-function @@ -5028,8 +5024,8 @@ Use function list is `wl-summary-write-current-folder-functions'." () (setq skip-pmark-regexp (wl-regexp-opt (list " " - elmo-msgdb-unread-cached-mark - elmo-msgdb-important-mark)))) + wl-summary-unread-cached-mark + wl-summary-important-mark)))) (while (and skip (not (if downward (eobp) (bobp)))) (if downward diff --git a/wl/wl-thread.el b/wl/wl-thread.el index c9ca3d6..5e5bca3 100644 --- a/wl/wl-thread.el +++ b/wl/wl-thread.el @@ -100,7 +100,7 @@ msgs-stack children) (while msgs (setq wl-summary-buffer-number-list (cons (car entity) - wl-summary-buffer-number-list)) + wl-summary-buffer-number-list)) (setq msgs (cdr msgs)) (setq children (wl-thread-entity-get-children entity)) (if children @@ -362,10 +362,10 @@ ENTITY is returned." (interactive) (dolist (number (elmo-folder-list-messages-mark-match wl-summary-buffer-elmo-folder - (wl-regexp-opt (list elmo-msgdb-unread-uncached-mark - elmo-msgdb-unread-cached-mark - elmo-msgdb-new-mark - elmo-msgdb-important-mark)))) + (wl-regexp-opt (list wl-summary-unread-uncached-mark + wl-summary-unread-cached-mark + wl-summary-new-mark + wl-summary-important-mark)))) (wl-thread-entity-force-open (wl-thread-get-entity number)))) (defsubst wl-thread-maybe-get-children-num (msg) @@ -737,9 +737,9 @@ Message is inserted to the summary buffer." (setq cur-mark (elmo-msgdb-get-mark msgdb msg)) (elmo-msgdb-set-mark msgdb msg - (if (string= cur-mark elmo-msgdb-important-mark) + (if (string= cur-mark wl-summary-important-mark) nil - elmo-msgdb-important-mark)) + wl-summary-important-mark)) (wl-summary-set-mark-modified))) (defun wl-thread-mark-as-read (&optional arg) @@ -831,7 +831,7 @@ Message is inserted to the summary buffer." (setq cur (1+ cur)) (if (or (zerop (% cur 2)) (= cur len)) (elmo-display-progress - 'wl-thread-insert-top "Inserting message..." + 'wl-thread-insert-top "Inserting thread..." (/ (* cur 100) len))))))) (defsubst wl-thread-insert-entity-sub (indent entity parent-entity all) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index a9baff0..d1f1b3c 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -905,11 +905,34 @@ Default is for 'followup-to-me'." :type 'boolean :group 'wl-folder) +(defcustom wl-summary-unread-mark "!" + "Mark for unread message." + :type '(string :tag "Mark") + :group 'wl-summary-marks) +(defcustom wl-summary-important-mark "$" + "Mark for important message." + :type '(string :tag "Mark") + :group 'wl-summary-marks) +(defcustom wl-summary-new-mark "N" + "Mark for new message." + :type '(string :tag "Mark") + :group 'wl-summary-marks) +(defcustom wl-summary-unread-uncached-mark "U" + "Mark for unread and uncached message." + :type '(string :tag "Mark") + :group 'wl-summary-marks) +(defcustom wl-summary-unread-cached-mark "!" + "Mark for unread but already cached message." + :type '(string :tag "Mark") + :group 'wl-summary-marks) +(defcustom wl-summary-read-uncached-mark "u" + "Mark for read but uncached message." + :type '(string :tag "Mark") + :group 'wl-summary-marks) (defcustom wl-summary-score-over-mark "+" "Score mark used for messages with high scores." :type '(string :tag "Mark") :group 'wl-summary-marks) - (defcustom wl-summary-score-below-mark "-" "Score mark used for messages with low scores." :type '(string :tag "Mark") @@ -965,7 +988,7 @@ This variable is local to the summary buffers." :group 'wl-score) (defcustom wl-summary-score-marks - (list elmo-msgdb-new-mark) + (list wl-summary-new-mark) "Persistent marks to scoring." :type '(repeat (string :tag "Mark")) :group 'wl-score) @@ -1682,9 +1705,9 @@ This wrapper is generated by the mail system when rejecting a letter." :group 'wl-pref) (defcustom wl-summary-auto-refile-skip-marks - (list elmo-msgdb-new-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-unread-cached-mark) + (list wl-summary-new-mark + wl-summary-unread-uncached-mark + wl-summary-unread-cached-mark) "Persistent marks to skip auto-refiling." :type '(repeat (string :tag "Mark")) :group 'wl-summary) @@ -1704,8 +1727,8 @@ the message is skipped at cursor move." :group 'wl-summary) (defcustom wl-summary-incorporate-marks - (list elmo-msgdb-new-mark - elmo-msgdb-unread-uncached-mark) + (list wl-summary-new-mark + wl-summary-unread-uncached-mark) "Persistent marks to prefetch at `wl-summary-incorporate'." :type '(repeat (string :tag "Mark")) :group 'wl-summary) @@ -2290,10 +2313,11 @@ ex. :group 'wl-expire) (defcustom wl-summary-expire-reserve-marks - (list elmo-msgdb-important-mark - elmo-msgdb-new-mark - elmo-msgdb-unread-uncached-mark - elmo-msgdb-unread-cached-mark) + (list wl-summary-important-mark + wl-summary-new-mark + wl-summary-unread-mark + wl-summary-unread-uncached-mark + wl-summary-unread-cached-mark) "Permanent marks of reserved message when expire. Don't reserve temporary mark message.