* wl-vars.el (wl-summary-persistent-mark-priority-list): Add `killed'.
authorhmurata <hmurata>
Sun, 26 Feb 2006 02:59:46 +0000 (02:59 +0000)
committerhmurata <hmurata>
Sun, 26 Feb 2006 02:59:46 +0000 (02:59 +0000)
(wl-summary-killed-mark): New user option.

* wl-thread.el (wl-thread-update-line-on-buffer-sub): Follow the
API change.
(wl-thread-insert-entity-sub): Ditto.
(wl-thread-recover-messages): New command.

* wl-summary.el (wl-summary-update-mark-and-highlight-window):
Don't call `wl-highlight-summary-current-line' directly.
(wl-summary-buffer-attach): Connect to signal `status-changed'
instead of `cache-changed'.
(wl-summary-buffer-detach): Follow the above change.
(wl-summary-detect-mark-position): Follow the API change.
(wl-summary-rescan-message): Ditto.
(wl-summary-insert-sequential): Ditto.
(wl-summary-update-thread): Ditto.
(wl-summary-message-mark): Ditto.
(wl-summary-persistent-mark): Ditto.
(wl-summary-create-line): Ditto.
(wl-summary-prefetch-region-no-mark): Call
`wl-summary-persistent-mark' with number.
(wl-summary-recover-messages-region): New command.
(wl-summary-target-mark-recover): Ditto.
(wl-summary-recover-message): Ditto.
(wl-summary-persistent-mark-string): Add argument `status' instead
of remove arguments `flags' and `cached'.  Treat killed status.
(wl-summary-update-persistent-mark): Remove optional argument `flags'.

* wl-highlight.el (wl-highlight-summary-displaying-face): New face.
(wl-highlight-summary-line-face-spec): Treat killed status.
(wl-highlight-summary-line-string): Follow the API change.
(wl-highlight-summary-current-line): Ditto.

* elmo.el (cache-changed): Abolish.
(status-changed): New signal.
(elmo-message-killed-p): New generic function and define for
elmo-folder.
(elmo-folder-recover-messages): Ditto.
(elmo-message-set-cached): Emit signal `status-changed' instead of
`cache-changed'.
(elmo-message-status): New macro.
(elmo-message-status-folder): Ditto.
(elmo-message-status-number): Ditto.
(elmo-message-status-set-flags): Ditto.
(elmo-message-status-set-killed): Ditto.
(elmo-message-status-flags): New function.
(elmo-message-status-cached-p): Ditto.
(elmo-message-status-killed-p): Ditto.

* elmo-pipe.el (elmo-pipe-connect-signals): Connect to signal
`status-changed' instead of `cache-changed'.
(elmo-folder-recover-messages): Define.
(elmo-message-killed-p): Ditto.

* elmo-filter.el (elmo-filter-connect-signals): Connect to signal
`status-changed' instead of `cache-changed'.

* elmo-multi.el (elmo-multi-connect-signals): Ditto.
(elmo-message-killed-p): Define.
(elmo-folder-recover-messages): Ditto.

elmo/ChangeLog
elmo/elmo-filter.el
elmo/elmo-multi.el
elmo/elmo-pipe.el
elmo/elmo.el
wl/ChangeLog
wl/wl-highlight.el
wl/wl-summary.el
wl/wl-thread.el
wl/wl-vars.el

index fa4e5c5..6011264 100644 (file)
@@ -1,5 +1,33 @@
 2006-02-26  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
+       * elmo.el (cache-changed): Abolish.
+       (status-changed): New signal.
+       (elmo-message-killed-p): New generic function and define for
+       elmo-folder.
+       (elmo-folder-recover-messages): Ditto.
+       (elmo-message-set-cached): Emit signal `status-changed' instead of
+       `cache-changed'.
+       (elmo-message-status): New macro.
+       (elmo-message-status-folder): Ditto.
+       (elmo-message-status-number): Ditto.
+       (elmo-message-status-set-flags): Ditto.
+       (elmo-message-status-set-killed): Ditto.
+       (elmo-message-status-flags): New function.
+       (elmo-message-status-cached-p): Ditto.
+       (elmo-message-status-killed-p): Ditto.
+
+       * elmo-pipe.el (elmo-pipe-connect-signals): Connect to signal
+       `status-changed' instead of `cache-changed'.
+       (elmo-folder-recover-messages): Define.
+       (elmo-message-killed-p): Ditto.
+
+       * elmo-filter.el (elmo-filter-connect-signals): Connect to signal
+       `status-changed' instead of `cache-changed'.
+
+       * elmo-multi.el (elmo-multi-connect-signals): Ditto.
+       (elmo-message-killed-p): Define.
+       (elmo-folder-recover-messages): Ditto.
+
        * elmo-version.el (elmo-version): Up to 2.15.3.
 
 2006-02-18  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
index 74afbaf..05d8b5a 100644 (file)
        (when filterd
         (elmo-emit-signal 'flag-changed folder filterd)))))
   (elmo-connect-signal
-   target 'cache-changed folder
-   (elmo-define-signal-handler (folder target number)
-     (elmo-emit-signal 'cache-changed folder number))
-   (elmo-define-signal-filter (folder target number)
-     (memq number (elmo-folder-list-messages folder nil t))))
+   target 'status-changed folder
+   (elmo-define-signal-handler (folder target numbers)
+     (let ((filterd (elmo-list-filter
+                    (elmo-folder-list-messages folder nil t)
+                    numbers)))
+       (when filterd
+        (elmo-emit-signal 'status-changed folder filterd)))))
   (elmo-connect-signal
    target 'update-overview folder
    (elmo-define-signal-handler (folder target number)
index 4d5b9a6..d9c2cf1 100644 (file)
    (elmo-define-signal-filter (folder sender)
      (memq sender (elmo-multi-folder-children-internal folder))))
   (elmo-connect-signal
-   nil 'cache-changed folder
-   (elmo-define-signal-handler (folder child number)
-     (elmo-emit-signal
-      'cache-changed folder
-      (car (elmo-multi-map-numbers folder child (list number)))))
+   nil 'status-changed folder
+   (elmo-define-signal-handler (folder child numbers)
+     (elmo-emit-signal 'status-changed folder
+                      (elmo-multi-map-numbers folder child numbers)))
    (elmo-define-signal-filter (folder sender)
      (memq sender (elmo-multi-folder-children-internal folder))))
   (elmo-connect-signal
   (dolist (fld (elmo-multi-folder-children-internal folder))
     (elmo-folder-close fld)))
 
+(luna-define-method elmo-message-killed-p ((folder elmo-multi-folder) number)
+  (let ((pair (elmo-multi-real-folder-number folder number)))
+    (elmo-message-killed-p (car pair) (cdr pair))))
+
 (luna-define-method elmo-folder-synchronize ((folder elmo-multi-folder)
                                             &optional
                                             disable-killed
          (setq flag-alist (cons pair flag-alist)))))
     flag-alist))
 
+(luna-define-method elmo-folder-recover-messages ((folder elmo-multi-folder)
+                                                 numbers)
+  (dolist (element (elmo-multi-split-numbers folder numbers))
+    (when (cdr element)
+      (elmo-folder-recover-messages (car element) (cdr element)))))
+
 (require 'product)
 (product-provide (provide 'elmo-multi) (require 'elmo-version))
 
index af78ab5..fe82b79 100644 (file)
@@ -66,9 +66,9 @@
    (elmo-define-signal-handler (folder dst numbers)
      (elmo-emit-signal 'flag-changed folder numbers)))
   (elmo-connect-signal
-   destination 'cache-changed folder
-   (elmo-define-signal-handler (folder dst number)
-     (elmo-emit-signal 'cache-changed folder number)))
+   destination 'status-changed folder
+   (elmo-define-signal-handler (folder dst numbers)
+     (elmo-emit-signal 'status-changed folder numbers)))
   (elmo-connect-signal
    destination 'update-overview folder
    (elmo-define-signal-handler (folder dst number)
 (luna-define-method elmo-folder-writable-p ((folder elmo-pipe-folder))
   (elmo-folder-writable-p (elmo-pipe-folder-dst-internal folder)))
 
+(luna-define-method elmo-folder-recover-messages ((folder elmo-pipe-folder)
+                                                 numbers)
+  (elmo-folder-recover-messages
+   (elmo-pipe-folder-dst-internal folder) numbers))
+
 (luna-define-method elmo-folder-create ((folder elmo-pipe-folder))
   (if (and (not (elmo-folder-exists-p (elmo-pipe-folder-src-internal folder)))
           (elmo-folder-creatable-p (elmo-pipe-folder-src-internal folder)))
                      field
                      type))
 
+(luna-define-method elmo-message-killed-p ((folder elmo-pipe-folder) number)
+  (elmo-message-killed-p (elmo-pipe-folder-dst-internal folder) number))
+
 (luna-define-method elmo-message-set-cached ((folder elmo-pipe-folder)
                                             number cached)
   (elmo-message-set-cached (elmo-pipe-folder-dst-internal folder)
index 6847d57..02a9a6d 100644 (file)
@@ -95,8 +95,8 @@ Otherwise, entire fetching of the message is aborted without confirmation."
 (elmo-define-signal flag-changed (numbers)
   "Notify the change flag of the messages with NUMBERS.")
 
-(elmo-define-signal cache-changed (number)
-  "Notify the change cache status of the message with NUMBER.")
+(elmo-define-signal status-changed (numbers)
+  "Notify the change status of the message with NUMBERS.")
 
 (elmo-define-signal update-overview (number)
   "Notify update overview of the message with NUMBER.")
@@ -1204,6 +1204,14 @@ If optional argument IF-EXISTS is nil, load on demand.
 (luna-define-method elmo-message-cached-p ((folder elmo-folder) number)
   (elmo-message-flagged-p folder number 'cached))
 
+(luna-define-generic elmo-message-killed-p (folder number)
+  "Return non-nil if the message is killed.")
+
+(luna-define-method elmo-message-killed-p ((folder elmo-folder) number)
+  (let ((killed-list (elmo-folder-killed-list-internal folder)))
+    (and killed-list
+        (elmo-number-set-member number killed-list))))
+
 (defun elmo-message-accessible-p (folder number)
   "Get accessibility of the message.
 Return non-nil when message is accessible."
@@ -1223,7 +1231,7 @@ If CACHED is t, message is set as cached.")
   (if cached
       (elmo-msgdb-set-flag (elmo-folder-msgdb folder) number 'cached)
     (elmo-msgdb-unset-flag (elmo-folder-msgdb folder) number 'cached))
-  (elmo-emit-signal 'cache-changed folder number))
+  (elmo-emit-signal 'status-changed folder (list number)))
 
 (defun elmo-message-copy-entity (entity)
   (elmo-msgdb-copy-message-entity (elmo-message-entity-handler entity)
@@ -1535,6 +1543,23 @@ If Optional LOCAL is non-nil, don't update server flag."
     numbers))
   (elmo-folder-unset-flag folder numbers 'all 'local-only))
 
+(luna-define-generic elmo-folder-recover-messages (folder numbers)
+  "Recover killed messages in the FOLDER with NUMBERS.")
+
+(luna-define-method elmo-folder-recover-messages ((folder elmo-folder) numbers)
+  (let ((msgdb (elmo-folder-msgdb folder)))
+    (elmo-folder-set-killed-list-internal
+     folder
+     (elmo-number-set-delete-list
+      (elmo-folder-killed-list-internal folder)
+      numbers))
+    (dolist (number numbers)
+      (if (elmo-file-cache-exists-p
+          (elmo-message-field folder number 'message-id))
+         (elmo-msgdb-set-flag msgdb number 'cached)
+       (elmo-msgdb-unset-flag msgdb number 'cached)))
+    (elmo-emit-signal 'status-changed folder numbers)))
+
 (luna-define-method elmo-folder-clear ((folder elmo-folder)
                                       &optional keep-killed)
   (unless keep-killed
@@ -1730,6 +1755,42 @@ Return a hashtable for newsgroups."
     (elmo-make-directory temp-dir)
     temp-dir))
 
+;; ELMO status structure.
+(defmacro elmo-message-status (folder number &optional flags killed)
+  "Make ELMO status structure from FOLDER and NUMBER.
+A value in this structure is cached at first access."
+  `(vector ,folder ,number ,flags ,killed))
+
+(defmacro elmo-message-status-folder (status)
+  `(aref ,status 0))
+
+(defmacro elmo-message-status-number (status)
+  `(aref ,status 1))
+
+(defmacro elmo-message-status-set-flags (status flags)
+  `(aset ,status 2 (or ,flags '(read))))
+
+(defsubst elmo-message-status-flags (status)
+  (or (aref status 2)
+      (elmo-message-status-set-flags
+       status
+       (elmo-message-flags (elmo-message-status-folder status)
+                          (elmo-message-status-number status)))))
+
+(defsubst elmo-message-status-cached-p (status)
+  (memq 'cached (elmo-message-status-flags status)))
+
+(defmacro elmo-message-status-set-killed (status killed)
+  `(aset ,status 3 (if ,killed 'killed 'living)))
+
+(defsubst elmo-message-status-killed-p (status)
+  (eq 'killed
+      (or (aref status 3)
+         (elmo-message-status-set-killed
+          status
+          (elmo-message-killed-p (elmo-message-status-folder status)
+                                 (elmo-message-status-number status))))))
+
 ;;;
 (defun elmo-init ()
   "Initialize ELMO module."
index d8533a0..a78429e 100644 (file)
@@ -1,5 +1,39 @@
 2006-02-26  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
+       * wl-vars.el (wl-summary-persistent-mark-priority-list): Add `killed'.
+       (wl-summary-killed-mark): New user option.
+
+       * wl-thread.el (wl-thread-update-line-on-buffer-sub): Follow the
+       API change.
+       (wl-thread-insert-entity-sub): Ditto.
+       (wl-thread-recover-messages): New command.
+
+       * wl-summary.el (wl-summary-update-mark-and-highlight-window):
+       Don't call `wl-highlight-summary-current-line' directly.
+       (wl-summary-buffer-attach): Connect to signal `status-changed'
+       instead of `cache-changed'.
+       (wl-summary-buffer-detach): Follow the above change.
+       (wl-summary-detect-mark-position): Follow the API change.
+       (wl-summary-rescan-message): Ditto.
+       (wl-summary-insert-sequential): Ditto.
+       (wl-summary-update-thread): Ditto.
+       (wl-summary-message-mark): Ditto.
+       (wl-summary-persistent-mark): Ditto.
+       (wl-summary-create-line): Ditto.
+       (wl-summary-prefetch-region-no-mark): Call
+       `wl-summary-persistent-mark' with number.
+       (wl-summary-recover-messages-region): New command.
+       (wl-summary-target-mark-recover): Ditto.
+       (wl-summary-recover-message): Ditto.
+       (wl-summary-persistent-mark-string): Add argument `status' instead
+       of remove arguments `flags' and `cached'.  Treat killed status.
+       (wl-summary-update-persistent-mark): Remove optional argument `flags'.
+
+       * wl-highlight.el (wl-highlight-summary-displaying-face): New face.
+       (wl-highlight-summary-line-face-spec): Treat killed status.
+       (wl-highlight-summary-line-string): Follow the API change.
+       (wl-highlight-summary-current-line): Ditto.
+
        * Version number is increased to 2.15.3.
 
 2006-02-24  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
index 6c3fac6..2c2dba4 100644 (file)
   :group 'wl-summary-faces
   :group 'wl-faces)
 
+(wl-defface wl-highlight-summary-killed-face
+  '((((type tty)
+      (background dark))
+     (:foreground "blue"))
+    (((class color)
+      (background dark))
+     (:foreground "gray"))
+    (((class color))
+     (:foreground "LightSlateGray")))
+  "Face used for displaying killed messages."
+  :group 'wl-summary-faces
+  :group 'wl-faces)
+
 (wl-defface wl-highlight-summary-displaying-face
   '((t
      (:underline t :bold t)))
     (and (find-face face)
         face)))
 
-(defsubst wl-highlight-summary-line-face-spec (flags temp-mark indent)
+(defsubst wl-highlight-summary-line-face-spec (status temp-mark indent)
   "Return a cons cell of (face . argument)."
-  (let (action)
-    (if (setq action (assoc temp-mark wl-summary-mark-action-list))
-       (cons (nth 5 action) (nth 2 action))
-      (cond
-       ((and (string= temp-mark wl-summary-score-over-mark)
-            (or (memq 'new flags) (memq 'unread flags)))
-       '(wl-highlight-summary-high-unread-face))
-       ((and (string= temp-mark wl-summary-score-below-mark)
-            (or (memq 'new flags) (memq 'unread flags)))
-       '(wl-highlight-summary-low-unread-face))
-       ((let ((priorities wl-summary-persistent-mark-priority-list)
-             (fl wl-summary-flag-alist)
-             face result global-flags)
-         (while (and (null result) priorities)
-           (if (eq (car priorities) 'flag)
+  (or (let (action)
+       (and (setq action (assoc temp-mark wl-summary-mark-action-list))
+            (cons (nth 5 action) (nth 2 action))))
+      (let ((flags (elmo-message-status-flags status)))
+       (cond
+        ((and (string= temp-mark wl-summary-score-over-mark)
+              (or (memq 'new flags) (memq 'unread flags)))
+         '(wl-highlight-summary-high-unread-face))
+        ((and (string= temp-mark wl-summary-score-below-mark)
+              (or (memq 'new flags) (memq 'unread flags)))
+         '(wl-highlight-summary-low-unread-face))
+        ((let ((priorities wl-summary-persistent-mark-priority-list)
+               (fl wl-summary-flag-alist)
+               face result global-flags)
+           (while (and (null result) priorities)
+             (cond
+              ((eq (car priorities) 'killed)
+               (when (elmo-message-status-killed-p status)
+                 (setq result '(wl-highlight-summary-killed-face))))
+              ((eq (car priorities) 'flag)
                (when (setq global-flags
                            (elmo-get-global-flags flags 'ignore-preserved))
                  (while fl
                            fl nil))
                    (setq fl (cdr fl)))
                  (unless result
-                   (setq result (list 'wl-highlight-summary-flagged-face))))
-             (when (memq (car priorities) flags)
+                   (setq result (list 'wl-highlight-summary-flagged-face)))))
+              ((memq (car priorities) flags)
                (setq result
                      (list (or (wl-highlight-get-face-by-name
                                 "wl-highlight-summary-%s-face"
                                 (car priorities))
                                'wl-summary-persistent-mark-face)))))
-           (setq priorities (cdr priorities)))
-         result))
-       ((string= temp-mark wl-summary-score-below-mark)
-       '(wl-highlight-summary-low-read-face))
-       ((string= temp-mark wl-summary-score-over-mark)
-       '(wl-highlight-summary-high-read-face))
-       (t (if indent
-             '(wl-highlight-summary-normal-face)
-           '(wl-highlight-summary-thread-top-face)))))))
+             (setq priorities (cdr priorities)))
+           result))
+        ((string= temp-mark wl-summary-score-below-mark)
+         '(wl-highlight-summary-low-read-face))
+        ((string= temp-mark wl-summary-score-over-mark)
+         '(wl-highlight-summary-high-read-face))
+        (t (if indent
+               '(wl-highlight-summary-normal-face)
+             '(wl-highlight-summary-thread-top-face)))))))
 
 (autoload 'elmo-flag-folder-referrer "elmo-flag")
 (defun wl-highlight-flag-folder-help-echo (folder number)
                             message
                             string)))))
 
-(defun wl-highlight-summary-line-string (number line flags temp-mark indent)
+(defun wl-highlight-summary-line-string (number line status temp-mark indent)
   (let ((fsymbol (car (wl-highlight-summary-line-face-spec
-                      flags
+                      status
                       temp-mark
                       (> (length indent) 0)))))
     (put-text-property 0 (length line) 'face fsymbol line))
   (when wl-highlight-summary-line-help-echo-alist
     (wl-highlight-summary-line-help-echo number 0 (length line) line)))
 
-(defun wl-highlight-summary-current-line (&optional number flags)
+(defun wl-highlight-summary-current-line (&optional number status)
   (interactive)
   (save-excursion
     (let ((inhibit-read-only t)
        (beginning-of-line)
        (setq bol (point))
        (setq spec (wl-highlight-summary-line-face-spec
-                   (or flags
-                       (elmo-message-flags wl-summary-buffer-elmo-folder
-                                           number))
+                   (or status (wl-summary-message-status number))
                    (wl-summary-temp-mark number)
                    (wl-thread-entity-get-parent-entity
                     (wl-thread-get-entity number))))
index 3bee35b..5d1f808 100644 (file)
@@ -609,20 +609,13 @@ See also variable `wl-use-petname'."
       (let ((beg (or beg (window-start win)))
            (end (condition-case nil
                     (window-end win t) ; old emacsen doesn't support 2nd arg.
-                  (error (window-end win))))
-           number flags)
+                  (error (window-end win)))))
        (save-excursion
          (goto-char beg)
          (while (and (< (point) end) (not (eobp)))
            (when (or (null (get-text-property (point) 'face))
                      (wl-summary-persistent-mark-invalid-p))
-             (setq number (wl-summary-message-number))
-             (when number
-               (setq flags (elmo-message-flags wl-summary-buffer-elmo-folder
-                                               number)))
-             (let (wl-summary-highlight)
-               (wl-summary-update-persistent-mark number flags))
-             (wl-highlight-summary-current-line number flags))
+             (wl-summary-update-persistent-mark (wl-summary-message-number)))
            (forward-line 1)))))
     (set-buffer-modified-p nil)))
 
@@ -691,10 +684,10 @@ See also variable `wl-use-petname'."
        (wl-summary-update-persistent-mark-on-event buffer numbers)))
     (elmo-connect-signal
      wl-summary-buffer-elmo-folder
-     'cache-changed
+     'status-changed
      (current-buffer)
-     (elmo-define-signal-handler (buffer folder number)
-       (wl-summary-update-persistent-mark-on-event buffer (list number))))
+     (elmo-define-signal-handler (buffer folder numbers)
+       (wl-summary-update-persistent-mark-on-event buffer numbers)))
     (elmo-connect-signal
      wl-summary-buffer-elmo-folder
      'update-overview
@@ -707,7 +700,7 @@ See also variable `wl-use-petname'."
   (when (and (eq major-mode 'wl-summary-mode)
             wl-summary-buffer-elmo-folder)
     (elmo-disconnect-signal 'flag-changed (current-buffer))
-    (elmo-disconnect-signal 'cache-changed (current-buffer))
+    (elmo-disconnect-signal 'status-changed (current-buffer))
     (elmo-disconnect-signal 'update-overview (current-buffer))))
 
 (defun wl-status-update ()
@@ -819,11 +812,12 @@ you."
 (defun wl-summary-detect-mark-position ()
   (let ((column wl-summary-buffer-number-column)
        (formatter wl-summary-buffer-line-formatter)
+       (lang wl-summary-buffer-weekday-name-lang)
+       (dummy-number 10000)
        (dummy-temp (char-to-string 200))
        ;; bind only for the check.
        (wl-summary-new-uncached-mark (char-to-string 201))
        (wl-summary-persistent-mark-priority-list '(new))     ; ditto.
-       (lang wl-summary-buffer-weekday-name-lang)
        wl-summary-highlight
        temp persistent)
     (with-temp-buffer
@@ -834,14 +828,16 @@ you."
        (wl-summary-create-line
        (elmo-msgdb-make-message-entity
         (luna-make-entity 'modb-entity-handler)
-        :number 10000
+        :number dummy-number
         :from "foo"
         :subject "bar"
         :size 100)
        nil
        dummy-temp
-       '(new)
-       nil))
+       (let ((status (elmo-message-status nil dummy-number)))
+         (elmo-message-status-set-flags status '(new))
+         (elmo-message-status-set-killed status nil)
+         status)))
       (goto-char (point-min))
       (setq temp (save-excursion
                   (when (search-forward dummy-temp nil t)
@@ -1195,8 +1191,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'."
            (wl-summary-insert-line
             (wl-summary-create-line entity nil
                                     (wl-summary-temp-mark number)
-                                    (elmo-message-flags folder number)
-                                    (elmo-message-cached-p folder number)))))
+                                    (elmo-message-status folder number)))))
       (when (and wl-summary-buffer-disp-msg
                 wl-summary-buffer-current-msg)
        (save-excursion
@@ -1664,8 +1659,8 @@ If ARG is non-nil, checking is omitted."
        (message "Collecting marks...")
        (goto-char (point-min))
        (while (not (eobp))
-         (setq mark (wl-summary-persistent-mark)
-               msg (wl-summary-message-number))
+         (setq msg (wl-summary-message-number))
+         (setq mark (wl-summary-persistent-mark msg))
          (if (or (and (null prefetch-marks)
                       msg
                       (null (elmo-file-cache-exists-p
@@ -1789,6 +1784,15 @@ If ARG is non-nil, checking is omitted."
       (wl-summary-count-unread)
       (wl-summary-update-modeline))))
 
+(defun wl-summary-recover-messages-region (beg end)
+  "Recover killed messages in region."
+  (interactive "r")
+  (let ((number-list (wl-summary-number-list-from-region beg end)))
+    (if (null number-list)
+       (message "No message.")
+      (elmo-folder-recover-messages wl-summary-buffer-elmo-folder
+                                   number-list))))
+
 (defun wl-summary-mark-as-read-all ()
   (interactive)
   (if (or (not (interactive-p))
@@ -2639,12 +2643,7 @@ If ARG, without confirm."
       (goto-char (point-max))
       (wl-summary-insert-line
        (wl-summary-create-line entity nil nil
-                              (elmo-message-flags
-                               wl-summary-buffer-elmo-folder
-                               number)
-                              (elmo-message-cached-p
-                               wl-summary-buffer-elmo-folder
-                               number)))
+                              (elmo-message-status folder number)))
       (setq wl-summary-buffer-number-list
            (wl-append wl-summary-buffer-number-list
                       (list (elmo-message-entity-number entity))))
@@ -2851,8 +2850,7 @@ If ARG, without confirm."
          entity
          parent-entity
          nil
-         (elmo-message-flags wl-summary-buffer-elmo-folder number)
-         (elmo-message-cached-p wl-summary-buffer-elmo-folder number)
+         (wl-summary-message-status number)
          (wl-thread-maybe-get-children-num number)
          (wl-thread-make-indent-string thr-entity)
          (wl-thread-entity-get-linked thr-entity)))))))
@@ -2977,60 +2975,60 @@ If ARG, exit virtual folder."
   (setq wl-summary-buffer-persistent-mark-version
        (1+ wl-summary-buffer-persistent-mark-version)))
 
-(defsubst wl-summary-persistent-mark-string (folder flags cached)
+(defsubst wl-summary-persistent-mark-string (folder status)
   "Return the persistent mark string.
-The mark is decided according to the FOLDER, FLAGS and CACHED."
+The mark is decided according to the FOLDER and STATUS."
   (let ((priorities wl-summary-persistent-mark-priority-list)
+       (flags (elmo-message-status-flags status))
+       (cached (elmo-message-status-cached-p status))
        mark)
     (while (and (null mark) priorities)
-      (if (and (eq (car priorities) 'flag)
-              (elmo-get-global-flags flags 'ignore-preserved))
-         (let ((specs wl-summary-flag-alist)
+      (let ((flag (car priorities)))
+       (cond
+        ((eq flag 'flag)
+         (let ((flags (elmo-get-global-flags flags 'ignore-preserved))
+               (specs wl-summary-flag-alist)
                spec)
-           (while (setq spec (car specs))
-             (if (memq (car spec) flags)
-                 (setq mark (or (nth 2 spec) wl-summary-flag-mark)
-                       specs nil)
-               (setq specs (cdr specs))))
-           (unless mark
-             (setq mark wl-summary-flag-mark)))
-       (when (memq (car priorities) flags)
+           (when flags
+             (while (setq spec (car specs))
+               (if (memq (car spec) flags)
+                   (setq mark (or (nth 2 spec) wl-summary-flag-mark)
+                         specs nil)
+                 (setq specs (cdr specs))))
+             (unless mark
+               (setq mark wl-summary-flag-mark)))))
+        ((eq flag 'killed)
+         (when (elmo-message-status-killed-p status)
+           (setq mark wl-summary-killed-mark)))
+        ((memq flag flags)
          (setq mark
-               (let ((var
-                      (intern
-                       (if cached
+               (let ((var (intern-soft
                            (format
-                            "wl-summary-%s-cached-mark" (car priorities))
-                         (format
-                          "wl-summary-%s-uncached-mark" (car priorities))))))
-                 (if (and (boundp var)
-                          (symbol-value var))
-                     (symbol-value var)
-                   (if cached
-                       (downcase (substring (symbol-name (car priorities))
-                                            0 1))
-                     (upcase (substring (symbol-name (car priorities))
-                                        0 1))))))))
-      (setq priorities (cdr priorities)))
+                            (if cached
+                                "wl-summary-%s-cached-mark"
+                              "wl-summary-%s-uncached-mark")
+                            flag))))
+                 (or (and var (boundp var) (symbol-value var))
+                     (funcall (if cached #'downcase #'upcase)
+                              (substring (symbol-name flag) 0 1)))))))
+       (setq priorities (cdr priorities))))
     (or mark
        (if (or cached (elmo-folder-local-p folder))
            nil
          wl-summary-uncached-mark))))
 
-(defsubst wl-summary-message-mark (folder number &optional flags)
+(defsubst wl-summary-message-mark (folder number &optional status)
   "Return mark of the message."
   (ignore-errors
     (wl-summary-persistent-mark-string
      folder
-     (or flags (setq flags (elmo-message-flags folder number)))
-     (memq 'cached flags) ; XXX for speed-up.
-     )))
+     (or status (elmo-message-status folder number)))))
 
-(defsubst wl-summary-persistent-mark (&optional number flags)
+(defsubst wl-summary-persistent-mark (&optional number status)
   "Return persistent-mark string of current line."
   (or (wl-summary-message-mark wl-summary-buffer-elmo-folder
                               (or number (wl-summary-message-number))
-                              flags)
+                              status)
       " "))
 
 (defun wl-summary-put-temp-mark (mark)
@@ -3127,6 +3125,19 @@ The mark is decided according to the FOLDER, FLAGS and CACHED."
       (wl-summary-count-unread)
       (wl-summary-update-modeline))))
 
+(defun wl-summary-target-mark-recover ()
+  "Recover killed messages which have target mark."
+  (interactive)
+  (wl-summary-check-target-mark)
+  (save-excursion
+    (let ((inhibit-read-only t)
+         (buffer-read-only nil)
+         wl-summary-buffer-disp-msg)
+      (elmo-folder-recover-messages wl-summary-buffer-elmo-folder
+                                   wl-summary-buffer-target-mark-list)
+      (dolist (number wl-summary-buffer-target-mark-list)
+       (wl-summary-unset-mark number)))))
+
 (defun wl-summary-target-mark-save ()
   (interactive)
   (wl-summary-check-target-mark)
@@ -3146,29 +3157,30 @@ The mark is decided according to the FOLDER, FLAGS and CACHED."
   (wl-summary-check-target-mark)
   (wl-summary-pick wl-summary-buffer-target-mark-list 'delete))
 
-(defun wl-summary-update-persistent-mark (&optional number flags)
+(defun wl-summary-update-persistent-mark (&optional number)
   "Synch up persistent mark of current line with msgdb's.
 Return non-nil if the mark is updated"
   (interactive)
-  (prog1
-      (when wl-summary-buffer-persistent-mark-column
-       (save-excursion
-         (move-to-column wl-summary-buffer-persistent-mark-column)
-         (let ((inhibit-read-only t)
-               (buffer-read-only nil)
-               (mark (buffer-substring (- (point) 1) (point)))
-               (new-mark (wl-summary-persistent-mark number flags)))
-           (prog1
-               (unless (string= new-mark mark)
-                 (delete-backward-char 1)
-                 (insert new-mark)
-                 (wl-summary-set-message-modified)
-                 t)
-             (wl-summary-validate-persistent-mark (point-at-bol)
-                                                  (point-at-eol))))))
-    (when wl-summary-highlight
-      (wl-highlight-summary-current-line))
-    (set-buffer-modified-p nil)))
+  (let ((status (wl-summary-message-status number)))
+    (prog1
+       (when wl-summary-buffer-persistent-mark-column
+         (save-excursion
+           (move-to-column wl-summary-buffer-persistent-mark-column)
+           (let ((inhibit-read-only t)
+                 (buffer-read-only nil)
+                 (mark (buffer-substring (- (point) 1) (point)))
+                 (new-mark (wl-summary-persistent-mark number status)))
+             (prog1
+                 (unless (string= new-mark mark)
+                   (delete-backward-char 1)
+                   (insert new-mark)
+                   (wl-summary-set-message-modified)
+                   t)
+               (wl-summary-validate-persistent-mark (point-at-bol)
+                                                    (point-at-eol))))))
+      (when wl-summary-highlight
+       (wl-highlight-summary-current-line number status))
+      (set-buffer-modified-p nil))))
 
 (defsubst wl-summary-mark-as-read-internal (inverse
                                            number-or-numbers
@@ -3433,6 +3445,14 @@ Return non-nil if the mark is updated"
      'important
      nil nil nil (interactive-p))))
 
+(defun wl-summary-recover-message (number)
+  "Recover current message if it is killed."
+  (interactive (list (wl-summary-message-number)))
+  (if (null number)
+      (message "No message.")
+    (elmo-folder-recover-messages wl-summary-buffer-elmo-folder
+                                 (list number))))
+
 ;;; Summary line.
 (defvar wl-summary-line-formatter nil)
 
@@ -3557,8 +3577,7 @@ Return non-nil if the mark is updated"
 (defun wl-summary-create-line (wl-message-entity
                               wl-parent-message-entity
                               wl-temp-mark
-                              wl-flags
-                              wl-cached
+                              wl-status
                               &optional
                               wl-thr-children-number
                               wl-thr-indent-string
@@ -3567,8 +3586,7 @@ Return non-nil if the mark is updated"
   (let ((wl-mime-charset wl-summary-buffer-mime-charset)
        (wl-persistent-mark (wl-summary-persistent-mark-string
                             wl-summary-buffer-elmo-folder
-                            wl-flags
-                            wl-cached))
+                            wl-status))
        (elmo-mime-charset wl-summary-buffer-mime-charset)
        (elmo-lang wl-summary-buffer-weekday-name-lang)
        (wl-datevec (or (elmo-time-to-datevec
@@ -3599,7 +3617,7 @@ Return non-nil if the mark is updated"
        (wl-highlight-summary-line-string
         (elmo-message-entity-number wl-message-entity)
         line
-        wl-flags
+        wl-status
         wl-temp-mark
         wl-thr-indent-string))
     line))
index 3ecb009..b6965bc 100644 (file)
@@ -386,10 +386,7 @@ ENTITY is returned."
              (elmo-message-entity wl-summary-buffer-elmo-folder
                                   parent-msg)
              temp-mark
-             (elmo-message-flags wl-summary-buffer-elmo-folder
-                                 msg)
-             (elmo-message-cached-p wl-summary-buffer-elmo-folder
-                                    msg)
+             (elmo-message-status wl-summary-buffer-elmo-folder msg)
              (if wl-thread-insert-force-opened
                  nil
                (wl-thread-maybe-get-children-num msg))
@@ -766,6 +763,11 @@ Message is inserted to the summary buffer."
   (interactive "P")
   (wl-thread-call-region-func 'wl-summary-mark-as-answered-region arg))
 
+(defun wl-thread-recover-messages (&optional arg)
+  "Recover killed messages which are contained current thread."
+  (interactive "P")
+  (wl-thread-call-region-func 'wl-summary-recover-messages-region arg))
+
 (defun wl-thread-unmark (&optional arg)
   (interactive "P")
   (wl-thread-call-region-func 'wl-summary-unmark-region arg))
@@ -839,10 +841,7 @@ Message is inserted to the summary buffer."
          (elmo-message-entity wl-summary-buffer-elmo-folder
                               (nth 0 parent-entity))
          temp-mark
-         (elmo-message-flags wl-summary-buffer-elmo-folder
-                             msg-num)
-         (elmo-message-cached-p wl-summary-buffer-elmo-folder
-                                msg-num)
+         (elmo-message-status wl-summary-buffer-elmo-folder msg-num)
          (if wl-thread-insert-force-opened
              nil
            (wl-thread-maybe-get-children-num msg-num))
index bb45388..a6e90aa 100644 (file)
@@ -1047,7 +1047,8 @@ cdr of each cons cell is used for preparing headers of draft message."
   :type 'boolean
   :group 'wl-folder)
 
-(defcustom wl-summary-persistent-mark-priority-list '(flag
+(defcustom wl-summary-persistent-mark-priority-list '(killed
+                                                     flag
                                                      new
                                                      answered
                                                      forwarded
@@ -1074,6 +1075,11 @@ Example:
                               (const :tag "Default mark" nil))))
   :group 'wl-summary)
 
+(defcustom wl-summary-killed-mark "X"
+  "Mark for killed message."
+  :type '(string :tag "Mark")
+  :group 'wl-summary-marks)
+
 (defcustom wl-summary-uncached-mark "!"
   "Mark for uncached message with no flag."
   :type '(string :tag "Mark")