* wl-vars.el (wl-summary-unread-mark, wl-summary-important-mark,
authorteranisi <teranisi>
Fri, 13 Sep 2002 04:30:41 +0000 (04:30 +0000)
committerteranisi <teranisi>
Fri, 13 Sep 2002 04:30:41 +0000 (04:30 +0000)
wl-summary-new-mark, wl-summary-unread-uncached-mark,
wl-summary-unread-cached-mark, wl-summary-read-uncached-mark):
Renamed to the elmo-msgdb-*-mark.
(wl-summary-score-marks): Follow the change above.
(wl-summary-auto-refile-skip-marks): Ditto.
(wl-summary-incorporate-marks): Ditto.
(wl-summary-expire-reserve-marks): Ditto.

* wl-thread.el (wl-thread-open-all-unread): Follow the variable name
changes.
(wl-thread-insert-top): Changed updating message.

* wl-summary.el (wl-summary-buffer-answered-count): New buffer local variable.
(wl-summary-count-unread): Count answered marks.
(wl-summary-rescan): Call wl-summary-insert-message instead of
wl-summary-append-message-func-internal.
(wl-summary-rescan): Don't call wl-summary-make-number-list.
(wl-summary-prefetch-msg): Follow the variable name changes.
(wl-summary-prefetch-region): Ditto.
(wl-summary-mark-as-read-all): Follow the API changes;
Don't call elmo-folder-replace-marks.
(wl-summary-delete-cache): Follow the variable name changes.
(wl-summary-resume-cache-status): Ditto.
(wl-summary-update-status-marks): New function.
(wl-summary-insert-message): New function.
(wl-summary-sync-marks): Follow the variable name changes.
(wl-summary-sync-update): Synchronize to the msgdb, too;
Changed update messages.
(wl-summary-make-number-list): Rewrite.
(wl-summary-insert-sequential): Update wl-summary-buffer-number-list.
(wl-summary-mark-as-unread): Follow the API changes.
(wl-summary-exec-subr): Follow the variable name changes.
(wl-summary-mark-as-read): Ditto.
(wl-summary-move-spec-plugged-alist): Ditto.
(wl-summary-move-spec-unplugged-alist): Ditto.
(wl-summary-cursor-move-surface): Ditto.

* wl-highlight.el (wl-highlight-summary-line-string): Follow the
variable name changes.
(wl-highlight-summary-current-line): Ditto.

* wl-expire.el (wl-expire-refile): Follow the API change in
elmo-folder-move-messages.
(wl-expire-refile-with-copy-reserve-msg): Ditto.
(wl-summary-archive): Use elmo-folder-msgdb instead of
elmo-msgdb-load.

wl/ChangeLog
wl/wl-expire.el
wl/wl-highlight.el
wl/wl-summary.el
wl/wl-thread.el
wl/wl-vars.el

index d6370da..3b584f0 100644 (file)
@@ -1,3 +1,54 @@
+2002-09-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-vars.el (wl-summary-unread-mark, wl-summary-important-mark,
+       wl-summary-new-mark, wl-summary-unread-uncached-mark,
+       wl-summary-unread-cached-mark, wl-summary-read-uncached-mark):
+       Renamed to the elmo-msgdb-*-mark.
+       (wl-summary-score-marks): Follow the change above.
+       (wl-summary-auto-refile-skip-marks): Ditto.
+       (wl-summary-incorporate-marks): Ditto.
+       (wl-summary-expire-reserve-marks): Ditto.
+
+       * wl-thread.el (wl-thread-open-all-unread): Follow the variable name
+       changes.
+       (wl-thread-insert-top): Changed updating message.
+
+       * wl-summary.el (wl-summary-buffer-answered-count): New buffer local
+       variable.
+       (wl-summary-count-unread): Count answered marks.
+       (wl-summary-rescan): Call wl-summary-insert-message instead of
+       wl-summary-append-message-func-internal.
+       (wl-summary-rescan): Don't call wl-summary-make-number-list.
+       (wl-summary-prefetch-msg): Follow the variable name changes.
+       (wl-summary-prefetch-region): Ditto.
+       (wl-summary-mark-as-read-all): Follow the API changes;
+       Don't call elmo-folder-replace-marks.
+       (wl-summary-delete-cache): Follow the variable name changes.
+       (wl-summary-resume-cache-status): Ditto.
+       (wl-summary-update-status-marks): New function.
+       (wl-summary-insert-message): New function.
+       (wl-summary-sync-marks): Follow the variable name changes.
+       (wl-summary-sync-update): Synchronize to the msgdb, too;
+       Changed update messages.
+       (wl-summary-make-number-list): Rewrite.
+       (wl-summary-insert-sequential): Update wl-summary-buffer-number-list.
+       (wl-summary-mark-as-unread): Follow the API changes.
+       (wl-summary-exec-subr): Follow the variable name changes.
+       (wl-summary-mark-as-read): Ditto.
+       (wl-summary-move-spec-plugged-alist): Ditto.
+       (wl-summary-move-spec-unplugged-alist): Ditto.
+       (wl-summary-cursor-move-surface): Ditto.
+
+       * wl-highlight.el (wl-highlight-summary-line-string): Follow the
+       variable name changes.
+       (wl-highlight-summary-current-line): Ditto.
+
+       * wl-expire.el (wl-expire-refile): Follow the API change in
+       elmo-folder-move-messages.
+       (wl-expire-refile-with-copy-reserve-msg): Ditto.
+       (wl-summary-archive): Use elmo-folder-msgdb instead of
+       elmo-msgdb-load.
+
 2002-09-12  Yoichi NAKAYAMA  <yoichi@eken.phys.nagoya-u.ac.jp>
 
        * wl-addrmgr.el (wl-addrmgr-apply-exec): Call wl-draft interactively
index 165e07e..d3f2b94 100644 (file)
                                         t
                                         copy
                                         preserve-number
-                                        nil
                                         wl-expire-add-seen-list)
              (progn
                (wl-expire-append-log
@@ -205,7 +204,6 @@ 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)))
@@ -813,7 +811,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-msgdb-load folder)))
+                   (elmo-folder-msgdb folder)))
         (msgs (if (not nolist)
                   (elmo-folder-list-messages folder)
                 (mapcar 'car (elmo-msgdb-get-number-alist msgdb))))
index 4391cf5..9cbfd21 100644 (file)
 (defun wl-highlight-summary-line-string (line mark temp-mark indent)
   (let (fsymbol)
     (cond ((and (string= temp-mark "+")
-               (member mark (list wl-summary-unread-cached-mark
-                                  wl-summary-unread-uncached-mark
-                                  wl-summary-new-mark)))
+               (member mark (list elmo-msgdb-unread-cached-mark
+                                  elmo-msgdb-unread-uncached-mark
+                                  elmo-msgdb-new-mark)))
           (setq fsymbol 'wl-highlight-summary-high-unread-face))
          ((and (string= temp-mark "-")
-               (member mark (list wl-summary-unread-cached-mark
-                                  wl-summary-unread-uncached-mark
-                                  wl-summary-new-mark)))
+               (member mark (list elmo-msgdb-unread-cached-mark
+                                  elmo-msgdb-unread-uncached-mark
+                                  elmo-msgdb-new-mark)))
           (setq fsymbol 'wl-highlight-summary-low-unread-face))
          ((string= temp-mark "o")
           (setq fsymbol 'wl-highlight-summary-refiled-face))
           (setq fsymbol 'wl-highlight-summary-deleted-face))
          ((string= temp-mark "*")
           (setq fsymbol 'wl-highlight-summary-temp-face))
-         ((string= mark wl-summary-new-mark)
+         ((string= mark elmo-msgdb-new-mark)
           (setq fsymbol 'wl-highlight-summary-new-face))
-         ((member mark (list wl-summary-unread-cached-mark
-                             wl-summary-unread-uncached-mark))
+         ((member mark (list elmo-msgdb-unread-cached-mark
+                             elmo-msgdb-unread-uncached-mark))
           (setq fsymbol 'wl-highlight-summary-unread-face))
-         ((or (string= mark wl-summary-important-mark))
+         ((or (string= mark elmo-msgdb-important-mark))
           (setq fsymbol 'wl-highlight-summary-important-face))
          ((string= temp-mark "-")
           (setq fsymbol 'wl-highlight-summary-low-read-face))
       (if (not fsymbol)
          (cond
           ((and (string= temp-mark "+")
-                (member status-mark (list wl-summary-unread-cached-mark
-                                          wl-summary-unread-uncached-mark
-                                          wl-summary-new-mark)))
+                (member status-mark (list elmo-msgdb-unread-cached-mark
+                                          elmo-msgdb-unread-uncached-mark
+                                          elmo-msgdb-new-mark)))
            (setq fsymbol 'wl-highlight-summary-high-unread-face))
           ((and (string= temp-mark "-")
-                (member status-mark (list wl-summary-unread-cached-mark
-                                          wl-summary-unread-uncached-mark
-                                          wl-summary-new-mark)))
+                (member status-mark (list elmo-msgdb-unread-cached-mark
+                                          elmo-msgdb-unread-uncached-mark
+                                          elmo-msgdb-new-mark)))
            (setq fsymbol 'wl-highlight-summary-low-unread-face))
-          ((string= status-mark wl-summary-new-mark)
+          ((string= status-mark elmo-msgdb-new-mark)
            (setq fsymbol 'wl-highlight-summary-new-face))
-          ((member status-mark (list wl-summary-unread-cached-mark
-                                     wl-summary-unread-uncached-mark))
+          ((member status-mark (list elmo-msgdb-unread-cached-mark
+                                     elmo-msgdb-unread-uncached-mark))
            (setq fsymbol 'wl-highlight-summary-unread-face))
-          ((string= status-mark wl-summary-important-mark)
+          ((string= status-mark elmo-msgdb-important-mark)
            (setq fsymbol 'wl-highlight-summary-important-face))
           ;; score mark
           ((string= temp-mark "-")
index cceed44..de78174 100644 (file)
@@ -83,6 +83,7 @@
 (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)
 (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)
 (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))))
 
@@ -572,15 +569,12 @@ See also variable `wl-use-petname'."
       (wl-summary-redisplay)))
 
 (defun wl-summary-count-unread ()
-  (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))))
+  (let ((lst (elmo-msgdb-count-marks (wl-summary-buffer-msgdb))))
     (if (eq major-mode 'wl-summary-mode)
-       (setq wl-summary-buffer-new-count (car pair)
-             wl-summary-buffer-unread-count (cdr pair)))
-    pair))
+       (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))
 
 (defun wl-summary-message-string (&optional use-cache)
   "Return full body string of current message.
@@ -950,8 +944,6 @@ 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)
@@ -978,7 +970,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-append-message-func-internal entity msgdb nil)
+      (wl-summary-insert-message entity msgdb nil)
       (setq curp (cdr curp))
       (when (> num elmo-display-progress-threshold)
        (setq i (+ i 1))
@@ -992,7 +984,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-append-message-func-internal
+       (wl-summary-insert-message
         (cdar wl-summary-delayed-update) msgdb nil t)
        (setq wl-summary-delayed-update (cdr wl-summary-delayed-update))))
     (message "Constructing summary structure...done")
@@ -1001,8 +993,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'."
        (progn
          (message "Inserting thread...")
          (wl-thread-insert-top)
-         (message "Inserting thread...done"))
-      (wl-summary-make-number-list))
+         (message "Inserting thread...done")))
     (when wl-use-scoring
       (setq wl-summary-scored nil)
       (wl-summary-score-headers nil msgdb
@@ -1436,15 +1427,15 @@ If ARG is non-nil, checking is omitted."
                    (setq new-mark
                          (cond
                           ((string= mark
-                                    wl-summary-unread-uncached-mark)
-                           wl-summary-unread-cached-mark)
-                          ((string= mark wl-summary-new-mark)
+                                    elmo-msgdb-unread-uncached-mark)
+                           elmo-msgdb-unread-cached-mark)
+                          ((string= mark elmo-msgdb-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))
-                           wl-summary-unread-cached-mark)
-                          ((string= mark wl-summary-read-uncached-mark)
+                           elmo-msgdb-unread-cached-mark)
+                          ((string= mark elmo-msgdb-read-uncached-mark)
                            nil)
                           (t mark)))
                    (elmo-msgdb-set-mark msgdb number new-mark)
@@ -1458,9 +1449,9 @@ If ARG is non-nil, checking is omitted."
                  new-mark)))))))
 
 ;;(defvar wl-summary-message-uncached-marks
-;;  (list wl-summary-new-mark
-;;     wl-summary-unread-uncached-mark
-;;     wl-summary-read-uncached-mark))
+;;  (list elmo-msgdb-new-mark
+;;     elmo-msgdb-unread-uncached-mark
+;;     elmo-msgdb-read-uncached-mark))
 
 (defun wl-summary-prefetch-region (beg end &optional prefetch-marks)
   (interactive "r")
@@ -1507,8 +1498,8 @@ If ARG is non-nil, checking is omitted."
                           (wl-summary-prefetch))
                       (wl-summary-prefetch-msg (car targets))))
          (if (if prefetch-marks
-                 (string= mark wl-summary-unread-cached-mark)
-               (or (string= mark wl-summary-unread-cached-mark)
+                 (string= mark elmo-msgdb-unread-cached-mark)
+               (or (string= mark elmo-msgdb-unread-cached-mark)
                    (string= mark " ")))
              (message "Prefetching... %d/%d message(s)"
                       (setq count (+ 1 count)) length))
@@ -1681,39 +1672,28 @@ 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
-                                  (list wl-summary-unread-cached-mark
-                                        wl-summary-unread-uncached-mark
-                                        wl-summary-new-mark)))
+                                  folder))
        (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 wl-summary-important-mark))
-                      (not (string= mark wl-summary-read-uncached-mark)))
+                      (not (string= mark elmo-msgdb-important-mark))
+                      (not (string= mark elmo-msgdb-read-uncached-mark)))
              (delete-backward-char 1)
              (if (or (not (elmo-message-use-cache-p folder msg))
-                     (string= mark wl-summary-unread-cached-mark))
+                     (string= mark elmo-msgdb-unread-cached-mark))
                  (progn
                    (insert " ")
                    (elmo-msgdb-set-mark msgdb msg nil))
                ;; New mark and unread-uncached mark
-               (insert wl-summary-read-uncached-mark)
+               (insert elmo-msgdb-read-uncached-mark)
                (elmo-msgdb-set-mark
-                msgdb msg wl-summary-read-uncached-mark))
+                msgdb msg elmo-msgdb-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 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)
@@ -1735,15 +1715,15 @@ If ARG is non-nil, checking is omitted."
           mark number unread new-mark)
       (setq mark (wl-summary-persistent-mark))
       (cond
-       ((or (string= mark wl-summary-new-mark)
-           (string= mark wl-summary-unread-uncached-mark)
-           (string= mark wl-summary-important-mark))
+       ((or (string= mark elmo-msgdb-new-mark)
+           (string= mark elmo-msgdb-unread-uncached-mark)
+           (string= mark elmo-msgdb-important-mark))
        ;; noop
        )
-       ((string= mark wl-summary-unread-cached-mark)
-       (setq new-mark wl-summary-unread-uncached-mark))
+       ((string= mark elmo-msgdb-unread-cached-mark)
+       (setq new-mark elmo-msgdb-unread-uncached-mark))
        (t
-       (setq new-mark wl-summary-read-uncached-mark)))
+       (setq new-mark elmo-msgdb-read-uncached-mark)))
       (when new-mark
        (setq number (wl-summary-message-number))
        (delete-backward-char 1)
@@ -1780,16 +1760,16 @@ If ARG is non-nil, checking is omitted."
        (setq set-mark nil)
        (if (elmo-file-cache-exists-p msgid)
            (if (or
-                (string= mark wl-summary-unread-uncached-mark) ; U -> !
-                (string= mark wl-summary-new-mark)             ; N -> !
+                (string= mark elmo-msgdb-unread-uncached-mark) ; U -> !
+                (string= mark elmo-msgdb-new-mark)             ; N -> !
                 )
-               (setq set-mark wl-summary-unread-cached-mark)
-             (if (string= mark wl-summary-read-uncached-mark)  ; u -> ' '
+               (setq set-mark elmo-msgdb-unread-cached-mark)
+             (if (string= mark elmo-msgdb-read-uncached-mark)  ; u -> ' '
                  (setq set-mark " ")))
          (if (string= mark " ")
-             (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
+             (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
              )))
        (when set-mark
          (delete-backward-char 1)
@@ -1863,6 +1843,25 @@ 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
@@ -1882,10 +1881,10 @@ If ARG is non-nil, checking is omitted."
                   (error "Trash Folder is not created"))))
               wl-trash-folder)))))
 
-(defun wl-summary-get-append-message-func ()
+(defun wl-summary-insert-message (&rest args)
   (if (eq wl-summary-buffer-view 'thread)
-      'wl-summary-insert-thread-entity
-    'wl-summary-insert-sequential))
+      (apply 'wl-summary-insert-thread-entity args)
+    (apply 'wl-summary-insert-sequential args)))
 
 (defun wl-summary-sort ()
   (interactive)
@@ -1901,8 +1900,9 @@ 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)
-       unread-marks importants unreads
+       importants unreads
        importants-in-db unreads-in-db diff diffs
        mes progress)
     ;; synchronize marks.
@@ -1910,27 +1910,22 @@ If ARG is non-nil, checking is omitted."
                    wl-summary-buffer-elmo-folder)
                   'internal))
       (message "Updating marks...")
-      (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
+      (setq importants-in-db (elmo-folder-list-messages-mark-match
                              wl-summary-buffer-elmo-folder
-                             (regexp-quote wl-summary-important-mark))
+                             (regexp-quote elmo-msgdb-important-mark))
            unreads-in-db (elmo-folder-list-messages-mark-match
                           wl-summary-buffer-elmo-folder
-                          (wl-regexp-opt unread-marks))
+                          (wl-regexp-opt (elmo-msgdb-unread-marks)))
            importants (elmo-folder-list-importants
-                       wl-summary-buffer-elmo-folder
-                       wl-summary-important-mark)
+                       wl-summary-buffer-elmo-folder)
            unreads (elmo-folder-list-unreads
-                    wl-summary-buffer-elmo-folder
-                    unread-marks))
+                    wl-summary-buffer-elmo-folder))
       (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)
-                                     wl-summary-important-mark
+                                     elmo-msgdb-important-mark
                                      'no-server)
        (setq diffs (cdr diffs)))
       (setq diffs (car diff)) ; important-appends
@@ -1961,34 +1956,22 @@ If ARG is non-nil, checking is omitted."
         (buffer-read-only nil)
         gc-message
         overview number-alist
-        curp num i new-msgdb
+        curp num i diff
         append-list delete-list crossed
         update-thread update-top-list
-        expunged mes sync-result entity)
+        expunged mes 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 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
+         (setq crossed (elmo-folder-synchronize folder sync-all no-check))
+         (if crossed
              (progn
                ;; Setup sync-all
                (if sync-all (wl-summary-sync-all-init))
@@ -1999,19 +1982,24 @@ 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"))
-               (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))
+               (wl-summary-update-status-marks)
                (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)))
@@ -2021,9 +2009,10 @@ 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 (car curp))
+                   (setq entity (elmo-msgdb-overview-get-entity
+                                 (car curp) (elmo-folder-msgdb folder)))
                    (when (setq update-thread
-                               (wl-summary-append-message-func-internal
+                               (wl-summary-insert-message
                                 entity (elmo-folder-msgdb folder)
                                 (not sync-all)))
                      (wl-append update-top-list update-thread))
@@ -2036,7 +2025,10 @@ 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 "Updating thread..."
+                          'wl-summary-sync-update
+                          (if (eq wl-summary-buffer-view 'thread)
+                              "Making thread..."
+                            "Inserting message...")
                           (/ (* i 100) num)))))
                  (when wl-summary-delayed-update
                    (while wl-summary-delayed-update
@@ -2045,7 +2037,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-append-message-func-internal
+                                 (wl-summary-insert-message
                                   (cdar wl-summary-delayed-update)
                                   (elmo-folder-msgdb folder)
                                   (not sync-all) t))
@@ -2056,16 +2048,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 "Updating thread...done"))
-               (unless (eq wl-summary-buffer-view 'thread)
-                 (wl-summary-make-number-list))
+                 (message (if (eq wl-summary-buffer-view 'thread)
+                              "Making thread...done"
+                            "Inserting message...done")))
                (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 thread...")
+                 (message "Inserting message...")
                  (wl-thread-insert-top)
-                 (message "Inserting thread...done"))
+                 (message "Inserting message...done"))
                (if elmo-use-database
                    (elmo-database-close))
                (run-hooks 'wl-summary-sync-updated-hook)
@@ -2079,7 +2071,7 @@ If ARG is non-nil, checking is omitted."
                                (length delete-list) num))))
            (setq mes "Quit updating.")))
       ;; synchronize marks.
-      (if (and wl-summary-auto-sync-marks sync-result)
+      (if (and crossed wl-summary-auto-sync-marks)
          (wl-summary-sync-marks))
       ;; scoring
       (when wl-use-scoring
@@ -2104,8 +2096,8 @@ If ARG is non-nil, checking is omitted."
       (wl-folder-set-folder-updated
        (elmo-folder-name-internal folder)
        (list 0
-            (let ((pair (wl-summary-count-unread)))
-              (+ (car pair) (cdr pair)))
+            (let ((lst (wl-summary-count-unread)))
+              (+ (car lst) (nth 1 lst)))
             (elmo-folder-messages folder)))
       (wl-summary-update-modeline)
       ;;
@@ -2382,10 +2374,15 @@ If ARG, without confirm."
        (get-buffer-create wl-summary-buffer-name))))
 
 (defun wl-summary-make-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)))))
+  (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))))
 
 (defun wl-summary-auto-select-msg-p (unread-msg)
   (and unread-msg
@@ -2393,7 +2390,7 @@ If ARG, without confirm."
             (elmo-msgdb-get-mark
              (wl-summary-buffer-msgdb)
              unread-msg)
-            wl-summary-important-mark))))
+            elmo-msgdb-important-mark))))
 
 (defsubst wl-summary-open-folder (folder)
   ;; Select folder
@@ -2639,7 +2636,11 @@ If ARG, without confirm."
                             (elmo-msgdb-get-mark
                              msgdb
                              (elmo-msgdb-overview-entity-get-number
-                              entity))))))
+                              entity))))
+    (setq wl-summary-buffer-number-list
+         (wl-append wl-summary-buffer-number-list
+                    (list (elmo-msgdb-overview-entity-get-number entity))))
+    nil))
 
 (defun wl-summary-default-subject-filter (subject)
   (let ((case-fold-search t))
@@ -2844,7 +2845,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)
+         new-mark visible mark cur-mark entity)
       (if number
          (progn
            (setq visible (wl-summary-jump-to-msg number))
@@ -2865,22 +2866,20 @@ If ARG, without confirm."
                ;; visible.
                (setq cur-mark (wl-summary-persistent-mark))
                (or (string= cur-mark " ")
-                   (string= cur-mark wl-summary-read-uncached-mark))))
+                   (string= cur-mark elmo-msgdb-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
-                                         wl-summary-read-uncached-mark)
-                                wl-summary-unread-uncached-mark
+                                         elmo-msgdb-read-uncached-mark)
+                                elmo-msgdb-unread-uncached-mark
                               (if (elmo-message-use-cache-p folder number)
-                                  wl-summary-unread-mark
-                                wl-summary-unread-uncached-mark))))
+                                  elmo-msgdb-unread-cached-mark
+                                elmo-msgdb-unread-uncached-mark))))
            ;; server side mark
            (unless no-server-update
-             (save-match-data
-               (unless (elmo-folder-unmark-read folder (list number))
-                 (error "Setting mark failed"))))
+             (elmo-folder-unmark-read folder (list number)))
            (when visible
              (delete-backward-char 1)
              (insert new-mark))
@@ -3016,9 +3015,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 wl-summary-unread-cached-mark
-                               wl-summary-unread-uncached-mark
-                               wl-summary-new-mark))
+           (unread-marks (list elmo-msgdb-unread-cached-mark
+                               elmo-msgdb-unread-uncached-mark
+                               elmo-msgdb-new-mark))
            (refiles (append moves dels))
            (refile-failures 0)
            (copy-failures 0)
@@ -3057,7 +3056,6 @@ 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.
@@ -3090,7 +3088,6 @@ 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.
@@ -3954,13 +3951,13 @@ If ARG, exit virtual folder."
                      t)
            mark (elmo-msgdb-get-mark msgdb number))
       (cond
-       ((string= mark wl-summary-new-mark) ; N
+       ((string= mark elmo-msgdb-new-mark) ; N
        (setq stat 'new))
-       ((string= mark wl-summary-unread-uncached-mark) ; U
+       ((string= mark elmo-msgdb-unread-uncached-mark) ; U
        (setq stat 'unread))
-       ((string= mark wl-summary-unread-cached-mark)  ; !
+       ((string= mark elmo-msgdb-unread-cached-mark)  ; !
        (setq stat 'unread))
-       ((string= mark wl-summary-read-uncached-mark)  ; u
+       ((string= mark elmo-msgdb-read-uncached-mark)  ; u
        (setq stat 'read))
        (t
        ;; no need to mark server.
@@ -3971,35 +3968,34 @@ If ARG, exit virtual folder."
                     (not (elmo-file-cache-exists-p
                           (elmo-message-field wl-summary-buffer-elmo-folder
                                               number 'message-id))))
-               wl-summary-read-uncached-mark
+               elmo-msgdb-read-uncached-mark
              nil))
       ;; folder mark.
       (unless no-folder-mark
-       (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)))
+       (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))
       (set-buffer-modified-p nil)
       (if stat
          (run-hooks 'wl-summary-unread-message-hook))
@@ -4045,7 +4041,7 @@ If ARG, exit virtual folder."
                              wl-summary-buffer-elmo-folder
                              number
                              'message-id))
-           (if (string= mark wl-summary-important-mark)
+           (if (string= mark elmo-msgdb-important-mark)
                (progn
                  ;; server side mark
                  (save-match-data
@@ -4068,16 +4064,16 @@ If ARG, exit virtual folder."
                  (elmo-folder-mark-as-important folder (list number))))
              (when visible
                (delete-backward-char 1)
-               (insert wl-summary-important-mark))
+               (insert elmo-msgdb-important-mark))
              (elmo-msgdb-set-mark msgdb number
-                                  wl-summary-important-mark)
+                                  elmo-msgdb-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
-                                           wl-summary-important-mark)))
+                                           elmo-msgdb-important-mark)))
            (wl-summary-set-mark-modified)))
       (if (and visible wl-summary-highlight)
          (wl-highlight-summary-current-line nil nil t))))
@@ -4262,25 +4258,25 @@ If ARG, exit virtual folder."
 
 (defvar wl-summary-move-spec-plugged-alist
   (` ((new . ((t . nil)
-             (p . (, wl-summary-new-mark))
+             (p . (, elmo-msgdb-new-mark))
              (p . (, (wl-regexp-opt
-                      (list wl-summary-unread-uncached-mark
-                            wl-summary-unread-cached-mark))))
-             (p . (, (regexp-quote wl-summary-important-mark)))))
+                      (list elmo-msgdb-unread-uncached-mark
+                            elmo-msgdb-unread-cached-mark))))
+             (p . (, (regexp-quote elmo-msgdb-important-mark)))))
       (unread . ((t . nil)
                 (p . (, (wl-regexp-opt
-                         (list wl-summary-new-mark
-                               wl-summary-unread-uncached-mark
-                               wl-summary-unread-cached-mark))))
-                (p . (, (regexp-quote wl-summary-important-mark))))))))
+                         (list elmo-msgdb-new-mark
+                               elmo-msgdb-unread-uncached-mark
+                               elmo-msgdb-unread-cached-mark))))
+                (p . (, (regexp-quote elmo-msgdb-important-mark))))))))
 
 (defvar wl-summary-move-spec-unplugged-alist
   (` ((new . ((t . nil)
-             (p . (, wl-summary-unread-cached-mark))
-             (p . (, (regexp-quote wl-summary-important-mark)))))
+             (p . (, elmo-msgdb-unread-cached-mark))
+             (p . (, (regexp-quote elmo-msgdb-important-mark)))))
       (unread . ((t . nil)
-                (p . (, wl-summary-unread-cached-mark))
-                (p . (, (regexp-quote wl-summary-important-mark))))))))
+                (p . (, elmo-msgdb-unread-cached-mark))
+                (p . (, (regexp-quote elmo-msgdb-important-mark))))))))
 
 (defsubst wl-summary-next-message (num direction hereto)
   (if wl-summary-buffer-next-message-function
@@ -4995,8 +4991,8 @@ Use function list is `wl-summary-write-current-folder-functions'."
        ()
       (setq skip-pmark-regexp
            (wl-regexp-opt (list " "
-                                wl-summary-unread-cached-mark
-                                wl-summary-important-mark))))
+                                elmo-msgdb-unread-cached-mark
+                                elmo-msgdb-important-mark))))
     (while (and skip
                (not (if downward (eobp) (bobp))))
       (if downward
index 2839ee7..067b10c 100644 (file)
        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
@@ -367,10 +367,10 @@ ENTITY is returned."
   (interactive)
   (dolist (number (elmo-folder-list-messages-mark-match
                   wl-summary-buffer-elmo-folder
-                  (wl-regexp-opt (list wl-summary-unread-uncached-mark
-                                       wl-summary-unread-cached-mark
-                                       wl-summary-new-mark
-                                       wl-summary-important-mark))))
+                  (wl-regexp-opt (list elmo-msgdb-unread-uncached-mark
+                                       elmo-msgdb-unread-cached-mark
+                                       elmo-msgdb-new-mark
+                                       elmo-msgdb-important-mark))))
     (wl-thread-entity-force-open (wl-thread-get-entity number))))
 
 (defsubst wl-thread-maybe-get-children-num (msg)
@@ -742,9 +742,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 wl-summary-important-mark)
+                        (if (string= cur-mark elmo-msgdb-important-mark)
                             nil
-                          wl-summary-important-mark))
+                          elmo-msgdb-important-mark))
     (wl-summary-set-mark-modified)))
 
 (defun wl-thread-mark-as-read (&optional arg)
@@ -836,7 +836,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 thread..."
+            'wl-thread-insert-top "Inserting message..."
             (/ (* cur 100) len)))))))
 
 (defsubst wl-thread-insert-entity-sub (indent entity parent-entity all)
index 1886291..efe30f4 100644 (file)
@@ -897,34 +897,11 @@ 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")
@@ -980,7 +957,7 @@ This variable is local to the summary buffers."
   :group 'wl-score)
 
 (defcustom wl-summary-score-marks
-  (list wl-summary-new-mark)
+  (list elmo-msgdb-new-mark)
   "Persistent marks to scoring."
   :type '(repeat (string :tag "Mark"))
   :group 'wl-score)
@@ -1689,9 +1666,9 @@ This wrapper is generated by the mail system when rejecting a letter."
   :group 'wl-pref)
 
 (defcustom wl-summary-auto-refile-skip-marks
-  (list wl-summary-new-mark
-       wl-summary-unread-uncached-mark
-       wl-summary-unread-cached-mark)
+  (list elmo-msgdb-new-mark
+       elmo-msgdb-unread-uncached-mark
+       elmo-msgdb-unread-cached-mark)
   "Persistent marks to skip auto-refiling."
   :type '(repeat (string :tag "Mark"))
   :group 'wl-summary)
@@ -1711,8 +1688,8 @@ the message is skipped at cursor move."
   :group 'wl-summary)
 
 (defcustom wl-summary-incorporate-marks
-  (list wl-summary-new-mark
-       wl-summary-unread-uncached-mark)
+  (list elmo-msgdb-new-mark
+       elmo-msgdb-unread-uncached-mark)
   "Persistent marks to prefetch at `wl-summary-incorporate'."
   :type '(repeat (string :tag "Mark"))
   :group 'wl-summary)
@@ -2297,11 +2274,10 @@ ex.
   :group 'wl-expire)
 
 (defcustom wl-summary-expire-reserve-marks
-  (list wl-summary-important-mark
-       wl-summary-new-mark
-       wl-summary-unread-mark
-       wl-summary-unread-uncached-mark
-       wl-summary-unread-cached-mark)
+  (list elmo-msgdb-important-mark
+       elmo-msgdb-new-mark
+       elmo-msgdb-unread-uncached-mark
+       elmo-msgdb-unread-cached-mark)
   "Permanent marks of reserved message when expire.
 Don't reserve temporary mark message.