* wl.el (wl-init): Setup faces accoding to wl-summary-flag-alist.
authorteranisi <teranisi>
Mon, 9 Feb 2004 12:08:24 +0000 (12:08 +0000)
committerteranisi <teranisi>
Mon, 9 Feb 2004 12:08:24 +0000 (12:08 +0000)
* wl-xmas.el (wl-summary-toolbar): Setup wl-summary-set-flags.

* wl-e21.el (wl-summary-toolbar): Ditto.

* wl-vars.el (wl-demo-background-color): Abolished.
(wl-summary-persistent-mark-priority-list): Renamed from
wl-summary-flag-priority-list.
(wl-summary-flag-alist): New user option.
(wl-summary-flag-mark): Renamed from wl-summary-important-mark.
(wl-message-mode-line-format-spec-alist): Added 'F'.
(wl-message-mode-line-format): Likewise.
(wl-summary-expire-reserve-marks): Use wl-summary-flag-mark
instead of wl-summary-important-mark.
(wl-file-folder-icon): New variable.

* wl-thread.el (wl-thread-set-flags): Renamed from
wl-thread-mark-as-important.

* wl-summary.el: Define `elmo-global-flag-list' to avoid byte-compile
warning.
(wl-summary-mode-menu-spec): Follow the change of
`wl-summary-mark-as-important', `wl-thread-set-flags', and so on.
(wl-summary-mode-map): Follow the change of
`wl-summary-mark-as-important', `wl-thread-set-flags', and so on.
(wl-summary-detect-mark-position): Follow the variable name change.
(wl-summary-set-flags-region): New function for the replacement of
wl-summary-mark-as-important-region.
(wl-summary-sync-marks): Sync all global-flags.
(wl-summary-auto-select-msg-p): Use elmo-message-has-global-flag-p
instead of elmo-message-flagged-p.
(wl-summary-persistent-mark-string): Follow the variable name change;
Put wl-summary-flag-mark if the message has global-flag.
(wl-summary-target-mark-set-flags): Renamed from
wl-summary-target-mark-mark-as-important.
(wl-summary-decide-flag): New function.
(wl-summary-set-flags-internal): Renamed from
wl-summary-mark-as-important-internal.
(wl-summary-add-flags-internal): New function.
(wl-summary-remove-flags-internal): Ditto.
(wl-summary-set-flags): Renamed from wl-summary-mark-as-important.
(wl-summary-mark-as-unimportant): Abolish.
(wl-summary-move-spec-alist): Changed `important' to `digest'.
(wl-summary-next-message): List flagged messages in the msgdb.

* wl-score.el (wl-summary-score-update-all-lines): Use
wl-summary-add-flags-internal instead of

* wl-mime.el (wl-mime-display-header): Follow the variable name change.

* wl-message.el (wl-message-buffer-cur-display-type): Renamed
from wl-message-buffer-cur-flag (To avoid misunderstanding).
(wl-message-buffer-require-all-header): Renamed from
wl-message-buffer-all-header-flag (Ditto).
(wl-message-buffer-flag-indicator): New variable.
(wl-message-redisplay): Changed local varibale name from `flag' to
`display-type'; Set up wl-message-buffer-flag-indicator.
(wl-message-buffer-display): Changed varibale name from `flag' to
`display-type'.
(wl-message-display-internal): Likewise.

* wl-highlight.el (wl-highlight-demo-face): Define default background
color.
(wl-highlight-summary-line-face-spec): Highlight flagged messages.

* wl-e21.el (wl-folder-internal-icon-list): Added file folder icon.

* wl-demo.el (wl-demo-xpm-set-background): Abolish.
(wl-demo-setup-properties): Renamed from
`wl-demo-set-background-color'.
(wl-demo): Follow the change above.

* slp.el (slp-exec-wait): Avoid byte-compile warnings.

* elmo-nntp.el (elmo-nntp-folder-list-subfolders): Avoid byte-compile
warnings.

* elmo-file.el: New file.

* modb-standard.el (elmo-msgdb-list-flagged): Treat keyword flags.

* elsp-sa.el (elmo-spam-spamassassin-max-messages-per-process): New
variable.
(elmo-spam-spamassassin-register-messages): New inline function.
(elmo-spam-register-spam-messages): Define.
(elmo-spam-register-good-messages): Ditto.

* elsp-bogofilter.el (elmo-spam-bogofilter-max-messages-per-process):
Fixed typo.

* elmo.el (toplevel): Added autoload setting for
`elmo-get-global-flags'.
(elmo-message-has-global-flag-p): New function.
(elmo-message-set-global-flags): Ditto.
(elmo-folder-type): Improvement for name: format.

* elmo-imap4.el (elmo-imap4-session-flag-available-p): Check
availability of keyword flags.
(elmo-imap4-folder-list-flagged): Treat keyword flags.
(elmo-folder-list-flagged-plugged): Renamed from
elmo-folder-list-flagged-unplugged.
(elmo-imap4-set-flag): If "\*" is treated as permanent flag,
accept any flag as keyword flag.
(elmo-folder-set-flag-plugged): Accept keyword flags.
(toplevel): Added autoload setting for `elmo-get-global-flags'.

* elmo-flag.el (elmo-get-global-flags): New function.

* elmo-filter.el (elmo-folder-diff): Fix total number for filter
filters.

* etc/icons/wl-summary-set-flags-up.xpm: Renamed from
wl-summary-mark-as-important-up.xpm.

* WL-ELS (ELMO-MODULES): Added elmo-file.

28 files changed:
ChangeLog
WL-ELS
elmo/ChangeLog
elmo/elmo-file.el [new file with mode: 0644]
elmo/elmo-filter.el
elmo/elmo-flag.el
elmo/elmo-imap4.el
elmo/elmo-mime.el
elmo/elmo-nntp.el
elmo/elmo.el
elmo/elsp-bogofilter.el
elmo/elsp-sa.el
elmo/modb-standard.el
elmo/slp.el
etc/icons/wl-summary-mark-as-important-up.xpm [deleted file]
etc/icons/wl-summary-set-flags-up.xpm [new file with mode: 0644]
wl/ChangeLog
wl/wl-demo.el
wl/wl-e21.el
wl/wl-highlight.el
wl/wl-message.el
wl/wl-mime.el
wl/wl-score.el
wl/wl-summary.el
wl/wl-thread.el
wl/wl-vars.el
wl/wl-xmas.el
wl/wl.el

index 33035ec..1943d29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-09  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * etc/icons/wl-summary-set-flags-up.xpm: Renamed from
+       wl-summary-mark-as-important-up.xpm.
+
+       * WL-ELS (ELMO-MODULES): Added elmo-file.
+
 2004-01-18  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * WL-ELS (UTILS-MODULES): Add im-wl.
diff --git a/WL-ELS b/WL-ELS
index c365e7d..f4d3b09 100644 (file)
--- a/WL-ELS
+++ b/WL-ELS
@@ -22,7 +22,7 @@
    elmo-multi elmo-filter
    elmo-archive elmo-pipe elmo-cache
    elmo-internal elmo-flag elmo-sendlog
-   elmo-dop elmo-nmz elmo-split
+   elmo-dop elmo-nmz elmo-file elmo-split
    elmo-spam elsp-bogofilter elsp-sa elsp-bsfilter
    modb modb-entity modb-legacy modb-standard
    ))
index b247576..dbd458d 100644 (file)
@@ -1,5 +1,44 @@
 2004-02-09  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * slp.el (slp-exec-wait): Avoid byte-compile warnings.
+
+       * elmo-nntp.el (elmo-nntp-folder-list-subfolders): Avoid byte-compile
+       warnings.
+
+       * elmo-file.el: New file.
+       
+       * modb-standard.el (elmo-msgdb-list-flagged): Treat keyword flags.
+
+       * elsp-sa.el (elmo-spam-spamassassin-max-messages-per-process): New
+       variable.
+       (elmo-spam-spamassassin-register-messages): New inline function.
+       (elmo-spam-register-spam-messages): Define.
+       (elmo-spam-register-good-messages): Ditto.
+
+       * elsp-bogofilter.el (elmo-spam-bogofilter-max-messages-per-process):
+       Fixed typo.
+
+       * elmo.el (toplevel): Added autoload setting for
+       `elmo-get-global-flags'.
+       (elmo-message-has-global-flag-p): New function.
+       (elmo-message-set-global-flags): Ditto.
+       (elmo-folder-type): Improvement for name: format.
+
+       * elmo-imap4.el (elmo-imap4-session-flag-available-p): Check
+       availability of keyword flags.
+       (elmo-imap4-folder-list-flagged): Treat keyword flags.
+       (elmo-folder-list-flagged-plugged): Renamed from
+       elmo-folder-list-flagged-unplugged.
+       (elmo-imap4-set-flag): If "\*" is treated as permanent flag,
+       accept any flag as keyword flag.
+       (elmo-folder-set-flag-plugged): Accept keyword flags.
+       (toplevel): Added autoload setting for `elmo-get-global-flags'.
+
+       * elmo-flag.el (elmo-get-global-flags): New function.
+
+       * elmo-filter.el (elmo-folder-diff): Fix total number for filter
+       filters.
+
        * elmo-version.el (elmo-version): Up to 2.11.24.
 
 2004-02-08  Yoichi NAKAYAMA  <yoichi@geiin.org>
diff --git a/elmo/elmo-file.el b/elmo/elmo-file.el
new file mode 100644 (file)
index 0000000..58fb1b0
--- /dev/null
@@ -0,0 +1,211 @@
+;;; elmo-file.el --- File interface for ELMO.
+
+;; Copyright (C) 2000 Yuuichi Teranishi <teranisi@gohome.org>
+
+;; Author: Yuuichi Teranishi <teranisi@gohome.org>
+;; Keywords: mail, net news
+
+;; This file is part of ELMO (Elisp Library for Message Orchestration).
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+;;
+
+;;; Commentary:
+;;
+
+;;; Code:
+;;
+(require 'elmo)
+(require 'elmo-map)
+(require 'mime-edit)
+
+(eval-and-compile
+  (luna-define-class elmo-file-folder (elmo-map-folder) (file-path))
+  (luna-define-internal-accessors 'elmo-file-folder))
+
+(luna-define-method elmo-folder-initialize ((folder
+                                            elmo-file-folder)
+                                           name)
+  (elmo-file-folder-set-file-path-internal folder name)
+  folder)
+
+(luna-define-method elmo-folder-expand-msgdb-path ((folder
+                                                   elmo-file-folder))
+  (expand-file-name
+   (elmo-replace-string-as-filename (elmo-folder-name-internal folder))
+   (expand-file-name "file" elmo-msgdb-directory)))
+
+(defun elmo-file-make-date-string (attrs)
+  (let ((s (current-time-string (nth 5 attrs))))
+    (string-match "\\`\\([A-Z][a-z][a-z]\\) +[A-Z][a-z][a-z] +[0-9][0-9]? *[0-9][0-9]?:[0-9][0-9]:[0-9][0-9] *[0-9]?[0-9]?[0-9][0-9]"
+                 s)
+    (concat (elmo-match-string 1 s) ", "
+           (timezone-make-date-arpa-standard s (current-time-zone)))))
+
+(defun elmo-file-msgdb-create-entity (msgdb folder number)
+  "Create msgdb entity for the message in the FOLDER with NUMBER."
+  (let* ((file (elmo-message-file-name folder number))
+        (attrs (file-attributes file)))
+    (and (not (file-directory-p file))
+        attrs
+        (elmo-msgdb-make-message-entity
+         (elmo-msgdb-message-entity-handler msgdb)
+         :message-id (concat "<" (elmo-replace-in-string
+                                  file "/" ":")
+                             "@" (system-name))
+         :number number
+         :size (nth 7 attrs)
+         :date (elmo-file-make-date-string attrs)
+         :subject (file-name-nondirectory file)
+         :from (concat (user-full-name (nth 2 attrs))
+                       " <" (user-login-name (nth 2 attrs)) "@"
+                       (system-name) ">")))))
+
+(luna-define-method elmo-folder-msgdb-create ((folder elmo-file-folder)
+                                             numlist flag-table)
+  (let ((new-msgdb (elmo-make-msgdb))
+       entity mark i percent num)
+    (setq num (length numlist))
+    (setq i 0)
+    (message "Creating msgdb...")
+    (while numlist
+      (setq entity
+           (elmo-file-msgdb-create-entity new-msgdb folder (car numlist)))
+      (when entity
+       (elmo-msgdb-append-entity new-msgdb entity '(new unread)))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (setq percent (/ (* i 100) num))
+       (elmo-display-progress
+        'elmo-folder-msgdb-create "Creating msgdb..."
+        percent))
+      (setq numlist (cdr numlist)))
+    (message "Creating msgdb...done")
+    new-msgdb))
+
+(luna-define-method elmo-folder-message-file-p ((folder elmo-file-folder))
+  t)
+
+(luna-define-method elmo-message-file-name ((folder elmo-file-folder)
+                                           number)
+  (expand-file-name (car (split-string
+                         (elmo-map-message-location folder number)
+                         "/"))
+                   (elmo-file-folder-file-path-internal folder)))
+
+(luna-define-method elmo-folder-message-make-temp-file-p
+  ((folder elmo-file-folder))
+  t)
+
+(luna-define-method elmo-folder-diff ((folder elmo-file-folder))
+  (cons nil nil))
+
+(luna-define-method elmo-folder-message-make-temp-files ((folder
+                                                         elmo-file-folder)
+                                                        numbers
+                                                        &optional
+                                                        start-number)
+  (let ((temp-dir (elmo-folder-make-temporary-directory folder))
+       (cur-number (if start-number 0)))
+    (dolist (number numbers)
+      (elmo-copy-file
+       (elmo-message-file-name folder number)
+       (expand-file-name
+       (int-to-string (if start-number (incf cur-number) number))
+       temp-dir)))
+    temp-dir))
+
+(luna-define-method elmo-map-message-fetch ((folder elmo-file-folder)
+                                           location strategy
+                                           &optional section unseen)
+  (let ((file (expand-file-name (car (split-string location "/"))
+                               (elmo-file-folder-file-path-internal folder)))
+       charset guess uid)
+    (when (file-exists-p file)
+      (prog1
+         (insert-file-contents-as-binary file)
+       (unless (or (std11-field-body "To")
+                   (std11-field-body "Cc")
+                   (std11-field-body "Subject"))
+           (erase-buffer)
+           (set-buffer-multibyte t)
+           (insert-file-contents file)
+           (setq charset (detect-mime-charset-region (point-min)
+                                                     (point-max)))
+           (goto-char (point-min))
+           (setq guess (mime-find-file-type file))
+           (setq uid (nth 2 (file-attributes file)))
+           (insert "From: " (concat (user-full-name uid)
+                                    " <"(user-login-name uid) "@"
+                                    (system-name) ">") "\n")
+           (insert "Subject: " (file-name-nondirectory file) "\n")
+           (insert "Date: "
+                   (elmo-file-make-date-string (file-attributes file))
+                   "\n")
+           (insert "Message-ID: "
+                   (concat "<" (elmo-replace-in-string file "/" ":")
+                           "@" (system-name) ">\n"))
+           (insert "Content-Type: "
+                   (concat (nth 0 guess) "/" (nth 1 guess))
+                   (or (and (string= (nth 0 guess) "text")
+                            (concat
+                             "; charset=" (upcase (symbol-name charset))))
+                       "")
+                   "\nMIME-Version: 1.0\n\n")
+           (when (string= (nth 0 guess) "text")
+             (encode-mime-charset-region (point-min) (point-max) charset))
+           (set-buffer-multibyte nil))))))
+
+(luna-define-method elmo-map-folder-list-message-locations
+  ((folder elmo-file-folder))
+  (mapcar
+   (lambda (file)
+     (concat
+      file "/"
+      (mapconcat
+       'number-to-string
+       (nth 5 (file-attributes (expand-file-name
+                               file
+                               (elmo-file-folder-file-path-internal
+                                folder))))
+       ":")))
+   (directory-files (elmo-file-folder-file-path-internal folder))))
+
+(luna-define-method elmo-folder-exists-p ((folder elmo-file-folder))
+  (file-directory-p (elmo-file-folder-file-path-internal folder)))
+
+(luna-define-method elmo-folder-list-subfolders ((folder elmo-file-folder)
+                                                &optional one-level)
+  (when (file-directory-p (elmo-file-folder-file-path-internal folder))
+    (append
+     (list (elmo-folder-name-internal folder))
+     (delq nil
+          (mapcar
+           (lambda (file)
+             (when (and (file-directory-p
+                         (expand-file-name
+                          file
+                          (elmo-file-folder-file-path-internal folder)))
+                        (not (string= file "."))
+                        (not (string= file "..")))
+               (concat (elmo-folder-name-internal folder) "/" file)))
+           (directory-files (elmo-file-folder-file-path-internal
+                             folder)))))))
+
+(require 'product)
+(product-provide (provide 'elmo-file) (require 'elmo-version))
+
+;;; elmo-file.el ends here
index 5790196..460e18a 100644 (file)
                   (string= (elmo-filter-value condition) "unread")))
          (setq diff (elmo-folder-diff (elmo-filter-folder-target-internal
                                        folder)))
-         (if (consp diff)
-             (cons (car diff) (car diff))
-           (cons (car diff) (nth 1 diff))))
+         (if (consp (cdr diff))
+             ;; new unread unread
+             (list (car diff) (nth 1 diff) (nth 1 diff))
+           (cons (car diff) (car diff))))
         ((string= "last" (elmo-filter-key condition))
          (luna-call-next-method))
         (t
index 50c2546..87ebab4 100644 (file)
@@ -375,6 +375,24 @@ the message is not flagged in any folder."
       (dolist (number numbers)
        (elmo-global-flag-detach flag folder number delete-if-none)))))
 
+(defun elmo-get-global-flags (&optional flags ignore-preserved)
+  "Get global flags.
+Return value is a subset of optional argument FLAGS.
+If FLAGS is `t', all global flags becomes candidates.
+If optional IGNORE-PRESERVED is non-nil, preserved flags
+\(answered, cached, new, unread\) are not included."
+  (let ((result (copy-sequence (if (eq flags t)
+                                  (setq flags elmo-global-flag-list)
+                                flags))))
+    (while flags
+      (unless (elmo-global-flag-p (car flags))
+       (setq result (delq (car flags) result)))
+      (setq flags (cdr flags)))
+    (when ignore-preserved
+      (dolist (flag '(answered cached new unread))
+       (setq result (delq flag result))))
+    result))
+
 ;;; To migrate from global mark folder
 (defvar elmo-global-mark-filename "global-mark"
   "Obsolete variable. (Just for migration)")
index 49848e9..ae79ff3 100644 (file)
@@ -750,9 +750,12 @@ Returns response value if selecting folder succeed. "
          "\\seen" (elmo-imap4-session-flags-internal session))
         (elmo-string-member-ignore-case
          "\\flagged" (elmo-imap4-session-flags-internal session))))
-    (t (elmo-string-member-ignore-case
-       (concat "\\" (symbol-name flag))
-       (elmo-imap4-session-flags-internal session)))))
+    (answered
+     (elmo-string-member-ignore-case
+      (concat "\\" (symbol-name flag))
+      (elmo-imap4-session-flags-internal session)))
+    (t
+     (member "\\*" (elmo-imap4-session-flags-internal session)))))
 
 (defun elmo-imap4-folder-list-flagged (folder flag)
   "List flagged message numbers in the FOLDER.
@@ -762,9 +765,20 @@ FLAG is one of the `unread', `read', `important', `answered', `any'."
                    (read "seen")
                    (unread "unseen")
                    (important "flagged")
+                   (answered "answered")
+                   (new "new")
                    (any "or answered or unseen flagged")
                    (digest "or unseen flagged")
-                   (t (symbol-name flag)))))
+                   (t (concat "keyword " (capitalize (symbol-name flag)))))))
+    ;; Add search keywords
+    (when (or (eq flag 'digest)(eq flag 'any))
+      (let ((flags (delq 'important (elmo-get-global-flags t t))))
+       (while flags
+         (setq criteria (concat "or keyword "
+                                (symbol-name (car flags))
+                                " "
+                                criteria))
+         (setq flags (cdr flags)))))
     (if (elmo-imap4-session-flag-available-p session flag)
        (progn
          (elmo-imap4-session-select-mailbox
@@ -1905,7 +1919,7 @@ Return nil if no complete line has arrived."
                         (format "uid %d:*" (cdr (car killed)))
                       "all"))))
 
-(luna-define-method elmo-folder-list-flagged-unplugged
+(luna-define-method elmo-folder-list-flagged-plugged
   ((folder elmo-imap4-folder) flag)
   (elmo-imap4-folder-list-flagged folder flag))
 
@@ -2098,6 +2112,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
     (when (or (elmo-string-member-ignore-case
               flag
               (elmo-imap4-session-flags-internal session))
+             (member "\\*" (elmo-imap4-session-flags-internal session))
              (string= flag "\\Deleted")) ; XXX Humm..
       (setq set-list (elmo-imap4-make-number-set-list
                      numbers
@@ -2346,14 +2361,16 @@ If optional argument REMOVE is non-nil, remove FLAG."
 (luna-define-method elmo-folder-set-flag-plugged ((folder elmo-imap4-folder)
                                                  numbers flag)
   (let ((spec (cdr (assq flag elmo-imap4-flag-specs))))
-    (when spec
-      (elmo-imap4-set-flag folder numbers (car spec) (nth 1 spec)))))
+    (elmo-imap4-set-flag folder numbers (or (car spec)
+                                           (capitalize (symbol-name flag))
+                                           (nth 1 spec)))))
 
 (luna-define-method elmo-folder-unset-flag-plugged ((folder elmo-imap4-folder)
                                                    numbers flag)
   (let ((spec (cdr (assq flag elmo-imap4-flag-specs))))
-    (when spec
-      (elmo-imap4-set-flag folder numbers (car spec) (not (nth 1 spec))))))
+    (elmo-imap4-set-flag folder numbers (or (car spec)
+                                           (capitalize (symbol-name flag)))
+                        (not (nth 1 spec)))))
 
 (luna-define-method elmo-message-use-cache-p ((folder elmo-imap4-folder)
                                              number)
@@ -2706,6 +2723,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
   nil)
 
 (autoload 'elmo-global-flags-set "elmo-flag")
+(autoload 'elmo-get-global-flags "elmo-flag")
 
 (require 'product)
 (product-provide (provide 'elmo-imap4) (require 'elmo-version))
index baa2eb0..d338f7d 100644 (file)
@@ -213,7 +213,7 @@ value is used."
 
 (defun elmo-mime-message-display (folder number viewbuf rawbuf original-mode
                                         &optional ignore-cache unread keymap)
-  "Display MIME message. 
+  "Display MIME message.
 A message in the FOLDER with NUMBER is displayed on the VIEWBUF using RAWBUF.
 VIEWBUF is a view buffer and RAWBUF is a raw buffer.
 ORIGINAL is the major mode of RAWBUF.
@@ -246,7 +246,7 @@ Return non-nil if not entire message was fetched."
 
 (defun elmo-mime-display-as-is (folder number viewbuf rawbuf original-mode
                                       &optional ignore-cache unread keymap)
-  "Display MIME message. 
+  "Display MIME message.
 A message in the FOLDER with NUMBER is displayed on the VIEWBUF using RAWBUF.
 VIEWBUF is a view buffer and RAWBUF is a raw buffer.
 ORIGINAL is the major mode of RAWBUF.
index 2ef6585..dbd373e 100644 (file)
@@ -504,9 +504,9 @@ Don't cache if nil.")
                            (not (string= (elmo-nntp-folder-group-internal
                                           folder) "")))
                       (concat " active"
-                              (format " %s.*"
-                                      (elmo-nntp-folder-group-internal folder)
-                                      "")))))
+                              (format 
+                               " %s.*"
+                               (elmo-nntp-folder-group-internal folder))))))
          (if (elmo-nntp-read-response session t)
              (if (null (setq response (elmo-nntp-read-contents session)))
                  (error "NNTP List folders failed")
@@ -546,14 +546,14 @@ Don't cache if nil.")
            (progn
              (setq regexp
                    (format "^\\(%s[^. ]+\\)\\([. ]\\).*\n"
-                           (if (and
-                                (elmo-nntp-folder-group-internal folder)
-                                (null (string=
-                                       (elmo-nntp-folder-group-internal
-                                        folder) "")))
+                           (if (and (elmo-nntp-folder-group-internal folder)
+                                    (null (string=
+                                           (elmo-nntp-folder-group-internal
+                                            folder) "")))
                                (concat (elmo-nntp-folder-group-internal
                                         folder)
-                                       "\\.") "")))
+                                       "\\.")
+                             "")))
              (while (looking-at regexp)
                (setq top-ng (elmo-match-buffer 1))
                (if (string= (elmo-match-buffer 2) " ")
index 87c867c..c31befe 100644 (file)
@@ -87,6 +87,7 @@ Otherwise, entire fetching of the message is aborted without confirmation."
   (autoload 'elmo-global-flag-detach "elmo-flag")
   (autoload 'elmo-global-flag-detach-messages "elmo-flag")
   (autoload 'elmo-global-flag-set "elmo-flag")
+  (autoload 'elmo-get-global-flags "elmo-flag")
   (autoload 'elmo-global-mark-migrate "elmo-flag")
   (autoload 'elmo-folder-list-global-flag-messages "elmo-flag"))
 
@@ -103,8 +104,10 @@ If a folder name begins with PREFIX, use BACKEND."
 
 (defmacro elmo-folder-type (name)
   "Get folder type from NAME string."
-  (` (and (stringp (, name))
-         (cdr (assoc (string-to-char (, name)) elmo-folder-type-alist)))))
+  `(and (stringp ,name)
+       (or (cdr (assoc (string-to-char ,name) elmo-folder-type-alist))
+           (when (string-match "\\([^:]*\\):" ,name)
+             (intern (match-string 1 ,name))))))
 
 ;;; ELMO folder
 ;; A elmo folder provides uniformed (orchestrated) access
@@ -252,9 +255,8 @@ FLAG is a symbol which is one of the following:
   `important'  (marked as important)
 'sugar' flags:
   `read'       (not unread)
-  `digest'     (unread + important)
-  `any'        (digest + answered)
-
+  `digest'     (unread + important + other flags)
+  `any'        (digest + answered + other flags)
 If optional IN-MSGDB is non-nil, retrieve flag information from msgdb.")
 
 (luna-define-method elmo-folder-list-flagged ((folder elmo-folder) flag
@@ -1194,6 +1196,32 @@ FIELD is a symbol of the field.")
                           number
                           flag))))
 
+(defun elmo-message-has-global-flag-p (folder number)
+  "Return non-nil when the message in the FOLDER with NUMBER has global flag."
+  (let ((flags (elmo-message-flags folder number))
+       result)
+    (while flags
+      (when (and (elmo-global-flag-p (car flags))
+                (not (memq (car flags) '(answered unread cached))))
+       (setq result t
+             flags nil))
+      (setq flags (cdr flags)))
+    result))
+
+(defun elmo-message-set-global-flags (folder number flags &optional local)
+  "Set global flags of the message in the FOLDER with NUMBER as FLAGS.
+If Optional LOCAL is non-nil, don't update server flag."
+  (dolist (flag flags)
+    (unless (elmo-global-flag-p flag)
+      (error "Not a global flag")))
+  (let ((old-flags (elmo-get-global-flags (elmo-message-flags folder number))))
+    (dolist (flag flags)
+      (unless (memq flag old-flags)
+       (elmo-message-set-flag folder number flag local)))
+    (dolist (flag old-flags)
+      (unless (memq flag flags)
+       (elmo-message-unset-flag folder number flag local)))))
+
 (luna-define-method elmo-folder-unset-flag ((folder elmo-folder)
                                            numbers
                                            flag
index 14f0f60..948a2d0 100644 (file)
@@ -53,7 +53,7 @@
   :group 'elmo-spam-bogofilter)
 
 (defcustom elmo-spam-bogofilter-max-messages-per-process 30
-  "Number of messages processed at one once"
+  "Number of messages processed at once."
   :type 'integer
   :group 'elmo-spam-bogofilter)
 
index e4bd6f2..4c9ea7e 100644 (file)
   :type '(file :tag "Program name of SpamAssassin Learner.")
   :group 'elmo-spam-spamassassin)
 
+(defcustom elmo-spam-spamassassin-max-messages-per-process 30
+  "Number of messages processed at once."
+  :type 'integer
+  :group 'elmo-spam-spamassassin)
+
 (defcustom elmo-spamassassin-debug nil
   "Non-nil to debug elmo spamassassin spam backend."
   :type 'boolean
     (eq 0 (apply 'elmo-spamassassin-call 'learn
                 (list (when restore "--forget") "--ham")))))
 
+(defsubst elmo-spam-spamassassin-register-messages (folder
+                                                   numbers
+                                                   spam
+                                                   restore)
+  (if (not (< 0 elmo-spam-spamassassin-max-messages-per-process))
+      (error
+ "non-positive value for `elmo-spam-spamassassin-max-messages-per-process'"))
+  (with-temp-buffer
+    (buffer-disable-undo (current-buffer))
+    (while numbers
+      (let ((count 0))
+       (while (and numbers
+                   (< count elmo-spam-spamassassin-max-messages-per-process))
+         (insert "From MAILER-DAEMON@example.com\n"
+                 (with-temp-buffer
+                   (elmo-spam-message-fetch folder (car numbers))
+                   (goto-char (point-min))
+                   (while (re-search-forward "^>*From " nil t)
+                     (goto-char (match-beginning 0))
+                     (insert ?>)
+                     (forward-line))
+                   (buffer-substring (point-min) (point-max)))
+                 "\n\n")
+         (setq count (1+ count)
+               numbers (cdr numbers)))
+       (apply 'elmo-spamassassin-call 'learn
+              (delq nil
+                    (list "--mbox"
+                          (when restore "--forget")
+                          (if spam "--spam" "--ham"))))
+       (elmo-progress-notify 'elmo-spam-register count)
+       (erase-buffer)))))
+
+(luna-define-method elmo-spam-register-spam-messages :around
+  ((processor elsp-sa) folder &optional numbers restore)
+  (let ((numbers (or numbers (elmo-folder-list-messages folder t t))))
+    (if (> (length numbers) 1)
+       (elmo-spam-spamassassin-register-messages folder numbers t restore)
+      (luna-call-next-method))))
+
+(luna-define-method elmo-spam-register-good-messages :around
+  ((processor elsp-sa) folder &optional numbers restore)
+  (let ((numbers (or numbers (elmo-folder-list-messages folder t t))))
+    (if (> (length numbers) 1)
+       (elmo-spam-spamassassin-register-messages folder numbers nil restore)
+      (luna-call-next-method))))
+
 (require 'product)
 (product-provide (provide 'elsp-sa) (require 'elmo-version))
 
index 9e3f426..9bfcd09 100644 (file)
    (modb-standard-number-list-internal msgdb)))
 
 (luna-define-method elmo-msgdb-list-flagged ((msgdb modb-standard) flag)
-  (let (entry matched)
+  (let ((flags (case flag
+                (digest
+                 (nconc '(unread)(elmo-get-global-flags t t)))
+                (any
+                 (nconc '(unread answered)(elmo-get-global-flags t t)))))
+       entry matched)
     (case flag
       (read
        (dolist (number (modb-standard-number-list-internal msgdb))
         (unless (memq 'unread (modb-standard-message-flags msgdb number))
           (setq matched (cons number matched)))))
-      (digest
+      ((digest any)
        (mapatoms
        (lambda (atom)
          (setq entry (symbol-value atom))
-         (when (modb-standard-match-flags '(unread important)
-                                          (cdr entry))
-           (setq matched (cons (car entry) matched))))
-       (modb-standard-flag-map msgdb)))
-      (any
-       (mapatoms
-       (lambda (atom)
-         (setq entry (symbol-value atom))
-         (when (modb-standard-match-flags '(unread important answered)
-                                          (cdr entry))
+         (when (modb-standard-match-flags flags (cdr entry))
            (setq matched (cons (car entry) matched))))
        (modb-standard-flag-map msgdb)))
       (t
index 42cbb25..84f4cac 100644 (file)
@@ -54,7 +54,7 @@ TYPE is a symbol (one of `srvs', `attrs', `srvtypes', `as-is', `ignore')."
     (let ((result (apply 'call-process slp-program nil t nil
                         (append slp-program-arguments (delq nil args)))))
       (unless (zerop result)
-       (error "SLP error: " (buffer-string)))
+       (error "SLP error: %s" (buffer-string)))
       (goto-char (point-min))
       (case type
        (srvs (slp-parse-srvs))
diff --git a/etc/icons/wl-summary-mark-as-important-up.xpm b/etc/icons/wl-summary-mark-as-important-up.xpm
deleted file mode 100644 (file)
index d4210b9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* XPM */
-static char * wl_summary_mark_as_important_up_xpm[] = {
-"32 32 8 1",
-"      c #BEFBBEFBBEFB s backgroundToolBarColor",
-".     c #000000000000",
-"X     c #E79DCB2B9E79",
-"o     c #CF3CBAEA9658",
-"O     c #B6DAA6998617",
-"+     c #FFFFFFFFFFFF",
-"@     c #AEBAAEBAAEBA",
-"#     c #69A68E38EFBE",
-"                                ",
-"        ..................      ",
-"       ..XoooooooooooooooO.     ",
-"       ..XoooooooooooooooO.     ",
-"       ..Xoooooooooooooooo.     ",
-"       .+.ooooooooooooooooO.    ",
-"       .+.XoooooooooooooooO.    ",
-"       .+.XoooooooooooooooO.    ",
-"       .+.XooooooooooooooooO.   ",
-"        .+.XoooooooooooooooO.   ",
-"        .+.OOOOOOOOOOOOOOOOO.   ",
-"        .+.................O.   ",
-"        .+.@@@@@@@@@@@@@@@@..   ",
-"         .+@+++++++++++++++@.   ",
-"        .++@++++++++++++++++.   ",
-"       .+++...@+++++++++++++.   ",
-" #    .+++++.@++++++++++++++.   ",
-" ##  .+++++.@@++++++++++++++.   ",
-"  # .+++++.@@@+++++++++++++.    ",
-"  ## .#++..................     ",
-"   ####+.                       ",
-"       .                        ",
-"                                ",
-"                                ",
-"                      .         ",
-"         .   .        .         ",
-"         .. .. ..  . .. .       ",
-"         . . .   . .. ..        ",
-"         . . . ... .  ..        ",
-"         . . . . . .  . .       ",
-"         . . . .. ..  . .       ",
-"                                "};
diff --git a/etc/icons/wl-summary-set-flags-up.xpm b/etc/icons/wl-summary-set-flags-up.xpm
new file mode 100644 (file)
index 0000000..d4210b9
--- /dev/null
@@ -0,0 +1,43 @@
+/* XPM */
+static char * wl_summary_mark_as_important_up_xpm[] = {
+"32 32 8 1",
+"      c #BEFBBEFBBEFB s backgroundToolBarColor",
+".     c #000000000000",
+"X     c #E79DCB2B9E79",
+"o     c #CF3CBAEA9658",
+"O     c #B6DAA6998617",
+"+     c #FFFFFFFFFFFF",
+"@     c #AEBAAEBAAEBA",
+"#     c #69A68E38EFBE",
+"                                ",
+"        ..................      ",
+"       ..XoooooooooooooooO.     ",
+"       ..XoooooooooooooooO.     ",
+"       ..Xoooooooooooooooo.     ",
+"       .+.ooooooooooooooooO.    ",
+"       .+.XoooooooooooooooO.    ",
+"       .+.XoooooooooooooooO.    ",
+"       .+.XooooooooooooooooO.   ",
+"        .+.XoooooooooooooooO.   ",
+"        .+.OOOOOOOOOOOOOOOOO.   ",
+"        .+.................O.   ",
+"        .+.@@@@@@@@@@@@@@@@..   ",
+"         .+@+++++++++++++++@.   ",
+"        .++@++++++++++++++++.   ",
+"       .+++...@+++++++++++++.   ",
+" #    .+++++.@++++++++++++++.   ",
+" ##  .+++++.@@++++++++++++++.   ",
+"  # .+++++.@@@+++++++++++++.    ",
+"  ## .#++..................     ",
+"   ####+.                       ",
+"       .                        ",
+"                                ",
+"                                ",
+"                      .         ",
+"         .   .        .         ",
+"         .. .. ..  . .. .       ",
+"         . . .   . .. ..        ",
+"         . . . ... .  ..        ",
+"         . . . . . .  . .       ",
+"         . . . .. ..  . .       ",
+"                                "};
index 7630906..2ac1038 100644 (file)
@@ -1,5 +1,78 @@
 2004-02-09  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * wl.el (wl-init): Setup faces accoding to wl-summary-flag-alist.
+
+       * wl-xmas.el (wl-summary-toolbar): Setup wl-summary-set-flags.
+
+       * wl-e21.el (wl-summary-toolbar): Ditto.
+
+       * wl-vars.el (wl-demo-background-color): Abolished.
+       (wl-summary-persistent-mark-priority-list): Renamed from
+       wl-summary-flag-priority-list.
+       (wl-summary-flag-alist): New user option.
+       (wl-summary-flag-mark): Renamed from wl-summary-important-mark.
+       (wl-message-mode-line-format-spec-alist): Added 'F'.
+       (wl-message-mode-line-format): Likewise.
+       (wl-summary-expire-reserve-marks): Use wl-summary-flag-mark
+       instead of wl-summary-important-mark.
+       (wl-file-folder-icon): New variable.
+
+       * wl-thread.el (wl-thread-set-flags): Renamed from
+       wl-thread-mark-as-important.
+
+       * wl-summary.el: Define `elmo-global-flag-list' to avoid byte-compile
+       warning.
+       (wl-summary-mode-menu-spec): Follow the change of 
+       `wl-summary-mark-as-important', `wl-thread-set-flags', and so on.
+       (wl-summary-mode-map): Follow the change of
+       `wl-summary-mark-as-important', `wl-thread-set-flags', and so on.
+       (wl-summary-detect-mark-position): Follow the variable name change.
+       (wl-summary-set-flags-region): New function for the replacement of
+       wl-summary-mark-as-important-region.
+       (wl-summary-sync-marks): Sync all global-flags.
+       (wl-summary-auto-select-msg-p): Use elmo-message-has-global-flag-p
+       instead of elmo-message-flagged-p.
+       (wl-summary-persistent-mark-string): Follow the variable name change;
+       Put wl-summary-flag-mark if the message has global-flag.
+       (wl-summary-target-mark-set-flags): Renamed from 
+       wl-summary-target-mark-mark-as-important.
+       (wl-summary-decide-flag): New function.
+       (wl-summary-set-flags-internal): Renamed from
+       wl-summary-mark-as-important-internal.
+       (wl-summary-add-flags-internal): New function.
+       (wl-summary-remove-flags-internal): Ditto.
+       (wl-summary-set-flags): Renamed from wl-summary-mark-as-important.
+       (wl-summary-mark-as-unimportant): Abolish.
+       (wl-summary-move-spec-alist): Changed `important' to `digest'.
+       (wl-summary-next-message): List flagged messages in the msgdb.
+
+       * wl-score.el (wl-summary-score-update-all-lines): Use
+       wl-summary-add-flags-internal instead of 
+
+       * wl-mime.el (wl-mime-display-header): Follow the variable name change.
+
+       * wl-message.el (wl-message-buffer-cur-display-type): Renamed
+       from wl-message-buffer-cur-flag (To avoid misunderstanding).
+       (wl-message-buffer-require-all-header): Renamed from
+       wl-message-buffer-all-header-flag (Ditto).
+       (wl-message-buffer-flag-indicator): New variable.
+       (wl-message-redisplay): Changed local varibale name from `flag' to
+       `display-type'; Set up wl-message-buffer-flag-indicator.
+       (wl-message-buffer-display): Changed varibale name from `flag' to
+       `display-type'.
+       (wl-message-display-internal): Likewise.
+
+       * wl-highlight.el (wl-highlight-demo-face): Define default background
+       color.
+       (wl-highlight-summary-line-face-spec): Highlight flagged messages.
+
+       * wl-e21.el (wl-folder-internal-icon-list): Added file folder icon.
+
+       * wl-demo.el (wl-demo-xpm-set-background): Abolish.
+       (wl-demo-setup-properties): Renamed from
+       `wl-demo-set-background-color'.
+       (wl-demo): Follow the change above.
+       
        * Version number is increased to 2.11.24.
 
 2004-02-06  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
index 7b2b787..6efca5e 100644 (file)
@@ -128,12 +128,6 @@ Yet Another Message Interface On Emacsen"
          (delq nil (list xpm bitmap xbm '("ascii")))))
     '(("ascii"))))
 
-(defun wl-demo-xpm-set-background ()
-  "A filter function to set xpm background.
-`wl-demo-background-color' is used for the background color."
-  (when (search-forward "None" nil t)
-    (replace-match wl-demo-background-color)))
-
 (defun wl-demo-image-filter (file type)
   "Get filtered image data.
 FILE is the image file name.
@@ -287,28 +281,29 @@ Return a number of lines that an image occupies in the buffer."
                      (max 0 (/ (1+ (- (window-width) width)) 2)))
       (count-lines (point-min) (goto-char (point-max))))))
 
-(defun wl-demo-set-background-color ()
-  "Set background color of the demo buffer."
+(defun wl-demo-setup-properties ()
+  "Set up properties of the demo buffer."
   (cond
    (wl-on-emacs21
     ;; I think there should be a better way to set face background
     ;; for the buffer only. But I don't know how to do it on Emacs21.
     (goto-char (point-max))
     (dotimes (i (- (window-height)
-                  (count-lines (point-min) (point)) 1)) ; 1 means modeline
+                  (count-lines (point-min) (point))))
       (insert ?\n))
-    (let ((fg (face-foreground 'wl-highlight-demo-face)))
+    (let ((fg (face-foreground 'wl-highlight-demo-face))
+         (bg (face-background 'wl-highlight-demo-face)))
       (put-text-property (point-min) (point-max)
                         'face
                         (nconc '(variable-pitch :slant oblique)
-                               (list ':background
-                                     wl-demo-background-color)
+                               (when (stringp bg)
+                                 (list ':background bg))
                                (when (stringp fg)
                                  (list ':foreground fg))))))
    ((featurep 'xemacs)
-    (and wl-demo-background-color
-        (set-face-background 'default wl-demo-background-color
-                             (current-buffer))))))
+    (set-face-background 'default
+                        (face-background 'wl-highlight-demo-face)
+                        (current-buffer)))))
 
 (defun wl-demo-insert-text (height)
   "Insert a version and the copyright message after a logo image.  HEIGHT
@@ -362,7 +357,7 @@ argument."
     (set (make-local-variable 'tab-stop-list)
         '(8 16 24 32 40 48 56 64 72 80 88 96 104 112 120))
     (wl-demo-insert-text (wl-demo-insert-image image-type))
-    (wl-demo-set-background-color)
+    (wl-demo-setup-properties)
     (set-buffer-modified-p nil)
     (goto-char (point-min))
     (sit-for (if (featurep 'lisp-float-type)
index eee3264..0520364 100644 (file)
      wl-summary-sync-force-update t "Sync Current Folder"]
     [wl-summary-dispose
      wl-summary-dispose t "Dispose Current Message"]
-    [wl-summary-mark-as-important
-     wl-summary-mark-as-important t "Mark Current Message as Important"]
+    [wl-summary-set-flags
+     wl-summary-set-flags t "Set Flags"]
     [wl-draft
      wl-summary-write-current-folder t "Write for Current Folder"]
     [wl-summary-reply
 
 (defvar wl-folder-internal-icon-list
   ;; alist of (image . icon-file)
-  '((wl-folder-nntp-image         . wl-nntp-folder-icon)
-    (wl-folder-imap4-image        . wl-imap-folder-icon)
-    (wl-folder-pop3-image         . wl-pop-folder-icon)
+  '((wl-folder-nntp-image        . wl-nntp-folder-icon)
+    (wl-folder-imap4-image       . wl-imap-folder-icon)
+    (wl-folder-pop3-image        . wl-pop-folder-icon)
     (wl-folder-localdir-image     . wl-localdir-folder-icon)
     (wl-folder-localnews-image    . wl-localnews-folder-icon)
     (wl-folder-internal-image     . wl-internal-folder-icon)
-    (wl-folder-multi-image        . wl-multi-folder-icon)
+    (wl-folder-multi-image       . wl-multi-folder-icon)
     (wl-folder-filter-image       . wl-filter-folder-icon)
     (wl-folder-archive-image      . wl-archive-folder-icon)
-    (wl-folder-pipe-image         . wl-pipe-folder-icon)
+    (wl-folder-pipe-image        . wl-pipe-folder-icon)
     (wl-folder-maildir-image      . wl-maildir-folder-icon)
-    (wl-folder-nmz-image          . wl-nmz-folder-icon)
+    (wl-folder-nmz-image         . wl-nmz-folder-icon)
     (wl-folder-shimbun-image      . wl-shimbun-folder-icon)
+    (wl-folder-file-image        . wl-file-folder-icon)
     (wl-folder-trash-empty-image  . wl-empty-trash-folder-icon)
-    (wl-folder-draft-image        . wl-draft-folder-icon)
-    (wl-folder-queue-image        . wl-queue-folder-icon)
-    (wl-folder-trash-image        . wl-trash-folder-icon)))
+    (wl-folder-draft-image       . wl-draft-folder-icon)
+    (wl-folder-queue-image       . wl-queue-folder-icon)
+    (wl-folder-trash-image       . wl-trash-folder-icon)))
 
 (defun wl-folder-init-icons ()
   (when (wl-e21-display-image-p)
index 31fb814..aa2cb3f 100644 (file)
   :group 'wl-faces)
 
 (wl-defface wl-highlight-demo-face
-  '(
-    (((type tty)
-      (background dark))
+  '((((type tty))
      (:foreground "green"))
     (((class color)
-      (background dark))
-     (:foreground "#006600"))
-    (((class color)
       (background light))
-     (:foreground "#006600")))
+     (:foreground "#006600" :background "#d9ffd9"))
+    (((class color)
+      (background dark))
+     (:foreground "#d9ffd9" :background "#004400")))
   "Face used for displaying demo."
   :group 'wl-faces)
 
 (wl-defface wl-highlight-logo-face
-  '(
-    (((type tty)
+  '((((type tty)
       (background dark))
      (:foreground "cyan"))
     (((class color)
        ((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-flag-priority-list)
-             result)
+       ((let ((priorities wl-summary-persistent-mark-priority-list)
+             (fl wl-summary-flag-alist)
+             face result global-flags)
          (while (and (null result) priorities)
-           (when (memq (car priorities) flags)
-             (setq result
-                   (case (car priorities)
-                     (new
-                      '(wl-highlight-summary-new-face))
-                     (important
-                      '(wl-highlight-summary-important-face))
-                     (answered
-                      '(wl-highlight-summary-answered-face))
-                     (unread
-                      '(wl-highlight-summary-unread-face)))))
+           (if (and (eq (car priorities) 'flag)
+                    (setq global-flags
+                          (elmo-get-global-flags flags 'ignore-preserved)))
+               (while fl
+                 (when (memq (car (car fl)) global-flags)
+                   (setq result
+                         (progn
+                           (setq face
+                                 (intern (format
+                                          "wl-highlight-summary-%s-flag-face"
+                                          (car (car fl)))))
+                           (when (facep face)
+                             (list face)))
+                         fl nil))
+                 (setq fl (cdr fl)))
+             (when (memq (car priorities) flags)
+               (setq result
+                     (progn (setq face
+                                  (intern (format
+                                           "wl-highlight-summary-%s-face"
+                                           (car priorities))))
+                            (when (facep face)
+                              (list face))))))
            (setq priorities (cdr priorities)))
          result))
        ((string= temp-mark wl-summary-score-below-mark)
@@ -1110,9 +1120,9 @@ Returns start point of signature."
 Faces used:
   wl-highlight-message-headers                   the part before the colon
   wl-highlight-message-header-contents           the part after the colon
-  wl-highlight-message-important-header-contents  contents of \"special\"
+  wl-highlight-message-important-header-contents  contents of \"important\"
                                                   headers
-  wl-highlight-message-important-header-contents2 contents of \"special\"
+  wl-highlight-message-important-header-contents2 contents of \"important\"
                                                   headers
   wl-highlight-message-unimportant-header-contents contents of unimportant
                                                    headers
@@ -1122,9 +1132,9 @@ Faces used:
   wl-highlight-message-signature                   signature
 
 Variables used:
-  wl-highlight-important-header-regexp  what makes a \"special\" header
-  wl-highlight-important-header2-regexp         what makes a \"special\" header
-  wl-highlight-unimportant-header-regexp what makes a \"special\" header
+  wl-highlight-important-header-regexp  what makes a \"important\" header
+  wl-highlight-important-header2-regexp         what makes a \"important\" header
+  wl-highlight-unimportant-header-regexp what makes a \"not important\" header
   wl-highlight-citation-prefix-regexp   matches lines of quoted text
   wl-highlight-citation-header-regexp   matches headers for quoted text
 
index 7cbdf84..25ec645 100644 (file)
 
 (defvar wl-message-buffer-cur-folder nil)
 (defvar wl-message-buffer-cur-number nil)
-(defvar wl-message-buffer-cur-flag nil)
+(defvar wl-message-buffer-cur-display-type nil)
 (defvar wl-message-buffer-cur-summary-buffer nil)
+(defvar wl-message-buffer-require-all-header nil)
 (defvar wl-message-buffer-original-buffer nil) ; original buffer.
-(defvar wl-message-buffer-all-header-flag nil)
 (defvar wl-message-buffer-mode-line-formatter nil)
+(defvar wl-message-buffer-flag-indicator nil)
 
 (make-variable-buffer-local 'wl-message-buffer-cur-folder)
 (make-variable-buffer-local 'wl-message-buffer-cur-number)
-(make-variable-buffer-local 'wl-message-buffer-cur-flag)
+(make-variable-buffer-local 'wl-message-buffer-cur-display-type)
 (make-variable-buffer-local 'wl-message-buffer-cur-summary-buffer)
+(make-variable-buffer-local 'wl-message-buffer-require-all-header)
 (make-variable-buffer-local 'wl-message-buffer-original-buffer)
-(make-variable-buffer-local 'wl-message-buffer-all-header-flag)
 (make-variable-buffer-local 'wl-message-buffer-mode-line-formatter)
+(make-variable-buffer-local 'wl-message-buffer-flag-indicator)
 
 (defvar wl-fixed-window-configuration nil)
 
@@ -413,17 +415,17 @@ Returns non-nil if bottom of message."
               (nth 3 entry) (match-string (nth 4 entry))))
            (goto-char end)))))))
 
-(defun wl-message-redisplay (folder number flag &optional force-reload)
+(defun wl-message-redisplay (folder number display-type &optional force-reload)
   (let* ((default-mime-charset wl-mime-charset)
         (buffer-read-only nil)
         (summary-buf (current-buffer))
         message-buf
         strategy entity
         cache-used
-        summary-win delim)
+        summary-win delim flags)
     (setq buffer-read-only nil)
     (setq cache-used (wl-message-buffer-display
-                     folder number flag force-reload))
+                     folder number display-type force-reload))
     (setq wl-message-buffer (car cache-used))
     (setq message-buf wl-message-buffer)
     (wl-message-select-buffer wl-message-buffer)
@@ -437,6 +439,33 @@ Returns non-nil if bottom of message."
     (setq wl-message-buffer-cur-summary-buffer summary-buf)
     (setq wl-message-buffer-cur-folder (elmo-folder-name-internal folder))
     (setq wl-message-buffer-cur-number number)
+    (setq wl-message-buffer-flag-indicator
+         (if (setq flags (elmo-get-global-flags (elmo-message-flags
+                                                 folder number)))
+             (let ((fl wl-summary-flag-alist)
+                   flag-strings flag-string face)
+               (while fl
+                 (when (memq (car (car fl)) flags)
+                   (setq flag-string (capitalize
+                                      (symbol-name (car (car fl))))
+                         flags (delq (car (car fl)) flags))
+                   (when (facep (setq face
+                                      (intern
+                                       (format
+                                        "wl-highlight-summary-%s-flag-face"
+                                        (car (car fl))))))
+                     (put-text-property 0 (length flag-string)
+                                        'face face flag-string))
+                   (setq flag-strings (nconc flag-strings
+                                             (list flag-string))))
+                 (setq fl (cdr fl)))
+               (setq flag-strings
+                     (nconc flag-strings
+                            (mapcar (lambda (flag)
+                                      (capitalize (symbol-name flag)))
+                                    flags)))
+               (concat " (" (mapconcat 'identity flag-strings ", ") ")"))
+           ""))
     (wl-line-formatter-setup
      wl-message-buffer-mode-line-formatter
      wl-message-mode-line-format
@@ -466,7 +495,7 @@ Returns non-nil if bottom of message."
     cache-used))
 
 ;; Use message buffer cache.
-(defun wl-message-buffer-display (folder number flag
+(defun wl-message-buffer-display (folder number display-type
                                         &optional force-reload unread)
   (let* ((msg-id (ignore-errors (elmo-message-field folder number
                                                    'message-id)))
@@ -489,7 +518,7 @@ Returns non-nil if bottom of message."
            (widen)
            (goto-char (point-min))
            (ignore-errors (wl-message-narrow-to-page))
-           (unless (eq wl-message-buffer-cur-flag flag)
+           (unless (eq wl-message-buffer-cur-display-type display-type)
              (setq read t))))
       ;; delete tail and add new to the top.
       (setq hit (wl-message-buffer-cache-add (list fname number msg-id)))
@@ -500,9 +529,9 @@ Returns non-nil if bottom of message."
              (set-buffer hit)
              (setq
               cache-used
-              (wl-message-display-internal folder number flag
+              (wl-message-display-internal folder number display-type
                                            force-reload unread))
-             (setq wl-message-buffer-cur-flag flag))
+             (setq wl-message-buffer-cur-display-type display-type))
          (quit
           (wl-message-buffer-cache-delete)
           (error "Display message %s/%s is quitted" fname number))
@@ -512,13 +541,14 @@ Returns non-nil if bottom of message."
           nil))) ;; will not be used
     (cons hit cache-used)))
 
-(defun wl-message-display-internal (folder number flag
+(defun wl-message-display-internal (folder number display-type
                                           &optional force-reload unread)
   (let ((default-mime-charset wl-mime-charset)
        (elmo-mime-charset wl-mime-charset))
-    (setq wl-message-buffer-all-header-flag (eq flag 'all-header))
+    (setq wl-message-buffer-require-all-header (eq display-type
+                                                  'all-header))
     (prog1
-       (if (eq flag 'as-is)
+       (if (eq display-type 'as-is)
            (let (wl-highlight-x-face-function)
              (prog1 (elmo-mime-display-as-is folder number
                                              (current-buffer)
index 85c9c81..f09f8a0 100644 (file)
@@ -615,7 +615,7 @@ With ARG, ask destination folder."
 
 (defun wl-mime-display-header (entity situation)
   (let ((elmo-message-ignored-field-list
-        (if wl-message-buffer-all-header-flag
+        (if wl-message-buffer-require-all-header
             nil
           wl-message-ignored-field-list))
        (elmo-message-visible-field-list wl-message-visible-field-list)
index f1ea581..bb465c3 100644 (file)
@@ -1195,7 +1195,7 @@ Set `wl-score-cache' nil."
              ((and wl-summary-important-above
                    (> score wl-summary-important-above))
               (if (wl-thread-jump-to-msg num);; force open
-                  (wl-summary-mark-as-important num)))
+                  (wl-summary-add-flags-internal num '(important))))
              ((and wl-summary-target-above
                    (> score wl-summary-target-above))
               (if visible
index daffe66..be420e0 100644 (file)
@@ -60,6 +60,7 @@
 (defvar dragdrop-drop-functions)
 (defvar scrollbar-height)
 (defvar mail-reply-buffer)
+(defvar elmo-global-flag-list)
 
 (defvar wl-summary-buffer-name "Summary")
 (defvar wl-summary-mode-map nil)
@@ -285,16 +286,16 @@ See also variable `wl-use-petname'."
     "----"
     ("Message Operation"
      ["Mark as read"    wl-summary-mark-as-read t]
-     ["Mark as important" wl-summary-mark-as-important t]
+     ["Set flags"      wl-summary-set-flags t]
      ["Mark as unread"   wl-summary-mark-as-unread t]
      ["Mark as answered" wl-summary-mark-as-answered t]
      ["Set dispose mark" wl-summary-dispose t]
      ["Set refile mark" wl-summary-refile t]
      ["Set copy mark"   wl-summary-copy t]
      ["Set resend mark" wl-summary-resend t]
-     ["Prefetch"        wl-summary-prefetch t]
+     ["Prefetch"       wl-summary-prefetch t]
      ["Set target mark" wl-summary-target-mark t]
-     ["Unmark"          wl-summary-unmark t]
+     ["Unmark"         wl-summary-unmark t]
      ["Save"           wl-summary-save t]
      ["Cancel posted news" wl-summary-cancel-message t]
      ["Supersedes message" wl-summary-supersedes-message t]
@@ -307,7 +308,7 @@ See also variable `wl-use-petname'."
      ["Open all"     wl-thread-open-all (eq wl-summary-buffer-view 'thread)]
      ["Close all"    wl-thread-close-all (eq wl-summary-buffer-view 'thread)]
      ["Mark as read" wl-thread-mark-as-read (eq wl-summary-buffer-view 'thread)]
-     ["Mark as important"      wl-thread-mark-as-important (eq wl-summary-buffer-view 'thread)]
+     ["Set flags"      wl-thread-set-flags (eq wl-summary-buffer-view 'thread)]
      ["Mark as unread"         wl-thread-mark-as-unread (eq wl-summary-buffer-view 'thread)]
      ["Mark as answered"       wl-thread-mark-as-answered (eq wl-summary-buffer-view 'thread)]
      ["Set delete mark"  wl-thread-delete (eq wl-summary-buffer-view 'thread)]
@@ -320,7 +321,7 @@ See also variable `wl-use-petname'."
      ["Execute"      wl-thread-exec (eq wl-summary-buffer-view 'thread)])
     ("Region Operation"
      ["Mark as read" wl-summary-mark-as-read-region t]
-     ["Mark as important" wl-summary-mark-as-important-region t]
+     ["Set flags" wl-summary-set-flags-region t]
      ["Mark as unread" wl-summary-mark-as-unread-region t]
      ["Mark as answered" wl-summary-mark-as-answered-region t]
      ["Set dispose mark" wl-summary-dispose-region t]
@@ -333,7 +334,7 @@ See also variable `wl-use-petname'."
      ["Execute" wl-summary-exec-region t])
     ("Mark Operation"
      ["Mark as read" wl-summary-target-mark-mark-as-read t]
-     ["Mark as important" wl-summary-target-mark-mark-as-important t]
+     ["Set flags" wl-summary-target-mark-set-flags t]
      ["Mark as unread" wl-summary-target-mark-mark-as-unread t]
      ["Set delete mark" wl-summary-target-mark-delete t]
      ["Set refile mark" wl-summary-target-mark-refile t]
@@ -412,7 +413,7 @@ See also variable `wl-use-petname'."
   (define-key wl-summary-mode-map "E"    'wl-summary-reedit)
   (define-key wl-summary-mode-map "\eE"  'wl-summary-resend-bounced-mail)
   (define-key wl-summary-mode-map "f"    'wl-summary-forward)
-  (define-key wl-summary-mode-map "$"    'wl-summary-mark-as-important)
+  (define-key wl-summary-mode-map "$"    'wl-summary-set-flags)
   (define-key wl-summary-mode-map "&"    'wl-summary-mark-as-answered)
   (define-key wl-summary-mode-map "@"    'wl-summary-edit-addresses)
 
@@ -491,7 +492,7 @@ See also variable `wl-use-petname'."
   (define-key wl-summary-mode-map "t~" 'wl-thread-resend)
   (define-key wl-summary-mode-map "tu" 'wl-thread-unmark)
   (define-key wl-summary-mode-map "t!" 'wl-thread-mark-as-unread)
-  (define-key wl-summary-mode-map "t$" 'wl-thread-mark-as-important)
+  (define-key wl-summary-mode-map "t$" 'wl-thread-set-flags)
   (define-key wl-summary-mode-map "t&" 'wl-thread-mark-as-answered)
   (define-key wl-summary-mode-map "ty" 'wl-thread-save)
   (define-key wl-summary-mode-map "ts" 'wl-thread-set-parent)
@@ -511,7 +512,7 @@ See also variable `wl-use-petname'."
   (define-key wl-summary-mode-map "my"   'wl-summary-target-mark-save)
   (define-key wl-summary-mode-map "mR"   'wl-summary-target-mark-mark-as-read)
   (define-key wl-summary-mode-map "m!"   'wl-summary-target-mark-mark-as-unread)
-  (define-key wl-summary-mode-map "m$"   'wl-summary-target-mark-mark-as-important)
+  (define-key wl-summary-mode-map "m$"   'wl-summary-target-mark-set-flags)
   (define-key wl-summary-mode-map "mU"   'wl-summary-target-mark-uudecode)
   (define-key wl-summary-mode-map "ma"   'wl-summary-target-mark-all)
   (define-key wl-summary-mode-map "mt"   'wl-summary-target-mark-thread)
@@ -536,7 +537,7 @@ See also variable `wl-use-petname'."
   (define-key wl-summary-mode-map "r~"   'wl-summary-resend-region)
   (define-key wl-summary-mode-map "ru"   'wl-summary-unmark-region)
   (define-key wl-summary-mode-map "r!"   'wl-summary-mark-as-unread-region)
-  (define-key wl-summary-mode-map "r$"   'wl-summary-mark-as-important-region)
+  (define-key wl-summary-mode-map "r$"   'wl-summary-set-flags-region)
   (define-key wl-summary-mode-map "r&"   'wl-summary-mark-as-answered-region)
   (define-key wl-summary-mode-map "ry"   'wl-summary-save-region)
 
@@ -717,7 +718,7 @@ you."
        (dummy-temp (char-to-string 200))
        ;; bind only for the check.
        (wl-summary-new-uncached-mark (char-to-string 201))
-       (wl-summary-flag-priority-list '(new))     ; ditto.
+       (wl-summary-persistent-mark-priority-list '(new))     ; ditto.
        (lang wl-summary-buffer-weekday-name-lang)
        wl-summary-highlight
        temp persistent)
@@ -1559,15 +1560,13 @@ If ARG is non-nil, checking is omitted."
            (forward-line 1))
          (wl-summary-mark-as-unread number-list))))))
 
-(defun wl-summary-mark-as-important-region (beg end)
+(defun wl-summary-set-flags-region (beg end)
   (interactive "r")
   (save-excursion
     (save-restriction
       (wl-summary-narrow-to-region beg end)
       (goto-char (point-min))
-      (let ((inverse (elmo-message-flagged-p wl-summary-buffer-elmo-folder
-                                            (wl-summary-message-number)
-                                            'important)))
+      (let (flags)
        (if (eq wl-summary-buffer-view 'thread)
            (while (not (eobp))
              (let* ((number (wl-summary-message-number))
@@ -1576,14 +1575,17 @@ If ARG is non-nil, checking is omitted."
                (if (wl-thread-entity-get-opened entity)
                    ;; opened...mark line.
                    ;; Crossposts are not processed
-                   (wl-summary-mark-as-important-internal inverse)
+                   (setq flags (wl-summary-set-flags-internal
+                               number
+                               flags))
                  ;; closed
-                 (wl-summary-mark-as-important-internal
-                  inverse
-                  (wl-thread-get-children-msgs number)))
+                 (setq flags (wl-summary-set-flags-internal
+                             (wl-thread-get-children-msgs number)
+                             flags)))
                (forward-line 1)))
          (while (not (eobp))
-           (wl-summary-mark-as-important-internal inverse)
+           (setq flags (wl-summary-set-flags-internal
+                       (wl-summary-message-number) flags))
            (forward-line 1))))))
   (wl-summary-count-unread)
   (wl-summary-update-modeline))
@@ -1759,28 +1761,34 @@ This function is defined for `window-scroll-functions'"
 (defun wl-summary-sync-marks ()
   "Update persistent marks in summary."
   (interactive)
-  (let (diff diffs mes)
+  (let ((mes "Updated ")
+       diff diffs)
     ;; synchronize marks.
     (when (not (eq (elmo-folder-type-internal
                    wl-summary-buffer-elmo-folder)
                   'internal))
+
       (message "Updating marks...")
-      (setq diff (elmo-list-diff (elmo-folder-list-flagged
-                                 wl-summary-buffer-elmo-folder
-                                 'important)
-                                (elmo-folder-list-flagged
-                                 wl-summary-buffer-elmo-folder
-                                 'important 'in-msgdb)))
-      (setq diffs (cadr diff)) ; important-deletes
-      (setq mes (format "Updated (-%d" (length diffs)))
-      (while diffs
-       (wl-summary-mark-as-unimportant (car diffs) 'no-server)
-       (setq diffs (cdr diffs)))
-      (setq diffs (car diff)) ; important-appends
-      (setq mes (concat mes (format "/+%d) important," (length diffs))))
-      (while diffs
-       (wl-summary-mark-as-important (car diffs) 'no-server)
-       (setq diffs (cdr diffs)))
+      (dolist (flag elmo-global-flag-list)
+       (unless (memq flag '(answered cached new unread))
+         (setq diff (elmo-list-diff (elmo-folder-list-flagged
+                                     wl-summary-buffer-elmo-folder
+                                     flag)
+                                    (elmo-folder-list-flagged
+                                     wl-summary-buffer-elmo-folder
+                                     flag 'in-msgdb)))
+         (setq diffs (cadr diff)) ; deletes
+         (setq mes (concat mes (format "-%d" (length diffs))))
+         (while diffs
+           (wl-summary-remove-flags-internal (car diffs)
+                                            (list flag) 'no-server)
+           (setq diffs (cdr diffs)))
+         (setq diffs (car diff)) ; appends
+         (setq mes (concat mes (format "/+%d %s," (length diffs) flag)))
+         (while diffs
+           (wl-summary-add-flags-internal (car diffs)
+                                         (list flag) 'no-server)
+           (setq diffs (cdr diffs)))))
 
       (setq diff (elmo-list-diff (elmo-folder-list-flagged
                                  wl-summary-buffer-elmo-folder
@@ -1789,12 +1797,12 @@ This function is defined for `window-scroll-functions'"
                                  wl-summary-buffer-elmo-folder
                                  'answered 'in-msgdb)))
       (setq diffs (cadr diff))
-      (setq mes (concat mes (format "(-%d" (length diffs))))
+      (setq mes (concat mes (format "-%d" (length diffs))))
       (while diffs
        (wl-summary-mark-as-unanswered (car diffs) 'no-modeline)
        (setq diffs (cdr diffs)))
       (setq diffs (car diff)) ; unread-appends
-      (setq mes (concat mes (format "/+%d) answered mark(s)," (length diffs))))
+      (setq mes (concat mes (format "/+%d answered," (length diffs))))
       (while diffs
        (wl-summary-mark-as-answered (car diffs) 'no-modeline)
        (setq diffs (cdr diffs)))
@@ -1806,12 +1814,12 @@ This function is defined for `window-scroll-functions'"
                                  wl-summary-buffer-elmo-folder
                                  'unread 'in-msgdb)))
       (setq diffs (cadr diff))
-      (setq mes (concat mes (format "(-%d" (length diffs))))
+      (setq mes (concat mes (format "-%d" (length diffs))))
       (while diffs
        (wl-summary-mark-as-read (car diffs) 'no-folder 'no-modeline)
        (setq diffs (cdr diffs)))
       (setq diffs (car diff)) ; unread-appends
-      (setq mes (concat mes (format "/+%d) unread mark(s)." (length diffs))))
+      (setq mes (concat mes (format "/+%d unread." (length diffs))))
       (while diffs
        (wl-summary-mark-as-unread (car diffs) 'no-folder 'no-modeline)
        (setq diffs (cdr diffs)))
@@ -2236,9 +2244,8 @@ If ARG, without confirm."
 
 (defun wl-summary-auto-select-msg-p (unread-msg)
   (and unread-msg
-       (not (elmo-message-flagged-p wl-summary-buffer-elmo-folder
-                                   unread-msg
-                                   'important))))
+       (not (elmo-message-has-global-flag-p
+            wl-summary-buffer-elmo-folder unread-msg))))
 
 (defsubst wl-summary-open-folder (folder)
   ;; Select folder
@@ -2377,15 +2384,15 @@ If ARG, without confirm."
                (cond ((and wl-auto-select-first
                            (wl-summary-auto-select-msg-p unreadp))
                       ;; wl-auto-select-first is non-nil and
-                      ;; unreadp is non-nil but not important
+                      ;; unreadp is non-nil but not flagged
                       (setq retval 'disp-msg))
                      ((and wl-auto-prefetch-first
                            (wl-summary-auto-select-msg-p unreadp))
                       ;; wl-auto-select-first is non-nil and
-                      ;; unreadp is non-nil but not important
+                      ;; unreadp is non-nil but not flagged
                       (setq retval 'prefetch-msg))
                      ((not (wl-summary-auto-select-msg-p unreadp))
-                      ;; unreadp is nil or important
+                      ;; unreadp is nil or flagged
                       (setq retval 'more-next))))
            (goto-char (point-max))
            (if (elmo-folder-plugged-p folder)
@@ -2797,26 +2804,27 @@ If ARG, exit virtual folder."
 (defsubst wl-summary-persistent-mark-string (folder flags cached)
   "Return the persistent mark string.
 The mark is decided according to the FOLDER, FLAGS and CACHED."
-  (let ((priorities wl-summary-flag-priority-list)
+  (let ((priorities wl-summary-persistent-mark-priority-list)
        mark)
     (while (and (null mark) priorities)
-      (when (memq (car priorities) flags)
-       (setq mark
-             (case (car priorities)
-               (new
-                (if cached
-                    wl-summary-new-cached-mark
-                  wl-summary-new-uncached-mark))
-               (important
-                wl-summary-important-mark)
-               (answered
-                (if cached
-                    wl-summary-answered-cached-mark
-                  wl-summary-answered-uncached-mark))
-               (unread
-                (if cached
-                    wl-summary-unread-cached-mark
-                  wl-summary-unread-uncached-mark)))))
+      (if (and (eq (car priorities) 'flag)
+              (elmo-get-global-flags flags 'ignore-preserved))
+         (setq mark wl-summary-flag-mark)
+       (when (memq (car priorities) flags)
+         (setq mark
+               (or (case (car priorities)
+                     (new
+                      (if cached
+                          wl-summary-new-cached-mark
+                        wl-summary-new-uncached-mark))
+                     (answered
+                      (if cached
+                          wl-summary-answered-cached-mark
+                        wl-summary-answered-uncached-mark))
+                     (unread
+                      (if cached
+                          wl-summary-unread-cached-mark
+                        wl-summary-unread-uncached-mark)))))))
       (setq priorities (cdr priorities)))
     (or mark
        (if (or cached (elmo-folder-local-p folder))
@@ -2894,16 +2902,17 @@ The mark is decided according to the FOLDER, FLAGS and CACHED."
       (dolist (number wl-summary-buffer-target-mark-list)
        (wl-summary-unset-mark number)))))
 
-(defun wl-summary-target-mark-mark-as-important ()
+(defun wl-summary-target-mark-set-flags ()
   (interactive)
   (save-excursion
     (goto-char (point-min))
     (let ((inhibit-read-only t)
          (buffer-read-only nil)
-         wl-summary-buffer-disp-msg)
+         wl-summary-buffer-disp-msg
+         flags)
       (dolist (number wl-summary-buffer-target-mark-list)
        (wl-summary-unset-mark number)
-       (wl-summary-mark-as-important number))
+       (setq flags (wl-summary-set-flags-internal number flags)))
       (wl-summary-count-unread)
       (wl-summary-update-modeline))))
 
@@ -3062,16 +3071,44 @@ Return non-nil if the mark is updated"
                                        number-or-numbers
                                        no-modeline-update))
 
-(defsubst wl-summary-mark-as-important-internal (inverse
-                                                &optional
-                                                number-or-numbers
-                                                no-server-update)
+(defun wl-summary-decide-flag (folder number)
+  (let ((flags (elmo-get-global-flags (elmo-message-flags
+                                      folder number)))
+       (completion-ignore-case t)
+       new-flags)
+    (setq new-flags
+         (delq nil
+               (mapcar
+                (lambda (flag)
+                  (and (> (length flag) 0)
+                       (intern (downcase flag))))
+                (completing-read-multiple
+                 "Flags: "
+                 (mapcar (lambda (flag)
+                           (list (capitalize (symbol-name flag))))
+                         elmo-global-flag-list)
+                 nil nil (mapconcat (lambda (flag)
+                                      (capitalize (symbol-name flag)))
+                                    (or flags '(important))
+                                    ",")))))
+    (dolist (flag new-flags)
+      (unless (memq flag elmo-global-flag-list)
+       (if (y-or-n-p (format "Flag `%s' does not exist yet. Create?"
+                             (capitalize (symbol-name flag))))
+           (setq elmo-global-flag-list (append
+                                        elmo-global-flag-list
+                                        (list flag)))
+         (error "Stopped"))))
+    new-flags))
+
+(defsubst wl-summary-set-flags-internal (&optional
+                                       number-or-numbers
+                                       flags
+                                       local
+                                       remove-all)
   (save-excursion
     (let ((folder wl-summary-buffer-elmo-folder)
          number number-list visible)
-      (when (and (eq (elmo-folder-type-internal folder) 'flag)
-                (eq (elmo-flag-folder-flag-internal folder) 'important))
-       (error "Cannot process mark in this folder"))
       (setq number-list (cond ((numberp number-or-numbers)
                               (list number-or-numbers))
                              ((and (not (null number-or-numbers))
@@ -3080,36 +3117,81 @@ Return non-nil if the mark is updated"
                              ((setq number (wl-summary-message-number))
                               ;; interactive
                               (list number))))
+      (if remove-all
+         (setq flags nil)
+       (unless flags
+         (setq flags (wl-summary-decide-flag folder (car number-list)))))
+      (if (null number-list)
+         (message "No message.")
+       (dolist (number number-list)
+         (elmo-message-set-global-flags folder number flags local)
+         (setq visible (wl-summary-jump-to-msg number))
+         ;; set mark on buffer
+         (when visible
+           (wl-summary-update-persistent-mark))))
+      flags)))
+
+(defsubst wl-summary-add-flags-internal (&optional
+                                        number-or-numbers
+                                        flags
+                                        local)
+  (save-excursion
+    (let ((folder wl-summary-buffer-elmo-folder)
+         set-flags msg number-list visible)
+      (setq number-list (cond ((numberp number-or-numbers)
+                              (list number-or-numbers))
+                             ((and (not (null number-or-numbers))
+                                   (listp number-or-numbers))
+                              number-or-numbers)
+                             ((setq msg (wl-summary-message-number))
+                              ;; interactive
+                              (list msg))))
       (if (null number-list)
          (message "No message.")
-       (if inverse
-           (elmo-folder-unset-flag folder number-list
-                                   'important no-server-update)
-         (elmo-folder-set-flag folder number-list
-                               'important no-server-update))
        (dolist (number number-list)
+         (setq set-flags
+               (elmo-get-global-flags
+                (elmo-message-flags folder number)))
+         (setq set-flags (nconc flags set-flags))
+         (elmo-message-set-global-flags folder number set-flags local)
          (setq visible (wl-summary-jump-to-msg number))
          ;; set mark on buffer
          (when visible
            (wl-summary-update-persistent-mark)))))))
 
-(defun wl-summary-mark-as-important (&optional number-or-numbers
-                                              no-server-update)
-  (interactive)
-  (wl-summary-mark-as-important-internal
-   (and (interactive-p)
-       (elmo-message-flagged-p wl-summary-buffer-elmo-folder
-                               (wl-summary-message-number)
-                               'important))
-   number-or-numbers
-   no-server-update))
+(defsubst wl-summary-remove-flags-internal (&optional
+                                           number-or-numbers
+                                           flags
+                                           local)
+  (save-excursion
+    (let ((folder wl-summary-buffer-elmo-folder)
+         set-flags msg number-list visible)
+      (setq number-list (cond ((numberp number-or-numbers)
+                              (list number-or-numbers))
+                             ((and (not (null number-or-numbers))
+                                   (listp number-or-numbers))
+                              number-or-numbers)
+                             ((setq msg (wl-summary-message-number))
+                              ;; interactive
+                              (list msg))))
+      (if (null number-list)
+         (message "No message.")
+       (dolist (number number-list)
+         (setq set-flags (elmo-get-global-flags
+                          (elmo-message-flags folder number)))
+         (dolist (flag flags)
+           (setq set-flags (delq flag set-flags)))
+         (elmo-message-set-global-flags folder number set-flags local)
+         (setq visible (wl-summary-jump-to-msg number))
+         ;; set mark on buffer
+         (when visible
+           (wl-summary-update-persistent-mark)))))))
 
-(defun wl-summary-mark-as-unimportant (&optional number-or-numbers
-                                                no-server-update)
-  (interactive)
-  (wl-summary-mark-as-important-internal 'inverse
-                                        number-or-numbers
-                                        no-server-update))
+(defun wl-summary-set-flags (&optional remove)
+  (interactive "P")
+  (if (eq 'flag (elmo-folder-type-internal wl-summary-buffer-elmo-folder))
+      (error "Cannot process flags in this folder"))
+  (wl-summary-set-flags-internal nil nil nil remove))
 
 ;;; Summary line.
 (defvar wl-summary-line-formatter nil)
@@ -3296,10 +3378,10 @@ Return non-nil if the mark is updated"
   '((new . ((t . nil)
            (p . new)
            (p . unread)
-           (p . important)))
+           (p . digest)))
     (unread . ((t . nil)
               (p . unread)
-              (p . important)))))
+              (p . digest)))))
 
 (defsubst wl-summary-next-message (num direction hereto)
   (if wl-summary-buffer-next-message-function
@@ -3320,7 +3402,7 @@ Return non-nil if the mark is updated"
                     (if (setq flagged-list
                               (elmo-folder-list-flagged
                                wl-summary-buffer-elmo-folder
-                               (cdr (car cur-spec))))
+                               (cdr (car cur-spec)) t))
                         (while nums
                           (if (and (memq (car nums) flagged-list)
                                    (elmo-message-accessible-p
@@ -3350,7 +3432,7 @@ Return non-nil if the mark is updated"
          (wl-thread-jump-to-msg num))
       t)))
 ;;
-;; Goto unread or important
+;; Goto unread or global flag message
 ;; returns t if next message exists in this folder.
 (defun wl-summary-cursor-down (&optional hereto)
   (interactive "P")
index b99bbc6..a491ef5 100644 (file)
@@ -735,9 +735,9 @@ Message is inserted to the summary buffer."
   (interactive "P")
   (wl-thread-call-region-func 'wl-summary-mark-as-unread-region arg))
 
-(defun wl-thread-mark-as-important (&optional arg)
+(defun wl-thread-set-flags (&optional arg)
   (interactive "P")
-  (wl-thread-call-region-func 'wl-summary-mark-as-important-region arg))
+  (wl-thread-call-region-func 'wl-summary-set-flags-region arg))
 
 (defun wl-thread-mark-as-answered (&optional arg)
   (interactive "P")
index 32aed4f..03d9d6f 100644 (file)
@@ -498,13 +498,6 @@ You had better set this variable if you set 'wl-insert-mail-followup-to' as t."
   :type '(repeat (cons symbol function))
   :group 'wl-pref)
 
-(defcustom wl-demo-background-color "#d9ffd9"
-  "The color name for demo background.
-If nil, the default face background is used."
-  :type '(choice (const :tag "Default")
-                (string :tag "Color name"))
-  :group 'wl-pref)
-
 (defcustom wl-envelope-from nil
   "*Envelope From used in SMTP.
 If nil, `wl-from' is used."
@@ -978,14 +971,31 @@ cdr of each cons cell is used for draft message."
   :type 'boolean
   :group 'wl-folder)
 
-(defcustom wl-summary-flag-priority-list '(new important answered unread)
- "List of flags reflected with the priority to a persistent mark."
+(defcustom wl-summary-persistent-mark-priority-list '(new
+                                                     flag
+                                                     answered
+                                                     unread)
+  "List of flags reflected with the priority to persistent marks and faces."
   :type '(repeat (radio (const :format "%v " new)
-                       (const :format "%v " important)
+                       (const :format "%v " flag)
                        (const :format "%v " answered)
                        (const :format "%v " unread)))
   :group 'wl-summary)
 
+(defcustom wl-summary-flag-alist
+  '((important "orange"))
+  "An alist to define the flags for the summary mode.
+Each element is a form like:
+\(SYMBOL-OF-FLAG COLOR\)
+Example:
+\((important \"orange\"\)
+ \(todo \"red\"\)
+ \(business \"green\"\)
+ \(private \"blue\"\)\)"
+  :type '(repeat (list (symbol :tag "flag")
+                      (string :tag "color")))
+  :group 'wl-summary)
+
 (defcustom wl-summary-new-uncached-mark "N"
   "Mark for new and uncached message."
   :type '(string :tag "Mark")
@@ -1021,8 +1031,8 @@ cdr of each cons cell is used for draft message."
   :type '(string :tag "Mark")
   :group 'wl-summary-marks)
 
-(defcustom wl-summary-important-mark "$"
-  "Mark for important message."
+(defcustom wl-summary-flag-mark "$"
+  "Mark for the messages which have tags."
   :type '(string :tag "Mark")
   :group 'wl-summary-marks)
 
@@ -1575,6 +1585,7 @@ which appear just before @."
   '((?f (if (memq 'modeline wl-use-folder-petname)
            (wl-folder-get-petname wl-message-buffer-cur-folder)
          wl-message-buffer-cur-folder))
+    (?F wl-message-buffer-flag-indicator)
     (?n wl-message-buffer-cur-number))
   "An alist of format specifications for message buffer's mode-lines.
 Each element is a list of following:
@@ -1582,13 +1593,14 @@ Each element is a list of following:
 SPEC is a character for format specification.
 STRING-EXP is an expression to get string to insert.")
 
-(defcustom wl-message-mode-line-format "Wanderlust: << %f / %n >>"
+(defcustom wl-message-mode-line-format "Wanderlust: << %f / %n %F>>"
   "*A format string for message buffer's mode-line of Wanderlust.
 It may include any of the following format specifications
 which are replaced by the given information:
 
 %f The folder name.
-%n The number of the message."
+%n The number of the message.
+%F The global flag indicator."
   :group 'wl-pref
   :type 'string)
 
@@ -2514,7 +2526,7 @@ ex.
   :group 'wl-expire)
 
 (defcustom wl-summary-expire-reserve-marks
-  (list wl-summary-important-mark
+  (list wl-summary-flag-mark
        wl-summary-new-uncached-mark
        wl-summary-new-cached-mark
        wl-summary-unread-uncached-mark
@@ -2819,6 +2831,8 @@ a symbol `bitmap', `xbm' or `xpm' in order to force the image format."
   "*Icon file for namazu folder.")
 (defvar wl-shimbun-folder-icon "shimbun.xpm"
   "*Icon file for shimbun folder.")
+(defvar wl-file-folder-icon "file.xpm"
+  "*Icon file for file folder.")
 (defvar wl-maildir-folder-icon "maildir.xpm"
   "*Icon file for maildir folder.")
 (defvar wl-empty-trash-folder-icon "trash-e.xpm"
index 5b9a447..2994415 100644 (file)
@@ -92,8 +92,8 @@
      wl-summary-sync-force-update t "Sync Current Folder"]
     [wl-summary-dispose
      wl-summary-dispose t "Dispose Current Message"]
-    [wl-summary-mark-as-important
-     wl-summary-mark-as-important t "Mark Current Message as Important"]
+    [wl-summary-set-flags
+     wl-summary-set-flags t "Set Flags"]
     [wl-draft
      wl-summary-write-current-folder t "Write for Current Folder"]
     [wl-summary-reply
     (wl-folder-maildir-glyph   . wl-maildir-folder-icon)
     (wl-folder-nmz-glyph       . wl-nmz-folder-icon)
     (wl-folder-shimbun-glyph   . wl-shimbun-folder-icon)
+    (wl-folder-file-glyph      . wl-file-folder-icon)
     (wl-folder-trash-empty-glyph . wl-empty-trash-folder-icon)
     (wl-folder-draft-glyph     . wl-draft-folder-icon)
     (wl-folder-queue-glyph     . wl-queue-folder-icon)
index ac7859d..9b8189a 100644 (file)
--- a/wl/wl.el
+++ b/wl/wl.el
@@ -699,6 +699,11 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
     (fset 'wl-summary-subject-filter-func-internal
          (symbol-value 'wl-summary-subject-filter-function))
     (wl-summary-define-mark-action)
+    (dolist (spec wl-summary-flag-alist)
+      (set-face-foreground
+       (make-face (intern
+                  (format "wl-highlight-summary-%s-flag-face" (car spec))))
+       (nth 1 spec)))
     (setq elmo-no-from wl-summary-no-from-message)
     (setq elmo-no-subject wl-summary-no-subject-message)
     (wl-news-check)