Merged beta branch.
authorteranisi <teranisi>
Tue, 17 Oct 2000 02:54:33 +0000 (02:54 +0000)
committerteranisi <teranisi>
Tue, 17 Oct 2000 02:54:33 +0000 (02:54 +0000)
* elmo-version.el (elmo-version): Up to 2.3.90.

68 files changed:
ChangeLog
Makefile
WL-ELS
WL-MK
doc/TODO.ja
doc/wl-ja.texi
doc/wl.texi
elmo/ChangeLog
elmo/elmo-archive.el
elmo/elmo-cache.el
elmo/elmo-database.el
elmo/elmo-date.el
elmo/elmo-dop.el
elmo/elmo-filter.el
elmo/elmo-imap4.el
elmo/elmo-internal.el
elmo/elmo-localdir.el
elmo/elmo-localnews.el
elmo/elmo-maildir.el
elmo/elmo-msgdb.el
elmo/elmo-multi.el
elmo/elmo-net.el [new file with mode: 0644]
elmo/elmo-nntp.el
elmo/elmo-pipe.el
elmo/elmo-pop3.el
elmo/elmo-util.el
elmo/elmo-vars.el
elmo/elmo-version.el [new file with mode: 0644]
elmo/elmo2.el
elmo/mmelmo-1.el
elmo/mmelmo-2.el
elmo/mmelmo-imap4-1.el
elmo/mmelmo-imap4-2.el
elmo/mmelmo-imap4.el
elmo/mmelmo.el
elmo/pldap.el [new file with mode: 0644]
etc/icons/letter.xpm [new file with mode: 0644]
etc/icons/no-letter.xpm [new file with mode: 0644]
etc/icons/wl-logo.xbm
etc/icons/wl-logo.xpm
utils/bbdb-wl.el
utils/im-wl.el
utils/ptexinfmt.el [new file with mode: 0644]
wl/ChangeLog
wl/tm-wl.el
wl/wl-address.el
wl/wl-demo.el
wl/wl-dnd.el
wl/wl-draft.el
wl/wl-e21.el [new file with mode: 0644]
wl/wl-expire.el
wl/wl-fldmgr.el
wl/wl-folder.el
wl/wl-highlight.el
wl/wl-message.el
wl/wl-mime.el
wl/wl-mule.el
wl/wl-nemacs.el
wl/wl-refile.el
wl/wl-score.el
wl/wl-summary.el
wl/wl-template.el
wl/wl-thread.el
wl/wl-util.el
wl/wl-vars.el
wl/wl-version.el [new file with mode: 0644]
wl/wl-xmas.el
wl/wl.el

index ea19321..18b0576 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
-2000-09-11  OKAZAKI Tetsurou  <okazaki@be.to>
+2000-10-13  Katsumi Yamaoka    <yamaoka@jpl.org>
 
-       * INSTALL: Deleted time-stamp line.
+       * WL-MK: (byte-compile-file-form-custom-declare-variable): Define
+       function if bytecomp doesn't have it; warn if "new custom" isn't
+       detected; don't require `backquote' because it's always autoloaded.
+
+2000-10-10  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * WL-ELS (WL-MODULES): Add wl-version.
+       (ELMO-MODULES): Add elmo-version.
+
+2000-10-03  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * WL-MK: Set `recursive-load-depth-limit' to nil.  It is currently
+       needed to byte-compile with Emacs 21.  FIXME!
+
+2000-10-02  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * Makefile (PIXMAPDIR): New variable.
+       (elc, install-elc, uninstall-elc, package, install-package): Use
+       it.
+
+       * WL-MK (config-wl-pixmap-dir): New function.
+       (config-wl-package, config-wl-package-xmas): Use it.
+       (install-wl-icons): New function.
+       (install-wl-package, install-wl-package-xmas): Use it.
+       (uninstall-wl-package): Uninstall icons as well.
+
+2000-09-27  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el (texinfo-multitable-widths): Fix
+       broken-facility probrem when use multitable unsupported
+       texinfmt.el.
+
+2000-09-26  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el (texinfo-format-printindex): Use (featurep
+       'meadow) instead of `texinfmt-version'.
+
+2000-09-22  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el (texinfo-format-printindex): Add
+       broken-facility check, for Mule for Windows.
+       (texinfo-format-printindex): New function.
+
+2000-09-18  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * etc/icons/letter.xpm, etc/icons/no-letter.xpm: New files.
+
+2000-09-15  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el (texinfo-multitable-widths): Add
+       broken-facility check.
+       (texinfo-multitable-item): Use it, when broken-facility check.
+
+2000-09-14  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * doc/wl.texi, doc/wl-ja.texi: Replace
+       `wl-highlight-group-folder-by-numbers' with
+       `wl-highlight-folder-by-numbers';
+       add description about `wl-highlight-folder-by-numbers';
+       update for Emacs 21.
+
+       * WL-ELS (WL-MODULES): Add `wl-e21'.
+
+2000-08-31  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el (texinfo-multitable-widths,
+       texinfo-multitable-item): Apply char-width probrem fix patch
+       (by KOIE Hidetaka <koie@skipjack.koie.org>).
+       Newsgroups: fj.editor.emacs
+       Message-ID: <5dzom3nxq7.fsf@skipjack.koie.org>
+
+       * utils/ptexinfmt.el (ptexinfmt-disable-broken-notice): New
+       variable.
+
+2000-08-29  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * doc/TODO.ja: Updated.
+
+2000-08-23  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * WL-ELS (ELMO-MODULES): Added elmo-net.
+
+2000-07-28  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el: Disable broken check notice.
+
+       * utils/ptexinfmt.el (texinfo-format-uref): Fixed.
+
+2000-07-20  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el: Support @multitable.
+       (texinfo-multitable, texinfo-end-multitable,
+       texinfo-multitable-widths, texinfo-multitable-extract-row,
+       texinfo-multitable-item): New function.
+
+2000-07-18  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el: Use fmakunbound, when broken-function
+       replace.
+
+2000-07-17  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * WL-ELS: Deleted time-stamp line.
+
+2000-07-16  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el: Support @image. Fix broken @uref.
+       (texinfo-format-image): New function.
+       (texinfo-format-uref): Fixed 2times parse probrem.
+
+2000-07-14  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * WL-MK (wl-texinfo-format-file): require ptexinfmt.
+       * utils/ptexinfmt.el: provide feature.
+       (documentlanguage, documentencoding): Fixed probrem.
+
+2000-07-13  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * utils/ptexinfmt.el: New file.
+
+2000-07-09  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * README: Remove CVS keyword.
+       * README.ja: Ditto.
+       * INSTALL: Ditto.
        * INSTALL.ja: Ditto.
-       * README: Ditto.
+       * doc/wl.texi: Ditto.
+       * doc/wl-ja.texi: Ditto.
+
+2000-06-28  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * README: CVS keyword instaed of time-stamp.
        * README.ja: Ditto.
-       * WL-ELS: Ditto.
-       * WL-MK: Ditto.
+       * INSTALL: Ditto.
+       * INSTALL.ja: Ditto.
+       * doc/wl.texi: Ditto.
+       * doc/wl-ja.texi: Ditto.
+
+2000-06-15  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * WL-ELS (ELMO-MODULES): Added `pldap'.
+
+2000-06-12  Yasushi ABE <yasushi@stbbs.net>
+
+       * utils/bbdb-wl.el (bbdb-extract-field-value): Decode with
+       multibyte-buffer.
 
 2000-05-15  Katsumi Yamaoka <yamaoka@jpl.org>
 
index 55874cd..2261861 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,27 +19,30 @@ INFODIR = NONE
 # For XEmacs package.
 PACKAGEDIR = NONE
 
+# For XEmacs or Emacs 21: directory where icon files should go.
+PIXMAPDIR = NONE
+
 
 ################# No need to modify following lines ####################
 FLAGS   = -batch -q -no-site-file
 
 elc:
-       $(EMACS) $(FLAGS) -l WL-MK -f compile-wl-package $(LISPDIR)
+       $(EMACS) $(FLAGS) -l WL-MK -f compile-wl-package $(LISPDIR) $(PIXMAPDIR)
 
 install-elc:
-       $(EMACS) $(FLAGS) -l WL-MK -f install-wl-package $(LISPDIR)
+       $(EMACS) $(FLAGS) -l WL-MK -f install-wl-package $(LISPDIR) $(PIXMAPDIR)
 
 uninstall-elc:
-       $(EMACS) $(FLAGS) -l WL-MK -f uninstall-wl-package $(LISPDIR)
+       $(EMACS) $(FLAGS) -l WL-MK -f uninstall-wl-package $(LISPDIR) $(PIXMAPDIR)
 
 clean-elc:
        rm -f wl/*.elc wl/auto-autoloads.el wl/custom-load.el elmo/*.elc utils/*.elc utils/hmac/lisp/*.elc
 
 package:
-       $(XEMACS) $(FLAGS) -l WL-MK -f compile-wl-package-xmas $(PACKAGEDIR)
+       $(XEMACS) $(FLAGS) -l WL-MK -f compile-wl-package-xmas $(PACKAGEDIR) $(PIXMAPDIR)
 
 install-package:
-       $(XEMACS) $(FLAGS) -l WL-MK -f install-wl-package-xmas $(PACKAGEDIR)
+       $(XEMACS) $(FLAGS) -l WL-MK -f install-wl-package-xmas $(PACKAGEDIR) $(PIXMAPDIR)
 
 info:
        $(EMACS) $(FLAGS) -l WL-MK -f wl-texinfo-format $(INFODIR)
diff --git a/WL-ELS b/WL-ELS
index ac41fbb..dc5eb06 100644 (file)
--- a/WL-ELS
+++ b/WL-ELS
@@ -8,17 +8,17 @@
 ;;; generic modules
 (defconst WL-MODULES '(
    wl wl-folder wl-summary wl-message
-   wl-vars wl-draft wl-util wl-address
+   wl-vars wl-draft wl-util wl-version wl-address
    wl-highlight wl-demo wl-refile wl-thread
    wl-fldmgr wl-expire wl-template wl-score
    ))
 
 (defconst ELMO-MODULES '(
-   elmo-util elmo-imap4 elmo-nntp elmo-archive
+   elmo-util elmo-version elmo-net elmo-imap4 elmo-nntp elmo-archive
    elmo-localdir elmo-msgdb elmo-vars elmo2
    elmo-cache elmo-multi elmo-filter elmo-pipe
    elmo-dop elmo-pop3 elmo-localnews elmo-maildir
-   elmo-date elmo-internal utf7
+   elmo-date elmo-internal utf7 pldap
    ))
 
 \f
@@ -31,6 +31,8 @@
   (setq ELMO-MODULES (append (list 'elmo-database) ELMO-MODULES)))
  ((fboundp 'nemacs-version)
   (setq WL-MODULES (append WL-MODULES (list 'wl-nemacs))))
+ ((and (boundp 'emacs-major-version) (>= emacs-major-version 21))
+  (setq WL-MODULES (append WL-MODULES (list 'wl-e21))))
  ((featurep 'mule)
   (setq WL-MODULES (append WL-MODULES (list 'wl-mule)))))
 
diff --git a/WL-MK b/WL-MK
index 75b7d82..a3080ca 100644 (file)
--- a/WL-MK
+++ b/WL-MK
 (condition-case () (require 'custom) (error nil))
 ;; for wl-vars.el
 (unless (and (fboundp 'defgroup)
-             (fboundp 'defcustom)
-             ;; ignore broken module
-             (not (featurep 'tinycustom)))
-  (require 'backquote)
+            (fboundp 'defcustom)
+            ;; ignore broken module
+            (not (featurep 'tinycustom)))
+  (when (and (boundp 'emacs-major-version)
+            (eq emacs-major-version 19)
+            (>= emacs-minor-version 29))
+    (message "%s" "
+  Warning: You don't seem to have \"new custom\" package installed.
+  It is recommended to use \"new custom\" package if you are using
+  old Emacs, such as Mule 2.3.
+  Get it from http://www.dina.kvl.dk/~abraham/custom/ and then apply
+  the patch which is included in README file of APEL package.
+"))
   (defmacro defgroup (&rest args))
   (defmacro defcustom (symbol value &optional doc &rest args)
     (let ((doc (concat "*" (or doc ""))))
-      (` (defvar (, symbol) (, value) (, doc)))))
-  )
+      (` (defvar (, symbol) (, value) (, doc))))))
+
+(require 'bytecomp)
+(unless (fboundp 'byte-compile-file-form-custom-declare-variable)
+  ;; Bind defcustom'ed variables.
+  (put 'custom-declare-variable 'byte-hunk-handler
+       'byte-compile-file-form-custom-declare-variable)
+  (defun byte-compile-file-form-custom-declare-variable (form)
+    (if (memq 'free-vars byte-compile-warnings)
+       (setq byte-compile-bound-variables
+             (cons (nth 1 (nth 1 form)) byte-compile-bound-variables)))
+    form))
 
 (setq byte-compile-warnings '(free-vars unresolved callargs redefine))
 
@@ -63,6 +82,9 @@
        (fboundp 'nemacs-version))
     (setq max-lisp-eval-depth 400))
 
+;; FIXME: it is currently needed to byte-compile with Emacs 21.
+(setq recursive-load-depth-limit nil)
+
 (condition-case () (require 'easymenu) (error nil))
 
 (defvar config-wl-package-done nil)
       (require 'mime-setup)
     (error (error "No MIME module was detected. Please install SEMI or tm.")))
   (if wl-use-semi
-      (princ (concat "\nUse SEMI" 
+      (princ (concat "\nUse SEMI"
                     (if wl-use-luna " with LUNA\n" " without LUNA\n")))
     (princ "\nUse tm.\n"))))
 
+(defun config-wl-pixmap-dir (&optional packagedir)
+  "Examine pixmap directory where icon files should go."
+  (let ((pixmap-dir (car command-line-args-left)))
+    (defvar PIXMAPDIR
+      (if (string= pixmap-dir "NONE")
+         (if packagedir
+             (expand-file-name "etc/wl/" packagedir)
+           (if (or (featurep 'xemacs)
+                   (and (boundp 'emacs-major-version)
+                        (>= emacs-major-version 21)))
+               (expand-file-name "wl/icons/" data-directory)))
+       pixmap-dir)))
+  (if PIXMAPDIR
+      (princ (format "PIXMAPDIR is %s\n" PIXMAPDIR)))
+  (setq command-line-args-left (cdr command-line-args-left)))
+
 (defun config-wl-package ()
   (config-wl-package-subr)
   ;; LISPDIR check.
     (if (string= elispdir "NONE")
        (defvar LISPDIR (install-detect-elisp-directory))
       (defvar LISPDIR elispdir)))
-  (princ (format "LISPDIR is %s\n\n" LISPDIR))
-  (setq command-line-args-left (cdr command-line-args-left)))
+  (princ (format "LISPDIR is %s\n" LISPDIR))
+  (setq command-line-args-left (cdr command-line-args-left))
+  ;; PIXMAPDIR check.
+  (config-wl-pixmap-dir)
+  (princ "\n"))
 
 
 (defun wl-scan-source (path)
       (compile-elisp-modules (cdr x) (car x)))
    modules-alist))
 
+(defun install-wl-icons ()
+  (if (not (file-directory-p PIXMAPDIR))
+      (make-directory PIXMAPDIR t))
+  (let* ((case-fold-search t)
+        (icons (directory-files ICONDIR t "\\.x[bp]m$"))
+        icon dest)
+    (while icons
+      (setq icon (car icons)
+           icons (cdr icons)
+           dest (expand-file-name (file-name-nondirectory icon) PIXMAPDIR))
+      (princ (format "%s->%s\n" icon dest))
+      (copy-file icon dest t))))
+
 (defun install-wl-package ()
   (compile-wl-package)
   (let ((wl-install-dir (expand-file-name WL_PREFIX LISPDIR))
                               (if (string= (car x) ELMODIR)
                                   elmo-install-dir
                                 wl-install-dir)))
-     modules-alist)))
+     modules-alist))
+  (if PIXMAPDIR
+      (install-wl-icons)))
 
 
 (defun uninstall-wl-package ()
     (wl-uninstall (wl-scan-source (list WLDIR UTILSDIR SASLDIR))
                  wl-install-dir)
     (wl-uninstall (wl-scan-source (list ELMODIR))
-                 elmo-install-dir)
-    ))
+                 elmo-install-dir))
+  (if PIXMAPDIR
+      (let* ((case-fold-search t)
+            (icons (directory-files PIXMAPDIR t "\\.x[bp]m$"))
+            icon)
+       (while icons
+         (setq icon (car icons)
+               icons (cdr icons))
+         (if (and (file-exists-p icon)
+                  (file-writable-p icon))
+             (progn
+               (princ (format "%s was uninstalled.\n" icon))
+               (delete-file icon)))))))
 
 
 (defun config-wl-package-xmas ()
                       (setq dirs (cdr dirs)))
                     dir)))
           (defvar PACKAGEDIR package-dir)))
-    (princ (format "PACKAGEDIR is %s\n\n" PACKAGEDIR))
-    (setq command-line-args-left (cdr command-line-args-left))))
+    (princ (format "PACKAGEDIR is %s\n" PACKAGEDIR))
+    (setq command-line-args-left (cdr command-line-args-left)))
+  ;; PIXMAPDIR check.
+  (config-wl-pixmap-dir PACKAGEDIR)
+  (princ "\n"))
 
 ;; from SEMI-MK
 (defun compile-wl-package-xmas ()
     (or (file-exists-p INFODIR)
        (make-directory INFODIR t))
     ;; copy xpm files
-    (mapcar '(lambda (x) 
-              (let* ((src-file-nondirectory (file-name-nondirectory x))
-                     (dst-file (expand-file-name src-file-nondirectory
-                                                 DATADIR)))
-                (princ (format "%s->%s\n"
-                               x ; fullpath
-                               dst-file))
-                (copy-file x dst-file t)))
-           (directory-files "etc/icons" t "xpm"))
+    (install-wl-icons)
+
     (mapcar '(lambda (x)
              (install-elisp-modules (cdr x) (car x) LISPDIR))
                   modules-alist)
     ;; WL-AUTOLOAD-MODULES
     (install-elisp-modules WL-AUTOLOAD-MODULES WLDIR LISPDIR)
-    ;; 
+    ;;
     (wl-texinfo-format)
     (wl-texinfo-install)))
 
     (or (file-newer-than-file-p (expand-file-name infofile DOCDIR)
                                (expand-file-name texifile DOCDIR))
        (let (obuf beg)
+         ;; Support old texinfmt.el
+         (require 'ptexinfmt (expand-file-name "ptexinfmt.el" UTILSDIR))
          (find-file (expand-file-name texifile DOCDIR))
          (setq obuf (current-buffer))
-         ;; texinfmt.el 2.37 or earlier can't format @direntry
-         (require 'texinfmt)
-         (unless (fboundp 'texinfo-format-direntry)
-           (goto-char (point-min))
-           (when (re-search-forward "^@direntry" nil t)
-             (replace-match "@ifinfo\nSTART-INFO-DIR-ENTRY"))
-           (when (re-search-forward "^@end direntry" nil t)
-             (replace-match "END-INFO-DIR-ENTRY\n@end ifinfo"))
-           (set-buffer-modified-p nil))
          ;; We can't know file names if splitted.
          (texinfo-format-buffer t)
          ;; Emacs20.2's default is 'raw-text-unix.
index e908b30..d329d56 100644 (file)
@@ -1,9 +1,6 @@
-\e$B%M%C%H%o!<%/4X78$N%3!<%I$r\e(B elmo-network \e$B$K=8Ls\e(B
-product \e$B$rDj5A$9$k\e(B
 elmo-search \e$B$G\e(B msgdb \e$B$H%U%)%k%@K\BN$r%7!<%`%l%9$K8!:w\e(B
 pick/virtual \e$B$N\e(B completion \e$BE}9g\e(B
 msgdb \e$B9=B$$N8+D>$7$H\e(B obarray \e$B2=\e(B
-POP3 \e$B$N\e(B UIDL \e$BBP1~\e(B
 \e$B=EMW%^!<%/$N4IM}\e(B
 \e$B%5%^%j%U%)!<%^%C%H<+M32=\e(B
 \e$B%W%j%U%'%C%AM=Ls%^!<%/\e(B
@@ -12,5 +9,4 @@ virtual \e$B4V$G\e(B msgdb \e$B6&M-\e(B
 MIME Bcc
 wl-summary-other-frame-list
 rfc2192, rfc2193, rfc2221 (imap referral \e$B$N=hM}\e(B)
-imap.el \e$B$H$NE}9g\e(B(\e$B6l$7$$5$$,$7$F$-$?\e(B)
 \e$B$"$d$7$2$J%3!<%I$r$X$i$7$?$$\e(B
index 4b64e0c..4315300 100644 (file)
@@ -2,14 +2,14 @@
 @c %**start of header
 @setfilename wl-ja.info
 @settitle Wanderlust -- Yet Another Message Interface On Emacsen --
-@c @documentlanguage ja
 @c %**end of header
-@c Wanderlust \e$B$N\e(B texinfo
-@set Time-stamp: <00/04/26 17:31:17 teranisi>
-@set version 1.1.1
+@documentlanguage ja
+@documentencoding iso-2022-jp
+@set VERSION 2.3.0
 @synindex pg cp
 @finalout
 
+@dircategory GNU Emacs Lisp
 @direntry
 * Wanderlust-ja: (wl-ja).  Yet Another Message Interface On Emacsen
 @end direntry
@@ -22,14 +22,13 @@ Yet another message interface on Emacsen.
 \e$B$3$N%U%!%$%k$O\e(B Emacs \e$B$GF0$/%a!<%k\e(B/\e$B%K%e!<%94IM}%7%9%F%`\e(B
 Wanderlust \e$B$K4X$9$k@bL@=q$G$9!#\e(B
 
-Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi}.
-@c Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi}, @*
-@c @w{Fujikazu Okunishi}, @w{Masahiro Murata},
-@c @w{Kenichi Okada} and @w{Kaoru Takahashi}.
+Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi},
+@w{Fujikazu Okunishi}, @w{Masahiro Murata},
+@w{Kenichi Okada} and @w{Kaoru Takahashi}.
 
-This edition is for Wanderlust version @value{version}.
+This edition is for Wanderlust version @value{VERSION}.
 
-\e$B$3$NHG$O\e(B Wanderlust version @value{version} \e$B$KBP1~$7$^$9!#\e(B
+\e$B$3$NHG$O\e(B Wanderlust version @value{VERSION} \e$B$KBP1~$7$^$9!#\e(B
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -67,7 +66,9 @@ into another language, under the above conditions for modified versions.
 
 @titlepage
 @sp 10
-@title Wanderlust \e$B%f!<%6%^%K%e%"%k\e(B (ver. @value{version})
+@title Wanderlust \e$B%f!<%6%^%K%e%"%k\e(B
+@subtitle Yet another message interface on Emacsen
+@subtitle for Wanderlust version @value{VERSION}
 @author Yuuichi Teranishi \e$B;{@>M50l\e(B
 @author Fujikazu Okunishi \e$B1|@>F#OB\e(B
 @author Masahiro Murata   \e$BB<EDA442\e(B
@@ -76,14 +77,13 @@ into another language, under the above conditions for modified versions.
 @page
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi}.
-@c Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi}, @*
-@c @w{Fujikazu Okunishi}, @w{Masahiro Murata},
-@c @w{Kenichi Okada}, and @w{Kaoru Takahashi}.
+Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi},
+@w{Fujikazu Okunishi}, @w{Masahiro Murata},
+@w{Kenichi Okada}, and @w{Kaoru Takahashi}.
 
-This manual is for Wanderlust version @value{version}.
+This manual is for Wanderlust version @value{VERSION}.
 
-\e$B$3$N%^%K%e%"%k$O\e(B Wanderlust version @value{version} \e$B$KBP1~$7$^$9!#\e(B
+\e$B$3$N%^%K%e%"%k$O\e(B Wanderlust version @value{VERSION} \e$B$KBP1~$7$^$9!#\e(B
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -109,9 +109,6 @@ into another language, under the above conditions for modified versions.
 @end titlepage
 
 
-@c
-@c  Top
-@c 
 @ifinfo
 @node Top, Introduction, (dir), (dir)
 @top Wanderlust \e$B%f!<%6%^%K%e%"%k\e(B
@@ -122,10 +119,9 @@ Fujikazu Okunishi \e$B1|@>F#OB\e(B
 Masahiro Murata   \e$BB<EDA442\e(B
 Kenichi Okada     \e$B2,ED7r0l\e(B
 Kaoru Takahashi   \e$B9b66\e(B  \e$B0j\e(B
-Last Modified@value{Time-stamp:}
 @end flushright
 
-\e$B$3$NJ8=q$O\e(B Wanderlust@value{version} \e$B$KBP1~$7$^$9!#\e(B
+\e$B$3$NJ8=q$O\e(B Wanderlust @value{VERSION} \e$B$KBP1~$7$^$9!#\e(B
 
 @end ifinfo
 
@@ -147,9 +143,6 @@ Last Modified@value{Time-stamp:}
 @end menu
 
 
-@c
-@c  Introduction
-@c 
 @node Introduction, Start Me Up, Top, Top
 @chapter \e$B$O$8$a$K\e(B
 @cindex Introduction
@@ -171,7 +164,7 @@ Wanderlust \e$B$N<g$JFCD'\e(B/\e$BFCD9$O0J2<$NDL$j$G$9!#\e(B
 @item MH \e$BE*\e(B FCC\e$B!#\e(B(@samp{FCC: %Backup} \e$B$d\e(B @samp{FCC: $Backup} \e$B$b2D\e(B)\e$B!#\e(B
 @item MIME \e$BBP1~\e(B (by SEMI or tm)\e$B!#\e(B
 @item \e$B%K%e!<%9\e(B/\e$B%a!<%k$NAw?.$rE}9g$7$?%a%C%;!<%8Aw?.%I%i%U%H!#\e(B
-@item \e$B%U%)%k%@0lMw$N%"%$%3%sI=<(\e(B (XEmacs)\e$B!#\e(B
+@item \e$B%U%)%k%@0lMw$N%"%$%3%sI=<(\e(B (XEmacs \e$B$H\e(B Emacs 21)\e$B!#\e(B
 @item \e$BBg$-$J%Q!<%H$r<h$j4s$;$:$KI=<(\e(B(IMAP4)\e$B!#\e(B
 @item \e$B%a%C%;!<%8$N8!:w$r%5!<%PB&$G<B9T\e(B(IMAP4)\e$B!#F|K\8l8!:w$b2D!#\e(B
 @item \e$B2>A[%U%)%k%@!#\e(B
@@ -181,27 +174,51 @@ Wanderlust \e$B$N<g$JFCD'\e(B/\e$BFCD9$O0J2<$NDL$j$G$9!#\e(B
 @item \e$BDj7?%a%C%;!<%8$NAw?.$KJXMx$J%F%s%W%l!<%H5!G=!#\e(B
 @end itemize
 
-Wanderlust \e$B$O\e(B Emacs 19.28\e$B!A\e(B \e$B$r%Y!<%9$H$7$?\e(B Mule, Emacs 20.2\e$B!A\e(B, XEmacs 
-20.4\e$B!A!"\e(B \e$B$*$h$S\e(B MS Windows \e$B>e$GF0$/\e(B Meadow 1.00, Mule for Windows v1.22,
-NTEmacs(Windows NT) \e$B$GF0:n$9$k$3$H$,3NG'$5$l$F$$$^$9!#\e(BOS/2 \e$B>e$GF0:n$9$k\e(B 
-PMMule \e$B$bEvA3\e(B OK \e$B$G$9!#$5$i$K!"\e(BNemacs 3.3.2 \e$B>e$G$b!"\e(B(\e$B;H$($k5!G=$O8BDj$5\e(B
-\e$B$l$k$b$N$N\e(B) \e$BF0:n$9$k$3$H$,3NG'$5$l$F$$$^$9!#\e(B
 
-\e$B$^$?!"\e(BWanderlust \e$B$,@\B3$7$FF0:n$9$k$3$H$,3NG'$5$l$F$$$k\e(B IMAP \e$B%5!<%P$O\e(BUW
-imapd 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.7a, Cyrus imapd 1.4, Cyrus imapd 1.5.19,
-AIR MAIL(AIRCimapd release 2.00) \e$B$G$9!#\e(B
+@section \e$BF0:n4D6-\e(B
+
+Wanderlust \e$B$O0J2<$N\e(B Emacsen \e$B$GF0:n$9$k$3$H$,3NG'$5$l$F$$$^$9!#\e(B
+@c \e$B$5$i$K\e(B Nemacs 3.3.2 \e$B>e$G$b!"\e(B(\e$B;H$($k5!G=$O8BDj$5$l$k$b$N$N\e(B) \e$BF0:n$9$k$3$H\e(B
+@c \e$B$,3NG'$5$l$F$$$^$9!#\e(B
+
+@itemize @bullet
+@item Nemacs 3.3.2 (\e$BCm\e(B: \e$B;H$($k5!G=$O8BDj$5$l$^$9\e(B)
+@item Mule 2.3 based on Emacs 19.28
+@item Mule 2.3 based on Emacs 19.34
+@item Emacs 20.2 \e$B0J9_\e(B
+@item XEmacs 20.4 \e$B0J9_\e(B
+@item Meadow 1.00 \e$B0J9_\e(B
+@item Mule for Windows v1.22
+@item NTEmacs 20.4 \e$B0J9_\e(B
+@item PMMule
+@end itemize
+
+Wanderlust \e$B$,@\B3$7$FF0:n$9$k$3$H$,3NG'$5$l$F$$$k\e(B IMAP \e$B%5!<%P$O0J2<$NDL\e(B
+\e$B$j$G$9!#\e(B
+
+@itemize @bullet
+@item UW imapd 4.1\e$B!A\e(B4.7, 4.7a, 4.7b, 4.7c
+@item Cyrus imapd 1.4
+@item Cyrus imapd 1.5.19
+@item Cyrus imapd 1.6.22
+@item Cyrus imapd 2.0.5
+@item AIR MAIL (AIRC imapd release 2.00)
+@item Express Mail
+@item Microsoft Exchange Server 5.5
+@item Sun Internet Mail Server 4.0
+@end itemize
+
+@c Wanderlust \e$B$,@\B3$7$FF0:n$9$k$3$H$,3NG'$5$l$F$$$k\e(B LDAP \e$B%5!<%P$O0J2<$NDL\e(B
+@c \e$B$j$G$9!#\e(B
 
 
-@c
-@c  Start Me Up
-@c 
 @node Start Me Up, Folders, Introduction, Top
 @chapter Wanderlust \e$B$r5/F0$9$k\e(B
 @cindex Start up
 
 Wanderlust \e$B$r5/F0$9$k$^$G$KI,MW$J<j=g$r=gHV$K@bL@$7$^$9!#\e(B
 
-(\e$BEvA3$N$3$H$J$,$i!"$3$l$i$h$j$b@h$K!"%a!<%k\e(B/\e$B%K%e!<%9$rFI$`$3$H$,$G$-$k4D6-$,$"$i$+$8$aI,MW$G$9!#\e(B)
+(\e$BEvA3$N$3$H$J$,$i!"$3$l$i$h$j$b@h$K!"%a!<%k\e(B/\e$B%K%e!<%9$rFI$`$3$H$N$G$-$k4D6-$,$"$i$+$8$aI,MW$G$9!#\e(B)
 
 @menu
 * MIME Modules::      MIME \e$BMQ%b%8%e!<%k$N%$%s%9%H!<%k\e(B
@@ -227,7 +244,7 @@ Wanderlust \e$B$r@5>o$KF0:n$5$;$k$K$O!"$^$:!"\e(BSEMI \e$B$b$7$/$O\e(B tm \e$B$,%$%s%
 
 Emacs19.28 \e$B0JA0$r%Y!<%9$H$7$?\e(B mule \e$B$r$*;H$$$N>l9g$O\e(B SEMI \e$B$,F0$+$J$$$O$:\e(B
 @footnote{Emacs 19.34 \e$B%Y!<%9$N\e(B Mule \e$B$G$O\e(B SEMI \e$B$rF0:n$5$;$k$3$H$b2DG=$G$9!#\e(B@*
-@samp{http://www.jpl.org/elips/INSTALL-SEMI-ja.html} \e$B$,;29M$K$J$j$^$9!#\e(B}
+@uref{http://www.jpl.org/elips/INSTALL-SEMI-ja.html} \e$B$,;29M$K$J$j$^$9!#\e(B}
 \e$B$J$N$G\e(B tm \e$B$r%$%s%9%H!<%k$7$^$9!#\e(B
 (tm \e$B$O%P!<%8%g%s\e(B 8.7 \e$B0J9_$r$4MxMQ$/$@$5$$!#\e(B)
 
@@ -240,16 +257,20 @@ SEMI \e$B$,;H$($k\e(B Emacsen \e$B$G$O!"\e(Btm \e$B$h$j$b5!G=$N=<<B$7$?\e(B SEMI\e$B$r%
 SEMI, tm \e$B$O0J2<$N>l=j$+$i%@%&%s%m!<%I$G$-$^$9!#\e(B
 
 @example
-SEMI: ftp://ftp.m17n.org/mule/semi/
-tm:   http://cvs.m17n.org/tomo/comp/emacsen/tm/tm-8/
+@group
+SEMI:   ftp://ftp.m17n.org/pub/mule/semi/
+tm:     http://cvs.m17n.org/tomo/comp/emacsen/tm/tm-8/
+@end group
 @end example
 
 SEMI \e$B$K$O\e(B APEL, FLIM \e$B$H8F$P$l$k%Q%C%1!<%8$bI,MW$G$9!#\e(B
-FLIM, APEL \e$B$O0J2<$N>l=j$+$i%@%&%s%m!<%I$G$-$^$9!#\e(B
+APEL, FLIM \e$B$O0J2<$N>l=j$+$i%@%&%s%m!<%I$G$-$^$9!#\e(B
 
 @example
-FLIM:     ftp://ftp.m17n.org/mule/flim/
-APEL:     ftp://ftp.m17n.org/mule/apel/
+@group
+APEL:   ftp://ftp.m17n.org/pub/mule/apel/
+FLIM:   ftp://ftp.m17n.org/pub/mule/flim/
+@end group
 @end example
 
 APEL, FLIM, SEMI \e$B$N=g$K%$%s%9%H!<%k$7$F$/$@$5$$!#\e(B
@@ -269,15 +290,17 @@ APEL 10.2 \e$B$H\e(B FLIM 1.12.7 \e$B$NAH9g$;$G$O!"\e(BFLIM 1.12.7 \e$B$N%3%s%Q%$%k;~
 Please install latest APEL 7.3 or later.
 @end example
    
-\e$B$H$$$&%(%i!<$,H/@8$9$k>l9g$,$"$j$^$9!#$3$N>l9g!"\e(BFLIM-CFG \e$B$N0J2<$N9T$r\e(B
+\e$B$H$$$&%(%i!<$,H/@8$9$k>l9g$,$"$j$^$9!#$3$N>l9g!"\e(B@file{FLIM-CFG} \e$B$N0J2<$N9T$r\e(B
 \e$B%3%a%s%H%"%&%H$7$F2<$5$$!#\e(B
 
-@example
+@lisp
+@group
 (or (fboundp 'write-region-as-binary)
     (error "Please install latest APEL 7.3 or later."))
 (or (fboundp 'insert-file-contents-as-binary)
     (error "Please install latest APEL 7.3 or later."))
-@end example
+@end group
+@end lisp
 
 \e$B$=$NB>!"\e(BFLIM, SEMI \e$B$K$O$$$m$$$m$JJQ7A%P!<%8%g%s$,B8:_$7$^$9$,!"\e(B
 \e$B$=$l$i$N$$$:$l$bMxMQ$9$k$3$H$,2DG=$G$9!#\e(B
@@ -299,6 +322,7 @@ Please install latest APEL 7.3 or later.
 Wanderlust \e$BK\BN$O0J2<$N>l=j$+$i%@%&%s%m!<%I$G$-$^$9!#\e(B
 
 \e$B0l<!G[I[85\e(B:
+
 @example
 ftp://ftp.gohome.org/wl/
 @end example
@@ -306,34 +330,44 @@ ftp://ftp.gohome.org/wl/
 \e$B%_%i!<$7$F$$$?$@$$$F$$$k\e(B ftp, http \e$B%5%$%H\e(B:
 
 @example
+@group
 ftp://ftp.jaist.ac.jp/pub/GNU/elisp/ftp.gohome.org/wl/
-ftp://daidai.kuis.kyoto-u.ac.jp/pub/mirror/ftp.gohome.org/pub/elisp/wl/
-http://www.jpl.org/elips/
+http://www.jpl.org/elips/wl/
 http://www.ring.gr.jp/archives/text/elisp/wl/
 ftp://ftp.ring.gr.jp/pub/text/elisp/wl/
 ftp://opaopa.org/pub/mirror/elisp/wl/
+@end group
 @end example
 
 \e$BF~<j$7$?%Q%C%1!<%8$OE,Ev$J:n6H%G%#%l%/%H%j$KE83+$7$^$7$g$&!#\e(B
 
 @example
+@group
 % cd ~/work
-% tar zxvf wl-(@var{version}).tar.gz
-% cd wl-(@var{version})
+% tar zxvf wl-@var{version}.tar.gz
+% cd wl-@var{version}
+@end group
 @end example
 
 @subsection SSL (Secure Socket Layer)\e$B$NMxMQ\e(B
+@cindex SSL
+@pindex OpenSSL
+@pindex starttls
 
 Wanderlust \e$B$G$O!"\e(BSMTP, IMAP, NNTP, POP \e$B$N%3%M%/%7%g%s$K$*$$$F!"\e(B
 SSL (Secure Socket Layer) \e$B$rMQ$$$k$3$H$,$G$-$^$9!#\e(B
-SSL \e$B$NMxMQ7ABV$K$O\e(B2\e$B<oN`$"$j!"%3%M%/%7%g%s$HF1;~$K\e(B
-SSL negotiation \e$B$r;O$a$k$b$N$H!"\e(B starttls command \e$B$N8e$K!"\e(B
-SSL negotiation \e$B$r;O$a$k$b$N$,$"$j$^$9!#\e(B
+
+SSL \e$B$NMxMQ7ABV$K$O\e(B2\e$B<oN`$"$j!"%3%M%/%7%g%s$HF1;~$K\e(B SSL negotiation \e$B$r;O$a\e(B
+\e$B$k$b$N$H!"\e(B@command{starttls} command \e$B$N8e$K\e(B SSL negotiation \e$B$r;O$a$k$b$N\e(B
+\e$B$,$"$j$^$9!#\e(B
+
 \e$BDL>o$N\e(B SSL \e$B$rMxMQ$9$k$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B @file{utils} \e$B%G%#%l%/%H%j$K$"$k\e(B
-@file{ssl.el} \e$B$r%$%s%9%H!<%k$9$kI,MW$,$"$j$^$9!#\e(B
-\e$B$J$*$+$D!"\e(BOpenSSL \e$B$K4^$^$l$k\e(B openssl \e$B$K%Q%9$,DL$C$F$$$kI,MW$,$"$j$^$9!#\e(B
+@file{ssl.el} \e$B$r%$%s%9%H!<%k$9$kI,MW$,$"$j$^$9!#$J$*$+$D!"\e(BOpenSSL \e$B$K4^$^\e(B
+\e$B$l$k\e(B @command{openssl} \e$B$K%Q%9$,DL$C$F$$$kI,MW$,$"$j$^$9!#\e(B
+
 STARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls \e$B%Q%C%1!<%8$r%$%s%9%H!<%k\e(B
 \e$B$9$kI,MW$,$"$j$^$9!#\e(B
+
 starttls \e$B%Q%C%1!<%8$O0J2<$N>l=j$+$iF~<j$G$-$^$9!#\e(B
 
 @example
@@ -355,8 +389,10 @@ ftp://opaopa.org/pub/elisp/
 @code{EMACS} \e$B$K$OMxMQ$9$k\e(B Emacs \e$B$N%3%^%s%IL>$r;XDj$7$^$9!#\e(B
 
 @example
+@group
 % make
 % make install
+@end group
 @end example
 
 @file{Makefile} \e$BCf$N\e(B @code{LISPDIR} \e$B$rJQ99$;$:!"\e(B
@@ -364,7 +400,7 @@ ftp://opaopa.org/pub/elisp/
 \e$B<+F0E*$K%$%s%9%H!<%k@h$rE,Ev$K8!=P$7$^$9!#\e(B
 \e$B<B:]$N%$%s%9%H!<%k@h$K$D$$$F$O8e=R$7$^$9!#\e(B
 
-Mule 2.3 \e$B$J$I!"\e(B@file{subdirs.el} \e$B$,L5$/!"\e(Bload-path \e$B$K%5%V%G%#%l%/%H%j$,\e(B
+Mule 2.3 \e$B$J$I!"\e(B@file{subdirs.el} \e$B$,L5$/!"\e(B@code{load-path} \e$B$K%5%V%G%#%l%/%H%j$,\e(B
 \e$B<+F0E*$K2C$o$i$J$$\e(B Emacs \e$B$G$O!"\e(B
 
 @example
@@ -373,19 +409,19 @@ Cannot open load file: mime-setup
 
 @noindent
 \e$B$H$$$&%(%i!<$,=P$k$3$H$,$"$j$^$9!#$3$N>l9g$O!"\e(B
-custom, apel, flim, semi \e$B$N%$%s%9%H!<%k@h$r4D6-JQ?t\e(B @code{EMACSLOADPATH}
+custom, APEL, FLIM, SEMI \e$B$N%$%s%9%H!<%k@h$r4D6-JQ?t\e(B @env{EMACSLOADPATH}
 \e$B$K2C$($k$+!"E83+%G%#%l%/%H%j$N\e(B @file{WL-CFG} \e$B$H$$$&%U%!%$%kCf$G\e(B
-load-path \e$B$rDL$7$F$*$/$H$h$$$G$7$g$&!#\e(B
+@code{load-path} \e$B$rDL$7$F$*$/$H$h$$$G$7$g$&!#\e(B
 
-\e$B$^$?!"\e(BBBDB \e$B$rMxMQ$7$?$$>l9g!"\e(BBBDB \e$B$X$b\e(B load-path \e$B$rDL$7$F$*$/$HI,MW$J%b\e(B
+\e$B$^$?!"\e(BBBDB \e$B$rMxMQ$7$?$$>l9g!"\e(BBBDB \e$B$X$b\e(B @code{load-path} \e$B$rDL$7$F$*$/$HI,MW$J%b\e(B
 \e$B%8%e!<%k$,%P%$%H%3%s%Q%$%k\e(B/\e$B%$%s%9%H!<%k$5$l$^$9!#\e(B
 @xref{BBDB}.
 
-@subsection WL-CFG
+@subsection @file{WL-CFG}
 
 @file{WL-CFG} \e$B$H$$$&%U%!%$%k$,E83+%G%#%l%/%H%j$KB8:_$9$k$H!"\e(B
-\e$B%$%s%9%H!<%k;~$K\e(B load \e$B$5$l$k$h$&$K$J$C$F$$$^$9!#\e(B
-\e$B%$%s%9%H!<%k$G\e(B SEMI \e$BEy$N\e(B load-path \e$B$N@_Dj$,I,MW$G$"$l$P!"\e(B
+\e$B%$%s%9%H!<%k;~$KFI$_9~$^$l$k$h$&$K$J$C$F$$$^$9!#\e(B
+\e$B%$%s%9%H!<%k$G\e(B SEMI \e$BEy$N\e(B @code{load-path} \e$B$N@_Dj$,I,MW$G$"$l$P!"\e(B
 @file{WL-CFG} \e$B$K@_Dj$7$F$/$@$5$$!#\e(B
 
 \e$B%$%s%9%H!<%k@h$O\e(B @file{Makefile}\e$BCf$N\e(B @code{LISPDIR} \e$B$G;XDj$7$^$9$,!"\e(B
@@ -411,7 +447,7 @@ ELMO \e$B%b%8%e!<%k$K$O%U%!%$%k\e(B @file{elmo*.el} @file{elmo*.elc} \e$B$,4^$^$l$^
 @code{WL_PREFIX}, @code{ELMO_PREFIX}
  \e$B$N%G%U%)%k%H$O$$$:$l$b\e(B @file{wl} \e$B$G$9!#\e(B
 
-@file{elmo*} (ELMO \e$B%b%8%e!<%k\e(B) \e$B$O\e(B @file{elmo} \e$BG[2<$K%$%s%9%H!<%k$7$?$1$l$P!"\e(B
+@file{elmo*} (ELMO \e$B%b%8%e!<%k\e(B) \e$B$r\e(B @file{elmo} \e$BG[2<$K%$%s%9%H!<%k$7$?$1$l$P!"\e(B
 
 @lisp
 (setq ELMO_PREFIX "elmo")
@@ -429,30 +465,34 @@ ELMO \e$B%b%8%e!<%k$K$O%U%!%$%k\e(B @file{elmo*.el} @file{elmo*.elc} \e$B$,4^$^$l$^
 
 Wanderlust \e$B$O\e(B XEmacs (21.0 \e$B!A\e(B) \e$B$N\e(B package \e$B$N$R$H$D$H$7$F%$%s%9%H!<%k$9$k\e(B
 \e$B$3$H$b2DG=$G$9!#\e(Bpackage \e$B$H$7$F%$%s%9%H!<%k$9$k$H!"\e(Bautoload \e$B$N@_Dj!"\e(B
-\e$B%"%$%3%s$N%Q%9@_Dj$r8D?M$N\e(B @file{.emacs} \e$B$K5-=R$7$J$/$F$b\e(B Wanderlust
+\e$B%"%$%3%s$N%Q%9@_Dj$r8D?M$N\e(B @file{~/.emacs} \e$B$K5-=R$7$J$/$F$b\e(B Wanderlust
 \e$B$r@5>o$K5/F0$G$-$k$h$&$K$J$j$^$9!#\e(B
 
 XEmacs \e$B$N\e(B package \e$B$H$7$F%$%s%9%H!<%k$9$k$K$O0J2<$N$h$&$K$7$^$9!#\e(B
 
 @example
+@group
 % vi Makefile
 % make package
 % make install-package
+@end group
 @end example
 
 package \e$B$N%G%#%l%/%H%j$O\e(B SEMI \e$B$,%$%s%9%H!<%k$5$l$F$$$l$P<+F08!=P$5$l$^$9!#\e(B
-(@file{Makefile} \e$BCf$N\e(B PACKAGEDIR \e$B$G$b@_Dj2D\e(B)
+(@file{Makefile} \e$BCf$N\e(B @code{PACKAGEDIR} \e$B$G$b@_Dj2D\e(B)
 
 @subsection \e$B%$%s%9%H!<%k$7$J$$$GMxMQ\e(B
 
-Wanderlust \e$B$O%P%$%H%3%s%Q%$%k!"%$%s%9%H!<%k$7$J$/$F$b!"\e(B
-wl, elmo \e$B$N%G%#%l%/%H%j$K\e(B load-path \e$B$,@_Dj$5$l$F$$$l$P5/F0$9$k$3$H$,$G$-$^$9!#\e(B
+Wanderlust \e$B$O%P%$%H%3%s%Q%$%k!"%$%s%9%H!<%k$7$J$/$F$b!"\e(B@file{wl}, @file{elmo}
+\e$B$N%G%#%l%/%H%j$K\e(B @code{load-path} \e$B$,@_Dj$5$l$F$$$l$P5/F0$9$k$3$H$,$G$-$^$9!#\e(B
 \e$BNc$($P\e(B @file{~/work} \e$B$K%Q%C%1!<%8$rE83+$7$?>l9g!"\e(B
-@file{.emacs} \e$B$K0J2<$N@_Dj$r$9$k$H5/F0$G$-$^$9!#\e(B
+@file{~/.emacs} \e$B$K0J2<$N@_Dj$r$9$k$H5/F0$G$-$^$9!#\e(B
 
 @lisp
-(add-to-list 'load-path "~/work/wl-(@var{version})")
-(add-to-list 'load-path "~/work/wl-(@var{version})/elmo")
+@group
+(add-to-list 'load-path "~/work/wl-@var{version}/wl")
+(add-to-list 'load-path "~/work/wl-@var{version}/elmo")
+@end group
 @end lisp
 
 @subsection \e$B%^%K%e%"%k$K$D$$$F\e(B
@@ -461,8 +501,10 @@ wl, elmo \e$B$N%G%#%l%/%H%j$K\e(B load-path \e$B$,@_Dj$5$l$F$$$l$P5/F0$9$k$3$H$,$G$
 \e$B%$%s%9%H!<%k$9$k$K$O2<5-$r<B9T$7$F$/$@$5$$!#\e(B
 
 @example
+@group
 % make info
 % make install-info
+@end group
 @end example
 
 XEmacs \e$B$N\e(B package \e$B$H$7$F%$%s%9%H!<%k$7$?>l9g$O<+F0E*$K\e(B Info \e$B%U%!%$%k$b\e(B
@@ -476,7 +518,7 @@ http://www.gohome.org/wl/doc/wl-euc_toc.html
 
 
 @node Minimal Settings, Mail Addresses, Install, Start Me Up
-@section .emacs \e$B$N@_Dj\e(B
+@section @file{.emacs}, @file{.wl} \e$B$N@_Dj\e(B
 @cindex Minimal Settings
 @cindex Settings
 @cindex Configuration
@@ -487,17 +529,18 @@ Wanderlust \e$B$N%Q%C%1!<%8$K$OBg$-$/J,$1$FFs$D$N%b%8%e!<%k72$,4^$^$l$F$$$^$9!#\e(
 
 @table @samp
 @item ELMO (elmo-*.el)
-\e$B$9$Y$F$r%U%)%k%@$K8+$;$k%b%8%e!<%k72$G$9!#\e(BWanderlust \e$B$N%P%C%/%(%s%I$G$9!#\e(B
+\e$B$9$Y$F$r%U%)%k%@$K8+$;$k%b%8%e!<%k72$G$9!#\e(BWL \e$B$N%P%C%/%(%s%I$G$9!#\e(B
 @item WL (wl-*.el)
 Wanderlust \e$BK\BN$NF0:n$r7h$a$k%b%8%e!<%k72$G$9!#\e(BELMO \e$B$N%U%m%s%H%(%s%I$G$9!#\e(B
 @end table
 
-\e$B%f!<%6$O\e(B @code{elmo-*}, @code{wl-*} \e$B$G;O$^$kJQ?t$N@_Dj$rJQ$($k$3$H$K$h$C$F\e(B
+\e$B%f!<%6$O\e(B @code{elmo-}, @code{wl-} \e$B$G;O$^$kJQ?t$N@_Dj$rJQ$($k$3$H$K$h$C$F\e(B
 Wanderlust \e$B$NF0:n$r%+%9%?%^%$%:$G$-$^$9!#\e(B
 
 \e$B:GDc8BI,MW$J@_Dj$O0J2<$NDL$j$G$9!#\e(B
 
 @lisp
+@group
 ;; @r{SEMI/tm \e$B$r;H$&$?$a$N@_Dj\e(B}
 (load "mime-setup")
 
@@ -506,26 +549,28 @@ Wanderlust \e$B$NF0:n$r%+%9%?%^%$%:$G$-$^$9!#\e(B
 (autoload 'wl "wl" "Wanderlust" t)
 (autoload 'wl-draft "wl-draft" "Write draft with Wanderlust." t)
 
-;; @r{\e$B%"%$%3%s$rCV$/%G%#%l%/%H%j\e(B (XEmacs \e$B$N$_\e(B)\e$B!#=i4|@_Dj$O\e(B nil\e$B!#\e(B}
+;; @r{\e$B%"%$%3%s$rCV$/%G%#%l%/%H%j\e(B (XEmacs \e$B$H\e(B Emacs 21)\e$B!#=i4|@_Dj$O\e(B @code{nil}\e$B!#\e(B}
 ;; @r{(XEmacs \e$B$N\e(B package \e$B$H$7$F%$%s%9%H!<%k$5$l$F$$$k>l9g!"I,MW$"$j$^$;$s\e(B)}
 (setq wl-icon-dir "~/work/wl/etc")
 
-;; @r{\e$B%a!<%k$rAw?.$9$k\e(B SMTP \e$B%5!<%P!#\e(B \e$B=i4|@_Dj$O\e(B "localhost"\e$B!#\e(B}
+;; @r{\e$B%a!<%k$rAw?.$9$k\e(B SMTP \e$B%5!<%P!#\e(B \e$B=i4|@_Dj$O\e(B @code{nil}\e$B!#\e(B}
 (setq wl-smtp-posting-server "your.smtp.server.com")
-;; @r{\e$B%K%e!<%9Ej9FMQ$N\e(B NNTP \e$B%5!<%P!#\e(B \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B}
+;; @r{\e$B%K%e!<%9Ej9FMQ$N\e(B NNTP \e$B%5!<%P!#\e(B \e$B=i4|@_Dj$O\e(B @code{nil}\e$B!#\e(B}
 (setq wl-nntp-posting-server "your.nntp.server.com")
+@end group
 @end lisp
 
 Wanderlust \e$B5/F08e!"\e(B@file{~/.wl} \e$B$,B8:_$9$l$P%m!<%I$5$l$^$9$N$G!"\e(BWanderlust \e$B$K\e(B
 \e$B8GM-$N@_Dj$O\e(B @file{~/.wl} \e$B$K5-=R$7$F$*$1$P@0M}$7$d$9$$$G$7$g$&!#\e(B
-face \e$B$N@_Dj$O\e(B @file{.emacs} \e$B$K=q$/$3$H$O$G$-$J$$$N$G\e(B
+face \e$B$N@_Dj$O\e(B @file{~/.emacs} \e$B$K=q$/$3$H$O$G$-$J$$$N$G\e(B
 @file{~/.wl} \e$B$K=q$$$F$/$@$5$$!#\e(B
 @xref{Highlights}.
 
-(\e$B>e5-$N$&$A!"\e(B@samp{(load "mime-setup")} \e$B$H\e(B autoload \e$B$N@_Dj0J30$O\e(B @file{~/.wl} 
-\e$B$K5-=R$G$-$^$9!#\e(B)
+\e$B>e5-$N$&$A!"\e(B@samp{(load "mime-setup")} \e$B$H\e(B autoload \e$B$N@_Dj$O\e(B
+@file{~/.emacs} \e$B$K=q$/I,MW$,$"$j$^$9!#\e(B
+\e$B$=$l0J30$N@_Dj$O\e(B @file{~/.wl} \e$B$K5-=R$G$-$^$9!#\e(B
 
-@subsection mail-user-agent
+@subsection @code{mail-user-agent}
 @cindex Default Mailer
 @cindex Mailer, Default
 @vindex mail-user-agent
@@ -535,10 +580,11 @@ face \e$B$N@_Dj$O\e(B @file{.emacs} \e$B$K=q$/$3$H$O$G$-$J$$$N$G\e(B
 (@code{compose-mail}) \e$BEy$K$h$C$F\e(B Wanderlust \e$B$N%I%i%U%H%b!<%I$,5/F0$5$l$k\e(B
 \e$B$h$&$K$J$j$^$9!#\e(BWanderlust \e$B$r\e(B Emacs \e$B>e$NI8=`%a!<%i$H$7$F;H$$$?$$>l9g$O\e(B
 \e$B@_Dj$7$F$*$/$H$h$$$G$7$g$&!#\e(B
-\e$B$?$@$7!"$3$l$O\e(B @code{mail-user-agent} \e$B$NDj5A$,2DG=$J\e(B Emacs \e$B$N>l9g$N$_M-8z$G$9!#\e(B
-@c @xref{Mail Methods, , ,emacs}.
+\e$B$?$@$7!"$3$l$O\e(B @code{mail-user-agent} \e$B$NDj5A$,2DG=$J\e(B Emacsen \e$B$N>l9g$N$_M-8z$G$9!#\e(B
+@xref{Mail Methods, , ,emacs-ja, The Emacs Editor}.
 
 @lisp
+@group
 (autoload 'wl-user-agent-compose "wl-draft" nil t)
 (if (boundp 'mail-user-agent)
     (setq mail-user-agent 'wl-user-agent))
@@ -549,6 +595,7 @@ face \e$B$N@_Dj$O\e(B @file{.emacs} \e$B$K=q$/$3$H$O$G$-$J$$$N$G\e(B
       'wl-draft-send
       'wl-draft-kill
       'mail-send-hook))
+@end group
 @end lisp
 
 
@@ -569,28 +616,37 @@ face \e$B$N@_Dj$O\e(B @file{.emacs} \e$B$K=q$/$3$H$O$G$-$J$$$N$G\e(B
 \e$B=q$-J}$O$H$F$bC1=c$G$9!#$3$s$J$+$s$8$G$9!#\e(B
 
 @example
+@group
 #
 # @r{@samp{#} \e$B$G;O$^$k9T$O%3%a%s%H!#\e(B}
 # @r{\e$B6u9T$OL5;k!#\e(B}
 #
-# @r{\e$B%a!<%k%"%I%l%9\e(B  ``\e$B$"$@L>\e(B'' ``\e$BK\L>\e(B''}
+# @var{\e$B%a!<%k%"%I%l%9\e(B}  "@var{\e$B$"$@L>\e(B}"  "@var{\e$BK\L>\e(B}"
 #
 teranisi@@gohome.org            "\e$B$F$i$K$7\e(B"      "\e$B;{@>M50l\e(B"
 foo@@bar.gohome.org             "Foo \e$B$5$s\e(B"      "John Foo"
 bar@@foo.gohome.org             "Bar \e$B$5$s\e(B"      "Michael Bar"
+@end group
 @end example
 
 @noindent
 \e$B0l9T$,0l?MJ,$NDj5A$G$9!#\e(B
 
-\e$B<B:]$K$O\e(B(\e$B%G%U%)%k%H@_Dj$G$O\e(B)\e$B%5%^%jI=<($G\e(B``\e$B$"$@L>\e(B''\e$B!"\e(B
-\e$B%I%i%U%H:n@.;~$N%"%I%l%9>pJs$H$7$F\e(B``\e$BK\L>\e(B''\e$B$,$D$+$o$l$^$9!#\e(B
+\e$B<B:]$K$O\e(B(\e$B%G%U%)%k%H@_Dj$G$O\e(B)\e$B%5%^%jI=<($G\e(B@var{\e$B$"$@L>\e(B}\e$B!"\e(B
+\e$B%I%i%U%H:n@.;~$N%"%I%l%9>pJs$H$7$F\e(B@var{\e$BK\L>\e(B}\e$B$,$D$+$o$l$^$9!#\e(B
 \e$B;n$7$F$_$F!"3NG'$7$F$+$i$NJ}$,$o$+$j$d$9$$$H;W$o$l$^$9!#\e(B
 \e$B$A$g$C$H=q$$$F;n$7$F$_$F$+$i!"$^$?%"%I%l%9D"$NDj5A$r$d$j$J$*$9$N$,$h$$$G$7$g$&!#\e(B
 
 \e$B$^$?!"JQ?t\e(B @code{wl-alias-file} \e$B$N%U%!%$%k$K\e(B MH \e$B$N\e(B alias file \e$B$,;XDj$5$l$F\e(B
 \e$B$$$l$P!"%I%i%U%H:n@.;~$N%"%I%l%9>pJs$H$7$F;H$o$l$^$9!#\e(B
 
+\e$B$5$i$K!"JQ?t\e(B @code{wl-use-ldap} (\e$B=i4|@_Dj$O\e(B nil) \e$B$r\e(B non-nil \e$B$K@_Dj$9$k$H!"\e(B
+LDAP \e$B%5!<%P$N>pJs$r%I%i%U%H:n@.;~$N%"%I%l%9>pJs$H$7$FMxMQ$7$^$9!#\e(B
+
+LDAP \e$B$rMxMQ$9$k>l9g$O!"\e(B@code{wl-ldap-server}\e$B!"\e(B@code{wl-ldap-port},
+@code{wl-ldap-base} \e$B$bE,@Z$K@_Dj$7$F2<$5$$!#$^$?!"\e(BLDAP \e$BBP1~$N\e(B XEmacs \e$B0J\e(B
+\e$B30$G$O!"30It%W%m%0%i%`$H$7$F\e(B ldapsearch \e$B$rMxMQ$7$^$9$N$G!"\e(Bldapsearch \e$B$X\e(B
+\e$B$"$i$+$8$a%3%^%s%I<B9T%Q%9$r@_Dj$7$F$*$/I,MW$,$"$j$^$9!#\e(B
 
 @node Folder Definition, Start Wanderlust, Mail Addresses, Start Me Up
 @section \e$B9XFI$9$k%U%)%k%@$NDj5A\e(B
@@ -606,11 +662,12 @@ bar@@foo.gohome.org             "Bar \e$B$5$s\e(B"      "Michael Bar"
 @file{~/.folders} \e$B$N=q$-J}$O$H$F$bC1=c$G$9!#$3$s$J$+$s$8$G$9!#\e(B
 
 @example
+@group
 #
 # @r{@samp{#} \e$B$G;O$^$k9T$O%3%a%s%H!#\e(B}
 # @r{\e$B6u9T$OL5;k!#\e(B}
 #
-# @r{\e$B%U%)%k%@\e(B}  "@r{\e$B$"$@L>\e(B}"
+# @var{\e$B%U%)%k%@\e(B}  "@var{\e$B$"$@L>\e(B}"
 # @r{(\e$B$"$@L>$OL5$/$F$b$h$$\e(B)}
 #
 %inbox  "\e$B<u?.H"\e(B"
@@ -633,6 +690,7 @@ Emacsen@{
 %#mh/expire@@localhost /
 # @r{MH \e$B$N%U%)%k%@A4$F$r$R$H$D$N%0%k!<%W$K$9$kNc!#\e(B}
 + /
+@end group
 @end example
 
 \e$B0l9T$K$R$H$D!"FI$_$?$$%U%)%k%@$r=q$-$^$9!#\e(B
@@ -675,9 +733,6 @@ M-x wl
 \e$B%U%)%k%@$N%A%'%C%/$r>JN,$7$F5/F0$7$^$9!#\e(B
 
 
-@c
-@c  Folders
-@c
 @node Folders, Folder, Start Me Up, Top
 @chapter Wanderlust \e$B$G07$($k%U%)%k%@$?$A\e(B
 @cindex Folder Type
@@ -687,7 +742,7 @@ M-x wl
 Wanderlust \e$B$O\e(B ELMO \e$B$N%$%s%?%U%'!<%9$rMxMQ$7$F$$$k$?$a!"\e(BELMO \e$B%b%8%e!<%k$K\e(B
 \e$B$h$C$F%5%]!<%H$5$l$F$$$l$P!"$I$s$J%U%)%k%@$G$bMxMQ$9$k$3$H$,$G$-$^$9!#\e(B
 
-\e$B%P!<%8%g%s\e(B @value{version} \e$B8=:_!"MQ0U$5$l$F$$$k%U%)%k%@$N<oN`$O!"\e(B
+\e$B%P!<%8%g%s\e(B @value{VERSION} \e$B8=:_!"MQ0U$5$l$F$$$k%U%)%k%@$O!"\e(B
 IMAP, NNTP, LocalDir(MH), Maildir, News Spool, POP, Archive, 
 Multi, Filter, Pipe, Internal \e$B$N\e(B 10 \e$B<oN`$G$9!#\e(B
 
@@ -715,61 +770,81 @@ Multi, Filter, Pipe, Internal \e$B$N\e(B 10 \e$B<oN`$G$9!#\e(B
 
 RFC 2060 \e$B$G5,Dj$5$l$?\e(B IMAP4rev1 \e$B$rMxMQ$7$F%a!<%k$rFI$`$?$a$N%U%)%k%@$G$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '%' '\e$B%a!<%k%\%C%/%9L>\e(B'[':' '\e$B%f!<%6L>\e(B' ['/' '\e$BG'>ZK!\e(B']]['@@' '\e$B%[%9%HL>\e(B'][':' '\e$B%]!<%HHV9f\e(B']['!']
+@group
+@samp{%} @var{\e$B%a!<%k%\%C%/%9L>\e(B} [@samp{:} @var{\e$B%f!<%6L>\e(B} [@samp{/} @var{\e$BG'>ZK!\e(B}]][@samp{@@} @var{\e$B%[%9%HL>\e(B}][@samp{:} @var{\e$B%]!<%HHV9f\e(B}][@samp{!}]
+@end group
+@end example
 
-\e$BG'>ZK!$K$O\e(B "auth" (\e$B%(%s%3!<%I$7$F%Q%9%o!<%I$rAw?.\e(B)\e$B$+\e(B
-           "cram-md5" (cram-md5\e$B$K$h$kG'>Z\e(B)\e$B$+\e(B
-           "login" (\e$B@8%Q%9%o!<%I$rAw?.\e(B) \e$B$N$$$:$l$+$r;XDj!#\e(B
+@example
+@var{\e$BG'>ZK!\e(B}\e$B$K$O\e(B 'login (\e$B%(%s%3!<%I$7$F%Q%9%o!<%I$rAw?.\e(B)\e$B$+\e(B
+           'cram-md5 (CRAM-MD5 \e$B$K$h$kG'>Z\e(B)\e$B$+\e(B
+           'digest-md5 (DIGEST-MD5 \e$B$K$h$kG'>Z\e(B)\e$B$+\e(B
+           'plain (\e$B$^$?$O\e(B nil\e$B!#@8%Q%9%o!<%I$rAw?.\e(B) \e$B$N$$$:$l$+$r;XDj!#\e(B
+@end example
 
-(cram-md5 \e$B$K$h$kG'>Z$r9T$J$&$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B utils/sasl/ \e$B$r%$%s%9%H!<%k$9$k\e(B
-\e$BI,MW$,$"$j$^$9!#\e(B)
+(CRAM-MD5 \e$B$d\e(B DIGEST-MD5 \e$B$K$h$kG'>Z$r9T$J$&$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B
+@file{utils/sasl} \e$B$r%$%s%9%H!<%k$9$kI,MW$,$"$j$^$9!#\e(B)
 
 default \e$BCM\e(B:
 
+@example
 \e$B%f!<%6L>\e(B  -> \e$BJQ?t\e(B @code{elmo-default-imap4-user} \e$B$NCM!#\e(B
-             \e$B=i4|@_Dj$O\e(B \e$B4D6-JQ?t\e(B USER \e$B$+!"\e(BLOGNAME \e$B$+!"\e(B(user-login-name) \e$B$NJV$jCM!#\e(B
+             \e$B=i4|@_Dj$O\e(B \e$B4D6-JQ?t\e(B @env{USER} \e$B$+!"\e(B@env{LOGNAME} \e$B$+!"\e(B
+             @code{(user-login-name)} \e$B$NJV$jCM!#\e(B
 \e$BG'>ZK!\e(B    -> \e$BJQ?t\e(B @code{elmo-default-imap4-authenticate-type} \e$B$NCM!#\e(B
-             \e$B=i4|@_Dj$O\e(B "auth"\e$B!#\e(B
+             \e$B=i4|@_Dj$O\e(B 'login\e$B!#\e(B
 \e$B%[%9%HL>\e(B  -> \e$BJQ?t\e(B @code{elmo-default-imap4-server} \e$B$NCM!#\e(B
              \e$B=i4|@_Dj$O\e(B "localhost"\e$B!#\e(B
 \e$B%]!<%HHV9f\e(B-> \e$BJQ?t\e(B @code{elmo-default-imap4-port} \e$B$NCM!#\e(B
-             \e$B=i4|@_Dj$O\e(B "143"\e$B!#\e(B
+             \e$B=i4|@_Dj$O\e(B 143\e$B!#\e(B
+@end example
 
 \e$B%a%$%s$G;HMQ$9$k\e(B IMAP \e$B%5!<%P$rJQ?t\e(B @code{elmo-default-imap4-server} 
 \e$B$K;XDj$9$k$H!"$$$A$$$A%U%)%k%@L>$K%[%9%HL>$r=q$+$:$K$9$_$^$9!#Nc$($P%U%!\e(B
-\e$B%$%"%&%)!<%k$r1[$($J$1$l$P$J$i$J$$>l9g$G$b\e(B @samp{foo%imap@@geteway} \e$B$N$h\e(B
+\e$B%$%"%&%)!<%k$r1[$($J$1$l$P$J$i$J$$>l9g$G$b\e(B @samp{foo%imap@@gateway} \e$B$N$h\e(B
 \e$B$&$K;XDj$G$-$^$9!#\e(B
 
-\e$B%U%)%k%@L>$N:G8e$K\e(B '!' \e$B$,IU$$$F$$$k$H!"\e(BSSL (Secure Socket Layer)\e$B$r\e(B
-\e$BMxMQ$7$F%3%M%/%7%g%s$rD%$j$^$9!#\e(B'!!' \e$B$@$H!"\e(BSTARTTLS\e$B$K$h$j\e(B
+\e$B%U%)%k%@L>$N:G8e$K\e(B @samp{!} \e$B$,IU$$$F$$$k$H!"\e(BSSL (Secure Socket Layer)\e$B$r\e(B
+\e$BMxMQ$7$F%3%M%/%7%g%s$rD%$j$^$9!#\e(B@samp{!!} \e$B$@$H!"\e(BSTARTTLS\e$B$K$h$j\e(B
 SSL\e$B%3%M%/%7%g%s$rD%$j$^$9!#\e(B
-\e$BJQ?t\e(B @code{elmo-default-imap4-ssl} \e$B$NCM$,\e(B non-nil \e$B$J$i!"\e(B'!' \e$B$rIU$1\e(B
-\e$B$J$/$F$b\e(B SSL \e$B$r;H$$$^$9!#\e(B'starttls \e$B$J$i\e(B '!!' \e$B$r0UL#$7$^$9!#\e(B
+\e$BJQ?t\e(B @code{elmo-default-imap4-ssl} \e$B$NCM$,\e(B non-nil \e$B$J$i!"\e(B@samp{!} \e$B$rIU$1\e(B
+\e$B$J$/$F$b\e(B SSL \e$B$r;H$$$^$9!#\e(B'starttls \e$B$J$i\e(B @samp{!!} \e$B$r0UL#$7$^$9!#\e(B
 
-(SSL \e$B$rMxMQ$9$k$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B utils/ssl.el \e$B$r%$%s%9%H!<%k$9$k\e(B
-\e$BI,MW$,$"$j$^$9!#$J$*$+$D!"\e(BOpenSSL\e$B$K4^$^$l$k\e(Bopenssl\e$B$K%Q%9$,DL$C$F$$$k\e(B
-\e$BI,MW$,$"$j$^$9!#\e(B
-STARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls\e$B%Q%C%1!<%8$r%$%s%9%H!<%k\e(B
-\e$B$9$kI,MW$,$"$j$^$9!#\e(B)
+(SSL \e$B$rMxMQ$9$k$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B @file{utils/ssl.el} \e$B$r%$%s%9%H!<%k$9\e(B
+\e$B$kI,MW$,$"$j$^$9!#$J$*$+$D!"\e(BOpenSSL\e$B$K4^$^$l$k\e(B @command{openssl} \e$B$K%Q%9$,\e(B
+\e$BDL$C$F$$$kI,MW$,$"$j$^$9!#\e(BSTARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls\e$B%Q%C\e(B
+\e$B%1!<%8$r%$%s%9%H!<%k$9$kI,MW$,$"$j$^$9!#\e(B)
 
-\e$BG'>ZK!$H$7$F!"\e(B"auth" \e$B$b$7$/$O\e(B "cram-md5" \e$B$r;XDj$7$?>l9g!"%Q%9%o!<%I$r\e(B
-\e$B%(%s%3!<%I$7$FAw?.$7$^$9!#$?$@$7!"%5!<%PB&$,%Q%9%o!<%I$r%(%s%3!<%I$7$F\e(B
-\e$B<u$1<h$kG=NO$,L5$$>l9g$O!"3NG'$N$N$A!"\e(B"login" (\e$B@8%Q%9%o!<%I$rAw$k\e(B) 
+\e$BG'>ZK!$H$7$F!"\e(B'login\e$B!"\e(B'cram-md5 \e$B$b$7$/$O\e(B 'digest-md5 \e$B$r;XDj$7$?>l9g!"\e(B
+\e$B%Q%9%o!<%I$r%(%s%3!<%I$7$FAw?.$7$^$9!#$?$@$7!"%5!<%PB&$,%Q%9%o!<%I$r%(%s\e(B
+\e$B%3!<%I$7$F<u$1<h$kG=NO$,L5$$>l9g$O!"3NG'$N$N$A!"\e(B'plain (\e$B@8%Q%9%o!<%I$rAw$k\e(B) 
 \e$B$K@ZBX$($^$9!#JQ?t\e(B @code{elmo-imap4-force-login} \e$B$,\e(B non-nil \e$B$J$i$P!"\e(B
-\e$B3NG'L5$7$K\e(B "login" \e$B$K@ZBX$($^$9\e(B(\e$B=i4|@_Dj$O\e(B nil)\e$B!#\e(B
+\e$B3NG'L5$7$K\e(B 'plain \e$B$K@ZBX$($^$9\e(B(\e$B=i4|@_Dj$O\e(B nil)\e$B!#\e(B
 
-\e$BNc\e(B: %inbox     -> IMAP \e$B$N%a!<%k%\%C%/%9!"\e(B"inbox"
-    %#mh/inbox -> IMAP \e$B$N%a!<%k%\%C%/%9!"\e(B"#mh/inbox"
+\e$BNc\e(B:
 
-    %inbox:hoge -> IMAP \e$B$N%a!<%k%\%C%/%9!"\e(B"inbox" \e$B$X%f!<%6\e(B "hoge" \e$B$G%"%/%;%9!#\e(B
-    %inbox:hoge/login@@server1
-                -> server1 \e$B>e$N\e(B IMAP \e$B$N%a!<%k%\%C%/%9\e(B "inbox" \e$B$X\e(B
-                   \e$B%f!<%6\e(B "hoge" \e$B$G!"@8%Q%9%o!<%I$rAw$C$F\e(B("login"\e$B$G\e(B)
-                   \e$B%"%/%;%9!#\e(B
+@example
+@group
+%inbox     -> IMAP \e$B$N%a!<%k%\%C%/%9!"\e(B"inbox"
+%#mh/inbox -> IMAP \e$B$N%a!<%k%\%C%/%9!"\e(B"#mh/inbox"
+
+%inbox:hoge -> IMAP \e$B$N%a!<%k%\%C%/%9!"\e(B"inbox" \e$B$X%f!<%6\e(B "hoge" \e$B$G%"%/%;%9!#\e(B
+%inbox:hoge/plain@@server1
+            -> server1 \e$B>e$N\e(B IMAP \e$B$N%a!<%k%\%C%/%9\e(B "inbox" \e$B$X\e(B
+               \e$B%f!<%6\e(B "hoge" \e$B$G!"@8%Q%9%o!<%I$rAw$C$F\e(B('plain \e$B$G\e(B)
+               \e$B%"%/%;%9!#\e(B
+@end group
 @end example
 
 @subsection \e$BF|K\8l%a!<%k%\%C%/%9L>$N07$$\e(B(Modified UTF7)
+@cindex Modified UTF7
+@cindex UTF7
+@cindex UTF8
+@pindex Mule-UCS
+@pindex ucs-conv
 
 \e$B;HMQ$7$F$$$k\e(B Emacs \e$B$,%f%K%3!<%I$KBP1~$7$F$*$j!$$+$D!"JQ?t\e(B 
 @code{elmo-imap4-use-modified-utf7} \e$B$K\e(B non-nil \e$B$NCM$r@_Dj$7$F$$$k>l9g\e(B(\e$B%G\e(B
@@ -794,18 +869,20 @@ ftp://ftp.m17n.org/pub/mule/Mule-UCS/
 \e$BMW$G$9!#\e(Bucs-conv \e$B$O0J2<$N\e(B anonymous cvs \e$B7PM3$GF~<j2DG=$G$9!#\e(B
 
 @example
-:pserver:anonymous@@cvs.m17n.org:/cvs/root
+@group
+cvs -d :pserver:anonymous@@cvs.m17n.org:/cvs/root login
 Password: NULL (\e$B2~9T$rF~NO\e(B)
+cvs -d :pserver:anonymous@@cvs.m17n.org:/cvs/root checkout ucs-conv
+@end group
 @end example
 
-\e$B$^$?!$\e(BXEmacs \e$B$GF|K\8l%U%)%k%@L>$r07$&$K$O!"$5$i$K!"%3%^%s%I\e(B u7tou8,
-u8tou7 \e$B$,%$%s%9%H!<%k$5$l$F$$$kI,MW$,$"$j$^$9!#$3$l$i$N%3%^%s%I$O0J2<$+\e(B
+\e$B$^$?!$\e(BXEmacs \e$B$GF|K\8l%U%)%k%@L>$r07$&$K$O!"$5$i$K!"%3%^%s%I\e(B @code{u7tou8},
+@code{u8tou7} \e$B$,%$%s%9%H!<%k$5$l$F$$$kI,MW$,$"$j$^$9!#$3$l$i$N%3%^%s%I$O0J2<$+\e(B
 \e$B$iF~<j$G$-$k\e(B UTF7 \e$B%Q%C%1!<%8$K4^$^$l$F$$$^$9!#\e(B
 
 @example
 ftp://ftp.ifcss.org/pub/software/unix/convert/utf7.tar.gz
 @end example
-
 @end itemize
 
 @node NNTP Folder, MH Folder, IMAP Folder, Folders
@@ -816,29 +893,40 @@ ftp://ftp.ifcss.org/pub/software/unix/convert/utf7.tar.gz
 \e$B%M%C%H%K%e!<%9$rFI$`$?$a$N%U%)%k%@$G$9!#\e(B
 \e$B0l$D$N%K%e!<%9%0%k!<%W$,0l$D$N%U%)%k%@$H$7$F07$o$l$^$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '-' '\e$B%K%e!<%9%0%k!<%WL>\e(B'[[':' '\e$B%f!<%6L>\e(B']['@@' '\e$B%[%9%HL>\e(B'][':' '\e$B%]!<%HHV9f\e(B']]['!']
+@group
+@samp{-} @var{\e$B%K%e!<%9%0%k!<%WL>\e(B} [[@samp{:} @var{\e$B%f!<%6L>\e(B}][@samp{@@} @var{\e$B%[%9%HL>\e(B}][@samp{:} @var{\e$B%]!<%HHV9f\e(B}]][@samp{!}]
+@end group
+@end example
 
 default \e$BCM\e(B:
+@example
 \e$B%[%9%HL>\e(B  -> \e$BJQ?t\e(B @code{elmo-default-nntp-server} \e$B$NCM!#=i4|@_Dj$O\e(B "localhost"\e$B!#\e(B
 \e$B%f!<%6L>\e(B  -> \e$BJQ?t\e(B @code{elmo-default-nntp-user} \e$B$NCM!#=i4|@_Dj$O\e(B nil\e$B!#\e(B
 \e$B%]!<%HHV9f\e(B-> \e$BJQ?t\e(B @code{elmo-default-nntp-port} \e$B$NCM!#\e(B
              \e$B=i4|@_Dj$O\e(B 119\e$B!#\e(B
+@end example
 
-\e$B%f!<%6L>$,\e(B non-nil \e$B$N>l9g$O\e(BAUTHINFO\e$B$K$h$kG'>Z$r9T$J$$$^$9!#\e(B
-\e$B%U%)%k%@L>$N:G8e$K\e(B '!' \e$B$,IU$$$F$$$k$H!"\e(BSSL \e$B$rMxMQ$7$F%3%M%/%7%g%s$rD%$j$^$9!#\e(B
-'!!' \e$B$@$H!"\e(BSTARTTLS\e$B$K$h$j\e(BSSL\e$B%3%M%/%7%g%s$rD%$j$^$9!#\e(B
-\e$BJQ?t\e(B @code{elmo-default-nntp-ssl} \e$B$NCM$,\e(B non-nil \e$B$J$i!"\e(B'!' \e$B$rIU$1\e(B
-\e$B$J$/$F$b\e(B SSL \e$B$r;H$$$^$9!#\e(B'starttls \e$B$J$i\e(B '!!' \e$B$r0UL#$7$^$9!#\e(B
-(SSL \e$B$rMxMQ$9$k$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B utils/ssl.el \e$B$r%$%s%9%H!<%k$9$k\e(B
-\e$BI,MW$,$"$j$^$9!#$J$*$+$D!"\e(BOpenSSL\e$B$K4^$^$l$k\e(Bopenssl\e$B$K%Q%9$,DL$C$F$$$k\e(B
-\e$BI,MW$,$"$j$^$9!#\e(B
-STARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls\e$B%Q%C%1!<%8$r%$%s%9%H!<%k\e(B
-\e$B$9$kI,MW$,$"$j$^$9!#\e(B)
+@var{\e$B%f!<%6L>\e(B}\e$B$,\e(B non-nil \e$B$N>l9g$O\e(BAUTHINFO\e$B$K$h$kG'>Z$r9T$J$$$^$9!#\e(B
+\e$B%U%)%k%@L>$N:G8e$K\e(B @samp{!} \e$B$,IU$$$F$$$k$H!"\e(BSSL \e$B$rMxMQ$7$F%3%M%/%7%g%s$rD%$j$^$9!#\e(B
+@samp{!!} \e$B$@$H!"\e(BSTARTTLS\e$B$K$h$j\e(BSSL\e$B%3%M%/%7%g%s$rD%$j$^$9!#\e(B
+\e$BJQ?t\e(B @code{elmo-default-nntp-ssl} \e$B$NCM$,\e(B non-nil \e$B$J$i!"\e(B@samp{!} \e$B$rIU$1\e(B
+\e$B$J$/$F$b\e(B SSL \e$B$r;H$$$^$9!#\e(B'starttls \e$B$J$i\e(B @samp{!!} \e$B$r0UL#$7$^$9!#\e(B
 
+(SSL \e$B$rMxMQ$9$k$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B @file{utils/ssl.el} \e$B$r%$%s%9%H!<%k$9\e(B
+\e$B$kI,MW$,$"$j$^$9!#$J$*$+$D!"\e(BOpenSSL\e$B$K4^$^$l$k\e(B @command{openssl} \e$B$K%Q%9$,\e(B
+\e$BDL$C$F$$$kI,MW$,$"$j$^$9!#\e(BSTARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls\e$B%Q%C\e(B
+\e$B%1!<%8$r%$%s%9%H!<%k$9$kI,MW$,$"$j$^$9!#\e(B)
 
-\e$BNc\e(B: -fj.rec.tv            -> \e$B%K%e!<%9%0%k!<%W!"\e(Bfj.rec.tv\e$B!#\e(B
-    -fj.rec.tv@@newsserver -> newsserver \e$B>e$N%K%e!<%9%0%k!<%W!"\e(Bfj.rec.tv\e$B!#\e(B
+\e$BNc\e(B:
+
+@example
+@group
+-fj.rec.tv            -> \e$B%K%e!<%9%0%k!<%W!"\e(Bfj.rec.tv\e$B!#\e(B
+-fj.rec.tv@@newsserver -> newsserver \e$B>e$N%K%e!<%9%0%k!<%W!"\e(Bfj.rec.tv\e$B!#\e(B
+@end group
 @end example
 
 
@@ -851,21 +939,30 @@ STARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls\e$B%Q%C%1!<%8$r%$%s%9%H!<%k\e(B
 
 MH \e$B7A<0\e(B(1\e$B%U%!%$%k\e(B1\e$B%a!<%k\e(B)\e$B$GJ]B8$5$l$?%a!<%k$rFI$`$?$a$N%U%)%k%@$G$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '+' '\e$B%G%#%l%/%H%jL>\e(B'
+@samp{+} @var{\e$B%G%#%l%/%H%jL>\e(B}
+@end example
 
-\e$B%G%#%l%/%H%jL>$O!"DL>o!"JQ?t\e(B @code{elmo-localdir-folder-path}
+@var{\e$B%G%#%l%/%H%jL>\e(B}\e$B$O!"DL>o!"JQ?t\e(B @code{elmo-localdir-folder-path}
 (\e$B=i4|@_Dj$O\e(B @file{~/Mail}) \e$B$+$i$NAjBP%Q%9$G$9$,!"\e(B
 @samp{/} \e$B$d\e(B @samp{~} \e$B$G;O$^$C$F$$$l$P@dBP%Q%9$H8+Pv$7$^$9\e(B
 (\e$B%I%i%$%V%l%?!<$bF1MM$G$9\e(B)\e$B!#\e(B
 
 \e$B%a%C%;!<%8$,J]B8$5$l$k%U%!%$%k$N%U%!%$%kL>$K$O!"%a%C%;!<%8HV9f$,;HMQ$5$l$^$9!#\e(B
 
-\e$BNc\e(B: +inbox         -> "~/Mail/inbox"
-    +from/teranisi -> "~/Mail/from/teranisi"
-    +~/test        -> "~/test"
+\e$BNc\e(B:
+
+@example
+@group
++inbox         -> "~/Mail/inbox"
++from/teranisi -> "~/Mail/from/teranisi"
++~/test        -> "~/test"
+@end group
 @end example
 
+
 @node Maildir Folder, News Spool Folder, MH Folder, Folders
 @section Maildir \e$B%U%)%k%@\e(B
 @cindex Maildir Folder
@@ -874,29 +971,37 @@ MH \e$B7A<0\e(B(1\e$B%U%!%$%k\e(B1\e$B%a!<%k\e(B)\e$B$GJ]B8$5$l$?%a!<%k$rFI$`$?$a$N%U%)
 
 Maildir \e$B7A<0\e(B(1\e$B%U%!%$%k\e(B1\e$B%a!<%k\e(B)\e$B$GJ]B8$5$l$?%a!<%k$rFI$`$?$a$N%U%)%k%@$G$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '.' '\e$B%G%#%l%/%H%jL>\e(B'
+@samp{.} @var{\e$B%G%#%l%/%H%jL>\e(B}
+@end example
 
-\e$B%G%#%l%/%H%jL>$O!"DL>o!"JQ?t\e(B @code{elmo-maildir-folder-path} (\e$B=i4|@_Dj$O\e(B 
+@var{\e$B%G%#%l%/%H%jL>\e(B}\e$B$O!"DL>o!"JQ?t\e(B @code{elmo-maildir-folder-path} (\e$B=i4|@_Dj$O\e(B 
 @file{~/Maildir}) \e$B$+$i$NAjBP%Q%9$G$9$,!"\e(B@samp{/} \e$B$d\e(B @samp{~} \e$B$G;O$^$C$F\e(B
 \e$B$$$l$P@dBP%Q%9$H8+Pv$7$^$9\e(B(\e$B%I%i%$%V%l%?!<$bF1MM$G$9\e(B)\e$B!#\e(B
 
-Maildir \e$B$O!"\e(Bcur\e$B!"\e(Bnew\e$B!"\e(Btmp \e$B$N%G%#%l%/%H%j$r4^$s$G$$$^$9!#<B:]$K%a%C%;!<%8\e(B
-\e$B$,4^$^$l$k$N$O!";XDj%G%#%l%/%H%jD>2<$N\e(B cur \e$B%G%#%l%/%H%j$G$9!#;XDj%G%#%l\e(B
-\e$B%/%H%jD>2<$N\e(B new \e$B%G%#%l%/%H%j$K4^$^$l$k%a%C%;!<%8%U%!%$%k$O!"%"%/%;%9;~\e(B
-\e$B$K\e(B cur \e$B%G%#%l%/%H%j$X0\F0$5$l$^$9!#$^$?!"\e(Btmp \e$B%G%#%l%/%H%j$K4^$^$l!"\e(B36 \e$B;~\e(B
-\e$B4V0J>e%"%/%;%9$,L5$$%a%C%;!<%8%U%!%$%k$O:o=|$5$l$^$9!#\e(B
+Maildir \e$B$O!"\e(B@file{cur}, @file{new}, @file{tmp} \e$B$N%G%#%l%/%H%j$r4^$s$G$$$^$9!#\e(B
+\e$B<B:]$K%a%C%;!<%8$,4^$^$l$k$N$O!";XDj%G%#%l%/%H%jD>2<$N\e(B @file{cur} \e$B%G%#%l%/%H%j$G$9!#\e(B
+\e$B;XDj%G%#%l%/%H%jD>2<$N\e(B @file{new} \e$B%G%#%l%/%H%j$K4^$^$l$k%a%C%;!<%8%U%!%$%k$O!"\e(B
+\e$B%"%/%;%9;~$K\e(B @file{cur} \e$B%G%#%l%/%H%j$X0\F0$5$l$^$9!#\e(B
+\e$B$^$?!"\e(B@file{tmp} \e$B%G%#%l%/%H%j$K4^$^$l!"\e(B36 \e$B;~4V0J>e%"%/%;%9$,L5$$%a%C%;!<%8%U%!%$%k$O:o=|$5$l$^$9!#\e(B
+
+\e$B$3$NF0:n$O\e(B @uref{http://cr.yp.to/proto/maildir.html} \e$B$K=>$C$F$$$^$9!#\e(B@*
+(\e$BF|K\8lLu$O\e(B @uref{http://www.jp.qmail.org/q103/jman5/maildir.html})
 
-\e$B$3$NF0:n$O\e(B @samp{http://cr.yp.to/proto/maildir.html}
-(\e$BF|K\8lLu$O\e(B @samp{http://www.jp.qmail.org/q103/jman5/maildir.html}) 
-\e$B$K=>$C$F$$$^$9!#\e(B
+\e$BNc\e(B:
 
-\e$BNc\e(B: .              -> "~/Maildir"
-    .inbox         -> "~/Maildir/inbox"
-    .from/teranisi -> "~/Maildir/from/teranisi"
-    .~/test        -> "~/test"
+@example
+@group
+.              -> "~/Maildir"
+.inbox         -> "~/Maildir/inbox"
+.from/teranisi -> "~/Maildir/from/teranisi"
+.~/test        -> "~/test"
+@end group
 @end example
 
+
 @node News Spool Folder, Archive Folder, Maildir Folder, Folders
 @section News Spool \e$B%U%)%k%@\e(B
 @cindex News spool Folder
@@ -907,16 +1012,24 @@ Mew/IM \e$B$,Ds>'$9$k!"%m!<%+%k$KJ]B8$5$l$?%K%e!<%95-;v$rFI$_=q$-$9$k$?$a$N\e(B
 \e$B%U%)%k%@$G$9!#\e(BNNTP \e$B7PM3$G$O$J$/!"\e(Bgnspool \e$B$J$I$r;H$C$F<h$j4s$;$F$$$k$h$&\e(B
 \e$B$J>l9g$K$=$N%9%W!<%k$rD>@\FI$`!"$H$$$&;H$$J}$bA[Dj$7$F$$$^$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '=' '\e$B%G%#%l%/%H%jL>\e(B'
+@samp{=} @var{\e$B%G%#%l%/%H%jL>\e(B}
+@end example
 
-\e$B%G%#%l%/%H%jL>$O!"JQ?t\e(B @code{elmo-localnews-folder-path}
+@var{\e$B%G%#%l%/%H%jL>\e(B}\e$B$O!"JQ?t\e(B @code{elmo-localnews-folder-path}
  (\e$B=i4|@_Dj$O\e(B @file{~/News})
 \e$B$G;XDj$5$l$?%G%#%l%/%H%j$N%5%V%G%#%l%/%H%j$r;X$7$^$9!#\e(B
 \e$B%G%#%l%/%H%j$N6h@Z$j$O\e(B @samp{.} \e$B$G$b2D$G$9!#\e(B
 
-\e$BNc\e(B: =fj/os/os2         -> "~/News/fj/os/os2"
-    =fj.os.bsd.freebsd -> "~/News/fj/os/bsd/freebsd"
+\e$BNc\e(B:
+
+@example
+@group
+=fj/os/os2         -> "~/News/fj/os/os2"
+=fj.os.bsd.freebsd -> "~/News/fj/os/bsd/freebsd"
+@end group
 @end example
 
 
@@ -929,36 +1042,46 @@ Mew/IM \e$B$,Ds>'$9$k!"%m!<%+%k$KJ]B8$5$l$?%K%e!<%95-;v$rFI$_=q$-$9$k$?$a$N\e(B
 Info-ZIP \e$B$d\e(B LHA \e$B$J$I$G05=L$5$l$?%"!<%+%$%V%U%!%$%k$r0l$D$N%U%)%k%@$H$7\e(B
 \e$B$F07$$$^$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '$' '\e$B%G%#%l%/%H%jL>\e(B' [';' \e$B%"!<%+%$%P%?%$%W\e(B ';' \e$B%W%l%U%#%/%9\e(B]
+@group
+@samp{$} @var{\e$B%G%#%l%/%H%jL>\e(B} [@samp{;} @var{\e$B%"!<%+%$%P%?%$%W\e(B} @samp{;} @var{\e$B%W%l%U%#%/%9\e(B}]
+@end group
+@end example
 
-\e$B!X%G%#%l%/%H%jL>!Y$O!"DL>o!"JQ?t\e(B @code{elmo-archive-folder-path}
+@var{\e$B%G%#%l%/%H%jL>\e(B}\e$B$O!"DL>o!"JQ?t\e(B @code{elmo-archive-folder-path}
 (\e$B=i4|@_Dj$O\e(B @file{~/Mail}) \e$B$+$i$NAjBP%Q%9$G$9$,!"\e(B
 @samp{/} \e$B$d\e(B @samp{~} \e$B$G;O$^$C$F$$$l$P@dBP%Q%9$H8+Pv$7$^$9\e(B
 (\e$B%I%i%$%V%l%?!<$b\e(B OK)\e$B!#\e(B
 ange-ftp \e$BI=5-$b\e(B ange-ftp, efs \e$B$,;H$($k4D6-$G$O\e(B OK \e$B$G$9!#\e(B
 
 \e$B%U%)%k%@$N<BBN$H$7$F$N=q8K%U%!%$%k$O!">e=R$N%G%#%l%/%H%j$K$"$k\e(B
-@code{elmo-archive-basename}(\e$B=i4|CM$O\e(B "elmo-archive")\e$B$K$J$j$^$9!#\e(B
+@code{elmo-archive-basename}(\e$B=i4|CM$O\e(B @file{elmo-archive})\e$B$K$J$j$^$9!#\e(B
 \e$B$?$@$7!"%G%#%l%/%H%j$G$J$/%U%!%$%k$G$"$C$?>l9g!"$=$N%U%!%$%k$r%U%)%k%@\e(B
 \e$B$H8+Pv$7$^$9!#\e(B
 \e$B3HD%;R$O%"!<%+%$%PKh$K<+F0E*$K\e(B(\e$BF0E*$K\e(B)\e$BA*Br$5$l$^$9!#\e(B
 
-\e$B!X%"!<%+%$%P%?%$%W!Y$r>JN,$7$?>l9g!"JQ?t\e(B @code{elmo-archive-default-type}
+@var{\e$B%"!<%+%$%P%?%$%W\e(B}\e$B$r>JN,$7$?>l9g!"JQ?t\e(B @code{elmo-archive-default-type}
 (\e$B=i4|@_Dj$O\e(B 'zip)\e$B$,;2>H$5$l$^$9!#\e(B
 
-\e$B!X%W%l%U%#%/%9!Y$O!"=q8K$,%G%#%l%/%H%j9=B$$r$b$C$F$$$k>l9g$K!"$=$N%G%#\e(B
-\e$B%l%/%H%jItJ,$r;XDj$7$^$9!#\e(B
-\e$B$3$l$O<g$K%"!<%+%$%V%5!<%S%9$d\e(B tar+gz+uue \e$B$K$h$k%@%$%8%'%9%HG[Aw$rDs6!$7\e(B
-\e$B$F$$$k\e(B ML \e$B$N=q8K%U%!%$%k$rE83+$9$k$3$H$J$/%^%&%s%H$9$k$?$a$N$b$N!"$D$^$j\e(B
-\e$B1\Mw;~$NJX59$N$?$a$N$b$N$G$9!#\e(B
+@var{\e$B%W%l%U%#%/%9\e(B}\e$B$O!"=q8K$,%G%#%l%/%H%j9=B$$r$b$C$F$$$k>l9g$K!"$=$N%G%#\e(B
+\e$B%l%/%H%jItJ,$r;XDj$7$^$9!#$3$l$O<g$K%"!<%+%$%V%5!<%S%9$d\e(B tar + gzip +
+uuencode \e$B$K$h$k%@%$%8%'%9%HG[Aw$rDs6!$7$F$$$k\e(B ML \e$B$N=q8K%U%!%$%k$rE83+$9\e(B
+\e$B$k$3$H$J$/%^%&%s%H$9$k$?$a$N$b$N!"$D$^$j1\Mw;~$NJX59$N$?$a$N$b$N$G$9!#\e(B
+
 \e$BNc$($P\e(B ML \e$B%5!<%P$,\e(B fml \e$B$N>l9g!"\e(B@file{msend.tar.gz} \e$B$O\e(B @file{spool/1} \e$B$N\e(B
-\e$B$h$&$J9=B$$J$N$G!"\e(B"spool" \e$B$r;XDj$7$^$9!#\e(B
+\e$B$h$&$J9=B$$J$N$G!"\e(B@samp{spool} \e$B$r;XDj$7$^$9!#\e(B
+
+\e$BNc\e(B:
 
-\e$BNc\e(B: $teranisi         -> "~/Mail/teranisi/elmo-archive.zip"
-    $bsd/freebsd;lha  -> "~/Mail/bsd/freebsd/elmo-archive.lzh"
-    $/foo@@server:~/bar;zoo     -> server \e$B>e$N\e(B "~/bar/elmo-archive.zoo"
-    $d:/msend.tar.gz;tgz;spool -> "d:/msend.tar.gz"
+@example
+@group
+$teranisi         -> "~/Mail/teranisi/elmo-archive.zip"
+$bsd/freebsd;lha  -> "~/Mail/bsd/freebsd/elmo-archive.lzh"
+$/foo@@server:~/bar;zoo     -> server \e$B>e$N\e(B "~/bar/elmo-archive.zoo"
+$d:/msend.tar.gz;tgz;spool -> "d:/msend.tar.gz"
+@end group
 @end example
 
 @menu
@@ -982,8 +1105,10 @@ ange-ftp \e$BI=5-$b\e(B ange-ftp, efs \e$B$,;H$($k4D6-$G$O\e(B OK \e$B$G$9!#\e(B
 \e$B%G%U%)%k%H$G0J2<$N%"!<%+%$%P$KBP1~$7$^$9!#\e(B
 
 @example
+@group
         LHA, Info-ZIP/UNZIP, ZOO, RAR  ;; \e$B%U%k%9%Z%C%/\e(B
         GNU TAR('tgz, 'tar)            ;; \e$B%G%U%)%k%H$G$O1\Mw@lMQ\e(B
+@end group
 @end example
 
 \e$BJ#?t%U%!%$%k$r#1%W%m%;%9$G0l$D$N=q8K$X$^$H$a$k$3$H$,$G$-$k%"!<%+%$%P$G\e(B
@@ -1021,6 +1146,7 @@ ARC \e$B$O!"<j5v$G;H$C$F$J$$$N$GDj5A$7$F$$$^$;$s!#\e(BTAR \e$B$O85%U%!%$%k$r>C$9\e(B
          GNU tar 1.11.8 + 1.5(WIN32)
          GZIP 1.2.4
          RAR 2.06
+@end example
 
 \e$B"(\e(B LHA \e$B$K4X$9$kCm0U\e(B
 
@@ -1032,16 +1158,15 @@ Win32 \e$B$G$O\e(B DOS \e$BHG$G$J$/!"\e(BLHa32 \e$B$G$J$$$HF0$+$J$$$H$N$3$H$G$9!#\e(B
 
 GNU tar \e$B$O=q8K$+$i$N:o=|$KLdBj$,$"$k$b$N$,B?$$$N$G!"FC$KCm0U$7$F$/$@$5$$!#\e(B
 \e$B=q8K$,GK2u$5$l$k4m81@-$,9b$$$N$G!"%U%k%9%Z%C%/$GFI$_=q$-$9$kA0$K\e(B
---delete -f \e$B$r=<J,%F%9%H$7$F$*$$$F$/$@$5$$!#$J$*!">e5-$N$b$N$G$O\e(B
-\e$B:#$N$H$3$mLdBj$OJs9p$5$l$F$$$^$;$s!#\e(B
-@end example
+@option{--delete} @option{-f} \e$B$r=<J,%F%9%H$7$F$*$$$F$/$@$5$$!#$J$*!">e5-\e(B
+\e$B$N$b$N$G$O:#$N$H$3$mLdBj$OJs9p$5$l$F$$$^$;$s!#\e(B
 
 
 @node Archive Tips, Archive Vars, Archiver, Archive Folder
 @subsection TIPS
 @cindex Archive Tips
 
-\e$B2wE,$K0\9T$9$k$K$O!"\e(Bwl-summary-archive() \e$B$r<B9T$9$k\e(B (@pxref{Archive}) \e$B$+!"\e(B
+\e$B2wE,$K0\9T$9$k$K$O!"\e(B@code{wl-summary-archive} \e$B$r<B9T$9$k\e(B (@pxref{Archive}) \e$B$+!"\e(B
 Expire \e$B5!G=\e(B (@pxref{Expire}) \e$B$HAH$_9g$o$;$k$H$$$$$G$7$g$&!#\e(B
 \e$B$?$@$7!"\e(BExpire \e$B5!G=$G:n@.$7$?%"!<%+%$%V%U%)%k%@$r07$&>l9g$O!"\e(B
 \e$BJQ?t\e(B @code{elmo-archive-treat-file} \e$B$r\e(B non-nil \e$B$K@_Dj$9$kI,MW$,$"$j$^$9!#\e(B
@@ -1057,8 +1182,10 @@ Expire \e$B5!G=\e(B (@pxref{Expire}) \e$B$HAH$_9g$o$;$k$H$$$$$G$7$g$&!#\e(B
 \e$B$J$*!"EvA3$N$3$H$J$,$i\e(B
 
 @lisp
+@group
 (setq wl-fcc "$backup")
 (setq wl-trash-folder "$trash;lha")
+@end group
 @end lisp
 
 @noindent
@@ -1072,7 +1199,7 @@ Expire \e$B5!G=\e(B (@pxref{Expire}) \e$B$HAH$_9g$o$;$k$H$$$$$G$7$g$&!#\e(B
 @table @code
 @item elmo-archive-default-type
 @vindex elmo-archive-default-type
-\e$B%G%U%)%k%H$N%"!<%+%$%P%?%$%W$r\e(B symbol \e$B$G;XDj$7$^$9!#=i4|CM$O\e(B 'zip \e$B$G$9!#\e(B
+\e$B%G%U%)%k%H$N%"!<%+%$%P%?%$%W$r%7%s%\%k$G;XDj$7$^$9!#=i4|CM$O\e(B 'zip \e$B$G$9!#\e(B
 
 @item elmo-archive-@var{type}-method-alist
 @vindex elmo-archive-TYPE-method-alist
@@ -1081,16 +1208,20 @@ Expire \e$B5!G=\e(B (@pxref{Expire}) \e$B$HAH$_9g$o$;$k$H$$$$$G$7$g$&!#\e(B
 \e$BKh$N!"3F<o%a%=%C%I$r5-=R$7$^$9!#\e(Balist \e$B$N3FMWAG$O0J2<$N$h$&$K$J$j$^$9!#\e(B
 
 @example
-        (action . (exec-name options))   ;; \e$B30It%W%m%0%i%`$H%*%W%7%g%s\e(B
-        (action . function)              ;; \e$B4X?t\e(B
+@group
+(@var{action} . (@var{exec-name} @var{options}))   ;; \e$B30It%W%m%0%i%`$H%*%W%7%g%s\e(B
+(@var{action} . @var{function})              ;; \e$B4X?t\e(B
+@end group
 @end example
 
-\e$B8=:_$N$H$3$m!"M-8z$J\e(B action \e$B$O\e(B
+\e$B8=:_$N$H$3$m!"M-8z$J\e(B @var{action} \e$B$O\e(B
 
 @example
-        'ls, 'cat ('cat-headers)        ;; \e$B:GDc8BI,MW\e(B(\e$B1\Mw$N$_\e(B)
-        'mv ('mv-pipe), 'rm ('rm-pipe)  ;; \e$B>e$H%;%C%H$G%U%k%9%Z%C%/\e(B
-        'cp ('cp-pipe)                  ;;
+@group
+'ls, 'cat ('cat-headers)        ;; \e$B:GDc8BI,MW\e(B(\e$B1\Mw$N$_\e(B)
+'mv ('mv-pipe), 'rm ('rm-pipe)  ;; \e$B>e$H%;%C%H$G%U%k%9%Z%C%/\e(B
+'cp ('cp-pipe)                  ;;
+@end group
 @end example
 
 @noindent
@@ -1098,17 +1229,17 @@ Expire \e$B5!G=\e(B (@pxref{Expire}) \e$B$HAH$_9g$o$;$k$H$$$$$G$7$g$&!#\e(B
 
 @item elmo-archive-suffix-alist
 @vindex elmo-archive-suffix-alist
-\e$B%"!<%+%$%P%?%$%W\e(B(symbol) \e$BKh$KBP1~$9$k=q8K$N3HD%;R$r5-=R$7$^$9!#\e(B
+\e$B%"!<%+%$%P%?%$%W\e(B(\e$B%7%s%\%k\e(B) \e$BKh$KBP1~$9$k=q8K$N3HD%;R$r5-=R$7$^$9!#\e(B
 
 @item elmo-archive-file-regexp-alist
 @vindex elmo-archive-file-regexp-alist
 \e$B=q8K$N%j%9%H1\Mw;~$N=PNO$+$i%U%!%$%kL>$r<hF@$9$k$?$a$N@55,I=8=$r!"%"!<\e(B
-\e$B%+%$%P%?%$%W\e(B (symbol) \e$BKh$K5-=R$7$^$9!#\e(B
+\e$B%+%$%P%?%$%W\e(B (\e$B%7%s%\%k\e(B) \e$BKh$K5-=R$7$^$9!#\e(B
 
 @item elmo-archive-method-list
 @vindex elmo-archive-method-list
 \e$BM-8z$K$7$?$$\e(B @var{type} \e$B$N\e(B elmo-archive-@var{type}-method-alist
-(@var{type} \e$B$O%"!<%+%$%P$N\e(B symbol)\e$B$r%j%9%H$G5-=R$7$^$9!#\e(B
+(@var{type} \e$B$O%"!<%+%$%P$N%7%s%\%k\e(B)\e$B$r%j%9%H$G5-=R$7$^$9!#\e(B
 
 @item elmo-archive-lha-dos-compatible
 @vindex elmo-archive-lha-dos-compatible
@@ -1127,8 +1258,8 @@ OS/2 \e$B$G$O%7%'%k$r2p$5$:$KH/9T$G$-$k%3%^%s%IJ8;zNs$O\e(B 8190 \e$B%P%$%H$^$G$J$N
 \e$B%H$J$I$r3z$^$9>l9g!"%7%'%k$N<BAu$K0MB8$9$k$3$H$KCm0U$7$F$/$@$5$$!#\e(B
 
 \e$B$J$*!"%"!<%+%$%P$,=hM}BP>]$H$J$k%U%!%$%k$N%j%9%H$rI8=`F~NO$+$i<u$1IU$1$k\e(B
-(\e$BA0=R$N\e(B rm-pipe, mv-pipe, cat-headers action \e$B$,;XDj$5$l$F$$$k\e(B)\e$B>l9g!"#1\e(B
-\e$B%W%m%;%9$G=hM}$9$k$3$H$,$G$-$^$9!#\e(B
+(\e$BA0=R$N\e(B @code{rm-pipe}, @code{mv-pipe}, @code{cat-headers} action
+\e$B$,;XDj$5$l$F$$$k\e(B)\e$B>l9g!"\e(B1\e$B%W%m%;%9$G=hM}$9$k$3$H$,$G$-$^$9!#\e(B
 @end table
 
 
@@ -1142,30 +1273,43 @@ OS/2 \e$B$G$O%7%'%k$r2p$5$:$KH/9T$G$-$k%3%^%s%IJ8;zNs$O\e(B 8190 \e$B%P%$%H$^$G$J$N
 
 RFC 1939 \e$B$G5,Dj$5$l$?\e(B POP3 \e$B$rMxMQ$7$F%a!<%k$rFI$`$?$a$N%U%)%k%@$G$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '&' ['\e$B%f!<%6L>\e(B'][['/' '\e$BG'>ZK!\e(B']['@@' '\e$B%[%9%HL>\e(B'][':' '\e$B%]!<%HHV9f\e(B']]['!']
+@group
+@samp{&} [@var{\e$B%f!<%6L>\e(B}][[@samp{/} @var{\e$BG'>ZK!\e(B}][@samp{@@} @var{\e$B%[%9%HL>\e(B}][@samp{:} @var{\e$B%]!<%HHV9f\e(B}]][@samp{!}]
+@end group
+@end example
 
-\e$BG'>ZK!$K$O!"0J2<$N\e(B 2 \e$B<oN`$,$"$j$^$9!#\e(B
-            "user"     (\e$B@8%Q%9%o!<%I$rAw?.$7$FG'>Z\e(B)
-            "apop"     (APOP \e$B$GG'>Z\e(B)
+@var{\e$BG'>ZK!\e(B}\e$B$K$O!"\e(B@samp{user} (\e$B@8%Q%9%o!<%I$rAw?.$7$FG'>Z\e(B) \e$B$H\e(B
+@samp{apop} (APOP \e$B$GG'>Z\e(B) \e$B$N\e(B 2 \e$B<oN`$,$"$j$^$9!#\e(B
 
 default \e$BCM\e(B:
+
+@example
 \e$B%f!<%6L>\e(B   -> \e$BJQ?t\e(B @code{elmo-default-pop3-user} \e$B$NCM!#\e(B
-              \e$B=i4|@_Dj$O\e(B \e$B4D6-JQ?t\e(B USER \e$B$+!"\e(BLOGNAME \e$B$+!"\e(B(user-login-name) \e$B$NJV$jCM!#\e(B
+              \e$B=i4|@_Dj$O\e(B \e$B4D6-JQ?t\e(B @env{USER} \e$B$+!"\e(B@env{LOGNAME} \e$B$+!"\e(B
+              @code{(user-login-name)} \e$B$NJV$jCM!#\e(B
 \e$BG'>ZK!\e(B     -> \e$BJQ?t\e(B @code{elmo-default-pop3-authenticate-type} \e$B$NCM!#\e(B
               \e$B=i4|@_Dj$O\e(B "user"\e$B!#\e(B
 \e$B%[%9%HL>\e(B   -> \e$BJQ?t\e(B @code{elmo-default-pop3-server} \e$B$NCM!#\e(B
               \e$B=i4|@_Dj$O\e(B "localhost"\e$B!#\e(B
-\e$B%]!<%HHV9f\e(B -> \e$BJQ?t\e(B @code{elmo-pop3-default-port} \e$B$NCM!#\e(B
+\e$B%]!<%HHV9f\e(B -> \e$BJQ?t\e(B @code{elmo-default-pop3-port} \e$B$NCM!#\e(B
               \e$B=i4|@_Dj$O\e(B 110\e$B!#\e(B
+@end example
+
+\e$BNc\e(B:
 
-\e$BNc\e(B: &hoge@@localhost -> localhost \e$B$X%f!<%6\e(B "hoge" \e$B$G%"%/%;%9!#\e(B
-    &hoge@@popserver:109 -> \e$B%[%9%H\e(B "popserver" \e$B$N%]!<%H\e(B 109 \e$BHV$X\e(B
-                            \e$B%f!<%6\e(B "hoge" \e$B$G%"%/%;%9!#\e(B
+@example
+@group
+&hoge@@localhost -> localhost \e$B$X%f!<%6\e(B "hoge" \e$B$G%"%/%;%9!#\e(B
+&hoge@@popserver:109 -> \e$B%[%9%H\e(B "popserver" \e$B$N%]!<%H\e(B 109 \e$BHV$X\e(B
+                        \e$B%f!<%6\e(B "hoge" \e$B$G%"%/%;%9!#\e(B
+@end group
 @end example
 
 APOP \e$B$rMxMQ$9$k$K$O!"\e(B@file{md5.el} \e$B$,I,MW$G$9!#\e(B
-(XEmacs\e$B$G$O!"I,MW$"$j$^$;$s!#\e(B)
+(XEmacs\e$B$G$OI,MW$"$j$^$;$s!#\e(B)
 @file{md5.el} \e$B$O\e(B \e$BK\%Q%C%1!<%8$N\e(B @file{utils/sasl/lisp/} \e$B$+\e(B
  Emacs/W3 \e$B%Q%C%1!<%8\e(B
 
@@ -1175,11 +1319,11 @@ http://www.cs.indiana.edu/elisp/w3/docs.html
 
 \e$B$^$?$O!"\e(BLCD archive \e$B$+$iF~<j2DG=$G$9\e(B(GPL2)\e$B!#\e(B
 
-\e$B%U%)%k%@L>$N:G8e$K\e(B '!' \e$B$,IU$$$F$$$k$H!"\e(BSSL \e$B$rMxMQ$7$F%3%M%/%7%g%s$rD%$j$^$9!#\e(B
-\e$BJQ?t\e(B @code{elmo-default-pop-ssl} \e$B$NCM$,\e(B non-nil \e$B$J$i!"\e(B'!' \e$B$rIU$1\e(B
-\e$B$J$/$F$b\e(B SSL \e$B$r;H$$$^$9!#\e(B'starttls \e$B$J$i\e(B '!!' \e$B$r0UL#$7$^$9!#\e(B
-(SSL \e$B$rMxMQ$9$k$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B utils/ssl.el \e$B$r%$%s%9%H!<%k$9$k\e(B
-\e$BI,MW$,$"$j$^$9!#$J$*$+$D!"\e(BOpenSSL\e$B$K4^$^$l$k\e(Bopenssl\e$B$K%Q%9$,DL$C$F$$$k\e(B
+\e$B%U%)%k%@L>$N:G8e$K\e(B @samp{!} \e$B$,IU$$$F$$$k$H!"\e(BSSL \e$B$rMxMQ$7$F%3%M%/%7%g%s$rD%$j$^$9!#\e(B
+\e$BJQ?t\e(B @code{elmo-default-pop-ssl} \e$B$NCM$,\e(B non-nil \e$B$J$i!"\e(B@samp{!} \e$B$rIU$1\e(B
+\e$B$J$/$F$b\e(B SSL \e$B$r;H$$$^$9!#\e(B'starttls \e$B$J$i\e(B @samp{!!} \e$B$r0UL#$7$^$9!#\e(B
+(SSL \e$B$rMxMQ$9$k$K$O\e(B \e$BK\%Q%C%1!<%8$N\e(B @file{utils/ssl.el} \e$B$r%$%s%9%H!<%k$9$k\e(B
+\e$BI,MW$,$"$j$^$9!#$J$*$+$D!"\e(BOpenSSL\e$B$K4^$^$l$k\e(B @file{openssl} \e$B$K%Q%9$,DL$C$F$$$k\e(B
 \e$BI,MW$,$"$j$^$9!#\e(B
 STARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls\e$B%Q%C%1!<%8$r%$%s%9%H!<%k\e(B
 \e$B$9$kI,MW$,$"$j$^$9!#\e(B)
@@ -1193,20 +1337,29 @@ STARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls\e$B%Q%C%1!<%8$r%$%s%9%H!<%k\e(B
 
 \e$BJ#?t$N%U%)%k%@$r2>A[E*$K0l$D$K8+$($k$h$&$K$9$k%U%)%k%@$G$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '*' '\e$B%U%)%k%@\e(B' [',' '\e$B%U%)%k%@\e(B'] ... [',' '\e$B%U%)%k%@\e(B']
+@group
+@samp{*} @var{\e$B%U%)%k%@\e(B1} [@samp{,} @var{\e$B%U%)%k%@\e(B2}] @dots{} [@samp{,} @var{\e$B%U%)%k%@\e(BN}]
+@end group
+@end example
 
-'*' \e$B$N8e$K\e(B \e$B%U%)%k%@\e(B,\e$B%U%)%k%@\e(B,@dots{},\e$B%U%)%k%@\e(B \e$B$N$h$&$K\e(B ',' (\e$B%3%s%^\e(B)\e$B$G6h@Z$C$F\e(B
-\e$B0l$D$K8+$($k$h$&$K$7$?$$%U%)%k%@72$r;XDj$7$^$9!#\e(B
+@samp{*} \e$B$N8e$K!"\e(B@samp{@var{\e$B%U%)%k%@\e(B1},@var{\e$B%U%)%k%@\e(B2},@dots{},@var{\e$B%U%)%k%@\e(BN}}
+\e$B$N$h$&$K\e(B @samp{,} (\e$B%3%s%^\e(B)\e$B$G6h@Z$C$F!"0l$D$K8+$($k$h$&$K$7$?$$%U%)%k%@72$r\e(B
+\e$B;XDj$7$^$9!#\e(B
 
 \e$BNc\e(B:
-  *-fj.editor.xemacs,-fj.editor.mule,-fj.editor.emacs
-  -> -fj.editor.xemacs, -fj.editor.mule, -fj.editor.emacs \e$B$,0l$D$N\e(B
-     \e$B%U%)%k%@$H$7$F8+$($k!#\e(B
-
-  *+inbox,-fj.rec.tv,%inbox
-  -> +inbox, -fj.rec.tv, %inbox \e$B$,0l$D$N%U%)%k%@$H$7$F8+$($k!#\e(B
 
+@example
+@group
+*-fj.editor.xemacs,-fj.editor.mule,-fj.editor.emacs
+-> -fj.editor.xemacs, -fj.editor.mule, -fj.editor.emacs \e$B$,0l$D$N\e(B
+   \e$B%U%)%k%@$H$7$F8+$($k!#\e(B
+
+*+inbox,-fj.rec.tv,%inbox
+-> +inbox, -fj.rec.tv, %inbox \e$B$,0l$D$N%U%)%k%@$H$7$F8+$($k!#\e(B
+@end group
 @end example
 
 
@@ -1219,87 +1372,136 @@ STARTTLS \e$B$rMxMQ$9$k$K$O!"$5$i$K!"\e(Bstarttls\e$B%Q%C%1!<%8$r%$%s%9%H!<%k\e(B
 
 \e$B;XDj$7$?>r7o$rK~$?$9%a%C%;!<%8$N$_$r4^$`2>A[E*$J%U%)%k%@$G$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '/' '\e$B>r7o\e(B' '/' '\e$B%U%)%k%@\e(B'
+@samp{/} @var{\e$B>r7o\e(B} @samp{/} @var{\e$B%U%)%k%@\e(B}
+@end example
 
-\e$B!X>r7o!Y$K$O!"0J2<$r=q$1$^$9!#\e(B
+@var{\e$B>r7o\e(B}\e$B$K$O!"0J2<$r=q$1$^$9!#\e(B
 
-1. \e$BItJ,%U%#%k%?!'\e(B "first:\e$B?t;z\e(B", "last:\e$B?t;z\e(B"
+@enumerate
+@item
+\e$BItJ,%U%#%k%?!'\e(B @samp{first:@var{\e$B?t;z\e(B}}, @samp{last:@var{\e$B?t;z\e(B}}
 
-first: \e$BA4%a%C%;!<%8$N@hF,$+$i\e(B'\e$B?t;z\e(B'\e$B$N?t$@$1%a%C%;!<%8$r@Z$j=P$7$^$9!#\e(B
-last: \e$BA4%a%C%;!<%8$NKvHx$+$i\e(B'\e$B?t;z\e(B'\e$B$N?t$@$1%a%C%;!<%8$r@Z$j=P$7$^$9!#\e(B
+first: \e$BA4%a%C%;!<%8$N@hF,$+$i\e(B@var{\e$B?t;z\e(B}\e$B$N?t$@$1%a%C%;!<%8$r@Z$j=P$7$^$9!#\e(B
+last: \e$BA4%a%C%;!<%8$NKvHx$+$i\e(B@var{\e$B?t;z\e(B}\e$B$N?t$@$1%a%C%;!<%8$r@Z$j=P$7$^$9!#\e(B
 
 \e$BNc\e(B:
-  /last:10/-fj.os.linux -> -fj.os.linux \e$B$N:G6a$N\e(B 10 \e$B8D$N%a%C%;!<%8\e(B
-                           \e$B$N$_$rI=<($9$k%U%)%k%@\e(B
-  /first:20/%inbox      -> %inbox \e$B$N:G=i$N\e(B 20 \e$B8D$rI=<($9$k%U%)%k%@\e(B
 
-2. \e$BF|IU$1%U%#%k%?!'\e(B "since:\e$BF|IU\e(B" "before:\e$BF|IU\e(B"
+@example
+@group
+/last:10/-fj.os.linux -> -fj.os.linux \e$B$N:G6a$N\e(B 10 \e$B8D$N%a%C%;!<%8\e(B
+                         \e$B$N$_$rI=<($9$k%U%)%k%@\e(B
+/first:20/%inbox      -> %inbox \e$B$N:G=i$N\e(B 20 \e$B8D$rI=<($9$k%U%)%k%@\e(B
+@end group
+@end example
 
-since: '\e$BF|IU\e(B'\e$B$h$j:G6a$N%a%C%;!<%8$N$_$r<h$j=P$7$^$9!#\e(B
-before: '\e$BF|IU\e(B'\e$B$h$j:G6a$N%a%C%;!<%8$N$_$r<h$j=P$7$^$9!#\e(B
+@item
+\e$BF|IU%U%#%k%?!'\e(B @samp{since:@var{\e$BF|IU\e(B}}, @samp{before:@var{\e$BF|IU\e(B}}
 
-'\e$BF|IU\e(B' \e$B$K$O0J2<$,=q$1$^$9!#\e(B
+since: @var{\e$BF|IU\e(B}\e$B$h$j:G6a$N%a%C%;!<%8$N$_$r<h$j=P$7$^$9!#\e(B
+before: @var{\e$BF|IU\e(B}\e$B$h$j0JA0$N%a%C%;!<%8$N$_$r<h$j=P$7$^$9!#\e(B
 
+@var{\e$BF|IU\e(B}\e$B$K$O0J2<$,=q$1$^$9!#\e(B
+
+@example
+@group
 yesterday ->  \e$B:rF|\e(B
 lastweek  ->  \e$B@h=5$N:#F|\e(B
 lastmonth ->  \e$B@h7n$N:#F|\e(B
 lastyear  ->  \e$B5nG/$N:#F|\e(B
-'\e$B?t;z\e(B'daysago -> '\e$B?t;z\e(B' \e$BF|A0\e(B (e.x. 3daysago)
-'\e$BF|\e(B'-'\e$B7n$NN,L>\e(B'-'\e$BG/\e(B' ->  \e$BF|IU$1$=$N$b$N$N;XDj\e(B (ex. 1-Nov-1998)
+@var{\e$B?t;z\e(B}daysago -> @var{\e$B?t;z\e(B} \e$BF|A0\e(B (e.x. 3daysago)
+@var{\e$BF|\e(B}-@var{\e$B7n$NN,L>\e(B}-@var{\e$BG/\e(B} ->  \e$BF|IU$=$N$b$N$N;XDj\e(B (ex. 1-Nov-1998)
+@end group
+@end example
 
 \e$BNc\e(B:
-  /since:3daysago/+inbox \e$B"*\e(B \e$B:G6a#3F|4V$N\e(B +inbox \e$BCf$N%a%C%;!<%8!#\e(B
-  /before:yesterday/+inbox \e$B"*\e(B \e$B$-$N$&$h$j0JA0$N\e(B +inbox \e$BCf$N%a%C%;!<%8!#\e(B
 
-3. \e$B%U%#!<%k%I%U%#%k%?!'\e(B "\e$B%U%#!<%k%IL>\e(B=\e$BJ8;zNs\e(B"
+@example
+@group
+/since:3daysago/+inbox \e$B"*\e(B \e$B:G6a#3F|4V$N\e(B +inbox \e$BCf$N%a%C%;!<%8!#\e(B
+/before:yesterday/+inbox \e$B"*\e(B \e$B$-$N$&$h$j0JA0$N\e(B +inbox \e$BCf$N%a%C%;!<%8!#\e(B
+@end group
+@end example
+
+@item
+\e$B%U%#!<%k%I%U%#%k%?!'\e(B @samp{@var{\e$B%U%#!<%k%IL>\e(B}:@var{\e$BJ8;zNs\e(B}}
 
-\e$B%a%C%;!<%8$N%U%#!<%k%I$NCf?H$,%^%C%A$9$k%a%C%;!<%8$r<h$j=P$7$^$9!#\e(B
-\e$B!X%U%#!<%k%IL>!Y!"!XJ8;zNs!Y$KBgJ8;z>.J8;z$N6hJL$O$"$j$^$;$s!#\e(B
+\e$B%a%C%;!<%8$N\e(B@var{\e$B%U%#!<%k%I\e(B}\e$B$NCf?H$,\e(B@var{\e$BJ8;zNs\e(B}\e$B$K%^%C%A$9$k%a%C%;!<%8$r<h$j=P$7$^$9!#\e(B
+@var{\e$B%U%#!<%k%IL>\e(B}\e$B!"\e(B@var{\e$BJ8;zNs\e(B}\e$B$KBgJ8;z>.J8;z$N6hJL$O$"$j$^$;$s!#\e(B
 
 \e$BNc\e(B:
-  /from=teranisi/+inbox -> +inbox \e$B$G!"\e(BFrom: \e$B%U%#!<%k%I$K\e(B "teranisi"
-                           \e$B$H$$$&J8;zNs$r4^$`%a%C%;!<%8$N%U%)%k%@\e(B
-  /body=\e$B$J$s$H$+\e(B/%inbox -> %inbox \e$B$G!"K\J8$K\e(B "\e$B$J$s$H$+\e(B"
-                           \e$B$H$$$&J8;zNs$r4^$`%a%C%;!<%8$N%U%)%k%@\e(B
 
-"|" \e$B$G6h@Z$C$F\e(B OR \e$B>r7o$r;XDj$G$-$^$9!#\e(B
-\e$B$^$?!"\e(B/tocc=xxxx/ \e$B$O!"\e(B/to=xxxx|cc=xxxx/ \e$B$HF1$8$K$J$j$^$9!#\e(B
+@example
+@group
+/from:teranisi/+inbox -> +inbox \e$B$G!"\e(BFrom: \e$B%U%#!<%k%I$K\e(B
+                         "teranisi" \e$B$H$$$&J8;zNs$r4^$`%a%C%;!<%8$N%U%)%k%@\e(B
+/body:\e$B$J$s$H$+\e(B/%inbox -> %inbox \e$B$G!"K\J8$K\e(B "\e$B$J$s$H$+\e(B"
+                         \e$B$H$$$&J8;zNs$r4^$`%a%C%;!<%8$N%U%)%k%@\e(B
+@end group
+@end example
+
+@item
+\e$BJ#9g>r7o\e(B
+
+\e$B>r7oItJ,$,\e(B @samp{!} \e$B$G;O$^$k$HH]Dj$N>r7o;XDj$H$J$j$^$9!#J#?t$N>r7o$r\e(B 
+@samp{|} \e$B$G6h@Z$C$F;XDj$9$k$H!"\e(BOR \e$B>r7o$H$J$j$^$9!#F1MM$K!"\e(B@samp{&} \e$B$G6h\e(B
+\e$B@Z$k$H\e(B AND \e$B>r7o$r;XDj$G$-$^$9\e(B(AND \e$B>r7o$O\e(B OR \e$B>r7o$h$j$bM%@h$7$FI>2A$5$l$^\e(B
+\e$B$9\e(B)\e$B!#$5$i$K!"\e(B@samp{(}, @samp{)}, \e$B$G0O$&$H>r7o<0$r%0%k!<%T%s%0;XDj$G$-$^$9!#\e(B
+
+\e$B$^$?!">r7o$N>JN,5-K!$H$7$F\e(B @samp{tocc} \e$B$,MQ0U$5$l$F$$$^$9!#\e(B
+@samp{/tocc:xxxx/} \e$B$O!"\e(B@samp{/to:xxxx|cc:xxxx/} \e$B$KE83+$5$l$^$9!#\e(B
+@samp{/!tocc:xxxx/} \e$B$O!"\e(B@samp{/!to:xxxx&!cc:xxxx/} \e$B$KE83+$5$l$^$9!#\e(B
 
 \e$BNc\e(B:
 
-  /from=teranisi|to=teranisi/+inbox
-                        -> +inbox \e$B$G\e(BTo: \e$B%U%#!<%k%I$+\e(B From: \e$B%U%#!<%k%I$K\e(B
-                          "teranisi" \e$B$r4^$`%a%C%;!<%8$N%U%)%k%@\e(B
-  /tocc=teranisi/+inbox -> +inbox \e$B$G!"\e(BTo: \e$B%U%#!<%k%I$+\e(B Cc: \e$B%U%#!<%k%I$K\e(B
-                          "teranisi" \e$B$r4^$`%a%C%;!<%8$N%U%)%k%@\e(B
+@example
+@group
+/from:teranisi&!to:teranisi/+inbox
+                      -> +inbox \e$B$G\e(B From: \e$B%U%#!<%k%I$K\e(B "teranisi" \e$B$r4^$_!"\e(B
+                        To: \e$B%U%#!<%k%I$K\e(B "teranisi" \e$B$r4^$^$J$$\e(B
+                        \e$B%a%C%;!<%8$N%U%)%k%@\e(B
+
+/tocc:"Yuuichi Teranishi"/+inbox -> +inbox \e$B$G!"\e(BTo: \e$B%U%#!<%k%I$+\e(B
+                         Cc: \e$B%U%#!<%k%I$K\e(B "Yuuichi Teranishi" \e$B$r4^$`\e(B
+                         \e$B%a%C%;!<%8$N%U%)%k%@\e(B
+
+/(from:yt|from:teranisi)&subject:\e$BJs9p\e(B/+inbox
+                      -> +inbox \e$B$G!"\e(BFrom: \e$B%U%#!<%k%I$,\e(B "yt" \e$B$+\e(B
+                        "teranisi" \e$B$r4^$_!"$+$D\e(B Subject \e$B$,\e(B "\e$BJs9p\e(B" \e$B$r4^$`\e(B
+                        \e$B%a%C%;!<%8$N%U%)%k%@\e(B
+@end group
+@end example
+@end enumerate
+
+@noindent
+\e$BCm0U\e(B
+
+\e$BJ8;zNsItJ,$K!"6uGrJ8;z!"\e(B@samp{"}\e$B!"\e(B@samp{/}\e$B!"\e(B@samp{)}\e$B!"\e(B@samp{|}\e$B!"\e(B@samp{&} 
+\e$B$r4^$_$?$$>l9g$O!"J8;zNsA4BN$r\e(B @samp{"} \e$B$G3g$kI,MW$,$"$j$^$9!#\e(B(@samp{"}
+\e$B$G3g$i$l$F$$$kJ8;zNsCf$K\e(B @samp{"} \e$B$r4^$`>l9g$O!"\e(B@samp{\} \e$B$G%(%9%1!<%W$9\e(B
+\e$B$kI,MW$,$"$j$^$9\e(B)\e$B!#$3$l$i$NJ8;z$r4^$^$J$$>l9g$G$b\e(B @samp{"} \e$B$G3g$k$N$OLd\e(B
+\e$BBj$"$j$^$;$s!#\e(B
 
+@noindent
 \e$B1~MQJT\e(B
 
-  %inbox,/from=teranisi/%inbox@@server
-         -> %inbox\e$B!"$*$h$S!"\e(B
-            %inbox@@server \e$B$NCf$G\e(B From \e$B%U%#!<%k%I$,\e(B "teranisi" \e$B$N%a%C%;!<%872!"\e(B
-            \e$B$r$$$C$Z$s$KI=<($9$k%U%)%k%@!#\e(B
-
-  /last:100//to=teranisi/*+inbox,%inbox
-         -> +inbox \e$B$H\e(B %inbox \e$BCf$N%a%C%;!<%8$N$&$A!"\e(B
-            To: \e$B%U%#!<%k%I$,\e(B "teranisi" \e$B$K%^%C%A$9$k\e(B
-            \e$B%a%C%;!<%8$N:G6a$N\e(B100\e$B8D$rI=<($9$k%U%)%k%@!#\e(B
-
-  /from=hogehoge//last:20//tocc=teranisi/%#mh/inbox@@localhost
-  (\e$B"*$G@^$jJV$7!#<B:]$O0l9T\e(B)
-
-         -> %#mh/inbox@@localhost \e$B$NCf$G!"\e(BTo \e$B$+\e(B Cc \e$B$K\e(B "teranisi" \e$B$,4^$^$l$k\e(B
-            \e$B%a%C%;!<%8$N:G6a$N\e(B 20 \e$B8D$N$&$A!"\e(BFrom \e$B$,\e(B "hogehoge" \e$B$N$b$N$r\e(B
-            \e$BI=<($9$k%U%)%k%@!#\e(B
-
-;;; --- \e$B<BAu>e$N@)Ls\e(B ---
-;;; \e$B8=:_$N$H$3$m!"\e(Bnntp \e$B%U%)%k%@$OF|IU%U%#%k%?!"%U%#!<%k%I%U%#%k%?\e(B
-;;; \e$B$r=q$1$^$;$s!#\e(B
-;;; \e$B$^$?!"\e(Bimap4 \e$B%U%)%k%@\e(B \e$B$G$O\e(B rfc2060 \e$B$N\e(B search \e$B%3%^%s%I$K$=$N$^$^\e(B
-;;; \e$BM?$($i$l$k$b$N$7$+>r7o$N%U%#!<%k%IL>$K=q$1$^$;$s!#\e(B
-;;; (-> to,cc,from,subject,body \e$B$N$_\e(B)
-;;; localdir \e$B$N%U%)%k%@$K$OG$0U$N%U%#!<%k%IL>$r=q$1$^$9!#\e(B
+@example
+*%inbox,/from:teranisi/%inbox@@server
+       -> %inbox\e$B!"$*$h$S!"\e(B
+          %inbox@@server \e$B$NCf$G\e(B From \e$B%U%#!<%k%I$,\e(B "teranisi" \e$B$N%a%C%;!<%872!"\e(B
+          \e$B$r$$$C$Z$s$KI=<($9$k%U%)%k%@!#\e(B
+
+/last:100//to:teranisi/*+inbox,%inbox
+       -> +inbox \e$B$H\e(B %inbox \e$BCf$N%a%C%;!<%8$N$&$A!"\e(B
+          To: \e$B%U%#!<%k%I$,\e(B "teranisi" \e$B$K%^%C%A$9$k\e(B
+          \e$B%a%C%;!<%8$N:G6a$N\e(B100\e$B8D$rI=<($9$k%U%)%k%@!#\e(B
+
+/from:hogehoge//last:20//tocc:teranisi/%#mh/inbox@@localhost
+       -> %#mh/inbox@@localhost \e$B$NCf$G!"\e(BTo \e$B$+\e(B Cc \e$B$K\e(B "teranisi" \e$B$,4^$^$l$k\e(B
+          \e$B%a%C%;!<%8$N:G6a$N\e(B 20 \e$B8D$N$&$A!"\e(BFrom \e$B$,\e(B "hogehoge" \e$B$N$b$N$r\e(B
+          \e$BI=<($9$k%U%)%k%@!#\e(B
 @end example
 
 
@@ -1313,23 +1515,34 @@ lastyear  ->  \e$B5nG/$N:#F|\e(B
 
 \e$B%U%)%k%@1\Mw;~$K!"<+F0E*$K%a%C%;!<%8$N<h$j9~$_$r<B9T$9$k%U%)%k%@$G$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: '|'\e$B<h$j9~$_85\e(B'|'\e$B<h$j9~$_@h\e(B
+@samp{|} @var{\e$B<h$j9~$_85\e(B} @samp{|} @var{\e$B<h$j9~$_@h\e(B}
+@end example
 
-\e$B%U%)%k%@1\Mw;~!"!X<h$j9~$_85!Y$+$i!X<h$j9~$_@h!Y$X<+F0E*$K%a%C%;!<%8$,\e(B
+\e$B%U%)%k%@1\Mw;~!"\e(B@var{\e$B<h$j9~$_85\e(B}\e$B$+$i\e(B@var{\e$B<h$j9~$_@h\e(B}\e$B$X<+F0E*$K%a%C%;!<%8$,\e(B
 \e$B0\F0$7$^$9!#\e(BPOP \e$B$rMxMQ$7$F%a%C%;!<%8$r%m!<%+%k$K%@%&%s%m!<%I$7$F1\Mw$7$?$$\e(B
 \e$B>l9g$O!"\e(B
 
+@example
 |&username@@popserver|+inbox
+@end example
 
+@noindent
 \e$B$N$h$&$K;XDj$9$k$H!"%U%)%k%@$NI=<($r99?7$9$k$H$-$K\e(B
-&username@@popserver \e$B$+$i!"\e(B+inbox \e$B$X%a%C%;!<%8$,<+F0E*$K<h$j9~$^$l$^$9!#\e(B
+@samp{&username@@popserver} \e$B$+$i\e(B @samp{+inbox} \e$B$X!"%a%C%;!<%8$,<+F0E*$K<h$j9~$^$l$^$9!#\e(B
 
-\e$BNc\e(B: %inbox|%myinbox   -> %inbox \e$B$+$i\e(B %myinbox \e$B$X%a%C%;!<%8$r<h$j9~$s$G\e(B
-                         \e$B1\Mw$9$k%U%)%k%@!#\e(B
-    *&user@@popserver1,&user@@popserver2|+inbox
-    -> &user@@popserver1 \e$B$H\e(B &user@@popserver2 \e$B$+$i\e(B +inbox \e$B$X%a%C%;!<%8$r\e(B
-    \e$B<h$j9~$s$G1\Mw$9$k%U%)%k%@!#\e(B
+\e$BNc\e(B:
+
+@example
+@group
+%inbox|%myinbox   -> %inbox \e$B$+$i\e(B %myinbox \e$B$X%a%C%;!<%8$r<h$j9~$s$G\e(B
+                       \e$B1\Mw$9$k%U%)%k%@!#\e(B
+*&user@@popserver1,&user@@popserver2|+inbox
+  -> &user@@popserver1 \e$B$H\e(B &user@@popserver2 \e$B$+$i\e(B +inbox \e$B$X%a%C%;!<%8$r\e(B
+  \e$B<h$j9~$s$G1\Mw$9$k%U%)%k%@!#\e(B
+@end group
 @end example
 
 \e$B%a%C%;!<%8$,0\F0$7$?$"$H!"%U%C%/\e(B @code{elmo-pipe-drained-hook} \e$B$,8F$P$l\e(B
@@ -1344,12 +1557,17 @@ lastyear  ->  \e$B5nG/$N:#F|\e(B
 
 Wanderlust \e$B$NFbIt$GJ];}$5$l$?%a%C%;!<%8$r1\Mw$9$k$?$a$N%U%)%k%@$G$9!#\e(B
 
+\e$B=q<0\e(B:
+
 @example
-\e$B=q<0\e(B: 'mark 
-      \e$B$b$7$/$O\e(B
-      'cache/00\e$B!A\e(B1F
+@group
+'mark
+@r{\e$B$b$7$/$O\e(B}
+'cache/00\e$B!A\e(B1F
+@end group
+@end example
 
-'mark \e$B$H$$$&%U%)%k%@$O!"8e=R$N!X=EMW%^!<%/\e(B @samp{$}\e$B!Y$,$D$$$?%a%C%;!<%8$r\e(B
+'mark \e$B$H$$$&%U%)%k%@$O!"8e=R$N=EMW%^!<%/\e(B(@samp{$})\e$B$,$D$$$?%a%C%;!<%8$r\e(B
 \e$B$"$D$+$&FCJL$J2>A[%U%)%k%@$G$9!#\e(B
 \e$B=EMW%^!<%/$r%a%C%;!<%8$K$D$1$F$*$$$F!"$"$H$+$i8+D>$7$?$$$H$-$J$I$KJXMx$G$9!#\e(B
 
@@ -1361,11 +1579,8 @@ Wanderlust \e$B$NFbIt$GJ];}$5$l$?%a%C%;!<%8$r1\Mw$9$k$?$a$N%U%)%k%@$G$9!#\e(B
 'cache/00 \e$B!A\e(B 1F \e$B$O%M%C%H%o!<%/7PM3$GFI$s$@%a%C%;!<%8$N%-%c%C%7%e$K%"%/%;\e(B
 \e$B%9$9$k$?$a$N%U%)%k%@$G$9!#\e(B00 \e$B!A\e(B 1F \e$B$K$O!"%-%c%C%7%e%G%#%l%/%H%j\e(B 
 (@file{~/.elmo/cache})\e$B$N%5%V%G%#%l%/%H%jL>$r;XDj$7$^$9!#\e(B
-@end example
 
-@c
-@c  Folder
-@c
+
 @node Folder, Summary, Folders, Top
 @chapter \e$B%U%)%k%@%b!<%I\e(B
 @cindex Folder
@@ -1392,6 +1607,7 @@ Wanderlust \e$B$NFbIt$GJ];}$5$l$?%a%C%;!<%8$r1\Mw$9$k$?$a$N%U%)%k%@$G$9!#\e(B
 (XEmacs \e$B$G$O$b$&$A$g$C$H$+$C$3$h$/8+$($k$O$:$G$9\e(B @t{;-)})
 
 @example
+@group
 [-]Desktop:14186/35580/67263
    \e$B<u?.H"\e(B:3/10/10
    \e$B%4%_H"\e(B:2/7/10
@@ -1405,12 +1621,13 @@ Wanderlust \e$B$NFbIt$GJ];}$5$l$?%a%C%;!<%8$r1\Mw$9$k$?$a$N%U%)%k%@$G$9!#\e(B
      Mew:0/0/998
      Mule-Win32:0/0/1491
      fj \e$B$N\e(B Emacsen:0/5/88
+@end group
 @end example
 
 \e$B3F9T$KI=<($5$l$k$N$O!"\e(B
 
 @example
-\e$B!X%U%)%k%@L>\e(B:\e$BL$F14|\e(B(\e$B?75,\e(B)\e$B?t\e(B/\e$BL$FI?t\e(B/\e$BAm?t!Y\e(B
+@var{\e$B%U%)%k%@L>\e(B}:@var{\e$BL$F14|\e(B}(@var{\e$B?75,\e(B})@var{\e$B?t\e(B}/@var{\e$BL$FI?t\e(B}/@var{\e$BAm?t\e(B}
 @end example
 
 @noindent
@@ -1457,16 +1674,25 @@ Wanderlust \e$B$NFbIt$GJ];}$5$l$?%a%C%;!<%8$r1\Mw$9$k$?$a$N%U%)%k%@$G$9!#\e(B
 
 @item w
 @kindex w (Folder)
-@findex wl-summary-write
+@findex wl-draft
 \e$B?75,%I%i%U%H$rMQ0U$7$^$9!#\e(B
-(@code{wl-summary-write})
+(@code{wl-draft})
 
 @item W
 @kindex W (Folder)
-@findex wl-summary-write-current-newsgroup
+@findex wl-folder-write-current-newsgroup
 \e$B8=:_%+!<%=%k$,$"$k%U%)%k%@$,\e(B NNTP \e$B%U%)%k%@$J$i!"\e(B
 Newsgroups \e$B%U%#!<%k%I$rJd$C$F%I%i%U%H$rMQ0U$7$^$9!#\e(B
-(@code{wl-summary-write-current-newsgroup})
+(@code{wl-folder-write-current-newsgroup})
+
+@item C-c C-o
+@kindex C-c C-o (Folder)
+@findex wl-jump-to-draft-buffer
+\e$B%I%i%U%H%P%C%U%!$,$"$l$P0\F0$7$^$9!#\e(B \e$BJ#?t$N%I%i%U%H%P%C%U%!$,B8:_$9$k>l9g$O!"\e(B
+\e$B<!!9$H@Z$jBX$($F$$$-$^$9!#$^$?!"\e(Bprefix argument \e$B$r$D$1$k$3$H$K$h$j!"\e(B
+\e$B%P%C%U%!$,B8:_$7$F$$$J$$>l9g$O!"%I%i%U%H%U%)%k%@$+$i%U%!%$%k$r\e(B(\e$BB8:_$9$l$P\e(B)
+\e$BFI$_9~$_$^$9!#\e(B
+(@code{wl-jump-to-draft-buffer})
 
 @item s
 @kindex s (Folder)
@@ -1492,6 +1718,12 @@ Newsgroups \e$B%U%#!<%k%I$rJd$C$F%I%i%U%H$rMQ0U$7$^$9!#\e(B
 \e$B%j!<%8%g%s$K$"$k%U%)%k%@$N%5%^%j$r99?7$7$^$9!#\e(B
 (@code{wl-folder-sync-region})
 
+@item Z
+@kindex Z (Folder)
+@findex wl-status-update
+@file{~/.addresses} \e$BEy$N>uBV$r:G?7$N$b$N$K99?7$7$^$9!#\e(B
+(@code{wl-status-update})
+
 @item P
 @kindex P (Folder)
 @findex wl-folder-prev-unread
@@ -1604,7 +1836,7 @@ Wanderlust \e$B$N%5!<%P!&%]!<%HJL$N%*%U%i%$%s\e(B/\e$B%*%s%i%$%s$rJQ99$7$^$9!#\e(B
 @table @code
 @item wl-folders-file
 @vindex wl-folders-file
-\e$B=i4|@_Dj$O\e(B "~/.folders"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @file{~/.folders}\e$B!#\e(B
 \e$B9XFI$9$k%U%)%k%@$r5-=R$9$k%U%!%$%k$NL>A0$G$9!#\e(B
 
 @item wl-folder-info-save
@@ -1627,9 +1859,16 @@ Non-nil \e$B$J$i%5%^%j$K0\F0$7$?$H$-$K%U%)%k%@%P%C%U%!$N1&$K%5%^%j$N%P%C%U%!$,8=$
 \e$B=i4|@_Dj$O\e(B 70\e$B!#\e(B
 \e$BL$F14|?t$,$?$/$5$s$+$I$&$+$NogCM!#$3$NCM$r1[$($k$H?'$,JQ$o$j$^$9!#\e(B
 
+@item wl-highlight-folder-by-numbers
+@vindex wl-highlight-folder-by-numbers
+\e$B%U%)%k%@%P%C%U%!$K$*$1$k3F9T$N%O%$%i%$%H$N7A<0$r;XDj$7$^$9!#=i4|CM$O\e(B
+@code{t} \e$B$G!"9TA4BN$K%a%C%;!<%8?t$K1~$8$??'$rIU$1$^$9!#\e(B@code{nil} \e$B$G$O%U%)\e(B
+\e$B%k%@$N>uBV$K1~$8$??'$rIU$1$^$9!#$^$?!"?t;z\e(B (\e$BNc$($P\e(B @code{1}) \e$B$K$7$F$*$/\e(B
+\e$B$H!"%a%C%;!<%8?t$H%U%)%k%@$N>uBV$NN>J}$K1~$8$?%O%$%i%$%H$,9T$J$o$l$^$9!#\e(B
+
 @item wl-folder-desktop-name
 @vindex wl-folder-desktop-name
-\e$B=i4|@_Dj$O\e(B "Desktop"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{Desktop}\e$B!#\e(B
 \e$B%H%C%W$N%0%k!<%W$NL>A0$G$9!#\e(B
 
 @item wl-folder-petname-alist
@@ -1645,22 +1884,27 @@ Non-nil \e$B$J$i%5%^%j$K0\F0$7$?$H$-$K%U%)%k%@%P%C%U%!$N1&$K%5%^%j$N%P%C%U%!$,8=$
 
 \e$B%j%9%H$N3FMWAG$O\e(B
 
-(\e$B%"%/%;%9%0%k!<%W$N@55,I=8=\e(B . (\e$B9XFI%U%i%0\e(B \e$B%U%)%k%@$N@55,I=8=\e(B @dots{}))
+@example
+(@var{\e$B%"%/%;%9%0%k!<%W$N@55,I=8=\e(B} . (@var{\e$B9XFI%U%i%0\e(B} @var{\e$B%U%)%k%@$N@55,I=8=\e(B} @dots{}))
+@end example
 
-\e$B$H$J$C$F$$$^$9!#9XFI%U%i%0$,\e(B non-nil \e$B$N>l9g$O%U%)%k%@$N@55,I=8=$K%^%C%A\e(B
-\e$B$7$?%U%)%k%@$N$_I=<($7!"9XFI%U%i%0$,\e(B nil \e$B$N>l9g$O%U%)%k%@$N@55,I=8=$K%^%C\e(B
-\e$B%A$7$?%U%)%k%@$OI=<($5$l$J$/$J$j$^$9!#$?$@$7!"9XFI%U%i%0$,\e(B non-nil \e$B$G$b\e(B
-\e$B4{$K\e(B unsubscribe \e$B$5$l$F$$$k%U%)%k%@$OI=<($5$l$^$;$s!#$^$?!"%U%)%k%@$N@5\e(B
-\e$B5,I=8=$OJ#?t8D5-=R$G$-$^$9!#\e(B
+@noindent
+\e$B$H$J$C$F$$$^$9!#\e(B@var{\e$B9XFI%U%i%0\e(B}\e$B$,\e(B non-nil \e$B$N>l9g$O\e(B@var{\e$B%U%)%k%@$N@55,I=8=\e(B}\e$B$K%^%C%A\e(B
+\e$B$7$?%U%)%k%@$N$_I=<($7!"\e(B@var{\e$B9XFI%U%i%0\e(B}\e$B$,\e(B nil \e$B$N>l9g$O\e(B@var{\e$B%U%)%k%@$N@55,I=8=\e(B}
+\e$B$K%^%C%A$7$?%U%)%k%@$OI=<($5$l$J$/$J$j$^$9!#$?$@$7!"\e(B@var{\e$B9XFI%U%i%0\e(B}\e$B$,\e(B non-nil \e$B$G$b\e(B
+\e$B4{$K\e(B unsubscribe \e$B$5$l$F$$$k%U%)%k%@$OI=<($5$l$^$;$s!#$^$?!"\e(B
+@var{\e$B%U%)%k%@$N@55,I=8=\e(B}\e$B$OJ#?t8D5-=R$G$-$^$9!#\e(B
 
 \e$BNc\e(B:
 
-@example
+@lisp
+@group
 '(("^-fj$" . (t   "^-fj\\.\\(comp\\|editor\\|mail\\)"
                   "^-fj\\.\\(net\\|news\\|os\\|rec\\)"))
   ("^-$" . (t   "^-\\(fj\\|tnn\\|japan\\|gnu\\|comp\\)"))
   ("^\\+ml$" . (nil "^\\+ml$" "^\\+ml/tmp")))
-@end example
+@end group
+@end lisp
 
 @item wl-folder-hierarchy-access-folders
 @vindex wl-folder-hierarchy-access-folders
@@ -1671,13 +1915,17 @@ Non-nil \e$B$J$i%5%^%j$K0\F0$7$?$H$-$K%U%)%k%@%P%C%U%!$N1&$K%5%^%j$N%P%C%U%!$,8=$
 @code{wl-folder-hierarchy-access-folders} \e$B$r@_Dj$9$k$H!"\e(B
 
 @lisp
+@group
 (setq wl-folder-hierarchy-access-folders
      '("-" "-alt" "-japan" "-comp" "-comp.unix"))
+@end group
 @end lisp
 
+@noindent
 \e$B<!$N$h$&$J3,AX9=B$$K$J$C$?%"%/%;%9%0%k!<%W$,:n$i$l$^$9!#\e(B
 
 @example
+@group
    [-]-:912/912/3011
      [-]-fj:674/674/1314
        -fj.comp.announce:0/0/2
@@ -1692,6 +1940,7 @@ Non-nil \e$B$J$i%5%^%j$K0\F0$7$?$H$-$K%U%)%k%@%P%C%U%!$N1&$K%5%^%j$N%P%C%U%!$,8=$
          [-]-comp.unix.bsd:0/0/23
            -comp.unix.bsd.freebsd.announce:0/0/0
      @dots{}
+@end group
 @end example
 
 \e$B$?$@$7!"\e(B@samp{-} \e$B$r3+$$$?$@$1$G$O\e(B1\e$B$DL\$N3,AX\e(B
@@ -1733,14 +1982,14 @@ Non-nil \e$B$J$i%5%^%j$K0\F0$7$?$H$-$K%U%)%k%@%P%C%U%!$N1&$K%5%^%j$N%P%C%U%!$,8=$
 @item
 @kbd{m q}\e$B$G\e(B @code{wl-fldmgr-cut-entity-list} \e$B$r>C$7$^$9!#\e(B
 @item
-@kbd{C-k} \e$B$+\e(B @kbd{M-c} \e$B$G%U%)%k%@$r:o=|!"$^$?$O%3%T!<$7$^$9!#\e(B
+@kbd{C-k} \e$B$G%U%)%k%@$r@Z$j<h$j!"$^$?$O\e(B @kbd{M-c} \e$B$G%U%)%k%@$r%3%T!<$7$^$9!#\e(B
 @item
-@kbd{m m} \e$B$r<B9T$9$k$H!"%^%k%A%U%)%k%@$,:n@.$5$l$^$9!#\e(B
+@kbd{m m} \e$B$r<B9T$9$k$H%^%k%A%U%)%k%@$,:n@.$5$l$^$9!#\e(B
 @end enumerate
 
 @subsubsection \e$B$"$@L>\e(B(petname)\e$B$d%U%#%k%?$N:o=|\e(B
 
-\e$B$"$@L>$d%U%#%k%?$N@_Dj$G$O!"\e(Bminibuffer \e$B$G\e(B ""(NULL) \e$B$rF~NO$9$k$H\e(B
+\e$B$"$@L>$d%U%#%k%?$N@_Dj$G$O!"%_%K%P%C%U%!$G\e(B ""(NULL) \e$B$rF~NO$9$k$H\e(B
 \e$B$"$@L>$d%U%#%k%?$,:o=|$5$l$^$9!#\e(B
 
 @subsubsection \e$B6u%0%k!<%W$X$NDI2C\e(B
@@ -1752,9 +2001,10 @@ Non-nil \e$B$J$i%5%^%j$K0\F0$7$?$H$-$K%U%)%k%@%P%C%U%!$N1&$K%5%^%j$N%P%C%U%!$,8=$
 \e$B$k$H$$$$$G$7$g$&!#$D$^$j!"%+!<%=%k0LCV$h$j>e$K$"$k%0%k!<%W$N3+JD>uBV$K\e(B
 \e$B$h$jA^F~$5$l$k0LCV$,0[$J$k$N$G$9!#\e(B
 
-@subsubsection save\e$B;~$N8@8l%3!<%I\e(B
+@subsubsection \e$B%;!<%V;~$N8@8l%3!<%I\e(B
 
-@code{wl-folders-file} \e$B$r\e(B save \e$B$9$k$H$-$O\e(B @code{wl-mime-charset} \e$B$N8@8l%3!<%I$K$J$j$^$9!#\e(B
+@code{wl-folders-file} \e$B$r%;!<%V$9$k$H$-$O\e(B @code{wl-mime-charset} \e$B$N8@8l\e(B
+\e$B%3!<%I$K$J$j$^$9!#\e(B
 
 @subsubsection \e$B%U%#%k%?%U%)%k%@$N:n@.\e(B
 
@@ -1771,7 +2021,7 @@ Non-nil \e$B$J$i%5%^%j$K0\F0$7$?$H$-$K%U%)%k%@%P%C%U%!$N1&$K%5%^%j$N%P%C%U%!$,8=$
 \e$B$5$l$?4X?t$rMQ$$$^$9!#=i4|@_Dj$G$O\e(B @code{wl-fldmgr-sort-standard} \e$B$,;XDj\e(B
 \e$B$5$l$F$*$j!"$3$l$O%"%k%U%!%Y%C%H=g$KJB$S$+$(%0%k!<%W$O:G=i$K$9$k4X?t$G$9!#\e(B
 \e$BJB$SJQ$($O;XDj$7$?%0%k!<%W$N$_9T$$!"2<0L$N%0%k!<%W$^$GJB$SJQ$($O$7$^$;$s!#\e(B
-\e$B$D$^$j!"\e(Brecursive \e$B$K$O9T$$$^$;$s!#\e(B
+\e$B$D$^$j!":F5"E*$K$O9T$$$^$;$s!#\e(B
 
 @subsubsection \e$B%"%/%;%9%0%k!<%WFb$NI=<($7$J$$%U%)%k%@$N;XDj\e(B
 
@@ -1782,11 +2032,14 @@ Non-nil \e$B$J$i%5%^%j$K0\F0$7$?$H$-$K%U%)%k%@%P%C%U%!$N1&$K%5%^%j$N%P%C%U%!$,8=$
 \e$B%3%^%s%I\e(B @code{wl-fldmgr-unsubscribe} (@kbd{u}) \e$B$O%+!<%=%k0LCV$N%U%)%k%@$N\e(B
 \e$BI=<(\e(B(subscribe)\e$B!&HsI=<(\e(B(unsubscribe)\e$B@_Dj$r%H%0%k$7$^$9!#$=$l$KBP$7$F\e(B
 @code{wl-fldmgr-unsubscribe-region} (@kbd{U}) \e$B$O;XDjHO0O$N%U%)%k%@$rHsI=<($K\e(B
-\e$B$7$^$9!#\e(Bunsubscribe \e$B$O%H%0%k$7$^$9$,!"\e(Bregion \e$B$@$HDL>o%H%0%k$K$J$i\e(B
-\e$B$J$$$3$H$KCm0U2<$5$$!#\e(Bregion \e$B$N>l9g%H%0%k$K$9$k$h$j$I$A$i$+$K@_Dj$5\e(B
-\e$B$;$kJ}$,;H$$$d$9$$$H9M$($3$N$h$&$K$7$F$$$^$9!#$7$+$7!">e5-\e(B2\e$B$D$N4X?t$H\e(B
-\e$B$b\e(B prefix argument \e$B$NCM$,@5$J$i%U%)%k%@$rHsI=<(!"Ii$J$iI=<(!"\e(B0\e$B$J$i\e(B
-\e$B%H%0%k$5$;$^$9!#\e(B
+\e$B$7$^$9!#\e(B
+
+@code{wl-fldmgr-unsubscribe} \e$B$O%H%0%k$7$^$9$,!"\e(B
+@code{wl-fldmgr-unsubscribe-region} \e$B$@$HDL>o%H%0%k$K$J$i$J$$$3$H$KCm0U2<\e(B
+\e$B$5$$!#%j!<%8%g%s$N>l9g%H%0%k$K$9$k$h$j$I$A$i$+$K@_Dj$5$;$kJ}$,;H$$$d$9$$\e(B
+\e$B$H9M$($3$N$h$&$K$7$F$$$^$9!#\e(B
+\e$B$7$+$7!">e5-\e(B2\e$B$D$N4X?t$H$b\e(B prefix argument \e$B$NCM$,@5$J$i%U%)%k%@$rHsI=<(!"\e(B
+\e$BIi$J$iI=<(!"\e(B0\e$B$J$i%H%0%k$5$;$^$9!#\e(B
 
 \e$B$^$?%-!<$K$O3d$jEv$F$F$$$^$;$s$,!"%U%)%k%@$rI=<($K@_Dj$9$k$@$1$N\e(B
 @code{wl-fldmgr-subscribe} \e$B$H\e(B @code{wl-fldmgr-subscribe-region} \e$B$bMQ0U$7$F\e(B
@@ -1867,7 +2120,7 @@ nntp\e$B$J$I$N:o=|$G$-$J$$%U%)%k%@$G$O\e(B msgdb \e$B$N$_:o=|$7$^$9!#\e(B
 @kindex * (Folder)
 @kindex m m(Folder)
 @findex wl-fldmgr-make-multi
-\e$B%^%k%A%U%)%k%@$r:n@.$7$^$9\e(B (cut, copy \e$B$5$l$?%U%)%k%@$r7k9g$7$^$9\e(B)\e$B!#\e(B
+\e$B%^%k%A%U%)%k%@$r:n@.$7$^$9\e(B (\e$B%3%T!<!":o=|$5$l$?%U%)%k%@$r7k9g$7$^$9\e(B)\e$B!#\e(B
 (@code{wl-fldmgr-make-multi})
 
 @item |
@@ -1927,7 +2180,7 @@ nntp\e$B$J$I$N:o=|$G$-$J$$%U%)%k%@$G$O\e(B msgdb \e$B$N$_:o=|$7$^$9!#\e(B
 @item m q
 @kindex m q (Folder)
 @findex wl-fldmgr-clear-cut-entity-list
-cut, copy \e$B$7$?%U%)%k%@>pJs\e(B(cut-list)\e$B$r>C$9!#\e(B
+\e$B%3%T!<!":o=|$7$?%U%)%k%@>pJs\e(B(cut-list)\e$B$r>C$9!#\e(B
 (@code{wl-fldmgr-clear-cut-entity-list})
 
 @item m s
@@ -1939,7 +2192,7 @@ cut, copy \e$B$7$?%U%)%k%@>pJs\e(B(cut-list)\e$B$r>C$9!#\e(B
 @item m C-s
 @kindex m C-s (Folder)
 @findex wl-fldmgr-save
-wl-folders-file \e$B$K\e(B save \e$B$9$k!#\e(B
+wl-folders-file \e$B$K%;!<%V$9$k!#\e(B
 (@code{wl-fldmgr-save})
 @end table
 
@@ -1977,15 +2230,6 @@ wl-folders-file \e$B$K\e(B save \e$B$9$k!#\e(B
 @findex wl-fldmgr-access-display-all
 \e$BHsI=<($N%U%)%k%@$b4^$a$FA4$F$N%U%)%k%@$r0lMwI=<($9$k!#\e(B
 (@code{wl-fldmgr-access-display-all})
-
-@item C-c C-o
-@kindex C-c C-o (Folder)
-@findex wl-jump-to-draft-buffer
-\e$B%I%i%U%H%P%C%U%!$,$"$l$P0\F0$7$^$9!#\e(B \e$BJ#?t$N%I%i%U%H%P%C%U%!$,B8:_$9$k>l9g$O!"\e(B
-\e$B<!!9$H@Z$jBX$($F$$$-$^$9!#$^$?!"\e(Bprefix argument \e$B$r$D$1$k$3$H$K$h$j!"\e(B
-\e$B%P%C%U%!$,B8:_$7$F$$$J$$>l9g$O!"%I%i%U%H%U%)%k%@$+$i%U%!%$%k$r\e(B(\e$BB8:_$9$l$P\e(B)
-\e$BFI$_9~$_$^$9!#\e(B
-(@code{wl-jump-to-draft-buffer})
 @end table
 
 
@@ -1996,12 +2240,12 @@ wl-folders-file \e$B$K\e(B save \e$B$9$k!#\e(B
 @vindex wl-interactive-save-folders
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
 \e$B%U%)%k%@JQ99$NA`:n$r9T$C$?>l9g!"\e(BWanderlust \e$B=*N;;~$b$7$/$O\e(B Emacs \e$B=*N;;~$K\e(B
- save \e$B$9$k$+3NG'$r9T$$$^$9!#\e(Bnil \e$B$@$H3NG'$J$7$G\e(B save \e$B$7$^$9!#\e(B
+\e$B%;!<%V$9$k$+3NG'$r9T$$$^$9!#\e(Bnil \e$B$@$H3NG'$J$7$G%;!<%V$7$^$9!#\e(B
 
 @item wl-fldmgr-make-backup
 @vindex wl-fldmgr-make-backup
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
-Non-nil \e$B$J$i!"\e(Bsave\e$B$9$k:]$K\e(B @file{~/.folders.bak} \e$B$K%P%C%/%"%C%W$r<h$j$^$9!#\e(B
+Non-nil \e$B$J$i!"%;!<%V$9$k:]$K\e(B @file{~/.folders.bak} \e$B$K%P%C%/%"%C%W$r<h$j$^$9!#\e(B
 
 @item wl-fldmgr-sort-func
 @vindex wl-fldmgr-sort-func
@@ -2044,15 +2288,17 @@ Non-nil \e$B$J$i%a%C%;!<%8$,:o=|$5$l$?$H$-$K%U%)%k%@%b!<%I$GL$FI?t$r%A%'%C%/\e(B
 
 @enumerate
 @item
-cut \e$B$d\e(B copy \e$B$r9T$&$H!"%9%?%C%/$N$h$&$KJQ?t\e(B @code{wl-fldmgr-cut-entity-list}
\e$B$K$?$^$C$F$$$-$^$9!#\e(Bpaste(yank) \e$B$O\e(B cut \e$B$d\e(B copy \e$B$7$?C10L$G\e(B
- (region \e$B$G\e(B copy \e$B$7$?$J$i$=$N\e(B region \e$BFb$N%U%)%k%@$,\e(B \e$B0lEY$K\e(B) \e$BEG$-=P$5$l$^$9!#\e(B
+\e$B:o=|$d%3%T!<$r9T$&$H!"%9%?%C%/$N$h$&$KJQ?t\e(B 
+@code{wl-fldmgr-cut-entity-list} \e$B$K$?$^$C$F$$$-$^$9!#%Z!<%9%H\e(B(\e$BD%$jIU$1\e(B)
+\e$B$O:o=|$d%3%T!<$7$?C10L$G\e(B(\e$B%j!<%8%g%s$G%3%T!<$7$?$J$i!"$=$N%j!<%8%g%sFb$N\e(B
+\e$B%U%)%k%@$,0lEY$K\e(B) \e$BEG$-=P$5$l$^$9!#\e(B
 
 @item
-Desktop \e$B%0%k!<%W$N\e(B cut, copy \e$B$O$G$-$^$;$s!#$^$?!"\e(BDesktop \e$B30$X$NA^F~$O$G$-$^$;$s!#\e(B
+@samp{Desktop} \e$B%0%k!<%W$N:o=|!"%3%T!<$O$G$-$^$;$s!#\e(B
+\e$B$^$?!"\e(B@samp{Desktop} \e$B30$X$NA^F~$O$G$-$^$;$s!#\e(B
 
 @item
-\e$B%0%k!<%W$N\e(B copy \e$B$O$G$-$^$;$s!#\e(B
+\e$B%0%k!<%W$N%3%T!<$O$G$-$^$;$s!#\e(B
 
 @item
 \e$B%"%/%;%9%0%k!<%W$NA`:n$O%"%/%;%9%0%k!<%W$KB0$7$F$$$k%U%)%k%@$N$_BP>]\e(B
@@ -2067,24 +2313,37 @@ Desktop \e$B%0%k!<%W$N\e(B cut, copy \e$B$O$G$-$^$;$s!#$^$?!"\e(BDesktop \e$B30$X$NA^
 @end enumerate
 
 
-@c
-@c  Summary
-@c
 @node Summary, Message, Folder, Top
 @chapter \e$B%5%^%j%b!<%I\e(B
 
+\e$B%U%)%k%@%b!<%I$GFI$_$?$$%U%)%k%@$rA*Br$9$k$H!"%5%^%j%b!<%I$K0\F0$7$^$9!#\e(B
+\e$B%5%^%j%b!<%I$K$O%a%C%;!<%8$N0lMw$,I=<($5$l$^$9!#\e(B
+
+@menu
+* Usage of Summary mode::       \e$B;HMQJ}K!\e(B
+* Thread Oparations::           \e$B%9%l%C%I$NA`:n\e(B
+* Cache::                       \e$B%-%c%C%7%e$H@hFI$_5!G=\e(B
+* Auto Refile::                 \e$B<+F0%j%U%!%$%k\e(B
+* Sticky Summary::              \e$B%9%F%#%C%-!<%5%^%j\e(B
+* Key Bindings of Summary::     \e$B%-!<%P%$%s%I\e(B
+* Variables of Summary::        \e$B%+%9%?%^%$%:JQ?t\e(B
+@end menu
+
+
+@node Usage of Summary mode, Thread Oparations, Summary, Summary
 @section \e$B;HMQJ}K!\e(B(TIPS)
 
 @subsection \e$B%5%^%j$NI=<(FbMF\e(B
 
-\e$B%U%)%k%@%b!<%I$GFI$_$?$$%U%)%k%@$rA*Br$9$k$H!"%5%^%j%b!<%I$K0\F0$7$^$9!#\e(B
 \e$B%5%^%j%b!<%I$K$O!"0J2<$N$h$&$K%a%C%;!<%8$N0lMw$,I=<($5$l$^$9!#\e(B
 
 @example
+@group
   377  09/16(\e$B?e\e(B)11:57 [+1: \e$BKLL\$5$s\e(B       ] Bug?
   381  09/17(\e$BLZ\e(B)00:16 [+3: \e$B1|@>$5$s\e(B       ] elmo-lha.el -- LHA interface
   384  09/17(\e$BLZ\e(B)01:32 [+1: \e$B$F$i$K$7\e(B       ] wl-0.6.2
   389 N09/18(\e$B6b\e(B)01:07 [+2: \e$B$F$i$K$7\e(B       ] wl-0.6.3
+@end group
 @end example
 
 \e$B3F%a%C%;!<%8$O!"0l9T$K\e(B
@@ -2185,8 +2444,11 @@ NNTP \e$B%U%)%k%@$N%K%e!<%95-;v$rFI$`$3$H$,$G$-$^$9!#\e(B
 @kbd{N} \e$B$G<!$NL$FI!"\e(B@kbd{n} \e$B$G<!$N%a%C%;!<%8$rI=<($7$^$9!#\e(B
 @kbd{j} \e$B$r2!$9$H8=:_I=<(Cf$N%a%C%;!<%8$N%P%C%U%!$K0\F0$7$^$9!#\e(B
 \e$B%^%k%A%Q!<%H$NA`:n$O%a%C%;!<%8%P%C%U%!$K0\F0$7$F$+$i9T$$$^$9!#\e(B
+@xref{Message}.
+
 
-@subsection \e$B%9%l%C%I$NA`:n\e(B
+@node Thread Oparations, Cache, Usage of Summary mode, Summary
+@section \e$B%9%l%C%I$NA`:n\e(B
 
 \e$BNc$($P!"\e(B
 
@@ -2199,8 +2461,10 @@ NNTP \e$B%U%)%k%@$N%K%e!<%95-;v$rFI$`$3$H$,$G$-$^$9!#\e(B
 \e$B$3$N9T$G!"\e(B@kbd{/} \e$B$r2!$9$H$3$N%9%l%C%I$,3+$+$l!"<!$N$h$&$JI=<($K$J$j$^$9!#\e(B
 
 @example
+@group
   384  09/17(\e$BLZ\e(B)01:32 [ \e$B$F$i$K$7\e(B          ] wl-0.6.2
   388  09/17(\e$BLZ\e(B)22:34 \e$B(&\e(B[ \e$BB<ED$5$s\e(B          ]
+@end group
 @end example
 
 (388 \e$BHV$N%a%C%;!<%8$O\e(B 384 \e$BHV$N%a%C%;!<%8$KBP$9$kJV;v$G$9!#\e(B)
@@ -2209,6 +2473,10 @@ prefix argument \e$B$D$-$G\e(B @kbd{/} \e$B$r2!$9$H!"A4$F$N;R%9%l%C%I$r3+$-$^$9!#\e(
 
 @kbd{t} \e$B$+$i;O$^$k%3%^%s%I$G!"$=$N%9%l%C%I$KB0$9$k%a%C%;!<%8$KBP$7$F0l3g$7$F=hM}$r9T$&$3$H$,$G$-$^$9!#\e(B
 
+
+@node Cache, Auto Refile, Thread Oparations, Summary
+@section \e$B%-%c%C%7%e\e(B
+
 @subsection \e$B%-%c%C%7%e%U%!%$%k\e(B
 
 \e$B%M%C%H%o!<%/7PM3$N%a%C%;!<%8$O%-%c%C%7%e$5$l$^$9!#\e(B
@@ -2247,8 +2515,10 @@ imap4 \e$B$N%a%C%;!<%8$@$1$,@hFI$_$5$l$^$9!#\e(B
 
 \e$B$b$7!"\e(Blocaldir \e$B$H\e(B localnews \e$B%U%)%k%@$b@hFI$_$9$k>l9g$O<!$N$h$&$K;XDj$7$^$9!#\e(B
 @lisp
+@group
 (setq wl-cache-prefetch-folder-type-list
       '(nntp imap4 localdir localnews))
+@end group
 @end lisp
 
 @item wl-cache-prefetch-folder-list
@@ -2257,7 +2527,9 @@ imap4 \e$B$N%a%C%;!<%8$@$1$,@hFI$_$5$l$^$9!#\e(B
 \e$B@hFI$_5!G=$rM-8z$K$9$k%U%)%k%@$r%U%)%k%@L>\e(B(\e$B@55,I=8=\e(B)\e$B$N%j%9%H$G;XDj$7$^$9!#\e(B
 @end table
 
-@subsection \e$B<+F0%j%U%!%$%k\e(B
+
+@node Auto Refile, Sticky Summary, Cache, Summary
+@section \e$B<+F0%j%U%!%$%k\e(B
 @vindex elmo-msgdb-extra-fields
 @vindex wl-refile-rule-alist
 @findex wl-summary-auto-refile
@@ -2269,12 +2541,14 @@ msgdb \e$B$N\e(B overview \e$B>pJs$r85$K?6$jJ,$1$7$^$9!#\e(B
 \e$B$3$l0J30$N3HD%9`L\$G?6$jJ,$1$7$?$$$H$-$K$O!"\e(B
 
 @lisp
+@group
 (setq elmo-msgdb-extra-fields
       '("x-ml-name"
         "reply-to"
         "sender"
         "mailing-list"
         "newsgroups"))
+@end group
 @end lisp
 
 @noindent
@@ -2287,36 +2561,43 @@ msgdb \e$B$N\e(B overview \e$B>pJs$r85$K?6$jJ,$1$7$^$9!#\e(B
 @code{wl-refile-rule-alist} \e$B$O!"\e(B
 
 @example
-        (\e$B%U%#!<%k%I\e(B (\e$B@55,I=8=\e(B . \e$B?6$jJ,$1@h\e(B)
-                    (\e$B@55,I=8=\e(B . \e$B?6$jJ,$1@h\e(B)
-                    @dots{})
+@group
+(@var{\e$B%U%#!<%k%I\e(B} (@var{\e$B@55,I=8=\e(B} . @var{\e$B?6$jJ,$1@h\e(B})
+            (@var{\e$B@55,I=8=\e(B} . @var{\e$B?6$jJ,$1@h\e(B})
+            @dots{})
+@end group
 @end example
 
-\e$B$N$h$&$J%k!<%k$N%j%9%H$H$J$C$F$$$^$9!#3F%k!<%k$O!"!X%U%#!<%k%I!Y$NCM$,\e(B
-\e$B!X@55,I=8=!Y$K%^%C%A$9$k$H$-$K!X?6$jJ,$1@h!Y$K?6$jJ,$1$k$H$$$&0UL#$r;}$A\e(B
+\e$B$N$h$&$J%k!<%k$N%j%9%H$H$J$C$F$$$^$9!#3F%k!<%k$O!"!X\e(B@var{\e$B%U%#!<%k%I\e(B}\e$B!Y$NCM$,\e(B
+\e$B!X\e(B@var{\e$B@55,I=8=\e(B}\e$B!Y$K%^%C%A$9$k$H$-$K!X\e(B@var{\e$B?6$jJ,$1@h\e(B}\e$B!Y$K?6$jJ,$1$k$H$$$&0UL#$r;}$A\e(B
 \e$B$^$9!#A0J}$K;XDj$5$l$?%k!<%k$,M%@h$5$l$^$9!#\e(B
 
-\e$B!X%U%#!<%k%I!YItJ,$K$O!"%U%#!<%k%IL>$NJ8;zNs$r;XDj$7$^$9!#$^$?!"%U%#!<%k\e(B
+\e$B!X\e(B@var{\e$B%U%#!<%k%I\e(B}\e$B!YItJ,$K$O!"%U%#!<%k%IL>$NJ8;zNs$r;XDj$7$^$9!#$^$?!"%U%#!<%k\e(B
 \e$B%IL>$NJ8;zNs$N%j%9%H$r;XDj$9$k$3$H$b$G$-$^$9!#$3$N>l9g!"%j%9%H$N$$$:$l$+\e(B
 \e$B$N%U%#!<%k%I$NCM$,%^%C%A$7$?$H$-$KH/2P$7$^$9\e(B(OR \e$B>r7o$H$J$j$^$9\e(B)\e$B!#\e(B
 
-\e$B!X@55,I=8=!Y$K$O%U%#!<%k%I$NCM$K%^%C%A$5$;$k@55,I=8=J8;zNs$r;XDj$7$^$9!#\e(B
-\e$B!X?6$jJ,$1@h!Y$K$O?6$jJ,$1@h$N%U%)%k%@L>$NJ8;zNs$r;XDj$7$^$9!#!X?6$jJ,$1\e(B
-\e$B@h!YItJ,$K$O!":F$S%k!<%k$r=q$/$3$H$b$G$-!"$=$N>l9g!"$=$N%k!<%k$N%U%#!<%k\e(B
-\e$B%I$NCM$N>r7o$H8=:_$N%k!<%k$N%U%#!<%k%I$NCM$N>r7o$,K~$?$5$l$?$H$-$KH/2P$7\e(B
-\e$B$^$9\e(B(AND \e$B>r7o$H$J$j$^$9\e(B)\e$B!#\e(B
+\e$B!X\e(B@var{\e$B@55,I=8=\e(B}\e$B!Y$K$O%U%#!<%k%I$NCM$K%^%C%A$5$;$k@55,I=8=J8;zNs$r;XDj$7$^$9!#\e(B
+\e$B!X\e(B@var{\e$B?6$jJ,$1@h\e(B}\e$B!Y$K$O?6$jJ,$1@h$N%U%)%k%@L>$NJ8;zNs$r;XDj$7$^$9!#\e(B
+\e$B!X\e(B@var{\e$B?6$jJ,$1@h\e(B}\e$B!YItJ,$K$O!":F$S%k!<%k$r=q$/$3$H$b$G$-!"$=$N>l9g\e(B
+\e$B$=$N%k!<%k$N%U%#!<%k%I$NCM$N>r7o$H8=:_$N%k!<%k$N%U%#!<%k%I$NCM$N>r7o$,\e(B
+\e$BK~$?$5$l$?$H$-$KH/2P$7$^$9\e(B(AND \e$B>r7o$H$J$j$^$9\e(B)\e$B!#\e(B
 
-\e$B$^$?!"!X@55,I=8=!Y$G%^%C%A$7$?ItJ,J8;zNs$O!"!X?6$jJ,$1@h!Y$K0J2<$N\e(B
+\e$B$^$?!"!X\e(B@var{\e$B@55,I=8=\e(B}\e$B!Y$G%^%C%A$7$?ItJ,J8;zNs$O!"!X\e(B@var{\e$B?6$jJ,$1@h\e(B}\e$B!Y$K0J2<$N\e(B
 \e$B;XDj$r$9$k$3$H$G;2>H$G$-$^$9!#\e(B
 
-@example
-\&            \e$B%^%C%A$7$?J8;zNsA4BN$r;2>H$7$^$9!#\e(B
-\N (N \e$B$O?t;z\e(B) N \e$BHVL\$N\e(B `\(...\)' \e$B$K%^%C%A$7$?J8;zNs$r;2>H$7$^$9!#\e(B
-@end example
+@table @samp
+@item \&
+\e$B%^%C%A$7$?J8;zNsA4BN$r;2>H$7$^$9!#\e(B
+
+@item \@var{N}
+@var{N} \e$BHVL\$N\e(B `\(@dots{}\)' \e$B$K%^%C%A$7$?J8;zNs$r;2>H$7$^$9!#\e(B
+(@var{N} \e$B$O?t;z\e(B)
+@end table
 
 \e$B0J2<$O\e(B @code{wl-refile-rule-alist} \e$B$N0lNc$G$9!#\e(B
 
 @lisp
+@group
 (setq wl-refile-rule-alist
       '(("x-ml-name"
          ("^Wanderlust" . "+wl")
@@ -2326,6 +2607,7 @@ msgdb \e$B$N\e(B overview \e$B>pJs$r85$K?6$jJ,$1$7$^$9!#\e(B
         ("From"
          ("me@@gohome.org" . ("To" ("you@@gohome.org" . 
                                     "+from-me-to-you"))))))
+@end group
 @end lisp
 
 @kbd{C-o} (@code{wl-summary-auto-refile}) \e$B$G>r7o$K%^%C%A$7$?%a%C%;!<%8$K\e(B
@@ -2345,7 +2627,9 @@ msgdb \e$B$N\e(B overview \e$B>pJs$r85$K?6$jJ,$1$7$^$9!#\e(B
 @noindent
 \e$B$NMM$K\e(B @code{wl-summary-auto-refile-skip-marks} \e$B$r\e(B nil \e$B$K$7$^$9!#\e(B
 
-@subsection \e$B%9%F%#%C%-!<%5%^%j\e(B
+
+@node Sticky Summary, Key Bindings of Summary, Auto Refile, Summary
+@section \e$B%9%F%#%C%-!<%5%^%j\e(B
 @cindex Summary, Sticky
 @cindex Sticky Summary
 
@@ -2362,6 +2646,8 @@ msgdb \e$B$N\e(B overview \e$B>pJs$r85$K?6$jJ,$1$7$^$9!#\e(B
 \e$BJQ?t\e(B @code{wl-summary-always-sticky-folder-list} \e$B$K%U%)%k%@L>\e(B(\e$B@55,I=8=\e(B)
 \e$B$N%j%9%H$r@_Dj$9$k$3$H$K$h$j!"%U%)%k%@0\F0;~$K<+F0E*$K%9%F%#%C%-!<%5%^%j$H$9$k$3$H$b$G$-$^$9!#\e(B
 
+
+@node Key Bindings of Summary, Variables of Summary, Sticky Summary, Summary
 @section \e$B%-!<%P%$%s%I\e(B
 @cindex Keybind, Summary Mode
 @cindex Keybind, Summary Buffer
@@ -2409,6 +2695,15 @@ prefix argument \e$B$D$-$J$i$P%-%c%C%7%e$,B8:_$7$F$bL5;k$7$F:FFI$_9~$_$7D>$7$^$9!
 \e$BI=<(Cf$G$J$1$l$P!"I=<($7$^$9!#\e(B
 (@code{wl-summary-next-line-content})
 
+@item -
+@itemx M-@key{RET}
+@kindex - (Summary)
+@kindex M-@key{RET} (Summary)
+@findex wl-summary-prev-line-content
+\e$B%+!<%=%k9T$N%a%C%;!<%8$,I=<(Cf$G$"$l$P%a%C%;!<%8$r0l9T2<$K%9%/%m!<%k$7$^$9!#\e(B
+\e$BI=<(Cf$G$J$1$l$P!"I=<($7$^$9!#\e(B
+(@code{wl-summary-prev-line-content})
+
 @item /
 @kindex / (Summary)
 @findex wl-thread-open-close
@@ -2427,15 +2722,6 @@ prefix argument \e$B$D$-$J$i$P%-%c%C%7%e$,B8:_$7$F$bL5;k$7$F:FFI$_9~$_$7D>$7$^$9!
 @findex wl-thread-close-all
 (@code{wl-thread-close-all})
 
-@item -
-@itemx M-@key{RET}
-@kindex - (Summary)
-@kindex M-@key{RET} (Summary)
-@findex wl-summary-prev-line-content
-\e$B%+!<%=%k9T$N%a%C%;!<%8$,I=<(Cf$G$"$l$P%a%C%;!<%8$r0l9T2<$K%9%/%m!<%k$7$^$9!#\e(B
-\e$BI=<(Cf$G$J$1$l$P!"I=<($7$^$9!#\e(B
-(@code{wl-summary-prev-line-content})
-
 @item g
 @kindex g (Summary)
 @findex wl-summary-goto-folder
@@ -2535,9 +2821,9 @@ prefix argument \e$B$D$-$J$i$P%-%c%C%7%e$,B8:_$7$F$bL5;k$7$F:FFI$_9~$_$7D>$7$^$9!
 
 @item w
 @kindex w (Summary)
-@findex wl-draft
+@findex wl-summary-write
 \e$B?75,%I%i%U%H$rMQ0U$7$^$9!#\e(B
-(@code{wl-draft})
+(@code{wl-summary-write})
 
 @item W
 @kindex W (Summary)
@@ -2563,7 +2849,7 @@ prefix argument \e$B$D$-$J$i$P%-%c%C%7%e$,B8:_$7$F$bL5;k$7$F:FFI$_9~$_$7D>$7$^$9!
 @findex wl-summary-burst
 \e$B8=:_%+!<%=%k$,$"$k9T$N%a%C%;!<%8$,\e(B
 MIME \e$B$G%+%W%;%k2=$5$l$?J#?t$N%a%C%;!<%84^$`>l9g!"\e(B
-\e$B$=$l$i$r8=:_$N%U%)%k%@$K$[$I$-$^$9\e(B(\e$BL$<BAu\e(B)\e$B!#\e(B
+\e$B$=$l$i$r8=:_$N%U%)%k%@$K$[$I$-$^$9!#\e(B
 (@code{wl-summary-burst})
 
 @item @@
@@ -2590,9 +2876,14 @@ prefix argument \e$B$D$-$G<B9T$9$k$H!"G$0U$NF~NO%"%I%l%9$rEPO?\e(B/\e$BJQ99\e(B/\e$B:
 @kindex # (Summary)
 @findex wl-summary-print-message
 \e$B8=:_$N%a%C%;!<%8$NFbMF$r0u:~$7$^$9!#\e(B
-Emacs20 \e$B!A\e(B \e$B$G$O\e(B ps-print \e$B$r;H$$$^$9!#\e(B
+Emacs20 \e$B!A\e(B \e$B$G$O\e(B @code{ps-print} \e$B$r;H$$$^$9!#\e(B
 \e$BGr9u%W%j%s%?$G$O!"\e(B@code{wl-ps-print-buffer-func} \e$B$r\e(B
-'ps-print-buffer \e$B$K@_Dj$7$?$[$&$,$h$$$+$b$7$l$^$;$s!#\e(B
+@code{ps-print-buffer} \e$B$K@_Dj$7$?$[$&$,$h$$$+$b$7$l$^$;$s!#\e(B
+
+@lisp
+(setq wl-ps-print-buffer-func 'ps-print-buffer)
+@end lisp
+
 (@code{wl-summary-print-message})
 
 @item q
@@ -2624,7 +2915,7 @@ Emacs20 \e$B!A\e(B \e$B$G$O\e(B ps-print \e$B$r;H$$$^$9!#\e(B
 @item M-j
 @kindex M-j (Summary)
 @findex wl-summary-jump-to-msg-by-message-id
-\e$BF~NO$7$?%a%C%;!<%8\e(BID \e$B$r$b$D%a%C%;!<%8$N9T$K%8%c%s%W$7$^$9!#\e(B
+\e$BF~NO$7$?\e(B Message-ID \e$B$r$b$D%a%C%;!<%8$N9T$K%8%c%s%W$7$^$9!#\e(B
 @code{elmo-use-database} \e$B$,\e(B non-nil\e$B$J$i!"8=:_$N%5%^%j0J30$+$i$b\e(B
 \e$B8uJd$r8!:w$7$^$9!#\e(B
 (@code{wl-summary-jump-to-msg-by-message-id})
@@ -2647,11 +2938,13 @@ Emacs20 \e$B!A\e(B \e$B$G$O\e(B ps-print \e$B$r;H$$$^$9!#\e(B
 \e$B%a%C%;!<%8$N0lMwI=<($N99?7%l%s%8\e(B(all, update, rescan, first, last)\e$B$NF~NO$r<u$1IU$1$?$N$A!"$=$l$K$b$H$E$$$F%a%C%;!<%8$N0lMwI=<($r99?7$7$^$9!#\e(B
 
 @example
+@group
 all            ...\e$B$9$Y$F99?7\e(B
 update         ...\e$B8=:_$NI=<($r99?7\e(B
 rescan         ...\e$B8=:_$N\e(B msgdb \e$B$NFbMF$r:FI=<(\e(B
 rescan-noscore ...\e$B8=:_$N\e(B msgdb \e$B$NFbMF$r:FI=<(\e(B(\e$B%9%3%"$J$7\e(B)
 first, last    ...\e$B%U%#%k%?%U%)%k%@$K0\F0\e(B
+@end group
 @end example
 
 @noindent
@@ -2669,8 +2962,8 @@ Date(\e$BF|IU\e(B) From(\e$BH/?.<T\e(B) Number(\e$B%a%C%;!<%8HV9f\e(B) Subject(\e$B%5%V
 @findex wl-summary-toggle-thread
 \e$B%9%l%C%II=<($r%H%0%k$7$^$9!#\e(B
 \e$B8=:_$N%9%l%C%II=<(>uBV$O%b!<%I%i%$%s$KI=<($5$l$^$9!%\e(B
-@{S@} \e$B$O%9%l%C%I!&%*%U\e(B(Sequence)\e$B$N>uBV!$\e(B
-@{T@} \e$B$O%9%l%C%I!&%*%s\e(B(Thread)\e$B$N>uBV$r<($7$^$9!%\e(B
+@samp{@{S@}} \e$B$O%9%l%C%I!&%*%U\e(B(Sequence)\e$B$N>uBV!$\e(B
+@samp{@{T@}} \e$B$O%9%l%C%I!&%*%s\e(B(Thread)\e$B$N>uBV$r<($7$^$9!%\e(B
 (@code{wl-summary-toggle-thread})
 
 @item l
@@ -2713,6 +3006,8 @@ prefix argument \e$B$D$-$G<B9T$9$k$H2>A[%U%)%k%@$+$iC&=P$7$^$9!#\e(B
 @item i
 @kindex i (Summary)
 \e$B%+!<%=%k9T$N%a%C%;!<%8$r%W%j%U%'%C%A$7$^$9!#\e(B
+prefix argument \e$B$D$-$J$i$P$9$G$K%-%c%C%7%e$5$l$F$$$k%a%C%;!<%8$b\e(B
+\e$B:FEY%W%j%U%'%C%A$7$^$9!#\e(B
 @findex wl-summary-prefetch
 (@code{wl-summary-prefetch})
 
@@ -2835,7 +3130,6 @@ prefix argument \e$B$D$-$G<B9T$9$k$H2>A[%U%)%k%@$+$iC&=P$7$^$9!#\e(B
 @item r y
 @kindex r y (Summary)
 \e$B;XDj%j!<%8%g%s$K$"$k%a%C%;!<%8$rJ]B8$7$^$9!#\e(B
-\e$B8=:_%+!<%=%k$,$"$k9T$N\e(B
 @findex wl-summary-save-region
 (@code{wl-summary-save-region})
 
@@ -3039,6 +3333,8 @@ Wanderlust \e$B$N%5!<%P!&%]!<%HJL$N%*%U%i%$%s\e(B/\e$B%*%s%i%$%s$rJQ99$7$^$9!#\e(B
 (@code{wl-jump-to-draft-buffer})
 @end table
 
+
+@node Variables of Summary,  , Key Bindings of Summary, Summary
 @section \e$B%+%9%?%^%$%:JQ?t\e(B
 
 @table @code
@@ -3090,7 +3386,7 @@ Non-nil \e$B$J$i%5%^%j$GB>$N%U%)%k%@$K0\F0$9$k$H%U%)%k%@%b!<%I$G$N%+!<%=%k0LCV$b9
 
 @item wl-summary-fix-timezone
 @vindex  wl-summary-fix-timezone
-\e$B=i4|@_Dj$O\e(B "JST"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{JST}\e$B!#\e(B
 \e$B%5%^%j$NF|;~I=<($r;XDj$7$?%?%$%`%>!<%s$KD>$7$^$9!#\e(B
 nil \e$B$J$i\e(B GMT \e$B$KD>$7$^$9!#\e(B
 
@@ -3123,12 +3419,12 @@ nil \e$B$J$i%5%^%j$N\e(B indent \e$B$rL5@)8B$K$7$^$9!#\e(B
 
 @item wl-summary-no-from-message
 @vindex  wl-summary-no-from-message
-\e$B=i4|@_Dj$O\e(B "nobody@@nowhere?"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{nobody@@nowhere?}\e$B!#\e(B
 \e$B%a%C%;!<%8$K\e(B From: \e$B$,L5$+$C$?>l9g$K%5%^%j$KI=<($9$kJ8;zNs$G$9!#\e(B
 
 @item wl-summary-no-subject-message
 @vindex  wl-summary-no-subject-message
-\e$B=i4|@_Dj$O\e(B "(WL:No Subject in original.)"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{(WL:No Subject in original.)}\e$B!#\e(B
 \e$B%a%C%;!<%8$K\e(B Subject: \e$B$,L5$+$C$?>l9g$K%5%^%j$KI=<($9$kJ8;zNs$G$9!#\e(B
 
 @item wl-summary-width
@@ -3140,8 +3436,8 @@ nil \e$B$J$iI=<(I}$r@Z$j5M$a$^$;$s!#\e(B
 @item wl-use-folder-petname
 @vindex  wl-use-folder-petname
 \e$B=i4|@_Dj$O\e(B '(modeline)\e$B!#\e(B
-petname \e$B$r;HMQ$9$k>l=j\e(B(symbol)\e$B$N%j%9%H$r;XDj$7$^$9!#\e(B
-\e$B;XDj$G$-$k\e(B symbol \e$B$O<!$NDL$j$G$9!#\e(B
+\e$B%U%)%k%@$N$"$@L>\e(B (petname) \e$B$r;HMQ$9$k>l=j\e(B(\e$B%7%s%\%k\e(B)\e$B$N%j%9%H$r;XDj$7$^$9!#\e(B
+\e$B;XDj$G$-$k%7%s%\%k$O<!$NDL$j$G$9!#\e(B
 
 @table @code
 @item modeline
@@ -3250,9 +3546,6 @@ nil \e$B$K$9$k$H!"$I$s$JBg$-$5$N%a%C%;!<%8$G$b@hFI$_$r<B9T$7$^$9!#\e(B
 @end table
 
 
-@c
-@c  Message
-@c
 @node Message, Draft, Summary, Top
 @chapter \e$B%a%C%;!<%8%P%C%U%!\e(B
 
@@ -3307,9 +3600,6 @@ nil \e$B$K$9$k$H!"$I$s$JBg$-$5$N%a%C%;!<%8$G$b@hFI$_$r<B9T$7$^$9!#\e(B
 @end table
 
 
-@c
-@c  Draft
-@c
 @node Draft, Disconnected Operations, Message, Top
 @chapter \e$B%I%i%U%H%P%C%U%!\e(B
 
@@ -3335,7 +3625,7 @@ FCC: \e$B%U%#!<%k%I$GAw?.$7$?%a%C%;!<%8$N%3%T!<$rJ]B8$7$F$*$/%U%)%k%@$r;XDj$9$k$3
 
 \e$B%^%k%A%Q!<%H$NJT=8$O\e(B SEMI/tm \e$B$N\e(B MIME \e$BJT=8%b!<%I$rMxMQ$7$F$$$^$9!#\e(B
 \e$BJT=8$NJ}K!$O3F%Q%C%1!<%8IUB0$N%I%-%e%a%s%H$r;2>H$7$F$/$@$5$$!#\e(B
-@xref{Mail Methods, , ,mime-ui-ja, a MIME user interface for GNU Emacs}.
+@xref{MIME-Edit, , ,mime-ui-ja, a MIME user interface for GNU Emacs}.
 
 @subsection \e$B%a%C%;!<%8$NF0E*$JJQ99\e(B
 @vindex wl-draft-config-alist
@@ -3355,6 +3645,7 @@ FCC: \e$B%U%#!<%k%I$GAw?.$7$?%a%C%;!<%8$N%3%T!<$rJ]B8$7$F$*$/%U%)%k%@$r;XDj$9$k$3
 \e$B$KJQ99E@$,3NG'$G$-$k$N$G0B?4$G$9!#\e(B
 
 @lisp
+@group
 (setq wl-draft-config-alist
       '(((string-match "aaa.ne.jp$" (system-name))
          ;; @r{\e$B<0$,\e(Bnon-nil\e$B$J$iE,MQ$9$k\e(B}
@@ -3369,11 +3660,13 @@ FCC: \e$B%U%#!<%k%I$GAw?.$7$?%a%C%;!<%8$N%3%T!<$rJ]B8$7$F$*$/%U%)%k%@$r;XDj$9$k$3
          (top . "  \e$B!{!{$G$9!#\e(B\n")    ;; @r{\e$BK\J8@hF,$XJ8;zNs$rA^F~$7$^$9\e(B}
          (bottom . "\n\e$B0J>e$G$9!#\e(B\n") ;; @r{\e$BK\J8KvHx$XJ8;zNs$rA^F~$7$^$9\e(B}
         ))
+@end group
 @end lisp
 
 @code{wl-draft-config-alist} \e$B$O<!$N7A<0$K$J$C$F$$$^$9!#\e(B
 
 @example
+@group
 '(("\e$B%X%C%@$N@55,I=8=\e(B" \e$B$^$?$O\e(B elisp\e$B<0\e(B
    ("Field" . \e$BCM\e(B(elisp\e$B<0\e(B))
    (variable . \e$BCM\e(B(elisp\e$B<0\e(B))
@@ -3383,6 +3676,7 @@ FCC: \e$B%U%#!<%k%I$GAw?.$7$?%a%C%;!<%8$N%3%T!<$rJ]B8$7$F$*$/%U%)%k%@$r;XDj$9$k$3
   ("\e$B%X%C%@$N@55,I=8=\e(B" \e$B$^$?$O\e(B elisp\e$B<0\e(B
    ("Field" . \e$BCM\e(B(elisp\e$B<0\e(B))
    @dots{}))
+@end group
 @end example
 
 [\e$B%5%V4X?t\e(B]\e$B$K$O!"%G%U%)%k%H$G0J2<$N\e(B10\e$B8D$,MQ0U$5$l$F$$$^$9!#\e(B
@@ -3390,7 +3684,7 @@ FCC: \e$B%U%#!<%k%I$GAw?.$7$?%a%C%;!<%8$N%3%T!<$rJ]B8$7$F$*$/%U%)%k%@$r;XDj$9$k$3
 @example
 'header:      \e$B%X%C%@$NKvHx$K;XDj$7$?J8;zNs$rA^F~$7$^$9!#\e(B
 'header-file: \e$B%X%C%@$NKvHx$K;XDj$7$?%U%!%$%k$rA^F~$7$^$9!#\e(B
-'x-face:      \e$B;XDj$7$?%U%!%$%k$NFbMF$r$b$D\e(B "X-Face" \e$B%U%#!<%k%I$r\e(B
+'x-face:      \e$B;XDj$7$?%U%!%$%k$NFbMF$r$b$D\e(B @samp{X-Face:} \e$B%U%#!<%k%I$r\e(B
               \e$BA^F~$7$^$9!#\e(B
 'top:         \e$BK\J8$N@hF,$K;XDj$7$?J8;zNs$rA^F~$7$^$9!#\e(B
 'top-file:    \e$BK\J8$N@hF,$K;XDj$7$?%U%!%$%k$rA^F~$7$^$9!#\e(B
@@ -3426,6 +3720,7 @@ nil \e$B$J$i$P$=$N\e(B Field \e$B$r:o=|$7$^$9!#\e(B
 \e$B$D$E$$$F!"<!$NNc$r8+$F2<$5$$!#\e(B
 
 @lisp
+@group
 (setq wl-draft-config-alist
       '((reply                         ;; @r{(1)}
          "X-ML-Name: \\(Wanderlust\\|emacs-mime-ja\\|apel-ja\\)"
@@ -3433,6 +3728,7 @@ nil \e$B$J$i$P$=$N\e(B Field \e$B$r:o=|$7$^$9!#\e(B
          (body . "  \e$B$3$s$K$A$O\e(B\n")
          (template . "default")
          )))
+@end group
 @end lisp
 
 \e$B$3$NNc\e(B (1)\e$B$N$h$&$K!"%X%C%@$N@55,I=8=$NA0$K\e(B @code{reply} \e$B$r$D$1$k$H\e(B
@@ -3455,7 +3751,7 @@ nil \e$B$J$i$P$=$N\e(B Field \e$B$r:o=|$7$^$9!#\e(B
 @end lisp
 
 @subsection \e$B%F%s%W%l!<%H$NA^F~\e(B
-@cindex Templete
+@cindex Template
 @cindex Apply Template
 
 \e$BJQ?t\e(B @code{wl-template-alist} \e$B$r@_Dj$7!"\e(B
@@ -3465,6 +3761,7 @@ nil \e$B$J$i$P$=$N\e(B Field \e$B$r:o=|$7$^$9!#\e(B
 @code{wl-template-alist} \e$B$N=q<0$O\e(B @code{wl-draft-config-alist} \e$B$H$[$\F1$8$G$9!#\e(B
 
 @lisp
+@group
 (setq wl-template-alist
       '(("default"
          ("From" . wl-from)
@@ -3477,9 +3774,10 @@ nil \e$B$J$i$P$=$N\e(B Field \e$B$r:o=|$7$^$9!#\e(B
          (body-file . "~/work/report.txt")
          )
         ))
+@end group
 @end lisp
 
-\e$B$3$N$h$&$K%X%C%@$N@55,I=8=$NBe$o$j$K\e(B "default" \e$B$d\e(B "report" \e$B$N$h$&$K3F\e(B
+\e$B$3$N$h$&$K%X%C%@$N@55,I=8=$NBe$o$j$K\e(B @samp{default} \e$B$d\e(B @samp{report} \e$B$N$h$&$K3F\e(B
 \e$BMWAG$NL>A0\e(B(\e$B%F%s%W%l!<%HL>\e(B)\e$B$r$D$1$k$@$1$G$9!#\e(B
 \e$B3FMWAG$NDj5A$O\e(B @code{wl-draft-config-alist} \e$B$HF1$8$G$"$k$N$G!"\e(B
 (a)\e$B$N$h$&$KJL$N%F%s%W%l!<%H$r8F$V$3$H$b2DG=$G$9!#\e(B
@@ -3504,7 +3802,7 @@ nil \e$B$J$i$P$=$N\e(B Field \e$B$r:o=|$7$^$9!#\e(B
 @end example
 
 @noindent
-\e$B$H=q$/$3$H$G\e(B "default" \e$B$N%F%s%W%l!<%H$rE,MQ$9$k$3$H$,$G$-$^$9!#\e(B
+\e$B$H=q$/$3$H$G\e(B @samp{default} \e$B$N%F%s%W%l!<%H$rE,MQ$9$k$3$H$,$G$-$^$9!#\e(B
 
 @subsection POP-before-SMTP\e$B$K$h$k%a!<%k$NAw?.\e(B
 @cindex POP-before-SMTP
@@ -3553,8 +3851,10 @@ POP \e$B%U%)%k%@$N@_Dj\e(B (@code{elmo-default-pop3-*}) \e$B$,MQ$$$i$l$^$9!#\e(B
 \e$B$J$*!"\e(BPOP-before-SMTP\e$B$K$D$$$F$O0J2<$r;2>H$7$F$/$@$5$$!#\e(B
 
 @example
+@group
 http://spam.ayamura.org/tools/smPbS.html
 http://www.iecc.com/pop-before-smtp.html
+@end group
 @end example
 
 @section \e$B%-!<%P%$%s%I\e(B
@@ -3654,7 +3954,7 @@ Wanderlust \e$B$N%*%U%i%$%s%b!<%I\e(B/\e$B%*%s%i%$%s%b!<%I$r%H%0%k$7$^$9!#\e(B
 \e$B%U%!%$%k\e(B @file{~/.xface} (\e$BJQ?t\e(B @code{wl-x-face-file} \e$B$NCM\e(B) \e$B$NFbMF$r\e(B
 \e$B%I%i%U%H%P%C%U%!$K\e(B X-Face\e$B%U%#!<%k%I$H$7$FA^F~$7$^$9!#\e(B
 
-Encode \e$B$5$l$?\e(B X-Face \e$BJ8;zNs$r$"$i$+$8$a%U%!%$%k\e(B @file{~/.xface}
+\e$B%(%s%3!<%I$5$l$?\e(B X-Face \e$BJ8;zNs$r$"$i$+$8$a%U%!%$%k\e(B @file{~/.xface}
 \e$B$NFbMF$KMQ0U$7$F$*$/I,MW$,$"$j$^$9!#\e(B
 (@code{wl-draft-insert-x-face-field})
 @end table
@@ -3686,40 +3986,40 @@ Non-nil \e$B$J$i!"\e(BMail-Reply-To \e$B%U%#!<%k%I$r\e(B
 @item wl-auto-insert-x-face
 @vindex wl-auto-insert-x-face
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
-Non-nil \e$B$G$+$D!"\e(BEncode \e$B$5$l$?\e(B X-Face \e$BJ8;zNs$r\e(B @file{~/.xface}
-(\e$BJQ?t\e(B @code{wl-x-face-file} \e$B$NCM$G$9\e(B)\e$B$NFbMF$KMQ0U$7$F$*$/$H!"\e(B
-\e$B%I%i%U%H$,=`Hw$5$l$k$H$-$K<+F0E*$K\e(B X-Face\e$B%U%#!<%k%I$H$7$FA^F~$5$l$^$9!#\e(B
-nil\e$B$N>l9g$O<+F0E*$K$OA^F~$5$l$^$;$s$,!"\e(B@kbd{C-c C-a} \e$B$r2!$9$H%X%C%@It$K\e(B
-\e$BA^F~$5$l$^$9!#\e(B
+Non-nil \e$B$G$+$D!"%(%s%3!<%I$5$l$?\e(B X-Face \e$BJ8;zNs$r\e(B @file{~/.xface} (\e$BJQ?t\e(B 
+@code{wl-x-face-file} \e$B$NCM$G$9\e(B)\e$B$NFbMF$KMQ0U$7$F$*$/$H!"%I%i%U%H$,=`Hw$5\e(B
+\e$B$l$k$H$-$K<+F0E*$K\e(B @samp{X-Face:} \e$B%U%#!<%k%I$H$7$FA^F~$5$l$^$9!#\e(Bnil\e$B$N>l\e(B
+\e$B9g$O<+F0E*$K$OA^F~$5$l$^$;$s$,!"\e(B@kbd{C-c C-a} \e$B$r2!$9$H%X%C%@It$KA^F~$5$l\e(B
+\e$B$^$9!#\e(B
 
 @item wl-insert-message-id
 @vindex wl-insert-message-id
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
-Non-nil \e$B$J$i!"Aw?.;~$K\e(B Message-ID \e$B%U%#!<%k%I$r<+F0E*$KA^F~$7$^$9!#\e(B
+Non-nil \e$B$J$i!"Aw?.;~$K\e(B @samp{Message-ID:} \e$B%U%#!<%k%I$r<+F0E*$KA^F~$7$^$9!#\e(B
 
 @item wl-local-domain
 @vindex wl-local-domain
 \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
-nil \e$B$J$i$P\e(B Message-ID \e$B$N%I%a%$%s%Q!<%H$O4X?t\e(B @code{system-name} \e$B$NJVCM$,\e(B
-\e$B@_Dj$5$l$^$9!#\e(B
-@code{system-name} \e$B$,\e(B FQDN (\e$B$D$^$j!"\e(B@samp{smtp.gohome.org} \e$B$N$h$&$J\e(B
-\e$B%[%9%H$N%U%k%M!<%`\e(B) \e$B$rJV$5$J$$>l9g$O!"\e(B
-\e$B$3$NJQ?t$K\e(B @strong{\e$BI,$:\e(B} \e$B%[%9%HL>$r=|$$$?%I%a%$%sL>\e(B (@samp{gohome.org}\e$B$J$I\e(B) \e$B$r\e(B
-\e$B@_Dj$7$F$/$@$5$$!#\e(B \e$B$b$7!"%0%m!<%P%k$J\e(BIP\e$B$r;}$?$J$$>l9g$O!"\e(B
-@code{wl-message-id-domain}\e$B$r@_Dj$7$F$/$@$5$$!#\e(B
-(Message-ID \e$B$N%I%a%$%s$,$*$+$7$$$H!"\e(B
-\e$B%M%C%H%K%e!<%9$G$U$/$mC!$-$K$"$C$F$7$^$&2DG=@-$,$"$j$^$9!#\e(B)
-\e$B$^$?!"$3$NCM$,@_Dj$5$l$F$$$k>l9g!"\e(B
-@code{system-name} \e$B$K$3$NCM$rIU2C$7$?%[%9%HL>$,\e(B
-SMTP \e$B$N\e(B HELO \e$B$N0z?t$H$7$FMxMQ$5$l$^$9!#\e(B
+nil \e$B$J$i$P\e(B @samp{Message-ID:} \e$B$N%I%a%$%s%Q!<%H$O4X?t\e(B @code{system-name} 
+\e$B$NJVCM$,@_Dj$5$l$^$9!#\e(B
+
+@code{system-name} \e$B$,\e(B FQDN (@samp{smtp.gohome.org} \e$B$N$h$&$J%[%9%H$N%U%k\e(B
+\e$B%M!<%`\e(B) \e$B$rJV$5$J$$>l9g$O!"$3$NJQ?t$K\e(B @strong{\e$BI,$:\e(B} \e$B%[%9%HL>$r=|$$$?%I%a\e(B
+\e$B%$%sL>\e(B (@samp{gohome.org}\e$B$J$I\e(B) \e$B$r@_Dj$7$F$/$@$5$$!#\e(B \e$B$b$7!"%0%m!<%P%k$J\e(BIP
+\e$B$r;}$?$J$$>l9g$O!"\e(B@code{wl-message-id-domain}\e$B$r@_Dj$7$F$/$@$5$$!#\e(B
+(@samp{Message-ID:} \e$B$N%I%a%$%s$,$*$+$7$$$H!"%M%C%H%K%e!<%9$G$U$/$mC!$-$K\e(B
+\e$B$"$C$F$7$^$&2DG=@-$,$"$j$^$9!#\e(B)
+
\e$B$^$?!"$3$NCM$,@_Dj$5$l$F$$$k>l9g!"\e(B@code{system-name} \e$B$K$3$NCM$rIU2C$7$?\e(B
+\e$B%[%9%HL>$,\e(B SMTP \e$B$N\e(B HELO \e$B$N0z?t$H$7$FMxMQ$5$l$^$9!#\e(B
 
 @item wl-message-id-domain
 @vindex wl-message-id-domain
 \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
-Non-nil \e$B$J$i!"\e(BMessage-ID \e$B$N%I%a%$%s%Q!<%H$K;HMQ$5$l$^$9!#\e(B
-\e$B%0%m!<%P%k$J\e(B IP \e$B$r;}$?$J$$>l9g$J$I!"%I%a%$%s%Q!<%H$r7h$a$i$l$J$$>l9g$O!"\e(B
-@code{wl-message-id-domain} \e$B$K0l0U$JJ8;zNs\e(B
-(\e$BNc$($P!"%a!<%k%"%I%l%9$J$I\e(B)\e$B$r@_Dj$7$F$/$@$5$$!#\e(B
+Non-nil \e$B$J$i!"\e(B@samp{Message-ID:} \e$B$N%I%a%$%s%Q!<%H$K;HMQ$5$l$^$9!#%0%m!<\e(B
+\e$B%P%k$J\e(B IP \e$B$r;}$?$J$$>l9g$J$I!"%I%a%$%s%Q!<%H$r7h$a$i$l$J$$>l9g$O!"\e(B
+@code{wl-message-id-domain} \e$B$K0l0U$JJ8;zNs\e(B(\e$BNc$($P!"%a!<%k%"%I%l%9$J$I\e(B)\e$B$r\e(B
+\e$B@_Dj$7$F$/$@$5$$!#\e(B
 
 @item wl-draft-config-alist
 @vindex wl-draft-config-alist
@@ -3765,10 +4065,15 @@ Non-nil \e$B$J$i%&%#%s%I%&$rI=<($7$J$,$i%F%s%W%l!<%H$rA*Br$9$k>l9g!"%j%?!<%s\e(B
 'full \e$B$J$iJV;v$r=q$/$H$-$K%U%l!<%`A4BN$r;H$C$?%I%i%U%H%P%C%U%!$,\e(B
 \e$BMQ0U$5$l$^$9!#\e(B
 
+@item wl-draft-use-frame
+@vindex wl-draft-use-frame
+\e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
+Non-nil \e$B$J$i%I%i%U%HMQ$K?7$7$$%U%l!<%`$r3+$-$^$9!#\e(B
+
 @item wl-from
 @vindex wl-from
 \e$B=i4|@_Dj$OJQ?t\e(B @code{user-mail-address} \e$B$NCM!#\e(B
-\e$B@_Dj$5$l$?CM$r%I%i%U%H$N\e(B From \e$B%U%#!<%k%I$H$7$F:G=i$+$iA^F~$7$^$9!#\e(B
+\e$B@_Dj$5$l$?CM$r%I%i%U%H$N\e(B @samp{From:} \e$B%U%#!<%k%I$H$7$F:G=i$+$iA^F~$7$^$9!#\e(B
 
 @item wl-envelope-from
 @vindex wl-envelope-from
@@ -3785,34 +4090,46 @@ nil \e$B$J$i\e(B @code{wl-from} \e$B$N%"%I%l%9ItJ,$r;HMQ$7$^$9!#\e(B
 @item wl-fcc
 @vindex wl-fcc
 \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
-Non-nil \e$B$J$i!"@_Dj$5$l$?CM$r%I%i%U%H$N\e(B FCC \e$B$H$7$F:G=i$+$iA^F~$7$^$9!#\e(B
+Non-nil \e$B$J$i!"@_Dj$5$l$?CM$r%I%i%U%H$N\e(B @samp{Fcc:} \e$B$H$7$F:G=i$+$iA^F~$7$^$9!#\e(B
+\e$B4X?t$,;XDj$5$l$F$?>l9g!"4X?t$NJV$jCM\e(B(string) \e$B$,A^F~$5$l$^$9!#\e(B
 
 @item wl-bcc
 @vindex wl-bcc
 \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
-Non-nil \e$B$J$i!"@_Dj$5$l$?CM$r%I%i%U%H$N\e(B Bcc \e$B$H$7$F:G=i$+$iA^F~$7$^$9!#\e(B
+Non-nil \e$B$J$i!"@_Dj$5$l$?CM$r%I%i%U%H$N\e(B @samp{Bcc:} \e$B$H$7$F:G=i$+$iA^F~$7$^$9!#\e(B
 
 @item wl-reply-subject-prefix
 @vindex wl-reply-subject-prefix
 \e$B=i4|@_Dj$O\e(B "Re: "\e$B!#\e(B
 \e$BJV?.;~$N%I%i%U%H$N\e(B Subject \e$B$G!"855-;v$N\e(B Subject \e$B$N@hF,$KIU$12C$($kJ8;zNs$G$9!#\e(B
 
+@item wl-draft-reply-use-address-with-full-name
+@vindex wl-draft-reply-use-address-with-full-name
+\e$B=i4|@_Dj$O\e(B @code{t}\e$B!#\e(B
+Non-nil \e$B$J$iJV?.%"%I%l%9$N\e(B @samp{To:}, @samp{Cc:} \e$B%U%#!<%k%I$KAj<j$N%U%k\e(B
+\e$B%M!<%`$rA^F~$7$^$9!#\e(Bnil \e$B$J$i%"%I%l%9$@$1$rA^F~$7$^$9!#\e(B
+
 @item wl-draft-enable-queuing
 @vindex wl-draft-enable-queuing
-\e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @code{t}\e$B!#\e(B
 \e$B%*%U%i%$%sAw?.$9$k$+$I$&$+$r<($9%U%i%0$G$9!#\e(BNon-nil \e$B$J$i%*%U%i%$%sAw?.$7$^$9!#\e(B
 
+@item wl-draft-use-cache
+@vindex wl-draft-use-cache
+\e$B=i4|@_Dj$O\e(B @code{t}\e$B!#\e(B
+\e$BAw?.$9$k%a%C%;!<%8$r%-%c%C%7%e$9$k$+$I$&$+$r<($9%U%i%0$G$9!#\e(BNon-nil \e$B$J$i%-%c%C%7%e$7$^$9!#\e(B
+
 @item wl-auto-flush-queue
 @vindex wl-auto-flush-queue
-\e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @code{t}\e$B!#\e(B
 \e$B%*%s%i%$%s$K$J$C$?$H$-$K<+F0E*$K%-%e!<$rAw?.$9$k$+$I$&$+$r<($9%U%i%0$G$9!#\e(B
 Non-nil \e$B$J$i<+F0E*$KAw?.$7$^$9\e(B (\e$B$$$A$*$&\e(B @code{y-or-n-p} \e$B$G3NG'$7$^$9\e(B)\e$B!#\e(B
 \e$B<jF0$G%-%e!<$rAw?.$9$k$K$O!"%U%)%k%@%b!<%I$G\e(B @kbd{F} \e$B$r2!$7$F$/$@$5$$!#\e(B
 
 @item wl-draft-always-delete-myself
 @vindex wl-draft-always-delete-myself
-Non-nil \e$B$J$i!"<+J,08$F$N%a!<%k$KJV?.$9$k>l9g!">o$K\e(B To, Cc \e$B$+$i<+J,$N\e(B
-\e$B%a!<%k%"%I%l%9$r:o=|$7$^$9!#\e(B
+Non-nil \e$B$J$i!"<+J,08$F$N%a!<%k$KJV?.$9$k>l9g!">o$K\e(B @samp{To:},
+@samp{Cc:} \e$B$+$i<+J,$N%a!<%k%"%I%l%9$r:o=|$7$^$9!#\e(B
 
 @item wl-smtp-posting-server
 @vindex wl-smtp-posting-server
@@ -3830,7 +4147,7 @@ nil\e$B$J$i\e(B @code{smtp-authenticate-user} \e$B$r;H$$$^$9!#\e(B
 \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
 SMTP AUTH\e$B$K$h$kG'>Z$r9T$J$&$H$-$NG'>ZJ}<0$G$9!#\e(B
 nil\e$B$N$^$^$J$i\e(B @code{smtp-authenticate-type}\e$B$rMxMQ$7$^$9!#\e(B
-\e$B$=$l$G$b!"\e(Bnil\e$B$J$iG'>Z$r9T$$$^$;$s!#\e(B
+@code{smtp-authenticate-type} \e$B$b\e(B nil \e$B$J$iG'>Z$r9T$$$^$;$s!#\e(B
 
 @item wl-smtp-connection-type
 @vindex wl-smtp-connection-type
@@ -3905,27 +4222,63 @@ nil\e$B$N$^$^$J$i\e(B @code{elmo-default-pop3-ssl}\e$B$rMxMQ$7$^$9!#\e(B
 @vindex wl-draft-sendlog
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
 t \e$B$J$i\e(B @file{~/.elmo/sendlog} \e$B$KAw?.%m%0$r=PNO$7$^$9!#\e(B
-\e$B%m%0$r=PNO$9$k%?%$%_%s%0$O\e(B smtp, qmail \e$B$K$h$kAw?.!"\e(Bfcc, queuing \e$B$K$h$k%U%)\e(B
-\e$B%k%@$X$N3JG<!"$G$9\e(B(\e$B<:GT$N>l9g$b\e(B)\e$B!#$?$@$7!"\e(Bim-wl.el \e$B$K$h$kAw?.$O\e(B sendlog \e$B$K\e(B
-\e$B$O=PNO$;$:$K\e(B imput \e$B$N%m%05!G=$K$*$^$+$;$7$^$9!#\e(B
+\e$B%m%0$r=PNO$9$k%?%$%_%s%0$O0J2<$NDL$j$G$9\e(B(\e$B<:GT$N>l9g$b\e(B)\e$B!#\e(B
+
+@itemize @minus
+@item smtp, qmail \e$B$K$h$kAw?.\e(B
+@item fcc \e$B$K$h$k%U%)%k%@$X$N3JG<\e(B
+@item queuing \e$B$K$h$k%U%)%k%@$X$N3JG<\e(B
+@end itemize
+
+\e$B$?$@$7!"\e(B@file{im-wl.el} \e$B$K$h$kAw?.$G$O!"\e(B
+@file{sendlog} \e$B$K$O=PNO$;$:$K\e(B imput \e$B$N%m%05!G=$K$*$^$+$;$7$^$9!#\e(B
 
 @item wl-draft-sendlog-max-size
 @vindex wl-draft-sendlog-max-size
 \e$B=i4|@_Dj$O\e(B 20000 (\e$B%P%$%H\e(B)\e$B!#\e(B
 @code{wl-draft-sendlog} \e$B$,\e(B t \e$B$N>l9g!"\e(B
 \e$BJ]B8$7$?%m%0$NBg$-$5$,;XDj$7$?Bg$-$50J>e$K$J$l$P!"%m%0$r%m!<%F!<%7%g%s$7$^$9!#\e(B
+
+@item wl-use-ldap
+@vindex wl-use-ldap
+\e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
+Non-nil\e$B$J$i\e(B LDAP \e$B$rMxMQ$7$F%"%I%l%9Jd40$7$^$9!#\e(B
+
+@item wl-ldap-server
+@vindex wl-ldap-server
+\e$B=i4|@_Dj$O\e(B "localhost"\e$B!#\e(B
+\e$B%"%I%l%9Jd40$KMQ$$$k\e(B LDAP \e$B%5!<%PL>$G$9!#\e(B
+
+@item wl-ldap-port
+@vindex wl-ldap-port
+\e$B=i4|@_Dj$O\e(B nil\e$B!%\e(B
+\e$B%"%I%l%9Jd40$KMQ$$$k\e(B LDAP \e$B%5!<%P$N%]!<%HHV9f$G$9!#\e(B
+
+@item wl-ldap-base
+@vindex wl-ldap-base
+\e$B=i4|@_Dj$O\e(B "c=US"
+\e$B%"%I%l%9Jd40;~$N\e(B LDAP \e$B8!:w$N3+;OE@\e(B(base)\e$B$r;XDj$7$^$9!#\e(B
 @end table
 
 
-@c
-@c  Dsiconnected Operations
-@c
 @node Disconnected Operations, Expire and Archive, Draft, Top
 @chapter \e$B%*%U%i%$%s=hM}\e(B
 @cindex Disconnected Operations
 @cindex Offline
 @cindex Unplugged
 
+Wanderlust \e$B$K$O%*%s%i%$%s%b!<%I$H%*%U%i%$%s%b!<%I$,$"$j$^$9!#\e(B
+
+@menu
+* Off-line State::              \e$B%*%U%i%$%s%b!<%I\e(B
+* Enable Operations::           \e$B%*%U%i%$%s%b!<%I$G<B9T$G$-$kA`:n\e(B
+* Plugged Mode::                \e$B%5!<%P!&%]!<%HJL$N@Z$jBX$(\e(B
+* Off-line State settings::     \e$B5/F0;~$N%*%U%i%$%s>uBV@_Dj\e(B
+* Variables of Plugged Mode::   \e$B%+%9%?%^%$%:JQ?t\e(B
+@end menu
+
+
+@node Off-line State, Enable Operations, Disconnected Operations, Disconnected Operations
 @section \e$B%*%U%i%$%s%b!<%I\e(B
 
 Wanderlust \e$B$K$O%*%s%i%$%s%b!<%I$H%*%U%i%$%s%b!<%I$,$"$j$^$9!#\e(B
@@ -3943,25 +4296,32 @@ Wanderlust \e$B$K$O%*%s%i%$%s%b!<%I$H%*%U%i%$%s%b!<%I$,$"$j$^$9!#\e(B
 @file{~/.wl} \e$B$J$I$GJQ?t\e(B @code{wl-plugged} \e$B$r\e(B nil \e$B$K@_Dj$7$F$+$i5/F0$9$k$H!"\e(B
 \e$B5/F0;~$+$i%*%U%i%$%s%b!<%I$H$J$j$^$9!#\e(B
 
-\e$B0J2<$NA`:n$O\e(B(\e$BBP>]$H$J$k%a%C%;!<%8$,%-%c%C%7%e$5$l$F$$$l$P\e(B)
-\e$B%*%U%i%$%s%b!<%I$G$b<B9T$G$-$^$9!#\e(B
-(\e$BJQ?t\e(B @code{elmo-enable-disconnected-operation} (\e$B8e=R\e(B) \e$B$,\e(B non-nil \e$B$N$H$-!#\e(B)
 
-@itemize @minus
-@item \e$B%a%C%;!<%8$NAw?.\e(B
-@item \e$B%j%U%!%$%k\e(B/\e$B%3%T!<\e(B (IMAP4)
-@item \e$B%U%)%k%@@8@.\e(B (IMAP4)
-@item \e$B%^!<%/IU$1\e(B (IMAP4)
-@item \e$B%W%j%U%'%C%A\e(B (IMAP4, NNTP)
-@end itemize
+@node Enable Operations, Plugged Mode, Off-line State, Disconnected Operations
+@section \e$B%*%U%i%$%s%b!<%I$G<B9T$G$-$kA`:n\e(B
+
+\e$B0J2<$NA`:n$O\e(B(\e$BBP>]$H$J$k%a%C%;!<%8$,%-%c%C%7%e$5$l$F$$$l$P\e(B) \e$B%*%U%i%$%s%b!<\e(B
+\e$B%I$G$b<B9T$G$-$^$9!#\e(B(\e$BJQ?t\e(B @code{elmo-enable-disconnected-operation} (\e$B8e\e(B
+\e$B=R\e(B) \e$B$,\e(B non-nil \e$B$N$H$-!#\e(B) 
+@xref{Plugged Mode}, @xref{Off-line State settings}.
+
+@menu
+* Send Messages off-line::      \e$B%a%C%;!<%8$NAw?.\e(B
+* Re-file and Copy queue::      \e$B%j%U%!%$%k\e(B/\e$B%3%T!<\e(B (IMAP4)
+* Creation of Folders::         \e$B%U%)%k%@@8@.\e(B (IMAP4)
+* Marking::                     \e$B%^!<%/IU$1\e(B (IMAP4)
+* Pre-fetching Reservations::   \e$B%W%j%U%'%C%A\e(B (IMAP4, NNTP)
+@end menu
 
 \e$B%*%U%i%$%s%b!<%ICf$K$J$5$l$?$3$l$i$NA`:n$O!"\e(BWanderlust \e$B$,%*%s%i%$%s%b!<%I\e(B
 \e$B$K$J$C$?=V4V$K%M%C%H%o!<%/7PM3$G%5!<%P>e$KH?1G$5$l$^$9!#\e(B
 
-@section \e$B%a%C%;!<%8$NAw?.\e(B
+
+@node Send Messages off-line, Re-file and Copy queue, Enable Operations, Enable Operations
+@subsection \e$B%a%C%;!<%8$NAw?.\e(B
 
 \e$B%*%U%i%$%s>uBV$G%a!<%k\e(B/\e$B%K%e!<%95-;v$rAw?.$G$-$^$9!#\e(B
-(im-wl.el \e$B$r$*;H$$$N>l9g$O!"4X78$"$j$^$;$s!#\e(B)
+(@file{im-wl.el} \e$B$r$*;H$$$N>l9g$O!"4X78$"$j$^$;$s!#\e(B)
 \e$B%*%U%i%$%s$N$H$-$KAw?.$5$l$?%a%C%;!<%8$O\e(B
 \e$B%-%e!<%U%)%k%@\e(B @samp{+queue} \e$B$KN/$j$^$9!#\e(B
 \e$BN/$C$?%a%C%;!<%8$O!"%*%s%i%$%s$K$J$C$?$H$-$K0l5$$KAw?.$5$l$^$9!#\e(B
@@ -3974,7 +4334,9 @@ Wanderlust \e$B$K$O%*%s%i%$%s%b!<%I$H%*%U%i%$%s%b!<%I$,$"$j$^$9!#\e(B
 @c \e$B%-%e!<$K$"$k%a%C%;!<%8$r:FJT=8$9$k$3$H$b2DG=$G$9$,!"\e(B
 @c \e$BLdBj$,5/$3$k2DG=@-$,$"$j$^$9$N$G$*4+$a$G$-$^$;$s!#\e(B
 
-@section \e$B%j%U%!%$%k\e(B/\e$B%3%T!<\e(B(IMAP4)
+
+@node Re-file and Copy queue, Creation of Folders, Send Messages off-line, Enable Operations
+@subsection \e$B%j%U%!%$%k\e(B/\e$B%3%T!<\e(B(IMAP4)
 
 \e$B%*%U%i%$%s>uBV$N$"$$$@$K<B9T$5$l$?\e(B IMAP \e$B%U%)%k%@$KBP$9$k%j%U%!%$%k\e(B
 /\e$B%3%T!<A`:n$O%-%e!<$K$?$a$i$l!"%*%s%i%$%s$K$J$C$?$H$-$K%5!<%PB&$KH?1G$5\e(B
@@ -3986,20 +4348,26 @@ Wanderlust \e$B$K$O%*%s%i%$%s%b!<%I$H%*%U%i%$%s%b!<%I$,$"$j$^$9!#\e(B
 \e$B%U%!%$%k\e(B/\e$B%3%T!<@h$K;XDj$5$l$?%U%)%k%@$K%a%C%;!<%8$rDI2C$9$k$N$K<:GT$7$?\e(B
 \e$B$H$-$O\e(B @samp{+lost+found} \e$B%U%)%k%@$KDI2C$5$l$^$9!#\e(B
 
-@section \e$B%U%)%k%@@8@.\e(B(IMAP4)
+
+@node Creation of Folders, Marking, Re-file and Copy queue, Enable Operations
+@subsection \e$B%U%)%k%@@8@.\e(B(IMAP4)
 
 IMAP \e$B%U%)%k%@$N@8@.$b%*%U%i%$%s>uBV$G<B9T$G$-$^$9!#%*%s%i%$%s$K$J$C$?$H$-\e(B
 \e$B$K%U%)%k%@@8@.$,%5!<%P$KH?1G$5$l$^$9$,!"$3$N$H$-!"2?$i$+$N860x$G%U%)%k%@@8\e(B
 \e$B@.$,<:GT$7$F$7$^$C$?>l9g!"%*%U%i%$%sCf$K@8@.$5$l$?%U%)%k%@$X%j%U%!%$%k$5$l\e(B
-\e$B$?%a%C%;!<%8$O\e(B "+lost+found" \e$B%U%)%k%@$KDI2C$5$l$^$9!#\e(B
+\e$B$?%a%C%;!<%8$O\e(B @samp{+lost+found} \e$B%U%)%k%@$KDI2C$5$l$^$9!#\e(B
+
 
-@section \e$B%^!<%/IU$1\e(B(IMAP4)
+@node Marking, Pre-fetching Reservations, Creation of Folders, Enable Operations
+@subsection \e$B%^!<%/IU$1\e(B(IMAP4)
 
 IMAP \e$B%U%)%k%@$K$"$k%a%C%;!<%8$KBP$9$kL$FI\e(B/\e$B4{FI$N>pJs!"$*$h$S!"\e(B
 \e$B=EMW%^!<%/\e(B @samp{$} \e$B$,$D$$$F$$$k$+$I$&$+!"$b%*%U%i%$%sCf$NJQ99$,%*%s%i%$%s$K\e(B
 \e$B$J$C$?$H$-$K%5!<%P$KH?1G$5$l$^$9!#\e(B
 
-@section \e$B%W%j%U%'%C%A\e(B(IMAP4, NNTP)
+
+@node Pre-fetching Reservations,  , Marking, Enable Operations
+@subsection \e$B%W%j%U%'%C%A\e(B(IMAP4, NNTP)
 
 IMAP \e$B$b$7$/$O\e(B NNTP \e$B%U%)%k%@$K$"$k%a%C%;!<%8$KBP$7$F!"%W%j%U%'%C%A$NM=Ls\e(B
 \e$B$r$7$^$9!#%W%j%U%'%C%A$NM=Ls$,$5$l$?%a%C%;!<%8$O\e(B @samp{!} \e$B$,IU$-$^$9$,!"\e(B
@@ -4018,6 +4386,8 @@ IMAP \e$B$b$7$/$O\e(B NNTP \e$B%U%)%k%@$K$"$k%a%C%;!<%8$KBP$7$F!"%W%j%U%'%C%A$NM=Ls
 @code{elmo-cache-expire-by-size} \e$B$O%*%U%i%$%s=hM}$NBP>]$H$J$k%a%C%;!<%8$N\e(B
 \e$B%-%c%C%7%e$O:o=|$7$^$;$s!#\e(B
 
+
+@node Plugged Mode, Off-line State settings, Enable Operations, Disconnected Operations
 @section \e$B%5!<%P!&%]!<%HJL$N%*%s%i%$%s!"%*%U%i%$%s$N@Z$jBX$(\e(B
 
 \e$B>e5-$N\e(B @kbd{M-t} \e$B$K$h$kA`:n$G$O%M%C%H%o!<%/$N>uBV$r0l3g$7$F@Z$jBX$($^$9$,!"\e(B
@@ -4027,6 +4397,7 @@ IMAP \e$B$b$7$/$O\e(B NNTP \e$B%U%)%k%@$K$"$k%a%C%;!<%8$KBP$7$F!"%W%j%U%'%C%A$NM=Ls
 wl-plugged-mode \e$B$KF~$j!"$3$N%b!<%I$G3F%]!<%H$N\e(B plug \e$B>uBV$rJQ99$7$^$9!#\e(B
 
 @example
+@group
 Queuing:[ON] AutoFlushQueue:[--] DisconnectedOperation:[ON]
 [ON](wl-plugged)
   [--]hosta
@@ -4037,6 +4408,7 @@ Queuing:[ON] AutoFlushQueue:[--] DisconnectedOperation:[ON]
                             %inbox(delete-msgids:1)    @dots{}@r{dop queue}
     [ON]nntp(119)
     [ON]smtp
+@end group
 @end example
 
 1\e$B9TL\$O%*%U%i%$%sA`:n$K4X78$9$k<!$N\e(B3\e$B$D$NJQ?t$N>uBV$rI=<($7!"\e(B
@@ -4044,9 +4416,11 @@ Queuing:[ON] AutoFlushQueue:[--] DisconnectedOperation:[ON]
 \e$BJQ?t$NCM$r4JC1$KJQ99$G$-$k$h$&$K$J$C$F$$$^$9!#\e(B
 
 @example
-"Queuing"               wl-draft-enable-queuing
-"AutoFlushQueue"        wl-auto-flush-queue
-"DisconnectedOperation" elmo-enable-disconnected-operation
+@group
+"Queuing"               @code{wl-draft-enable-queuing}
+"AutoFlushQueue"        @code{wl-auto-flush-queue}
+"DisconnectedOperation" @code{elmo-enable-disconnected-operation}
+@end group
 @end example
 
 \e$B$3$3$G!"\e(B@samp{[ON]} \e$B$O$=$NJQ?t$NCM$,\e(B t \e$B$G$"$k$3$H$r!"\e(B
@@ -4055,7 +4429,7 @@ Queuing:[ON] AutoFlushQueue:[--] DisconnectedOperation:[ON]
 \e$B$^$?!"\e(B2\e$B9TL\0J9_$G$O%5!<%P$H%]!<%H$N%*%s%i%$%s$H%*%U%i%$%s>uBV$rI=<($7!"\e(B
 @samp{[ON]} \e$B$O$=$N%5!<%P$d%]!<%H$,%*%s%i%$%s$G$"$k$3$H$r!"\e(B
 @samp{[--]} \e$B$O%*%U%i%$%s$G$"$k$3$H$r<($7$F$$$^$9\e(B
-(XEmacs \e$B$G$O%"%$%3%s$GI=<($5$l$^$9\e(B)\e$B!#\e(B
+(XEmacs \e$B$H\e(B Emacs 21 \e$B$G$O%"%$%3%s$GI=<($5$l$^$9\e(B)\e$B!#\e(B
 \e$B$=$7$F$=$l$>$l$N9T$G\e(B @kbd{@key{SPC}} \e$B$d\e(B @kbd{@key{RET}} \e$B$r2!$9$3$H$G\e(B
 \e$B>uBV$r@Z$jBX$($k$3$H$,$G$-$^$9!#\e(B
 
@@ -4073,13 +4447,15 @@ hosta \e$B$N\e(B nntp \e$B8~$1$K\e(B 1 \e$B$D\e(B(3\e$BHV\e(B)\e$B$N%a%C%;!<%8$,$"$j!"\e(B
 dop queue \e$B$K$O\e(B @samp{%inbox} \e$B$NA`:n$,\e(B1\e$B$D$H!"\e(B
 @samp{%#mh/wl} \e$B$NA`:n$,\e(B2\e$B$D$"$k$3$H$r<($7$F$$$^$9!#\e(B
 
-\e$B$3$N%b!<%I$G\e(B2\e$B9TL\$K$"$k\e(B (wl-plugged) \e$B$rJQ99$9$k$H!"\e(Bwl-plugged \e$BJQ?t$,JQ99$5\e(B
+\e$B$3$N%b!<%I$G\e(B2\e$B9TL\$K$"$k\e(B (wl-plugged) \e$B$rJQ99$9$k$H!"\e(B@code{wl-plugged} \e$BJQ?t$,JQ99$5\e(B
 \e$B$l!"$3$l$K$h$j%b!<%I%i%$%s$N\e(B indicator \e$B$HA4BN$N\e(B \e$B%]!<%H\e(B plug \e$B>uBV$,\e(B 
 ON/OFF \e$B$5$l$^$9!#\e(B
 \e$B$^$?!"3F%5!<%P$d%]!<%H$N\e(B plug \e$B>uBV$rJQ99$9$k$H!"\e(B
 @code{elmo-plugged-condition} (\e$B8e=R\e(B)\e$B$N@_Dj$H3F%]!<%H$N\e(B plug \e$B>uBV$K$h$j\e(B 2\e$B9TL\$N\e(B 
-wl-plugged \e$B$,JQ2=$7$^$9!#\e(B
+(wl-plugged) \e$B$,JQ2=$7$^$9!#\e(B
 
+
+@node Off-line State settings, Variables of Plugged Mode, Plugged Mode, Disconnected Operations
 @section \e$B5/F0;~$N%*%U%i%$%s>uBV@_Dj\e(B
 
 \e$BA0=R$NDL$j!"\e(B@file{~/.wl} \e$B$J$I$GJQ?t\e(B @code{wl-plugged} \e$B$r\e(B nil \e$B$K@_Dj$7$F$+$i5/F0$9\e(B
@@ -4093,6 +4469,7 @@ wl-plugged \e$B$,JQ2=$7$^$9!#\e(B
 \e$B>l9g$K$O\e(B @code{wl-make-plugged-hook} \e$B$KJQ99$9$k4X?t$r5-=R$7$^$9!#\e(B
 
 @lisp
+@group
 (add-hook 'wl-make-plugged-hook
           '(lambda ()
              (elmo-set-plugged plugged\e$BCM\e(B(t/nil) server port)
@@ -4101,8 +4478,11 @@ wl-plugged \e$B$,JQ2=$7$^$9!#\e(B
                      ;; @r{port \e$B$r>JN,$9$k$H\e(Bserver\e$B$NA4\e(Bport\e$B$,JQ99$5$l$k\e(B}
                      ;; @r{(port \e$B$r>JN,$7$F?75,$NDI2C$O$G$-$J$$\e(B)}
              ))
+@end group
 @end lisp
 
+
+@node Variables of Plugged Mode,  , Off-line State settings, Disconnected Operations
 @section \e$B%+%9%?%^%$%:JQ?t\e(B
 
 @table @code
@@ -4113,7 +4493,7 @@ wl-plugged \e$B$,JQ2=$7$^$9!#\e(B
 
 @item wl-queue-folder
 @vindex wl-queue-folder
-\e$B=i4|@_Dj$O\e(B "+queue"\e$B!#Aw?.%-%e!<$N%a%C%;!<%8$,N/$k%U%)%k%@!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{+queue}\e$B!#Aw?.%-%e!<$N%a%C%;!<%8$,N/$k%U%)%k%@!#\e(B
 
 @item wl-auto-flush-queue
 @vindex wl-auto-flush-queue
@@ -4128,14 +4508,14 @@ Non-nil \e$B$J$i%*%U%i%$%s=hM}$r<B9T$7$^$9!#\e(B
 
 @item elmo-lost+found-folder
 @vindex elmo-lost+found-folder
-\e$B=i4|@_Dj$O\e(B "+lost+found"\e$B!#%*%U%i%$%s!&%j%U%!%$%k\e(B/\e$B%3%T!<$N%-%e!<=hM}$G\e(B
+\e$B=i4|@_Dj$O\e(B @samp{+lost+found}\e$B!#%*%U%i%$%s!&%j%U%!%$%k\e(B/\e$B%3%T!<$N%-%e!<=hM}$G\e(B
 \e$B%a%C%;!<%8$NDI2C$K<:GT$7$?$H$-$K%a%C%;!<%8$rB`Hr$5$;$k%U%)%k%@$G$9!#\e(B
 
 @item elmo-plugged-condition
 @vindex elmo-plugged-condition
 \e$B=i4|@_Dj$O\e(B 'one\e$B!#\e(B
 @code{wl-plugged} \e$B$NCM$O4X?t\e(B @code{elmo-plugged-p} (\e$B0z?t$J$7\e(B)\e$B$NLa$jCM$K$h$j7hDj$5$l$^$9!#\e(B
-\e$B$3$NJQ?t\e(B @code{elmo-plugged-condition} \e$B$O\e(B (elmo-plugged-p) \e$B$NLa$jCM$,\e(B t \e$B$K$J$k>r7o\e(B
+\e$B$3$NJQ?t\e(B @code{elmo-plugged-condition} \e$B$O\e(B @code{(elmo-plugged-p)} \e$B$NLa$jCM$,\e(B t \e$B$K$J$k>r7o\e(B
 \e$B$r3F%]!<%H$N\e(Bplug\e$B>uBV$K$h$j;XDj$7$^$9!#\e(B
 
 @example
@@ -4143,7 +4523,7 @@ Non-nil \e$B$J$i%*%U%i%$%s=hM}$r<B9T$7$^$9!#\e(B
 'all         : \e$BA4$F$N%]!<%H$,\e(B plugged \e$B$J$i\e(B plugged \e$B$G$"$k\e(B
 'independent : \e$B%]!<%H$N\e(B plug \e$B>uBV$K4X78$J$/\e(B wl-plugged (elmo-plugged)
                \e$B$r;2>H$9$k\e(B
-function     : \e$B4X?t$NLa$jCM$K$h$jJQ2=$9$k\e(B
+@var{function}     : \e$B4X?t\e(B @var{function} \e$B$NLa$jCM$K$h$jJQ2=$9$k\e(B
  \e$BI8=`$GMQ0U$5$l$F$$$k4X?t\e(B
  'elmo-plug-on-by-servrs
              : \e$BJQ?t\e(B elmo-plug-on-servers \e$B$G;XDj$7$?%5!<%P$N\e(B plug
@@ -4159,6 +4539,7 @@ function     : \e$B4X?t$NLa$jCM$K$h$jJQ2=$9$k\e(B
 @end example
 
 @example
+@group
 \e$BNc\e(B1:
  (setq elmo-plugged-condition 'all)
 \e$BNc\e(B2:
@@ -4167,6 +4548,7 @@ function     : \e$B4X?t$NLa$jCM$K$h$jJQ2=$9$k\e(B
 \e$BNc\e(B3:
  (setq elmo-plug-on-exclude-servers '("localhost" "myname"))
  (setq elmo-plugged-condition 'elmo-plug-on-by-exclude-servers)
+@end group
 @end example
 
 @item wl-reset-plugged-alist
@@ -4179,9 +4561,6 @@ nil \e$B$J$i!"\e(BEmacs \e$B$,F0:n$7$F$$$k4V!"A02s=*N;$7$?;~E@$N%W%i%0>uBV$rJ];}$7$
 @end table
 
 
-@c
-@c  Expire and Archive
-@c
 @node Expire and Archive, Scoring, Disconnected Operations, Top
 @chapter \e$B%a%C%;!<%8$N<+F0:o=|$H%"!<%+%$%V\e(B
 @cindex Expire and Archive
@@ -4214,15 +4593,16 @@ Expire \e$B$H$O!";XDj$7$?4|4V$r2a$.$?8E$$%a%C%;!<%8$r:o=|$9$k5!G=$G$9!#\e(B
 \e$B:G=i$N$&$A$O\e(B@code{wl-expire-use-log}\e$B$r\e(B t \e$B$K%;%C%H$7$F$*$/$HNI$$$G$7$g$&!#\e(B
 
 @lisp
+@group
 (setq wl-expire-alist
       '(("^\\+trash$"   (date 14) remove)
                                   ;; @r{\e$B:o=|$9$k!#\e(B}
         ("^\\+tmp$"     (date 7) trash)
-                                  ;; @r{@code{wl-trash-folder} \e$B$K\e(Brefile\e$B$9$k!#\e(B}
+                                 ;; @r{@code{wl-trash-folder} \e$B$K%j%U%!%$%k$9$k!#\e(B}
         ("^\\+outbox$"  (number 300) "$outbox;lha")
-                                  ;; @r{\e$BFCDj$N%U%)%k%@$K\e(Brefile\e$B$9$k!#\e(B}
+                                     ;; @r{\e$BFCDj$N%U%)%k%@$K%j%U%!%$%k$9$k!#\e(B}
         ("^\\+ml/tmp$"  nil)
-                           ;; @r{expire\e$B$7$J$$\e(B}
+                        ;; @r{expire\e$B$7$J$$\e(B}
         ("^\\+ml/wl$"   (number 500 510) wl-expire-archive-number1 t)
                            ;; @r{\e$BHV9f$4$H$K%"!<%+%$%V$9$k\e(B(\e$BHV9f$OJ];}$9$k\e(B)\e$B!#\e(B}
         ("^\\+ml/.*"    (number 300 310) wl-expire-archive-number2 t)
@@ -4230,73 +4610,74 @@ Expire \e$B$H$O!";XDj$7$?4|4V$r2a$.$?8E$$%a%C%;!<%8$r:o=|$9$k5!G=$G$9!#\e(B
         ("^\\+nikki$"   (date 30) wl-expire-archive-date)
                            ;; @r{\e$BG/7n$4$H$K%"!<%+%$%V$9$k\e(B(\e$BHV9f$OJ];}$7$J$$\e(B)\e$B!#\e(B}
         ))
+@end group
 @end lisp
 
 \e$B3F%j%9%H$NMWAG$O\e(B
 
 @example
-("\e$B%U%)%k%@$N\e(Bregexp"  (\e$B:o=|%a%C%;!<%8$N;XDj\e(B) \e$B:o=|@h\e(B)
+(@var{\e$B%U%)%k%@$N@55,I=8=\e(B}  @var{\e$B:o=|%a%C%;!<%8$N;XDj\e(B}  @var{\e$B:o=|@h\e(B})
 @end example
 
 @noindent
 \e$B$H$J$C$F$$$^$9!#\e(B
-\e$B%j%9%H$N@hF,$+$i\e(B"\e$B%U%)%k%@$N\e(Bregexp"\e$B$K%^%C%A$9$k$+$I$&$+$rD4$Y$^$9!#\e(B
-\e$B$b$7!"\e(B"\e$B%U%)%k%@$N\e(Bregexp"\e$B$K%^%C%A$7$J$$%U%)%k%@$G!"\e(Bexpire \e$B$r<B9T$7$F$b2?$b$7$^$;$s!#\e(B
+\e$B%j%9%H$N@hF,$+$i\e(B@var{\e$B%U%)%k%@$N@55,I=8=\e(B}\e$B$K%^%C%A$9$k$+$I$&$+$rD4$Y$^$9!#\e(B
+\e$B$b$7!"\e(B@var{\e$B%U%)%k%@$N@55,I=8=\e(B}\e$B$K%^%C%A$7$J$$%U%)%k%@$G!"\e(Bexpire \e$B$r<B9T$7$F$b2?$b$7$^$;$s!#\e(B
 \e$B$^$?!"\e(B2,3 \e$BHVL\$NMWAG$N$$$:$l$+$,\e(B nil \e$B$G$"$l$P\e(B expire \e$B$7$^$;$s!#\e(B
 
-\e$B:o=|%a%C%;!<%8$N;XDj$K$O<!$N$b$N$r;XDj$7$^$9!#\e(B
+@var{\e$B:o=|%a%C%;!<%8$N;XDj\e(B}\e$B$K$O<!$N$b$N$r;XDj$7$^$9!#\e(B
 
 @table @code
-@item (number n1 [n2])
+@item (number @var{n1} [@var{n2}])
 \e$B%U%)%k%@$K$"$k%a%C%;!<%8?t$K1~$8$F:o=|$r9T$$$^$9!#\e(B
 
-n1 \e$B$O:o=|8e$N%a%C%;!<%8?t$G!"\e(B
+@var{n1} \e$B$O:o=|8e$N%a%C%;!<%8?t$G!"\e(B
 \e$BNc$($PCM$,\e(B 500 \e$B$J$i:G?7$N\e(B 500 \e$B8D$r;D$7$F;D$j$r:o=|$9$k$3$H$K$J$j$^$9!#\e(B
 
-n2 \e$B$O\e(B expire \e$B$r<B9T$9$k$?$a$N%a%C%;!<%8$NAm?t$G!">JN,$9$k$H\e(B n1 + 1 \e$B$K$J$j$^$9!#\e(B
+@var{n2} \e$B$O\e(B expire \e$B$r<B9T$9$k$?$a$N%a%C%;!<%8$NAm?t$G!">JN,$9$k$H\e(B @var{n1} + 1 \e$B$K$J$j$^$9!#\e(B
 \e$BNc$($PCM$,\e(B 510 \e$B$J$i%a%C%;!<%8$,\e(B 510 \e$B0J>e$N$H$-$K\e(B expire \e$B$r<B9T$9$k$3$H$K$J$j$^$9!#\e(B
 \e$B$3$l$O<+F0<B9T$G\e(B expire \e$B$r9T$&$h$&$K$7$?>l9g!"IQHK$K%a!<%k$,Mh$k%U%)%k%@$G\e(B
 \e$B$OKh2s\e(B expire \e$B$r<B9T$9$k$?$a!"%a!<%k$rFI$`$^$G$K;~4V$,$+$+$j!"\e(B
 \e$BHQ$o$7$/$J$C$F$7$^$$$^$9!#\e(B
-\e$B$=$3$G\e(B n2 \e$B$r\e(B n1 \e$B$h$j$bBg$-$a$NCM$K@_Dj$9$k$3$H$K$h$j!"0lDj?tN/$^$k$^$G$O\e(B
+\e$B$=$3$G\e(B @var{n2} \e$B$r\e(B @var{n1} \e$B$h$j$bBg$-$a$NCM$K@_Dj$9$k$3$H$K$h$j!"0lDj?tN/$^$k$^$G$O\e(B
 expire \e$B$r<B9T$7$J$$$h$&$K$9$k$3$H$,$G$-$^$9!#\e(B
 
 \e$B$^$?!"\e(B@code{wl-summary-expire-reserve-marks}\e$B$G;XDj$7$?%a%C%;!<%8\e(B
-(important\e$B%^!<%/$d?75,!&L$FI%^!<%/$NIU$$$?%a%C%;!<%8\e(B)
+(\e$B=EMW%^!<%/$d?75,!&L$FI%^!<%/$NIU$$$?%a%C%;!<%8\e(B)
 \e$B$O:o=|$7$J$$$h$&$K$J$C$F$$$^$9$,!"\e(B
 \e$B$b$7!"\e(B@code{wl-expire-number-with-reserve-marks} \e$B$,\e(B non-nil \e$B$N>l9g!"\e(B
 \e$B$3$N$h$&$J%a%C%;!<%8$b4^$a$F\e(B 500 \e$B8D$K$J$k$h$&$K\e(B expire \e$B$5$l$^$9!#\e(B
 nil \e$B$N>l9g$O>e5-%a%C%;!<%80J30$G\e(B 500 \e$B$K$J$k$h$&$K\e(B expire \e$B$7$^$9!#\e(B
 
-@item (date d1)
+@item (date @var{d1})
 \e$B%a%C%;!<%8$NF|IU$K$h$j:o=|$r9T$$$^$9!#\e(B
 
-d1 \e$B$O8=:_$h$j2?F|A0$N%a%C%;!<%8$r:o=|$9$k$I$&$+$G$"$j!"\e(B
+@var{d1} \e$B$O8=:_$h$j2?F|A0$N%a%C%;!<%8$r:o=|$9$k$I$&$+$G$"$j!"\e(B
 \e$BNc$($PCM$,\e(B 7 \e$B$J$i\e(B 7\e$BF|$h$jA0$N%a%C%;!<%8$r:o=|$7$^$9!#\e(B
-\e$B$J$*!"$3$NF|IU$H$O%a%C%;!<%8$N\e(BDate\e$B%U%#!<%k%I$NF|IU$G$"$j!"\e(B
+\e$B$J$*!"$3$NF|IU$H$O%a%C%;!<%8$N\e(B @samp{Date:} \e$B%U%#!<%k%I$NF|IU$G$"$j!"\e(B
 \e$B%a%C%;!<%8$,%U%)%k%@$KF~$C$?F|IU$G$O$J$$$3$H$KCm0U$7$F$/$@$5$$!#\e(B
 
-\e$B$b$7!"%a%C%;!<%8$K\e(B Date\e$B%U%#!<%k%I$,$J$+$C$?$j!"\e(BDate\e$B%U%#!<%k%I$,IT@5$JCM\e(B
-\e$B$J$i!"\e(Bexpire \e$B$5$l$^$;$s$N$G<j$G:o=|$9$k$J$j$7$F2<$5$$!#\e(B
+\e$B$b$7!"%a%C%;!<%8$K\e(B @samp{Date:} \e$B%U%#!<%k%I$,$J$+$C$?$j!"\e(B@samp{Date:} \e$B%U%#!<\e(B
+\e$B%k%I$,IT@5$JCM$J$i!"\e(Bexpire \e$B$5$l$^$;$s$N$G<j$G:o=|$9$k$J$j$7$F2<$5$$!#\e(B
 @end table
 
-\e$B:o=|@h$K$O<!$N$b$N$r;XDj$7$^$9!#\e(B
+@var{\e$B:o=|@h\e(B}\e$B$K$O<!$N$b$N$r;XDj$7$^$9!#\e(B
 
-@table @code
-@item 'remove
+@table @asis
+@item @code{'remove}
 \e$BB(%a%C%;!<%8$r:o=|$7$^$9!#\e(B
 
-@item 'trash
+@item @code{'trash}
 \e$B%a%C%;!<%8$r\e(B @code{wl-trash-folder} \e$B$K0\F0$7$^$9!#\e(B
 
-@item string(folder)
-\e$B%a%C%;!<%8$r;XDj$N%U%)%k%@$K0\F0$7$^$9!#\e(B
+@item @var{string}(folder)
+\e$B%a%C%;!<%8$r\e(B@var{string}\e$B$G;XDj$7$?%U%)%k%@$K0\F0$7$^$9!#\e(B
 
 \e$B%"!<%+%$%V%U%)%k%@$r;XDj$9$k$HJXMx$G$9$,!"\e(B
-important\e$B%a%C%;!<%8$J$I$O0\F0$5$l$J$$$?$a!"\e(B
+ @samp{$} \e$B%^!<%/$NIU$$$?=EMW%a%C%;!<%8$J$I$O0\F0$5$l$J$$$?$a!"\e(B
 \e$B2<5-$NI8=`4X?t$r;H$&J}$,$h$j$h$$$G$9!#\e(B
 
-@item function
+@item @var{function}
 \e$B;XDj$N4X?t$r8F$S=P$7$^$9!#\e(B
 
 \e$B;XDj$7$?4X?t$K$O<!$N\e(B3\e$B$D$N0z?t!"%U%)%k%@L>!":o=|$9$k%a%C%;!<%8$N%j%9%H!"$=$7\e(B
@@ -4312,50 +4693,50 @@ important\e$B%a%C%;!<%8$J$I$O0\F0$5$l$J$$$?$a!"\e(B
 
 @table @code
 @item wl-expire-archive-number1
-\e$B:o=|BP>]$N%a%C%;!<%8HV9f$KBP$9$k%"!<%+%$%V%U%)%k%@$K\e(Brefile\e$B$7$^$9!#\e(B
+\e$B:o=|BP>]$N%a%C%;!<%8HV9f$KBP$9$k%"!<%+%$%V%U%)%k%@$K%j%U%!%$%k$7$^$9!#\e(B
 \e$BNc$($P!"\e(B102 \e$BHV$G$"$k$J$i\e(B @file{wl-00100.zip}\e$B!"\e(B
 390 \e$BHV$G$"$k$J$i\e(B @file{wl-00300.zip}\e$B!"$J$I$N$h$&$K$G$9!#\e(B
 \e$B$J$*!"\e(B@code{wl-expire-archive-files} \e$B$r\e(B 200 \e$B$K$9$k$H!"\e(B
 @file{wl-00000.zip}, @file{wl-00200.zip}, @file{wl-00400.zip},
-@dots{} \e$B$K\e(B refile \e$B$7$F$$$-$^$9!#\e(B
+@dots{} \e$B$K%j%U%!%$%k$7$F$$$-$^$9!#\e(B
 
-refile \e$B@h$N%"!<%+%$%V%U%)%k%@$O:o=|85$N%U%)%k%@L>$K$h$j<!$N$h$&$K7hDj$5$l$^$9!#\e(B
+\e$B%j%U%!%$%k@h$N%"!<%+%$%V%U%)%k%@$O:o=|85$N%U%)%k%@L>$K$h$j<!$N$h$&$K7hDj$5$l$^$9!#\e(B
 (\e$B$3$N$H$-!"%"!<%+%$%V%U%)%k%@$O\e(B @code{elmo-archive-treat-file} \e$B$,\e(B non-nil \e$B$N>l9g$H$7$F$"$D$+$o$l$^$9\e(B)
 
-@table @code
-@item \e$B%U%)%k%@%?%$%W$,\e(Blocaldir
-
+@table @asis
+@item \e$B%U%)%k%@%?%$%W$,\e(Blocaldir\e$B$N>l9g\e(B
 @code{$ArchiveDir/foldername-xxxxx.zip}
+
 \e$BNc$($P\e(B @samp{+ml/wl} \e$B$O\e(B @samp{$ml/wl;zip}
 (@file{~/Mail/ml/wl-00100.zip})\e$B$H$J$j$^$9!#\e(B
 
-@item \e$B%U%)%k%@%?%$%W$,\e(Blocaldir\e$B0J30\e(B
+@item \e$B%U%)%k%@%?%$%W$,\e(Blocaldir\e$B0J30$N>l9g\e(B
 @code{$ArchiveDir/foldertype/foldername-xxxxx.zip}
 
 \e$BNc$($P!"\e(B@samp{%#mh/ml/wl} \e$B$O\e(B @samp{$imap4/#mh/ml/wl;zip}
-
 (@file{~/Mail/imap4/#mh/ml/wl-00100.zip})\e$B$H$J$j$^$9!#\e(B
 @end table
 
 \e$B$9$J$o$A!"\e(Blocaldir \e$B$N>l9g$O<oJL$,%Q%9L>$K4^$^$l$^$;$s$,!"$=$l0J30$O<oJL\e(B
 \e$B$,%Q%9L>$K4^$^$l$k$N$G$9!#\e(B
 \e$B$^$?!"\e(B@code{wl-expire-archive-folder-prefix} \e$B$K$h$j!"\e(B
-\e$B%"!<%+%$%V%U%)%k%@$KIU$1$k\e(B prefix \e$B$,@)8f$G$-$^$9!#\e(B
+\e$B%"!<%+%$%V%U%)%k%@$KIU$1$k\e(B prefix \e$B$r@)8f$G$-$^$9!#\e(B
 @code{wl-expire-archive-folder-prefix}\e$B$N@bL@$rNI$/8+$F$*$$$F$/$@$5$$!#\e(B
 
 @item wl-expire-archive-number2
-\e$B;XDj$7$?8D?t$4$H$K%"!<%+%$%V%U%)%k%@$K\e(Brefile\e$B$7$^$9!#\e(B
+\e$B;XDj$7$?8D?t$4$H$K%"!<%+%$%V%U%)%k%@$K%j%U%!%$%k$7$^$9!#\e(B
 
 @samp{wl-expire-archive-number1}
-\e$B$H0[$J$kE@$O%a%C%;!<%8HV9f$K4X78$J$/%"!<%+%$%V%U%)%k%@$,;XDj?t$KC#$9$k$^$G$=$N%U%)%k%@$K\e(B refile \e$B$9$k!"$H$$$&E@$G$9!#\e(B
-\e$B$J$*!"\e(Brefile \e$B@h$N%"!<%+%$%V%U%)%k%@$O\e(B @code{wl-expire-archive-number1}
+\e$B$H0[$J$kE@$O%a%C%;!<%8HV9f$K4X78$J$/%"!<%+%$%V%U%)%k%@$,;XDj?t$KC#$9$k$^$G\e(B
+\e$B$=$N%U%)%k%@$K%j%U%!%$%k$9$k!"$H$$$&E@$G$9!#\e(B
+\e$B$J$*!"%j%U%!%$%k@h$N%"!<%+%$%V%U%)%k%@$O\e(B @code{wl-expire-archive-number1}
 \e$B$HF1$8$h$&$K7hDj$5$l$^$9!#\e(B
 
 @item wl-expire-archive-date
-\e$B%a%C%;!<%8$NF|IU\e(B(\e$BG/7n\e(B)\e$B$4$H$K%"!<%+%$%V%U%)%k%@$K\e(Brefile\e$B$7$^$9!#\e(B
+\e$B%a%C%;!<%8$NF|IU\e(B(\e$BG/7n\e(B)\e$B$4$H$K%"!<%+%$%V%U%)%k%@$K%j%U%!%$%k$7$^$9!#\e(B
 
 \e$BNc$($P!"\e(B1998\e$BG/\e(B12\e$B7n$N%a%C%;!<%8$O\e(B @code{$folder-199812;zip} 
-\e$B$K\e(Brefile\e$B$5$l$^$9!#\e(B
+\e$B$K%j%U%!%$%k$5$l$^$9!#\e(B
 \e$B$J$*!"F|IU$NItJ,0J30$N%"!<%+%$%V%U%)%k%@L>$O\e(B @code{wl-expire-archive-number1}
 \e$B$HF1$8$h$&$K7hDj$5$l$^$9!#\e(B
 @end table
@@ -4364,23 +4745,22 @@ refile \e$B@h$N%"!<%+%$%V%U%)%k%@$O:o=|85$N%U%)%k%@L>$K$h$j<!$N$h$&$K7hDj$5$l$^$9
 \e$B%U%)%k%@$N%a%C%;!<%8HV9f$r$=$N$^$^J]B8$9$k$3$H$,$G$-$^$9!#\e(B
 \e$BNc$($P!"<!$N$h$&$K4X?tL>$N8e$KB3$1$F;XDj$7$^$9!#\e(B
 
-@example
+@lisp
 ("^\\+ml/wl$" (number 300 310) wl-expire-archive-number1 t)
-@end example
+@end lisp
 
 \e$B0z?t$r;XDj$7$J$$>l9g$O!"3F%"!<%+%$%V%U%)%k%@$4$H$K\e(B 1 \e$B$+$i=g$KHV9f$,M?$(\e(B
 \e$B$i$l$FJ]B8$5$l$^$9!#\e(B
 @end table
 
-@subsection important\e$B$dL$FI%a%C%;!<%8$N07$$\e(B
+@subsection \e$B=EMW%a%C%;!<%8$dL$FI%a%C%;!<%8$N07$$\e(B
 
 \e$B:o=|@h$K\e(B 'remove \e$B$d\e(B 'trash\e$B!"%U%)%k%@L>!"I8=`4X?t$N$$$:$l$r;XDj$7$?>l9g$G\e(B
 \e$B$b!"\e(B@code{wl-summary-expire-reserve-marks}\e$B$G;XDj$7$?%^!<%/$N%a%C%;!<%8\e(B
 (\e$B0J2<!"\e(B@dfn{reserve\e$B%a%C%;!<%8\e(B}\e$B$H8F$S$^$9\e(B)\e$B$O;D$9$h$&$K$J$C$F$$$^$9!#\e(B
 
-\e$B$3$NJQ?t$K$O%G%U%)%k%H$G!"\e(Bimportant\e$B%^!<%/!"?75,%^!<%/!"L$FI%^!<%/$,@_Dj\e(B
-\e$B$5$l$F$$$^$9$N$G!"$3$l$i$N%^!<%/$N$D$$$?%a%C%;!<%8$O:o=|$5$l$J$$$3$H$K$J\e(B
-\e$B$j$^$9!#\e(B
+\e$B$3$NJQ?t$K$O%G%U%)%k%H$G!"=EMW%^!<%/!"?75,%^!<%/!"L$FI%^!<%/$,@_Dj$5$l$F\e(B
+\e$B$$$^$9$N$G!"$3$l$i$N%^!<%/$N$D$$$?%a%C%;!<%8$O:o=|$5$l$J$$$3$H$K$J$j$^$9!#\e(B
 \e$B$?$@$7!"$3$NJQ?t$K$O0l;~E*%^!<%/$O;XDj$G$-$J$$$?$a\e(B(\e$B$9$J$o$A:o=|$5$l$k$?\e(B
 \e$B$a\e(B)\e$B!"\e(Bexpire\e$B$r<B9T$9$kA0$K0l;~E*%^!<%/$O=hM}$7$F$*$$$F$/$@$5$$!#\e(B
 
@@ -4391,8 +4771,9 @@ refile \e$B@h$N%"!<%+%$%V%U%)%k%@$O:o=|85$N%U%)%k%@L>$K$h$j<!$N$h$&$K7hDj$5$l$^$9
 \e$B%U%)%k%@$N\e(Bregexp\e$B$J$I$K8m$j$,$J$$$+$I$&$+$r==J,3NG'$7$F$+$i@_Dj$7$F2<$5$$!#\e(B
 
 @lisp
-(add-hook 'wl-summary-prepared-pre-hook
-          'wl-summary-expire)
+@group
+(add-hook 'wl-summary-prepared-pre-hook 'wl-summary-expire)
+@end group
 @end lisp
 
 \e$B$^$?!"%U%)%k%@%b!<%I$G3F%U%)%k%@$4$H$K\e(B expire \e$B$r<B9T$G$-$k$N$O$b$A$m$s!"\e(B
@@ -4427,8 +4808,10 @@ refile \e$B@h$N%"!<%+%$%V%U%)%k%@$O:o=|85$N%U%)%k%@L>$K$h$j<!$N$h$&$K7hDj$5$l$^$9
 \e$B2<$N$h$&$K5-O?$5$l$^$9!#\e(B
 
 @example
+@group
 delete  +ml/wl  (593 594 595 596 597 598 599)
 move    +ml/wl -> $ml/wl-00600;tgz;wl  (600 601 602)
+@end group
 @end example
 
 \e$B:G=i$N9`L\$OF0:n$r<($9$b$N$G!"\e(Bdelete, copy, move \e$B$,$"$j$^$9!#<!$,\e(B expire
@@ -4437,18 +4820,18 @@ move    +ml/wl -> $ml/wl-00600;tgz;wl  (600 601 602)
 \e$B$?%a%C%;!<%8HV9f$N%j%9%H$G$9\e(B(copy\e$B$d\e(Bmove\e$B$N>l9g!"0\F08e$G$O$J$/0\F0A0$N%a%C\e(B
 \e$B%;!<%8HV9f$G$9\e(B)\e$B!#\e(B
 
-@subsection reserve\e$B%a%C%;!<%8$N\e(Brefile
+@subsection reserve\e$B%a%C%;!<%8$N%j%U%!%$%k\e(B
 
 \e$BI8=`$GMQ0U$5$l$F$$$k\e(B3\e$B$D$N4X?t$G$O!"\e(Breserve\e$B%a%C%;!<%8$O%"!<%+%$%V%U%)%k%@\e(B
 \e$B$K%3%T!<$7$^$9$,!"85$N%U%)%k%@$+$i$O:o=|$7$J$$$h$&$K$J$C$F$$$^$9!#$J$*!"\e(B
-important\e$B%^!<%/$J$I$O>o$K;D$k$?$a!"2?EY$b%3%T!<$5$l$k$3$H$,$J$$$h$&$K\e(B
+\e$B=EMW%^!<%/$J$I$O>o$K;D$k$?$a!"2?EY$b%3%T!<$5$l$k$3$H$,$J$$$h$&$K\e(B
 @file{~/.elmo/expired-alist} \e$B$K5-O?$9$k$h$&$K$7$F$$$^$9!#\e(B
 \e$B$?$@$7!"\e(Breserve\e$B%a%C%;!<%8$,\e(Brefile\e$BBP>]$K$J$C$?$H$-$N$_$G$9!#\e(B
 \e$B$^$?!"\e(B@code{wl-summary-archive} \e$B$J$I$G%3%T!<$5$l$k>l9g$O5-O?$5$l$^$;$s!#\e(B
 
-\e$B%m%05!G=$rM-8z$K$7$F$$$?>l9g$O!"\e(Brefile \e$B;~$K$ODL>o\e(B move \e$B$,5-\e(B
-\e$BO?$5$l$^$9$,!"\e(Breserve\e$B%a%C%;!<%8$,4^$^$l$F$$$k$H!"\e(Bcopy \e$B$H\e(B 
-delete \e$B$KJ,$1$F5-O?$5$l$^$9!#$3$l$O\e(B reserve\e$B%a%C%;!<%8$r4^$a$?%a%C\e(B
+\e$B%m%05!G=$rM-8z$K$7$F$$$?>l9g$O!"%j%U%!%$%k;~$K$ODL>o\e(B @samp{move} \e$B$,5-\e(B
+\e$BO?$5$l$^$9$,!"\e(Breserve\e$B%a%C%;!<%8$,4^$^$l$F$$$k$H!"\e(B@samp{copy} \e$B$H\e(B 
+@samp{delete} \e$B$KJ,$1$F5-O?$5$l$^$9!#$3$l$O\e(B reserve\e$B%a%C%;!<%8$r4^$a$?%a%C\e(B
 \e$B%;!<%8$r%3%T!<$7$?8e!"\e(Breserve\e$B%a%C%;!<%8$r=|$$$?%a%C%;!<%8$r:o=|$9$k!"\e(B
 \e$B$H$$$&=hM}$r9T$C$F$$$k$?$a$G$9!#\e(B
 
@@ -4466,15 +4849,17 @@ expire \e$B$r9T$&%U%)%k%@$H\e(B expire \e$BJ}K!$N;XDj$r9T$$$^$9!#>\$7$/$O>e5-$N\e(B
 \e$B=i4|@_Dj$O0J2<$N%j%9%H!#\e(B
 
 @lisp
+@group
 (list wl-summary-important-mark
       wl-summary-new-mark
       wl-summary-unread-mark
       wl-summary-unread-uncached-mark
       wl-summary-unread-cached-mark)
+@end group
 @end lisp
 
 expire \e$B$r9T$C$F$b!"%U%)%k%@$K$O;D$7$F$*$/%a%C%;!<%8$N%^!<%/$r;XDj$7$^$9!#\e(B
-\e$B%^!<%/$K$O\e(B \e$B1JB3E*%^!<%/\e(B \e$B$N$_;XDj$G$-$^$9!#\e(B
+\e$B%^!<%/$K$O1JB3E*%^!<%/$N$_;XDj$G$-$^$9!#\e(B
 \e$B0l;~E*%^!<%/$O;XDj$G$-$^$;$s!#\e(B
 
 \e$B%G%U%)%k%H$N$h$&$K%j%9%H$G;XDj$9$k$H$=$N%^!<%/$N%a%C%;!<%8$r;D$9$3$H$,$G\e(B
@@ -4488,7 +4873,8 @@ expire \e$B$r9T$C$F$b!"%U%)%k%@$K$O;D$7$F$*$/%a%C%;!<%8$N%^!<%/$r;XDj$7$^$9!#\e(B
 
 @item 'none
 \e$B$I$s$J%^!<%/$NIU$$$?%a%C%;!<%8$G$"$C$F$b!"DL>o$N4{FI%a%C%;!<%8$HF1$807$$\e(B
-\e$B$r$7$^$9!#$9$J$o$A!"\e(Bimportant\e$B%a%C%;!<%8$G$"$C$F$b:o=|$5$l$^$9!#\e(B
+\e$B$r$7$^$9!#$9$J$o$A!"\e(B@samp{$} \e$B%^!<%/$NIU$$$?=EMW%a%C%;!<%8$G$"$C$F$b:o=|\e(B
+\e$B$5$l$^$9!#\e(B
 @end table
 
 @item wl-expire-archive-files
@@ -4515,16 +4901,16 @@ Non-nil \e$B$K$9$k$H!"\e(B
 \e$B4X?t\e(B@code{wl-expire-archive-get-folder}\e$B$N%+%9%?%^%$%:JQ?t$K$O<!$N\e(B
 \e$B$b$N$,$"$j$^$9!#\e(B
 @itemize @bullet
-@item wl-expire-archive-folder-name-fmt
-@item wl-expire-archive-folder-type
-@item wl-expire-archive-folder-prefix
+@item @code{wl-expire-archive-folder-name-fmt}
+@item @code{wl-expire-archive-folder-type}
+@item @code{wl-expire-archive-folder-prefix}
 @end itemize
 
 @item wl-expire-archive-folder-name-fmt
 @vindex wl-expire-archive-folder-name-fmt
-\e$B=i4|@_Dj$O\e(B "%s-%%05d;%s"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{%s-%%05d;%s}\e$B!#\e(B
 @code{wl-expire-archive-number1}\e$B$*$h$S\e(B@code{wl-expire-archive-number2}\e$B$G\e(B
-\e$B;HMQ$5$l$k%"!<%+%$%V$N%U%)%k%@$N\e(B format \e$B7A<0$NJ8;zNs$r;XDj$7$^$9!#\e(B
+\e$B;HMQ$5$l$k%"!<%+%$%V$N%U%)%k%@$N\e(B @code{format} \e$B7A<0$NJ8;zNs$r;XDj$7$^$9!#\e(B
 \e$B$J$*!"\e(B2\e$BEY\e(B @code{format} \e$B$G;XDj$9$k$?$a!"\e(B
 \e$B$+$J$i$:HV9f$NItJ,$O\e(B @samp{%%d} \e$B$K$7$J$/$F$O$J$j$^$;$s!#\e(B
 
@@ -4533,12 +4919,12 @@ Non-nil \e$B$K$9$k$H!"\e(B
 
 @item wl-expire-archive-date-folder-name-fmt
 @vindex wl-expire-archive-date-folder-name-fmt
-\e$B=i4|@_Dj$O\e(B "%s-%%04d%%02d;%s"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{%s-%%04d%%02d;%s}\e$B!#\e(B
 @code{wl-expire-archive-date}
-\e$B$G;HMQ$5$l$k%"!<%+%$%V$N%U%)%k%@$N\e(B format \e$B7A<0$NJ8;zNs$r;XDj$7$^$9!#\e(B
+\e$B$G;HMQ$5$l$k%"!<%+%$%V$N%U%)%k%@$N\e(B @code{format} \e$B7A<0$NJ8;zNs$r;XDj$7$^$9!#\e(B
 \e$B$J$*!"\e(B2\e$BEY\e(B @code{format} \e$B$G;XDj$9$k$?$a!"\e(B
 \e$B$+$J$i$:HV9f$NItJ,$O\e(B @samp{%%d} \e$B$K$7$J$/$F$O$J$j$^$;$s!#\e(B
-\e$B$^$?!"%a%C%;!<%8$NG/$H7n$,M?$($i$l$k$?$a!"\e(B@code{%%d} \e$B$O\e(B2\e$B$DI,MW$G$9!#\e(B
+\e$B$^$?!"%a%C%;!<%8$NG/$H7n$,M?$($i$l$k$?$a!"\e(B@samp{%%d} \e$B$O\e(B2\e$B$DI,MW$G$9!#\e(B
 
 \e$B$b$7!"JQ99$9$k>l9g$O\e(B @code{wl-expire-archive-date-folder-num-regexp}
 \e$B$b9g$o$;$k$h$&$K$7$F$/$@$5$$!#\e(B
@@ -4572,14 +4958,14 @@ prefix \e$B$OIU$-$^$;$s!#\e(B
 
 @item wl-expire-archive-folder-num-regexp
 @vindex wl-expire-archive-folder-num-regexp
-\e$B=i4|@_Dj$O\e(B "-\\([-0-9]+\\);"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{-\\([-0-9]+\\);}\e$B!#\e(B
 @code{elmo-list-folders} \e$B$K$h$kJ#?t$N%"!<%+%$%V%U%)%k%@L>$+$i\e(B
 \e$BHV9f$r<hF@$9$k$?$a$N@55,I=8=$r;XDj$7$^$9!#\e(B
 @code{wl-expire-archive-folder-name-fmt} \e$B$KBP1~$7$F@_Dj$7$F$/$@$5$$!#\e(B
 
 @item wl-expire-archive-date-folder-num-regexp
 @vindex wl-expire-archive-date-folder-num-regexp
-\e$B=i4|@_Dj$O\e(B "-\\([-0-9]+\\);"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{-\\([-0-9]+\\);}\e$B!#\e(B
 @code{elmo-list-folders} \e$B$K$h$kJ#?t$N%"!<%+%$%V%U%)%k%@L>$+$i\e(B
 \e$BHV9f$r<hF@$9$k$?$a$N@55,I=8=$r;XDj$7$^$9!#\e(B
 @code{wl-expire-archive-date-folder-name-fmt} \e$B$KBP1~$7$F@_Dj$7$F$/$@$5$$!#\e(B
@@ -4604,23 +4990,23 @@ Non-nil \e$B$K$9$k$H!"\e(B@file{~/.elmo/expired-log}\e$B$K\e(B expire \e$B$N<B9T7k2L$
 @vindex wl-expire-add-seen-list
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
 
-Non-nil \e$B$N>l9g!"\e(Bexpire \e$B$K$h$j%a%C%;!<%8$r\e(B refile \e$B$7$?>l9g!"4{FI>pJs$r\e(B
-refile\e$B@h$N%U%)%k%@$KEA$($k$h$&$K$7$^$9!#\e(B
+Non-nil \e$B$N>l9g!"\e(Bexpire \e$B$K$h$j%a%C%;!<%8$r%j%U%!%$%k$7$?>l9g!"4{FI>pJs$r\e(B
+\e$B%j%U%!%$%k@h$N%U%)%k%@$KEA$($k$h$&$K$7$^$9!#\e(B
 
-\e$B$?$@$7!"\e(Brefile\e$B@h$N%U%)%k%@$r\e(B Wanderlust\e$B>e$+$iFI$^$J$$$H!"\e(B
+\e$B$?$@$7!"%j%U%!%$%k@h$N%U%)%k%@$r\e(B Wanderlust\e$B>e$+$iFI$^$J$$$H!"\e(B
 @file{~/.elmo/}\e$B0J2<$K$"$k\e(B @file{seen} \e$B%U%!%$%k$,Bg$-$/$J$C$F$$$/$N$G!"\e(B
 \e$B%"!<%+%$%V%U%)%k%@$J$I$KC1$KJ]B8$7$F$*$/$@$1$J$i\e(B
  nil \e$B$K@_Dj$7$F$*$/$H$h$$$G$7$g$&!#\e(Bnil \e$B$K@_Dj$7$F$b!"\e(B
-refile\e$B$7$?%"!<%+%$%V%U%)%k%@$rFI$`$H$-$K?75,%a%C%;!<%807$$$5$l$k$@$1$G!"\e(B
+\e$B%j%U%!%$%k$7$?%"!<%+%$%V%U%)%k%@$rFI$`$H$-$K?75,%a%C%;!<%807$$$5$l$k$@$1$G!"\e(B
 expire \e$B$J$I$NF0:n$K$O1F6A$O$"$j$^$;$s!#\e(B
 
 @item wl-expire-folder-update-msgdb
 @vindex wl-expire-folder-update-msgdb
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
 t \e$B$N>l9g!"%U%)%k%@%b!<%I$G\e(B expire \e$B$r<B9T$9$k$H$-$K!"\e(B
-\e$B%5%^%j>pJs$r\e(Bupdate\e$B$7$F$+$i\e(Bexpire\e$B$r<B9T$9$k!#\e(B
+\e$B%5%^%j>pJs$r\e(B update \e$B$7$F$+$i\e(B expire \e$B$r<B9T$9$k!#\e(B
 \e$B$^$?!"%U%)%k%@L>$N@55,I=8=$N%j%9%H$r;XDj$7$?>l9g$O!"%^%C%A$7$?%U%)%k%@$N\e(B
-\e$B$_%5%^%j>pJs$r\e(Bupdate\e$B$9$k!#\e(B
+\e$B$_%5%^%j>pJs$r\e(B update \e$B$9$k!#\e(B
 @end table
 
 
@@ -4636,26 +5022,28 @@ t \e$B$N>l9g!"%U%)%k%@%b!<%I$G\e(B expire \e$B$r<B9T$9$k$H$-$K!"\e(B
 \e$B$9!#\e(B
 
 @lisp
+@group
 (setq wl-archive-alist
       '(("^\\+tmp$"     wl-archive-date)
         ("^\\+outbox$"  wl-archive-number2)
         (".*"           wl-archive-number1)
         ))
+@end group
 @end lisp
 
 \e$B3F%j%9%H$NMWAG$O<!$N$h$&$K$J$j$^$9!#\e(B
 
 @example
-("\e$B%U%)%k%@$N\e(Bregexp"  \e$B:o=|4X?t\e(B)
+(@var{\e$B%U%)%k%@$N@55,I=8=\e(B}  @var{\e$B:o=|4X?t\e(B})
 @end example
 
-\e$B$3$N$h$&$K\e(B@samp{\e$B%U%)%k%@$N\e(Bregexp}\e$B$N8e$K$O4X?t$7$+;XDj$G$-$^$;$s!#\e(B
+\e$B$3$N$h$&$K\e(B@var{\e$B%U%)%k%@$N@55,I=8=\e(B}\e$B$N8e$K$O4X?t$7$+;XDj$G$-$^$;$s!#\e(B
 \e$BI8=`$G$O<!$N\e(B3\e$B$D$N4X?t\e(B
 
-@itemize
-@item wl-archive-number1
-@item wl-archive-number2
-@item wl-archive-date
+@itemize @bullet
+@item @code{wl-archive-number1}
+@item @code{wl-archive-number2}
+@item @code{wl-archive-date}
 @end itemize
 
 \e$B$,MQ0U$5$l$F$*$j!"L>A0$+$i$*2r$j$NDL$j<!$NE@$r=|$$$F\e(B Expire \e$B$GMQ0U$5$l$F\e(B
@@ -4669,8 +5057,8 @@ t \e$B$N>l9g!"%U%)%k%@%b!<%I$G\e(B expire \e$B$r<B9T$9$k$H$-$K!"\e(B
 \e$B%U%)%k%@$NA4%a%C%;!<%8$rHV9f$4$H$dF|IU$4$H$K$^$H$a$F%"!<%+%$%V$7$?$$>l9g\e(B
 \e$B$O!"$3$l$i$N4X?t$r;HMQ$9$k$H$h$$$G$7$g$&!#\e(B
 \e$B$^$?!"\e(Bexpire \e$B$r9T$&A0$N%P%C%/%"%C%W$dF0:n$r3NG'$9$k$N$K$bM-8z$G$9!#\e(B
-\e$B$b$C$H$b!"%"!<%+%$%V8e$K\e(Bexpire\e$B$G\e(Brefile\e$B$9$k$H!"\e(Brefile\e$B$;$:$K:o=|$9$k$@$1$K\e(B
-\e$B$J$j$^$9!#\e(B
+\e$B$b$C$H$b!"%"!<%+%$%V8e$K\e(B expire \e$B$G%j%U%!%$%k$9$k$H!"%j%U%!%$%k$;$:$K:o=|\e(B
+\e$B$9$k$@$1$K$J$j$^$9!#\e(B
 
 \e$B%G%U%)%k%H$G$O%3%T!<@h$N%"!<%+%$%V%U%)%k%@$O\e(B
 @code{wl-expire-archive-get-folder-func} \e$B$K=>$C$F<+F0E*$K7hDj$5$l$^$9$,!"\e(B
@@ -4682,17 +5070,16 @@ prefix argument \e$B$rIU$1$F\e(B @kbd{C-u M-x wl-summary-archive} \e$B$G<B9T$9$k$H!
 \e$B%T!<$9$k$3$H$G$b2DG=$J$?$a!"$*$^$1$N5!G=$G$7$+$"$j$^$;$s\e(B
 (\e$B$D$^$j!"F0:n3NG'$OIT==J,$G$9\e(B)\e$B!#\e(B
 
-
 \e$B$3$N%"!<%+%$%V%U%)%k%@$N7hDjJ}K!$O\e(B@code{wl-summary-expire}\e$B$HF1$8$b$N$rMQ\e(B
 \e$B$$$F$$$k$?$a!"%+%9%?%^%$%:JQ?t$NCf$G<!$K<($9$b$N$,4X78$7$F$-$^$9!#\e(B
 
 @itemize @bullet
-@item wl-expire-archive-files
-@item wl-expire-archive-get-folder-func
-@item wl-expire-archive-folder-name-fmt
-@item wl-expire-archive-folder-type
-@item wl-expire-archive-folder-prefix
-@item wl-expire-archive-folder-num-regexp
+@item @code{wl-expire-archive-files}
+@item @code{wl-expire-archive-get-folder-func}
+@item @code{wl-expire-archive-folder-name-fmt}
+@item @code{wl-expire-archive-folder-type}
+@item @code{wl-expire-archive-folder-prefix}
+@item @code{wl-expire-archive-folder-num-regexp}
 @end itemize
 
 @subsection \e$B%+%9%?%^%$%:JQ?t\e(B
@@ -4709,9 +5096,6 @@ prefix argument \e$B$rIU$1$F\e(B @kbd{C-u M-x wl-summary-archive} \e$B$G<B9T$9$k$H!
 @end table
 
 
-@c
-@c  Scoring
-@c
 @node Scoring, Customization, Expire and Archive, Top
 @chapter \e$B%9%3%"\e(B
 @cindex Scoring
@@ -4720,13 +5104,14 @@ prefix argument \e$B$rIU$1$F\e(B @kbd{C-u M-x wl-summary-archive} \e$B$G<B9T$9$k$H!
 \e$B%9%3%"$H$O!"%a%C%;!<%8$K%9%3%"\e(B(\e$BCM\e(B)\e$B$r$D$1!"\e(B
 \e$B$=$NCM$K$h$j4{FI%^!<%/$rIU$1$?$j%5%^%j$+$i>C$7$?$j$9$k5!G=$G$9!#\e(B
 
-\e$B$3$N5!G=$K$h$C$F=EMW$J%a%C%;!<%8$K\e(B temp \e$B%^!<%/$d\e(B important \e$B%^!<%/$r$D$1$?\e(B
-\e$B$j!"\e(Bspam \e$B5-;v$J$I$NFI$_$?$/$J$$%a%C%;!<%8$K4{FI%^!<%/$r$D$1$?$j$9$k$3$H$,\e(B
-\e$B$G$-$^$9!#\e(B
+\e$B$3$N5!G=$K$h$C$F=EMW$J%a%C%;!<%8$K$^$H$a=hM}MQ%^!<%/\e(B @samp{*} \e$B$d=EMW%^!<\e(B
+\e$B%/\e(B@samp{$}\e$B$r$D$1$?$j!"\e(Bspam \e$B5-;v$J$I$NFI$_$?$/$J$$%a%C%;!<%8$K4{FI%^!<%/\e(B
+\e$B$r$D$1$?$j$9$k$3$H$,$G$-$^$9!#\e(B
 
 \e$B$3$N%9%3%"5!G=$O\e(B Gnus \e$B$N%9%3%"$H$[$\F1Ey$N5!G=$r;}$A!"$^$?%9%3%"%U%!%$%k$N\e(B
 \e$B=q<0$b$[$\F1$8$G$9!#$?$@$7!"4v$D$+$OL$BP1~$G$"$C$?$j\e(B Wanderlust \e$BFCM-$N5!G=\e(B
 \e$B$,$"$C$?$j$7$^$9!#\e(B
+@xref{Scoring, , ,gnus-ja, The gnus Newsreader}.
 
 @menu
 * Score Commands::             \e$B%9%3%"$K4X$9$k%3%^%s%I\e(B
@@ -4744,12 +5129,14 @@ prefix argument \e$B$rIU$1$F\e(B @kbd{C-u M-x wl-summary-archive} \e$B$G<B9T$9$k$H!
 \e$B$K%U%)%k%@L>$KBP1~$7$?%9%3%"%U%!%$%kL>$+%9%3%"$rDj5A$7$?JQ?t$r@_Dj$7$^$9!#\e(B
 
 @lisp
+@group
 (setq wl-score-folder-alist
       '(("^-.*"
          "news.SCORE"
          "my.SCORE")
         (".*"
          "all.SCORE")))
+@end group
 @end lisp
 
 \e$B%9%3%"%U%!%$%kL>$N%Q%9$r>JN,$7$?>l9g$O!"\e(B
@@ -4777,8 +5164,8 @@ prefix argument \e$B$rIU$1$F\e(B @kbd{C-u M-x wl-summary-archive} \e$B$G<B9T$9$k$H!
 \e$B$5$l$F$$$k>uBV$K$J$j$^$9$N$G!"E,Ev$KJT=8$7$?$N$A\e(B @kbd{@key{RET}} \e$B$r2!$7$^$9!#\e(B
 
 \e$B$3$l$G!"F~NO$7$?J8;zNs$HF1$8\e(B Subject \e$B$r;}$D%a%C%;!<%8$KBP$7$F%9%3%"\e(B 
--1000 \e$B$,$D$1$i$l$k$h$&$K$J$j$^$9!#$D$^$j!"$3$N$h$&$J%9%3%"%U%!%$%k$,<+F0E*\e(B
-\e$B$K:n@.$5$l$?$3$H$K$J$j$^$9!#\e(B
+@minus{}1000 \e$B$,$D$1$i$l$k$h$&$K$J$j$^$9!#\e(B
+\e$B$D$^$j!"$3$N$h$&$J%9%3%"%U%!%$%k$,<+F0E*$K:n@.$5$l$?$3$H$K$J$j$^$9!#\e(B
 
 \e$B<!$K!"F1$8%5%^%j%P%C%U%!$G\e(B @kbd{h} @kbd{e} \e$B$H%?%$%W$7$F$/$@$5$$!#\e(B
 \e$B$9$k$H@h$[$I:n@.$7$?%9%3%"%U%!%$%k$,I=<($5$l$F$$$k$H;W$$$^$9!#\e(B
@@ -4818,9 +5205,9 @@ prefix argument \e$B$rIU$1$F\e(B @kbd{C-u M-x wl-summary-archive} \e$B$G<B9T$9$k$H!
 @code{wl-score-edit-insert-entry} \e$B$GF1$8%(%s%H%j$rDI2C$7$?>l9g!"\e(B
 \e$B%9%3%"$,2C;;$5$l$^$9!#\e(B
 
-\e$B$?$H$($P!"\e(B@kbd{L a} \e$B$G%9%3%"$,\e(B -1000 \e$B$N\e(B @samp{from} \e$B%(%s%H%j$r:n@.$7$?8e!"\e(B
-\e$B:FEY\e(B @kbd{C-u 200 L a} \e$B$G%9%3%"$,\e(B -200 \e$B$N\e(B @samp{from} \e$B%(%s%H%j$r:n@.$9$k$H!"\e(B
-\e$B%9%3%"$,\e(B -1200 \e$B$N%(%s%H%j$,\e(B1\e$B$D:n@.$5$l$k$3$H$K$J$j$^$9!#\e(B
+\e$B$?$H$($P!"\e(B@kbd{L a} \e$B$G%9%3%"$,\e(B @minus{}1000 \e$B$N\e(B @samp{from} \e$B%(%s%H%j$r:n@.$7$?8e!"\e(B
+\e$B:FEY\e(B @kbd{C-u 200 L a} \e$B$G%9%3%"$,\e(B @minus{}200 \e$B$N\e(B @samp{from} \e$B%(%s%H%j$r:n@.$9$k$H!"\e(B
+\e$B%9%3%"$,\e(B @minus{}1200 \e$B$N%(%s%H%j$,\e(B1\e$B$D:n@.$5$l$k$3$H$K$J$j$^$9!#\e(B
 
 @subsubsection Thread\e$B%-!<$N:n@.\e(B
 
@@ -4945,13 +5332,13 @@ Wanderlust \e$B0J30$GD>@\%9%3%"%U%!%$%k$rJQ99$7$?>l9g$O!"\e(B
 @item wl-summary-important-above
 @vindex wl-summary-important-above
 \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
-\e$B$3$NCM$h$jBg$-$$%9%3%"$KBP$7$F\e(B important\e$B%^!<%/\e(B(@samp{$}) \e$B$r$D$1$^$9!#\e(B
+\e$B$3$NCM$h$jBg$-$$%9%3%"$KBP$7$F=EMW%^!<%/\e(B(@samp{$}) \e$B$r$D$1$^$9!#\e(B
 nil \e$B$N>l9g$O%^!<%/$rIU$1$^$;$s!#\e(B
 
-@item wl-summary-temp-above
-@vindex wl-summary-temp-above
+@item wl-summary-target-above
+@vindex wl-summary-target-above
 \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
-\e$B$3$NCM$h$jBg$-$$%9%3%"$KBP$7$F\e(B temp\e$B%^!<%/\e(B(@samp{*}) \e$B$r$D$1$^$9!#\e(B
+\e$B$3$NCM$h$jBg$-$$%9%3%"$KBP$7$F$^$H$a=hM}MQ%^!<%/\e(B(@samp{*}) \e$B$r$D$1$^$9!#\e(B
 nil \e$B$N>l9g$O%^!<%/$rIU$1$^$;$s!#\e(B
 
 @item wl-summary-mark-below
@@ -4977,7 +5364,7 @@ Non-nil \e$B$J$i%9%3%"5!G=$rM-8z$K$7$^$9!#\e(B
 
 @item wl-score-files-dir
 @vindex wl-score-files-dir
-\e$B=i4|@_Dj$O\e(B "~/.elmo/"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @file{~/.elmo/}\e$B!#\e(B
 \e$B%9%3%"%U%!%$%k$r%G%U%)%k%H$N%G%#%l%/%H%j$r;XDj$7$^$9!#\e(B
 
 @item wl-score-interactive-default-score
@@ -5009,7 +5396,7 @@ Non-nil \e$B$J$i4|8BIU$-%9%3%"$r:o=|$9$k5!G=$rM-8z$K$7$^$9!#\e(B
 \e$B%9%3%"%(%s%H%j$N7?$G\e(B fuzzy \e$B$r;XDj$7$?>l9g!"\e(B
 \e$BJ8;zNs$+$i:o=|$9$k@55,I=8=$r;XDj$7$^$9!#\e(B
 Subject \e$B$G;HMQ$5$l$k$3$H$,B?$$$N$G!"%G%U%)%k%H$G$O\e(B
-\e$B%a%$%j%s%0%j%9%H%W%m%0%i%`$G$D$1$i$l$k\e(B prefix \e$B$r;XDj$7$F$$$^$9!#\e(B
+\e$B%a!<%j%s%0%j%9%H%W%m%0%i%`$G$D$1$i$l$k\e(B prefix \e$B$r;XDj$7$F$$$^$9!#\e(B
 
 @item wl-summary-rescore-partial-threshold
 @vindex wl-summary-rescore-partial-threshold
@@ -5036,8 +5423,10 @@ Non-nil \e$B$J$i$P!"%5%^%jF14|;~$KL$FI\e(B/\e$B=EMW%^!<%/$bF14|$7$^$9!#\e(B
 \e$B%9%3%"%U%!%$%k$,$=$N$^$^MxMQ$G$-$^$9!#\e(B
 \e$B$?$@$7!"4v$D$+$N%-!<$OBP1~$7$F$$$J$+$C$?$j\e(B Wanderlust \e$BFCM-$N%-!<$,$"$C$?$j\e(B
 \e$B$7$^$9$N$G!"40A4$K8_49@-$,$"$k$o$1$G$O$"$j$^$;$s!#\e(B
+@xref{Score File Format, , ,gnus-ja, The gnus Newsreader}.
 
-@example
+@lisp
+@group
 (("subject"
   ("for sale" -1000 nil s)
   ("\e$BLY$1\e(B" -1000 nil s))
@@ -5048,10 +5437,11 @@ Non-nil \e$B$J$i$P!"%5%^%jF14|;~$KL$FI\e(B/\e$B=EMW%^!<%/$bF14|$7$^$9!#\e(B
  ("chars"
   (1000000 -10 nil >))
  (important 5000)
- (temp 3000)
+ (target 3000)
  (mark 0)
  (expunge -3000))
-@end example
+@end group
+@end lisp
 
 @table @code
 @item \e$BJ8;zNs\e(B (STRING)
@@ -5141,12 +5531,12 @@ Non-nil \e$B$J$i$P!"%5%^%jF14|;~$KL$FI\e(B/\e$B=EMW%^!<%/$bF14|$7$^$9!#\e(B
 @code{mark} \e$B$H\e(B @code{expunge} \e$B$rF1;~$K;XDj$7$^$9!#\e(B
 \e$B$D$^$j!"$3$NCM$h$j>.$5$$%9%3%"$N%a%C%;!<%8$O4{FI%^!<%/$r$D$1!"%5%^%j$+$i>C5n$7$^$9!#\e(B
 
-@item temp
-\e$B$3$NCM$h$jBg$-$$%9%3%"$N%a%C%;!<%8$K$O\e(B temp \e$B%^!<%/$r$D$1$^$9!#\e(B
-\e$B%G%U%)%k%HCM$O\e(B @code{wl-summary-temp-above} \e$B$G;XDj$5$l$^$9!#\e(B
+@item target
+\e$B$3$NCM$h$jBg$-$$%9%3%"$N%a%C%;!<%8$K$O$^$H$a=hM}MQ%^!<%/\e(B @samp{*} \e$B$r$D$1$^$9!#\e(B
+\e$B%G%U%)%k%HCM$O\e(B @code{wl-summary-target-above} \e$B$G;XDj$5$l$^$9!#\e(B
 
 @item important
-\e$B$3$NCM$h$jBg$-$$%9%3%"$N%a%C%;!<%8$K$O\e(B important \e$B%^!<%/$r$D$1$^$9!#\e(B
+\e$B$3$NCM$h$jBg$-$$%9%3%"$N%a%C%;!<%8$K$O=EMW%^!<%/\e(B @samp{$} \e$B$r$D$1$^$9!#\e(B
 \e$B%G%U%)%k%HCM$O\e(B @code{wl-summary-important-above} \e$B$G;XDj$5$l$^$9!#\e(B
 @end table
 
@@ -5170,6 +5560,7 @@ Non-nil \e$B$J$i$P!"%5%^%jF14|;~$KL$FI\e(B/\e$B=EMW%^!<%/$bF14|$7$^$9!#\e(B
 \e$B%U%)%k%@<oJL$K$h$j;2>H$G$-$k%-!<$N0lMw!#\e(B
 
 @example
+@group
                         chars lines xref  extra
 localdir,localnews      \e$B!{\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
 nntp (xover\e$BBP1~\e(B)        \e$B!{\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B!_\e(B
@@ -5180,12 +5571,10 @@ pop3                    \e$B!_\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
                 \e$B!{\e(B: \e$B;2>H$G$-$k\e(B
                 \e$B!_\e(B: \e$B;2>H$G$-$J$$\e(B(\e$BL5;k$5$l$k\e(B)
                 \e$B"$\e(B: @code{elmo-msgdb-extra-fields} \e$B$r@_Dj$9$l$P;2>H$G$-$k\e(B
+@end group
 @end example
 
 
-@c
-@c  Customization
-@c
 @node Customization, Mailing List, Scoring, Top
 @chapter Wanderlust \e$B$N%+%9%?%^%$%:\e(B
 @cindex Customization
@@ -5193,8 +5582,10 @@ pop3                    \e$B!_\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
 @menu
 * Living with other packages::  \e$B%Q%C%1!<%8$N$"$k@83h\e(B
 * Highlights::                  \e$B%O%$%i%$%H$N@_Dj\e(B
+* Biff::                        \e$B%a!<%k$NCe?.$r$7$i$;$k\e(B
 * Advanced Settings::           \e$B%+%9%?%^%$%:!A1~MQJT!A\e(B
 * Customizable Valiables::      \e$B$=$NB>$N%+%9%?%^%$%:JQ?t0lMw\e(B
+* Hooks::                       \e$B%U%C%/\e(B
 @end menu
 
 
@@ -5204,6 +5595,7 @@ pop3                    \e$B!_\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
 \e$BB>$N%Q%C%1!<%8$r;H$&$?$a$N@_DjNc$G$9!#\e(B
 
 @menu
+* imput::                       imput (im-wl.el)
 * BBDB::                        BBDB
 * supercite::                   supercite.el
 * mu-cite::                     mu-cite.el
@@ -5212,17 +5604,39 @@ pop3                    \e$B!_\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
 @end menu
 
 
-@node BBDB, supercite, Living with other packages, Living with other packages
+@node imput, BBDB, Living with other packages, Living with other packages
+@subsection imput
+@pindex imput
+@cindex im-wl
+
+@file{util/im-wl.el} \e$B$r\e(B @code{load-path} \e$B$K$*$$$F0J2<$N$h$&$K@_Dj$9$l$P\e(B 
+OK \e$B$G$9!#\e(B
+
+\e$B%$%s%9%H!<%k;~$K\e(B @code{exec-path} \e$B>e$K\e(B imput \e$B$,$"$l$P!"\e(B@file{im-wl.el}
+\e$B$O%$%s%9%H!<%k$5$l$^$9!#\e(B
+@xref{Install}.
+
+@lisp
+@group
+(autoload 'wl-draft-send-with-imput-async "im-wl")
+(setq wl-draft-send-func 'wl-draft-send-with-imput-async)
+@end group
+@end lisp
+
+
+@node BBDB, supercite, imput, Living with other packages
 @subsection bbdb.el
 @pindex BBDB
 
-@file{util/bbdb-wl.el} \e$B$r\e(B load-path \e$B$K$*$$$F0J2<$N$h$&$K@_Dj$9$l$P\e(B OK \e$B$G$9!#\e(B
+@file{util/bbdb-wl.el} \e$B$r\e(B @code{load-path} \e$B$K$*$$$F0J2<$N$h$&$K@_Dj$9$l$P\e(B
+OK \e$B$G$9!#\e(B
 
-\e$B%$%s%9%H!<%k;~$K\e(B load-path \e$B>e$K\e(B BBDB \e$B$,$"$l$P!"\e(B
+\e$B%$%s%9%H!<%k;~$K\e(B @code{load-path} \e$B>e$K\e(B BBDB \e$B$,$"$l$P!"\e(B
 @file{bbdb-wl.el} \e$B$O%P%$%H%3%s%Q%$%k\e(B/\e$B%$%s%9%H!<%k$5$l$^$9!#\e(B
 @xref{Install}.
 
 @lisp
+@group
 (require 'bbdb-wl)
 
 (bbdb-wl-setup)
@@ -5237,6 +5651,7 @@ pop3                    \e$B!_\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
 ;; @r{\e$B<+F0E*$K\e(B ML \e$B%U%#!<%k%I$r2C$($k\e(B}
 (add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook)
 (setq bbdb-auto-notes-alist '(("X-ML-Name" (".*$" ML 0))))
+@end group
 @end lisp
 
 
@@ -5245,9 +5660,10 @@ pop3                    \e$B!_\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
 @pindex sc
 @pindex supercite
 
-\e$B$U$D$&$N\e(B mailer \e$B$HF1$8@_Dj$G\e(B OK \e$B$G$9!#0J2<$O!"@_Dj$N0lNc$G$9!#\e(B
+\e$B$U$D$&$N%a!<%i$HF1$8@_Dj$G\e(B OK \e$B$G$9!#0J2<$O!"@_Dj$N0lNc$G$9!#\e(B
 
 @lisp
+@group
 (autoload 'sc-cite-original "sc" nil t)
 (setq mail-yank-hooks 'sc-cite-original)
 (setq sc-preferred-header-style 1)
@@ -5255,6 +5671,7 @@ pop3                    \e$B!_\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
 (setq sc-citation-leader "")
 (setq sc-load-hook '(lambda () (require 'sc-register)))
 (setq sc-preferred-attribution 'registeredname)
+@end group
 @end lisp
 
 
@@ -5262,22 +5679,26 @@ pop3                    \e$B!_\e(B    \e$B"$\e(B    \e$B"$\e(B    \e$B"$\e(B
 @subsection mu-cite.el
 @pindex mu-cite
 
-\e$B$U$D$&$N\e(B mailer \e$B$HF1$8@_Dj$G\e(B OK \e$B$G$9!#0J2<$O!"@_Dj$N0lNc$G$9!#\e(B
+\e$B$U$D$&$N%a!<%i$HF1$8@_Dj$G\e(B OK \e$B$G$9!#0J2<$O@_Dj$N0lNc$G$9!#\e(B
 
 mu-cite 8.0\e$B0JA0$N%P!<%8%g%s$r$*;H$$$J$i!"\e(B
 \e$B0J2<$N$h$&$K@_Dj$7$F$/$@$5$$!#\e(B
 
 @lisp
+@group
 (autoload 'mu-cite/cite-original "mu-cite" nil t)
 (setq mail-citation-hook 'mu-cite/cite-original)
+@end group
 @end lisp
 
 mu-cite 8.1\e$B0J9_$N%P!<%8%g%s$r$*;H$$$J$i!"\e(B
 \e$B0J2<$N$h$&$K@_Dj$7$F$/$@$5$$!#\e(B
 
 @lisp
+@group
 (autoload 'mu-cite-original "mu-cite" nil t)
 (add-hook 'mail-citation-hook (function mu-cite-original))
+@end group
 @end lisp
 
 @node x-face-mule, dired-dd, mu-cite, Living with other packages
@@ -5291,36 +5712,41 @@ x-face-mule 0.19\e$B0JA0$N%P!<%8%g%s$r$*;H$$$J$i!"\e(B
 \e$B0J2<$N$h$&$K@_Dj$7$F$/$@$5$$!#\e(B
 
 @lisp
+@group
 (setq wl-highlight-x-face-func
       (function
        (lambda (beg end)
         (x-face-mule:x-face-decode-message-header))))
 (require 'x-face-mule)
+@end group
 @end lisp
 
 x-face-mule 0.20 \e$B0J9_$N%P!<%8%g%s$r$*;H$$$J$i!"\e(B
 \e$B0J2<$N$h$&$K@_Dj$7$F$/$@$5$$!#\e(B
 
 @lisp
+@group
 (setq wl-highlight-x-face-func
       (function
        (lambda (beg end)
         (x-face-mule-x-face-decode-message-header))))
 (require 'x-face-mule)
+@end group
 @end lisp
 
 bitmap-mule 8.0\e$B0J9_$KIUB0$N\e(B @file{x-face-mule.el}
 \e$B$r$*;H$$$K$J$k>l9g$O0J2<$N$h$&$K@_Dj$7$F$/$@$5$$!#\e(B
 
 @lisp
+@group
 (autoload 'x-face-decode-message-header "x-face-mule")
-(setq wl-highlight-x-face-func
-      (function x-face-decode-message-header))
+(setq wl-highlight-x-face-func 'x-face-decode-message-header)
+@end group
 @end lisp
 
-Encode \e$B:Q$_$N\e(B X-Face \e$BJ8;zNs$r\e(B @file{~/.xface}
+\e$B%(%s%3!<%I:Q$_$N\e(B X-Face \e$BJ8;zNs$r\e(B @file{~/.xface}
 (\e$BJQ?t\e(B @code{wl-x-face-file} \e$B$NCM$G$9\e(B)\e$B$NFbMF$KMQ0U$7$F$*$/$H!"\e(B
-\e$B%I%i%U%H$,=`Hw$5$l$k$H$-$K<+F0E*$K\e(B X-Face\e$B%U%#!<%k%I$H$7$FA^F~$5$l$^$9!#\e(B
+\e$B%I%i%U%H$,=`Hw$5$l$k$H$-$K<+F0E*$K\e(B @samp{X-Face:} \e$B%U%#!<%k%I$H$7$FA^F~$5$l$^$9!#\e(B
 (\e$BJQ?t\e(B @code{wl-auto-insert-x-face} \e$B$,\e(B non-nil \e$B$N>l9g\e(B)
 
 
@@ -5330,11 +5756,13 @@ Encode \e$B:Q$_$N\e(B X-Face \e$BJ8;zNs$r\e(B @file{~/.xface}
 @pindex Dired-DD
 @cindex Drag and Drop
 
-dired-dd \e$B%Q%C%1!<%8$K4^$^$l$k\e(B @file{dired-dd-mime.el} \e$B$rAH$_9~$a$P!"\e(BGNU Emacs
-\e$B$GJT=8Cf$NAp9F%P%C%U%!$X\e(B dired \e$B$+$i\e(B Drag&Drop \e$B$9$k$@$1$G4JC1$K%^%k%A%Q!<\e(B
-\e$B%H$r:n@.$G$-$^$9\e(B(\e$B$b$C$H$b!"\e(BWanderlust \e$B@lMQ$G$O$J$/\e(B tm/SEMI \e$BHFMQ$G$9$,\e(B)\e$B!#\e(B
+dired-dd \e$B%Q%C%1!<%8$K4^$^$l$k\e(B @file{dired-dd-mime.el} \e$B$rAH$_9~$a$P!"\e(BGNU
+Emacs \e$B$GJT=8Cf$NAp9F%P%C%U%!$X\e(B dired \e$B$+$i%I%i%C%0\e(B&\e$B%I%m%C%W$9$k$@$1$G4JC1\e(B
+\e$B$K%^%k%A%Q!<%H$r:n@.$G$-$^$9\e(B(\e$B$b$C$H$b!"\e(BWanderlust \e$B@lMQ$G$O$J$/\e(B tm/SEMI 
+\e$BHFMQ$G$9$,\e(B)\e$B!#\e(B
 
 @lisp
+@group
 ;; @r{dired-dd:} http://www.asahi-net.or.jp/~pi9s-nnb/dired-dd-home.html
 (add-hook 'dired-load-hook
           (function
@@ -5345,10 +5773,11 @@ dired-dd \e$B%Q%C%1!<%8$K4^$^$l$k\e(B @file{dired-dd-mime.el} \e$B$rAH$_9~$a$P!"\e(B
              (if window-system
                  (progn (require 'dired-dd)
                         (require 'dired-dd-mime))))))
+@end group
 @end lisp
 
 
-@node Highlights, Advanced Settings, Living with other packages, Customization
+@node Highlights, Biff, Living with other packages, Customization
 @section \e$B%O%$%i%$%H$N@_Dj\e(B
 
 @subsection \e$B%+%9%?%^%$%:JQ?t\e(B
@@ -5411,13 +5840,13 @@ Non-nil \e$B$J$i\e(B@code{wl-highlight-citation-prefix-regexp}\e$B$GM?$($i$l$k\e(B
 @vindex wl-highlight-citation-header-regexp
 \e$B0zMQ$r;O$a$k$3$H$r<($9%X%C%@$N@55,I=8=$r;XDj$7$^$9!#\e(B
 \e$B$3$N@55,I=8=$K%^%C%A$7$?K\J8$O!"\e(B
-@code{wl-highlight-message-headers}\e$B$G;XDj$5$l$k\e(Bface\e$B$G%O%$%i%$%H$5$l$^$9!#\e(B
+@code{wl-highlight-message-headers}\e$B$G;XDj$5$l$k\e(B face \e$B$G%O%$%i%$%H$5$l$^$9!#\e(B
 
 @item  wl-highlight-max-message-size
 @vindex wl-highlight-max-message-size
 \e$B=i4|@_Dj$O\e(B 10000\e$B!#\e(B
 \e$B%a%C%;!<%8$,$3$NCM$h$jBg$-$$>l9g!"%a%C%;!<%8$N%O%$%i%$%H$r9T$$$^$;$s!#\e(B
-\e$B$3$l$K$h$j\e(Buuencode\e$B$dHs>o$KBg$-$J%@%$%8%'%9%H$J$I$N\e(B
+\e$B$3$l$K$h$j\e(B uuencode \e$B$dHs>o$KBg$-$J%@%$%8%'%9%H$J$I$N\e(B
 \e$B%O%$%i%$%H$NM^;_$r9T$$$^$9!#\e(B
 
 @item  wl-highlight-signature-separator
@@ -5425,7 +5854,7 @@ Non-nil \e$B$J$i\e(B@code{wl-highlight-citation-prefix-regexp}\e$B$GM?$($i$l$k\e(B
 \e$B%7%0%K%A%c$N6-3&$rI=$9@55,I=8=$r;XDj$7$^$9!#\e(B
 \e$B@55,I=8=$G$b!"@55,I=8=$N%j%9%H$G$b9=$$$^$;$s!#\e(B
 \e$B$3$N@55,I=8=$K%^%C%A$7$?>l=j0J9_$N%a%C%;!<%8$O!"\e(B
-@code{wl-highlight-message-signature}\e$B$G;XDj$5$l$k\e(Bface\e$B$G%O%$%i%$%H$5$l$^$9!#\e(B
+@code{wl-highlight-message-signature}\e$B$G;XDj$5$l$k\e(B face \e$B$G%O%$%i%$%H$5$l$^$9!#\e(B
 
 @item  wl-max-signature-size
 @vindex wl-max-signature-size
@@ -5442,10 +5871,11 @@ Non-nil \e$B$J$i%U%)%k%@%b!<%I!"%5%^%j%b!<%I$J$I$G\e(B
 
 @subsection \e$BJ8;z$N?'!"%U%)%s%H$N@_Dj\e(B
 
-\e$BJ8;z$N?'$d!"%U%)%s%H$rJQ$($k$K$O!"\e(BWanderlust \e$B$GDj5A$5$l$F$$$k\e(B face \e$B$rJQ99\e(B
-\e$B$9$kI,MW$,$"$j$^$9!#%U%)%s%H$rJQ$($?$$$H$-$O\e(B set-face-font\e$B!"?'$rJQ$($?$$$H\e(B
-\e$B$-$O\e(B set-face-foreground \e$B$J$I$r;H$($P$h$$$G$7$g$&!#\e(Bface \e$B$N@_Dj$O\e(B @file{.emacs} \e$B$K\e(B
-\e$B=q$/$3$H$O$G$-$J$$$N$G\e(B @file{~/.wl} \e$B$K=q$$$F$/$@$5$$!#\e(B
+\e$BJ8;z$N?'$d!"%U%)%s%H$rJQ$($k$K$O!"\e(BWanderlust \e$B$GDj5A$5$l$F$$$k\e(B face \e$B$rJQ\e(B
+\e$B99$9$kI,MW$,$"$j$^$9!#%U%)%s%H$rJQ$($?$$$H$-$O\e(B @code{set-face-font}\e$B!"\e(B
+\e$B?'$rJQ$($?$$$H$-$O\e(B @code{set-face-foreground} \e$B$J$I$r;H$($P$h$$$G$7$g$&!#\e(B
+face \e$B$N@_Dj$O\e(B @file{.emacs} \e$B$K=q$/$3$H$O$G$-$J$$$N$G\e(B @file{~/.wl} \e$B$K=q$$\e(B
+\e$B$F$/$@$5$$!#\e(B
 
 \e$B$?$H$($P!"%7%0%K%A%c$N?'$r2+?'$KJQ$($?$$$H$-$O!"\e(B
 
@@ -5467,19 +5897,19 @@ Non-nil \e$B$J$i%U%)%k%@%b!<%I!"%5%^%j%b!<%I$J$I$G\e(B
 
 @item wl-highlight-message-important-header-contents
 \e$B%a%C%;!<%8%X%C%@$NFbMF$N$&$A=EMW$JItJ,$N\e(B face \e$B$G$9!#\e(B
-\e$B%G%U%)%k%H$G$O!"\e(BSubject \e$B$NFbMFItJ,$,@_Dj$5$l$F$$$^$9!#\e(B
+\e$B%G%U%)%k%H$G$O!"\e(B@samp{Subject:} \e$B$NFbMFItJ,$,@_Dj$5$l$F$$$^$9!#\e(B
 \e$B$3$NCM$O\e(B @code{wl-highlight-message-header-alist}
  \e$B$rJQ99$9$l$PJQ$($k$3$H$,$G$-$^$9!#\e(B
 
 @item wl-highlight-message-important-header-contents2
 \e$B%a%C%;!<%8%X%C%@$NFbMF$N$&$A=EMW$JItJ,$N\e(B face \e$B$=$N#2$G$9!#\e(B
-\e$B%G%U%)%k%H$G$O!"\e(BFrom \e$B$H\e(B To \e$B$NFbMFItJ,$,@_Dj$5$l$F$$$^$9!#\e(B
+\e$B%G%U%)%k%H$G$O!"\e(B@samp{From:} \e$B$H\e(B @samp{To:} \e$B$NFbMFItJ,$,@_Dj$5$l$F$$$^$9!#\e(B
 \e$B$3$NCM$O\e(B @code{wl-highlight-message-header-alist}
  \e$B$rJQ99$9$l$PJQ$($k$3$H$,$G$-$^$9!#\e(B
 
 @item wl-highlight-message-unimportant-header-contents
 \e$B%a%C%;!<%8%X%C%@$NFbMF$N$&$A=EMW$G$O$J$$ItJ,$N\e(B face \e$B$G$9!#\e(B
-\e$B%G%U%)%k%H$G$O!"\e(BX- \e$B$G;O$^$k%X%C%@$H\e(B User-Agent \e$B$NFbMFItJ,$,@_Dj$5$l$F$$$^$9!#\e(B
+\e$B%G%U%)%k%H$G$O!"\e(B@samp{X-} \e$B$G;O$^$k%X%C%@$H\e(B @samp{User-Agent:} \e$B$NFbMFItJ,$,@_Dj$5$l$F$$$^$9!#\e(B
 \e$B$3$NCM$O\e(B @code{wl-highlight-message-header-alist}
  \e$B$rJQ99$9$l$PJQ$($k$3$H$,$G$-$^$9!#\e(B
 
@@ -5527,7 +5957,7 @@ Non-nil \e$B$J$i%U%)%k%@%b!<%I!"%5%^%j%b!<%I$J$I$G\e(B
 \e$B%5%^%j$G%3%T!<%^!<%/$N$D$$$?%a%C%;!<%89T$N\e(B face \e$B$G$9!#\e(B
 
 @item wl-highlight-summary-target-face
-\e$B%5%^%j$G0l;~=hM}MQ%^!<%/\e(B @samp{*} \e$B$N$D$$$?%a%C%;!<%89T$N\e(B face \e$B$G$9!#\e(B
+\e$B%5%^%j$G$^$H$a=hM}MQ%^!<%/\e(B @samp{*} \e$B$N$D$$$?%a%C%;!<%89T$N\e(B face \e$B$G$9!#\e(B
 
 @item wl-highlight-summary-thread-top-face
 \e$B%5%^%j$G%9%l%C%I%H%C%W$N%a%C%;!<%89T$N\e(B face \e$B$G$9!#\e(B
@@ -5559,11 +5989,13 @@ Non-nil \e$B$J$i%U%)%k%@%b!<%I!"%5%^%j%b!<%I$J$I$G\e(B
 
 @item wl-highlight-folder-opened-face
 \e$B%U%)%k%@%b!<%I$G!"3+$$$?%0%k!<%W$K$D$/\e(B face \e$B$G$9!#\e(B
-\e$BJQ?t\e(B @code{wl-highlight-group-folder-by-numbers} \e$B$,\e(B nil \e$B$N$H$-M-8z$G$9!#\e(B
+\e$BJQ?t\e(B @code{wl-highlight-folder-by-numbers} \e$B$,\e(B @code{nil} \e$B$+\e(B @dfn{\e$B?t\e(B} \e$B$N\e(B
+\e$B$H$-M-8z$G$9!#\e(B
 
 @item wl-highlight-folder-closed-face
 \e$B%U%)%k%@%b!<%I$G!"JD$8$?%0%k!<%W$K$D$/\e(B face \e$B$G$9!#\e(B
-\e$BJQ?t\e(B @code{wl-highlight-group-folder-by-numbers} \e$B$,\e(B nil \e$B$N$H$-M-8z$G$9!#\e(B
+\e$BJQ?t\e(B @code{wl-highlight-folder-by-numbers} \e$B$,\e(B @code{nil} \e$B$+\e(B @dfn{\e$B?t\e(B} \e$B$N\e(B
+\e$B$H$-M-8z$G$9!#\e(B
 
 @item wl-highlight-folder-path-face
 \e$B%U%)%k%@%b!<%I$G!"8=:_A*BrCf$N%U%)%k%@$^$G$N%Q%9$K$D$/\e(B face \e$B$G$9!#\e(B
@@ -5576,45 +6008,78 @@ Non-nil \e$B$J$i%U%)%k%@%b!<%I!"%5%^%j%b!<%I$J$I$G\e(B
 @end table
 
 
-@node Advanced Settings, Customizable Valiables, Highlights, Customization
+@node Biff, Advanced Settings, Highlights, Customization
+@section \e$B%a!<%k$NCe?.$rCN$i$;$k\e(B
+
+\e$B0J2<$N$h$&$K@_Dj$7$F$*$/$H\e(B @samp{%inbox} \e$B$K%a!<%k$,FO$$$?$H$-$K!"\e(B
+\e$B%b!<%I%i%$%s$NI=<($K$h$j%a!<%k$NCe?.$rCN$i$;$F$/$l$^$9!#\e(B
+
+@lisp
+(setq wl-biff-check-folder-list '("%inbox"))
+@end lisp
+
+@subsection \e$B%+%9%?%^%$%:JQ?t\e(B
+
+@table @code
+@item wl-biff-check-folder-list
+@vindex wl-biff-check-folder-list
+\e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
+\e$B%a!<%k$NCe?.$r%A%'%C%/$9$k%U%)%k%@$N%j%9%H!#\e(B
+nil \e$B$N>l9g$OCe?.$N%A%'%C%/$r9T$J$$$^$;$s!#\e(B
+
+@item wl-biff-check-interval
+@vindex wl-biff-check-interval
+\e$B=i4|@_Dj$O\e(B 40\e$B!JC10L!'IC!K!#\e(B
+\e$B$3$NCM$4$H$K%a!<%kCe?.$N%A%'%C%/$r9T$J$$$^$9!#\e(B
+@end table
+
+
+@node Advanced Settings, Customizable Valiables, Biff, Customization
 @section \e$B%+%9%?%^%$%:!A1~MQJT!A\e(B
 
 @menu
 * Draft for Reply::             \e$BJV;vMQ%I%i%U%H\e(B
 * Thread Format::               \e$B%9%l%C%I$N8+$?L\\e(B
-* User-Agent Header::           User-Agent \e$B%X%C%@\e(B
+* User-Agent Field::            @samp{User-Agent:} \e$B%X%C%@%U%#!<%k%I\e(B
 @end menu
 
 
 @node Draft for Reply, Thread Format, Advanced Settings, Advanced Settings
 @subsection \e$BJV;vMQ%I%i%U%H\e(B
 
-Mailng List \e$B$N5-;v$KJV;v$r=q$/$H$-$O!"%5%^%j%b!<%I$G\e(B @kbd{a} \e$B$r2!$7$?$@$1$G\e(B
-\e$B855-;v$N\e(B Reply-To \e$B$K$"$k%"%I%l%9$r\e(B To \e$B$KMQ0U$7$F$[$7$$!"$H$$$&>l9g$O!"\e(B
-\e$B0J2<$N$h$&$K$7$?$i$h$$$G$7$g$&!#\e(B
+\e$B%a!<%j%s%0%j%9%H$N5-;v$KJV;v$r=q$/$H$-$O!"%5%^%j%b!<%I$G\e(B @kbd{a} \e$B$r2!$7\e(B
+\e$B$?$@$1$G855-;v$N\e(B @samp{Reply-To:} \e$B$K$"$k%"%I%l%9$r\e(B @samp{To:} \e$B$KMQ0U$7$F\e(B
+\e$B$[$7$$!"$H$$$&>l9g$O0J2<$N$h$&$K$7$?$i$h$$$G$7$g$&!#\e(B
 
 @lisp
+@group
 (setq wl-draft-reply-without-argument-list
       '(("Mail-Followup-To" . (("Mail-Followup-To") nil ("Newsgroups")))
         ("Followup-To" . (nil nil ("Followup-To")))
         (("X-ML-Name" "Reply-To") . (("Reply-To") nil nil))
         ("From" . (("From") ("To" "Cc") ("Newsgroups")))))
+@end group
 @end lisp
 
 @noindent
-("X-ML-Name" \e$B%U%#!<%k%I5Z$S\e(B "Reply-To" \e$B%U%#!<%k%I$NN>J}$,855-;v$K\e(B
-\e$BB8:_$9$k>l9g$@$1\e(B To: \e$B$K855-;vCf$N\e(B Reply-To: \e$B%U%#!<%k%I$,=`Hw$5$l$^$9!#\e(B)
+(@samp{X-ML-Name:} \e$B%U%#!<%k%I5Z$S\e(B @samp{Reply-To:} \e$B%U%#!<%k%I$NN>J}$,855-;v$K\e(B
+\e$BB8:_$9$k>l9g$@$1!"\e(B@samp{To:} \e$B$K855-;vCf$N\e(B @samp{Reply-To:} \e$B%U%#!<%k%I$,=`Hw$5$l$^$9!#\e(B)
+
+@c (\e$B:G8e$N9T$N0UL#$O!"%I%i%U%H$N\e(B @samp{To:} \e$B$K855-;vCf$N\e(B @samp{From:} \e$B%U%#!<\e(B
+@c \e$B%k%I$,!"%I%i%U%H$N\e(B @samp{Cc:} \e$B$K855-;v$N\e(B @samp{To:} \e$B%U%#!<%k%I$*$h$S\e(B 
+@c @samp{Cc:} \e$B%U%#!<%k%I!"$=$7$F\e(B @samp{Newsgroups:} \e$B$K855-;v$N\e(B c
+@c @samp{Newsgroups:} \e$B%U%#!<%k%I$,$=$l$>$l\e(B (\e$B$"$l$P\e(B) \e$B=`Hw$5$l$k$H$$$&$3$H$G\e(B
+@c \e$B$9!#\e(B)
 
-@c @noindent
-@c (\e$B:G8e$N9T$N0UL#$O!"\e(BTo: \e$B$K855-;vCf$N\e(B From \e$B%U%#!<%k%I$,!"\e(BCc: \e$B$K855-;v$N\e(B 
-@c To \e$B%U%#!<%k%I$*$h$S\e(B Cc \e$B%U%#!<%k%I!"$=$7$F\e(B Newsgroups: \e$B$K855-;v$N\e(B 
-@c Newsgroups \e$B%U%#!<%k%I$,$=$l$>$l\e(B (\e$B$"$l$P\e(B) \e$B=`Hw$5$l$k$H$$$&$3$H$G$9!#\e(B)
+\e$BF1MM$K$7$F!"\e(Bprefix argument \e$BIU$-$G\e(B  @kbd{a} \e$B$r2!$7$?$H$-$NF0:n$,!"\e(B
+@code{wl-draft-reply-with-argument-list} \e$B$G@_Dj$G$-$^$9!#\e(B
 
 
-@node Thread Format, User-Agent Header, Draft for Reply, Advanced Settings
+@node Thread Format, User-Agent Field, Draft for Reply, Advanced Settings
 @subsection \e$B%9%l%C%I$N8+$?$a\e(B
 
 @example
+@group
   389  09/18(\e$B6b\e(B)01:07 [ \e$B$F$i$K$7\e(B          ] wl-0.6.3
   390  09/18(\e$B6b\e(B)07:25 +-[ \e$BDEM8$5$s\e(B          ]
   391  09/18(\e$B6b\e(B)19:24 +-[ \e$BB<ED$5$s\e(B          ]
@@ -5628,49 +6093,69 @@ Mailng List \e$B$N5-;v$KJV;v$r=q$/$H$-$O!"%5%^%j%b!<%I$G\e(B @kbd{a} \e$B$r2!$7$?$@
   416  09/22(\e$B2P\e(B)12:38 |           +-[ \e$B$F$i$K$7\e(B          ]
   395  09/20(\e$BF|\e(B)21:49 +-[ \e$B1|@>$5$s\e(B          ]
   397  09/21(\e$B7n\e(B)00:15 +-[ \e$B1|@>$5$s\e(B          ]
+@end group
 @end example
 
 \e$B%9%l%C%I$N8+$?$a$r>e5-$N$h$&$K$7$?$$>l9g$N@_Dj$O0J2<$NDL$j$G$9!#\e(B
 
 @lisp
+@group
 (setq wl-thread-indent-level 2)
 (setq wl-thread-have-younger-brother-str "+")
 (setq wl-thread-youngest-child-str       "+")
 (setq wl-thread-vertical-str             "|")
 (setq wl-thread-horizontal-str           "-")
 (setq wl-thread-space-str                " ")
+@end group
 @end lisp
 
 \e$B;^$rI=<($7$J$$$h$&$K$7$?$$>l9g$N@_Dj$O0J2<$N$h$&$K$7$^$9!#\e(B
 
 @lisp
+@group
 (setq wl-thread-indent-level 2)
 (setq wl-thread-have-younger-brother-str " ")
 (setq wl-thread-youngest-child-str       " ")
 (setq wl-thread-vertical-str             " ")
 (setq wl-thread-horizontal-str           " ")
 (setq wl-thread-space-str                " ")
+@end group
 @end lisp
 
-@node User-Agent Header,  , Thread Format, Advanced Settings
-@subsection User-Agent
+@node User-Agent Field,  , Thread Format, Advanced Settings
+@subsection User-Agent \e$B%U%#!<%k%I\e(B
 
- X-Mailer \e$B%U%#!<%k%I$d\e(B User-Agent \e$B%U%#!<%k%I$K6E$j$?$$$H$$$&\e(B
-\e$BJQ$o$C$?$R$H$O!"E,Ev$KJ8;zNs$r\e(B insert \e$B$9$k4X?t$r<+J,$N9%$-$J$h$&$KDj5A$7$F\e(B
+@samp{X-Mailer:} \e$B%U%#!<%k%I$d\e(B @samp{User-Agent:} \e$B%U%#!<%k%I$K6E$j$?$$$H\e(B
+\e$B$$$&JQ$o$C$??M$O!"E,Ev$KJ8;zNs$r@8@.$9$k4X?t$r<+J,$N9%$-$J$h$&$KDj5A$7$F\e(B
 @code{wl-generate-mailer-string-func} \e$B$K@_Dj$7$F$/$@$5$$!#\e(B
 
-\e$B0J2<$O@_Dj$N0lNc$G$9!#\e(B
+@samp{User-Agent:} \e$B%U%#!<%k%I$rC;$/$7$?$$$N$G$"$l$P!"0J2<$N@_Dj$r$7$F$/\e(B
+\e$B$@$5$$!#\e(B
+
+@lisp
+@group
+(setq wl-generate-mailer-string-func
+      (function
+       (lambda ()
+         (let ((mime-edit-insert-user-agent-field nil))
+           (wl-generate-user-agent-string)))))
+@end group
+@end lisp
+
+\e$B0J2<$O@_Dj$NNc$G$9!#\e(B
 
 @lisp
+@group
 (setq wl-generate-mailer-string-func
       (function
        (lambda ()
-         (concat "X-Mailer: "
-                 (format "%s/%s (%s)" wl-appname wl-version wl-codename)))))
+         (format "X-Mailer: %s" (product-string-1 'wl-version)))))
+@end group
 @end lisp
 
 
-@node Customizable Valiables,  , Advanced Settings, Customization
+
+@node Customizable Valiables, Hooks, Advanced Settings, Customization
 @section \e$B$=$NB>$N%+%9%?%^%$%:JQ?t0lMw\e(B
 
 \e$B$=$NB>$N%+%9%?%^%$%:JQ?t0lMw!#\e(B
@@ -5678,16 +6163,16 @@ Mailng List \e$B$N5-;v$KJV;v$r=q$/$H$-$O!"%5%^%j%b!<%I$G\e(B @kbd{a} \e$B$r2!$7$?$@
 @table @code
 @item wl-default-folder
 @vindex wl-default-folder
-\e$B=i4|@_Dj$O\e(B "%inbox"\e$B!#%U%)%k%@0\F0;~$J$I$N%G%U%)%k%HCM$H$J$j$^$9!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{%inbox}\e$B!#%U%)%k%@0\F0;~$J$I$N%G%U%)%k%HCM$H$J$j$^$9!#\e(B
 
 @item wl-draft-folder
 @vindex wl-draft-folder
-\e$B=i4|@_Dj$O\e(B "+draft"\e$B!#%I%i%U%H$r%;!<%V$9$k%U%)%k%@$G$9!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{+draft}\e$B!#%I%i%U%H$r%;!<%V$9$k%U%)%k%@$G$9!#\e(B
 localdir \e$B%U%)%k%@$G$"$kI,MW$,$"$j$^$9!#\e(B
 
 @item wl-trash-folder
 @vindex wl-trash-folder
-\e$B=i4|@_Dj$O\e(B "+trash"\e$B!#%4%_H"%U%)%k%@$G$9!#\e(B
+\e$B=i4|@_Dj$O\e(B @samp{+trash}\e$B!#%4%_H"%U%)%k%@$G$9!#\e(B
 \e$B$3$NCM$rJQ99$7$?$H$-$O\e(B Wanderlust \e$B$r:F5/F0$9$k$3$H$r$*4+$a$7$^$9!#\e(B
 
 @item wl-interactive-exit
@@ -5703,44 +6188,44 @@ Non-nil \e$B$J$i$P!"%a!<%kAw?.;~$KK\Ev$KAw?.$7$F$h$$$+$r3NG'$7$^$9!#\e(B
 @item wl-folder-sync-range-alist
 @vindex wl-folder-sync-range-alist
 \e$B=i4|@_Dj$O!"0J2<$NCM!#\e(B
-@example
+
+@lisp
+@group
 (("^&.*$" . "all")
  ("^\\+draft$\\|^\\+queue$" . "all"))
-@end example
-\e$B%U%)%k%@L>$N@55,I=8=$H%U%)%k%@0\F0;~$N%5%^%j99?7%l%s%8O"A[%j%9%H$G$9!#\e(B
-\e$B99?7%l%s%8$K$O\e(B wl-summary-sync \e$B$GF~NO$G$-$kCM$N$$$:$l$+\e(B
+@end group
+@end lisp
+
+\e$B%U%)%k%@L>$N@55,I=8=$H%U%)%k%@0\F0;~$N%5%^%j99?7%l%s%8$H$NO"A[%j%9%H$G$9!#\e(B
+\e$B99?7%l%s%8$K$O\e(B @code{wl-summary-sync} \e$B$GF~NO$G$-$kCM$N$$$:$l$+\e(B
 (all, update, rescan, rescan-noscore, first, last) \e$B$r;XDj$7$^$9!#\e(B
 \e$B%^%C%A$7$J$+$C$?>l9g$O!"\e(Bupdate \e$B$H$J$j$^$9!#\e(B
 
 @item wl-ask-range
 @vindex wl-ask-range
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
-nil \e$B$J$i!"\e(Bfolder \e$B0\F0;~$N%5%^%j99?7$G\e(B @code{wl-folder-sync-range-alist} \e$B$NCM$r\e(B
-\e$B;HMQ$7$^$9!#\e(B
+nil \e$B$J$i!"%U%)%k%@0\F0;~$N%5%^%j99?7$G\e(B @code{wl-folder-sync-range-alist} 
+\e$B$NCM$r;HMQ$7$^$9!#\e(B
 
 @item wl-mime-charset
 @vindex wl-mime-charset
 \e$B=i4|@_Dj$O\e(B 'x-ctext\e$B!#\e(B
-MIME \e$B$G$O$J$$%a%C%;!<%8$N>l9g\e(B (Content-Type \e$B$,$J$$%a!<%k$J$I\e(B) \e$B$d!"\e(B
+MIME \e$B$G$O$J$$%a%C%;!<%8$N>l9g\e(B (@samp{Content-Type:} \e$B$,$J$$%a!<%k$J$I\e(B) \e$B$d!"\e(B
 \e$B%5%^%j$NI=<($GMQ$$$i$l$k\e(B MIME charset \e$B$G$9!#\e(B
-(Nemacs \e$B$H$=$NB>$N\e(B Emacs \e$B$G%5%^%j$r6&M-$7$?$$>l9g$O!"\e(B
+(Nemacs \e$B$H$=$NB>$N\e(B Emacsen \e$B$G%5%^%j$r6&M-$7$?$$>l9g$O!"\e(B
 \e$B$3$NCM$r\e(B 'iso-2022-jp \e$B$H$7$F$/$@$5$$!#\e(B)
 
-@item wl-search-mime-charset
-@vindex wl-search-mime-charset
-\e$B=i4|@_Dj$O\e(B 'iso-2022-jp\e$B!#\e(B
-\e$B8!:w$GMQ$$$k\e(B MIME charset \e$B$G$9!#\e(B
-
 @item wl-highlight-folder-with-icon
 @vindex wl-highlight-folder-with-icon
-XEmacs \e$B$N$_M-8z$G$9!#=i4|@_Dj$O\e(B XEmacs \e$B$K0MB8$7$^$9\e(B(\e$B%"%$%3%s$r;HMQ$G$-$k\e(BXEmacs \e$B$G$O\e(B t \e$B$K$J$j$^$9\e(B)\e$B!#\e(B
+XEmacs \e$B$^$?$O\e(B Emacs 21 \e$B$GM-8z$G$9!#=i4|@_Dj$O$=$N\e(B (X)Emacs \e$B$K0MB8$7$^$9\e(B
+(\e$B%"%$%3%s$r;HMQ$G$-$k\e(B (X)Emacs \e$B$G$O\e(B t \e$B$K$J$j$^$9\e(B)\e$B!#\e(B
 
 @item wl-strict-diff-folders
 @vindex wl-strict-diff-folders
 \e$B%U%)%k%@L>$N@55,I=8=$N%j%9%H$G$9!#\e(B
 \e$B%U%)%k%@%b!<%I$G\e(B @kbd{s} \e$B$r2!$9$J$I$7$FL$FI$N%a%C%;!<%8?t$r\e(B
 \e$B%A%'%C%/$7$?>l9g!"DL>o$O4J0WE*$JJ}K!$G%A%'%C%/$7$F$$$^$9\e(B(\e$B=hM}$OB.$$$,!"@53N$G$O$J$$\e(B)\e$B!#\e(B
-\e$B$3$NJQ?t$K%^%C%A$9$k%U%)%k%@$O$^$8$a$K%A%'%C%/$7$^$9!#\e(B
+\e$B$3$NJQ?t$K%^%C%A$9$k%U%)%k%@$O87L)$K%A%'%C%/$7$^$9!#\e(B
 IMAP4 \e$B%U%)%k%@$KBP$9$k>r7o%U%#%k%?%U%)%k%@$N$h$&$J>l9g$K$O!"\e(B
 \e$B$3$NJQ?t$K%^%C%A$9$k$h$&@_Dj$9$k$H$h$$$G$7$g$&!#\e(B
 \e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
@@ -5749,7 +6234,7 @@ IMAP4 \e$B%U%)%k%@$KBP$9$k>r7o%U%#%k%?%U%)%k%@$N$h$&$J>l9g$K$O!"\e(B
 @vindex wl-folder-use-server-diff
 \e$B%U%)%k%@%b!<%I$G\e(B @kbd{s} \e$B$r2!$9$J$I$7$FL$FI$N%a%C%;!<%8?t$r%A%'%C%/$7$?\e(B
 \e$B>l9g!"DL>o$O\e(B(\e$B%5!<%P>e$N%a%C%;!<%8?t\e(B)\e$B!]\e(B(\e$B%m!<%+%k$K$"$k%a%C%;!<%8?t\e(B)\e$B$,L$FI\e(B
-\e$B$H$_$J$5$l$^$9!#$7$+$7!"$3$NJQ?t$,\e(BNon-nil \e$B$J$i$P!"%5!<%P>e$NL$FI$N%a%C%;!<\e(B
+\e$B$H$_$J$5$l$^$9!#$7$+$7!"$3$NJQ?t$,\e(B non-nil \e$B$J$i$P!"%5!<%P>e$NL$FI$N%a%C%;!<\e(B
 \e$B%8?t$r%A%'%C%/$7$^$9!#\e(BIMAP4 \e$B%U%)%k%@$K$N$_1F6A$,$"$j$^$9!#$?$@$7!"JQ?t\e(B 
 @code{elmo-imap4-disuse-server-flag-mailbox-regexp} \e$B$K%^%C%A$9$k%a!<%k%\%C%/%9\e(B
 \e$B$N\e(B IMAP4 \e$B%U%)%k%@$O!"$3$NJQ?t$K%^%C%A$7$F$b%5!<%P>e$NL$FI$N%a%C%;!<%8?t\e(B
@@ -5791,11 +6276,12 @@ list \e$B$J$i$P!"\e(Blist \e$B$K@_Dj$5$l$?A4$F$N%U%)%k%@$r5/F0;~$K%A%'%C%/$7$^$9!#\e
 \e$B=i4|@_Dj$O0J2<$N%j%9%H!#\e(B
 
 @lisp
+@group
 '(("^-alt\\.chinese" . big5)
   ("^-relcom\\." . koi8-r)
   ("^-tw\\." . big5)
-  ("^-han\\." . euc-kr)
-  )
+  ("^-han\\." . euc-kr))
+@end group
 @end lisp
 
 \e$B%U%)%k%@L>$N@55,I=8=$H\e(B MIME charset \e$B$NO"A[%j%9%H$G$9!#\e(B
@@ -5818,7 +6304,7 @@ nil\e$B$N>l9g$O\e(B @code{wl-folder-init-no-load-access-folders} \e$B$,;2>H$5$l$^$9
 @item wl-delete-folder-alist
 @vindex wl-delete-folder-alist
 \e$B=i4|@_Dj$O\e(B '(("^-" . remove))\e$B!#\e(B
-delete mark \e$B$r$D$1$?%a%C%;!<%8$r:o=|$9$kJ}?K$r@_Dj$7$^$9!#\e(B
+\e$B:o=|%^!<%/\e(B @samp{D} \e$B$r$D$1$?%a%C%;!<%8$r:o=|$9$kJ}?K$r@_Dj$7$^$9!#\e(B
 \e$B%j%9%H$N3FMWAG$O%U%)%k%@$H:o=|@h$K$J$C$F$*$j!":o=|@h$K$O<!$N$b$N$,;XDj$G\e(B
 \e$B$-$^$9!#\e(B
 
@@ -5831,18 +6317,21 @@ string           : \e$B;XDj$7$?%U%)%k%@$K0\F0$9$k!#\e(B
 @item wl-refile-policy-alist
 @vindex wl-refile-policy-alist
 \e$B=i4|@_Dj$O\e(B '(("^[-=]" . copy) (".*" . move))\e$B!#\e(B
-refile mark \e$B$r$D$1$k:]!"%a%C%;!<%8$r0\F0$9$k$+%3%T!<$9$k$+$r;XDj$7$^$9!#\e(B
-\e$B%j%9%H$N3FMWAG$K$O%U%)%k%@$H\e(B copy \e$B$^$?$O\e(B move \e$B$N\e(B cons cell \e$B$r;XDj$7$^$9!#\e(B
+\e$B%j%U%!%$%k%^!<%/\e(B @samp{o} \e$B$r$D$1$k:]!"%a%C%;!<%8$r0\F0$9$k$+%3%T!<$9$k$+\e(B
+\e$B$r;XDj$7$^$9!#%j%9%H$N3FMWAG$K$O%U%)%k%@$H\e(B @code{copy} \e$B$^$?$O\e(B 
+@code{move} \e$B$H$N\e(B cons cell \e$B$r;XDj$7$^$9!#\e(B
 
 @item wl-x-face-file
 @vindex wl-x-face-file
-\e$B=i4|@_Dj$O\e(B "~/.xface"\e$B!#\e(B
-Encode \e$B:Q$_$N\e(B X-Face \e$BJ8;zNs$rFbMF$H$9$k%U%!%$%kL>$G$9!#\e(B
+\e$B=i4|@_Dj$O\e(B @file{~/.xface}\e$B!#\e(B
+\e$B%(%s%3!<%I:Q$_$N\e(B X-Face \e$BJ8;zNs$rFbMF$H$9$k%U%!%$%kL>$G$9!#\e(B
 @xref{x-face-mule}.
 
 @item wl-demo-display-logo
 @vindex wl-demo-display-logo
 Non-nil \e$B$J$i$P%*!<%W%K%s%0%G%b$G%S%C%H%^%C%W$N%$%a!<%8$rI=<($7$^$9!#\e(B
+@code{xpm}, @code{xbm} \e$B$r;XDj$9$k$H\e(B(\e$B2DG=$J$i$P\e(B)\e$B!"$=$N2hA|%?%$%W$N%$%a!<\e(B
+\e$B%8$rI=<($7$^$9!#$,2hA|%?%$%W$H$7$F;XDj$G$-$^$9!#\e(B
 
 @item elmo-use-database
 @vindex  elmo-use-database
@@ -5852,17 +6341,24 @@ Non-nil \e$B$J$i$P\e(B dbm \e$B$r;H$C$F\e(B Message-ID \e$B$N4IM}$r9T$J$$$^$9!#\e(B
 
 @item elmo-passwd-alist-file-name
 @vindex  elmo-passwd-alist-file-name
-\e$B=i4|@_Dj$O\e(B "passwd"\e$B!#\e(B
+\e$B=i4|@_Dj$O\e(B @file{passwd}\e$B!#\e(B
 \e$B%Q%9%o!<%I$r%;!<%V$7$F$*$/%U%!%$%k$NL>A0$G$9!#\e(B
 \e$B%3%^%s%I\e(B @code{elmo-passwd-alist-save} \e$B$r<B9T$9$k$H$3$N%U%!%$%k$K8=:_@_Dj\e(B
 \e$B$5$l$F$$$k%Q%9%o!<%I$,%;!<%V$5$l$^$9!#\e(B
 
+@item elmo-passwd-life-time
+@vindex  elmo-passwd-life-time
+\e$B=i4|@_Dj$O\e(B nil\e$B!#\e(B
+Non-nil \e$B$JCM$,@_Dj$5$l$?>l9g$O!"?75,$K%Q%9%o!<%I$,F~NO$5$l$F$+$i\e(B
+@code{elmo-passwd-life-time} \e$BIC8e$K%Q%9%o!<%I$r>C5n$9$k%?%$%^$,!"\e(B
+\e$B%;%C%H$5$l$^$9!#\e(B
+
 @item elmo-nntp-list-folders-use-cache
 @vindex elmo-nntp-list-folders-use-cache
 \e$B=i4|@_Dj$O\e(B 600 (\e$BIC\e(B)\e$B!#\e(B
 NNTP \e$B$K$*$$$F\e(B @samp{list} \e$B$d\e(B @samp{list active} \e$B$N7k2L$r\e(B
-cache\e$B$7$F$*$/;~4V$rICC10L$G;XDj$7$^$9!#\e(B
-nil \e$B$J$i\e(B cache \e$B$7$^$;$s!#\e(B
+\e$B%-%c%C%7%e$7$F$*$/;~4V$rICC10L$G;XDj$7$^$9!#\e(B
+nil \e$B$J$i%-%c%C%7%e$7$^$;$s!#\e(B
 
 @item elmo-nntp-max-number-precedes-list-active
 @vindex elmo-nntp-max-number-precedes-list-active
@@ -5876,9 +6372,9 @@ NNTP \e$B%5!<%P$H$7$F\e(B INN 2.3 \e$B$J$I$r;HMQ$7$F$$$F!"%U%)%k%@%b!<%I$G$N4{FI?t\e
 @item elmo-nntp-default-use-listgroup
 @vindex elmo-nntp-default-use-listgroup
 \e$B=i4|@_Dj$O\e(B t\e$B!#\e(B
-NNTP \e$B$K$*$$$F\e(B \e$BAm5-;v?t$rD4$Y$k$?$a$K!"\e(B@samp{listgroup} \e$B$r;H$&!#\e(B
-nil \e$B$J$i$P\e(B @samp{group} \e$B$N7k2L$rMQ$$$^$9!#\e(B
-@samp{group} \e$B$r;H$&$H!"@53N$5$K$O7g$1$^$9$,!"<c439bB.2=$5$l$^$9!#\e(B
+non-nil \e$B$J$i!"\e(BNNTP \e$B$K$*$$$F\e(B \e$BAm5-;v?t$rD4$Y$k$?$a$K\e(B @samp{listgroup} \e$B$r;H\e(B
+\e$B$$$^$9!#\e(Bnil \e$B$J$i$P\e(B @samp{group} \e$B$N7k2L$rMQ$$$^$9!#\e(B@samp{group} \e$B$r;H$&$H!"\e(B
+\e$B@53N$5$K$O7g$1$^$9$,!"<c439bB.2=$5$l$^$9!#\e(B
 
 @item elmo-pop3-send-command-synchronously
 @vindex elmo-pop3-send-command-synchronously
@@ -5890,20 +6386,31 @@ POP3 \e$B;2>H;~$K=hM}$,%O%s%0$9$k$h$&$J>l9g$O!"\e(Bt\e$B$K$9$k$H$$$$$+$b$7$l$^$;$s!
 @vindex elmo-dop-flush-confirm
 \e$B=i4|@_Dj$O!"\e(Bt\e$B!#\e(B
 Non-nil \e$B$J$i$P%*%U%i%$%s=hM}$GN/$C$?=hM}$r<B9T$9$k$+$I$&$+$r3NG'$7$^$9!#\e(B
+
+@item elmo-display-progress-threshold
+@vindex elmo-display-progress-threshold
+\e$B=i4|@_Dj$O\e(B 20\e$B!#\e(B
+\e$B?JD=I=<(\e(B(progress gauge)\e$B$rI=<($9$k$7$-$$CM!#$3$NCM$h$j$b99?7?t$,Bg$-$$>l\e(B
+\e$B9g$O?JD=I=<($7$^$9!#\e(B
 @end table
 
 
-@c
-@c  Mailing List
-@c
+@node Hooks,  , Customizable Valiables, Customization
+@section \e$B%U%C%/\e(B
+
+(Not yet written)
+
+
 @node Mailing List, Addition, Customization, Top
 @chapter \e$B%a!<%j%s%0%j%9%H\e(B
+@cindex Bug report
+@cindex Backtrace
 
 @display
 Wanderlust Mailing List @t{<wl@@lists.airs.net>}
 @end display
 
-Wanderlust \e$B$K4X$9$k5DO@$O$3$N%a%$%j%s%0%j%9%H$G9T$o$l$^$9!#\e(B
+Wanderlust \e$B$K4X$9$k5DO@$O$3$N%a!<%j%s%0%j%9%H$G9T$o$l$^$9!#\e(B
 \e$B:G?7%P!<%8%g%s$N%"%J%&%s%9$b$3$A$i$KN.$l$^$9!#\e(B
 
 @t{wl-ctl@@lists.airs.net} \e$B08$N%a!<%k$NK\J8$K!"\e(B
@@ -5918,13 +6425,15 @@ Wanderlust \e$B$K4X$9$k5DO@$O$3$N%a%$%j%s%0%j%9%H$G9T$o$l$^$9!#\e(B
 \e$B%P%0Js9p$d%Q%C%A$NAwIU$b$3$A$i$N%a!<%j%s%0%j%9%H$XAw$C$F$/$@$5$$!#\e(B
 \e$B%a!<%j%s%0%j%9%H$N%a%s%P$G$J$/$H$b!"Aw?.$G$-$k@_Dj$K$J$C$F$$$^$9!#\e(B
 
+\e$B$^$?!"%P%0Js9p$N>l9g$O\e(B Backtrace \e$B$r<h$C$FE:IU$9$k$H$h$j860x5fL@\e(B
+\e$B$7$d$9$/$J$j$^$9!#\e(B 
+@footnote{Backtrace \e$B$N<h$jJ}$O\e(B@uref{http://www.jpl.org/elips/BUGS-ja.html}\e$B$,;29M$K$J$j$^$9!#\e(B}
+
 \e$B%a!<%j%s%0%j%9%H$N3'MM$K$O5.=E$J8f=u8@!"\e(B
 \e$B%3!<%I$r$?$/$5$s8fDs6!$$$?$@$$$F$*$j$^$9!#\e(B
 \e$B$3$N>l$r<Z$j$F$*Ni?=$7>e$2$^$9!#\e(B
 
-@c
-@c  Addition
-@c
+
 @node Addition, Index, Mailing List, Top
 @chapter \e$B$*$^$1\e(B
 
@@ -5955,6 +6464,15 @@ Wanderlust \e$B$K4X$9$k5DO@$O$3$N%a%$%j%s%0%j%9%H$G9T$o$l$^$9!#\e(B
       4/28    wl-template by \e$BB<ED$5$s!#\e(B
       5/18    1.0.0 stable \e$B%j%j!<%9!#\e(B
       7/05    \e$B%9%3%"5!G=\e(B by \e$BB<ED$5$s\e(B(2.1.0)\e$B!#\e(B
+      9/26    \e$B%W%i%04IM}%7%9%F%`\e(B by \e$BB<ED$5$s\e(B(2.2.2)\e$B!#\e(B
+     12/20    Modified UTF7 \e$BBP1~!#\e(B
+2000  3/24    1.1.0 stable \e$B%j%j!<%9!#\e(B
+      4/03    CVS \e$B%5!<%P$G$N3+H/$r3+;O!#\e(B
+      5/07    \e$B%9%l%C%I$D$J$.D>$75!G=!u9bB.2=\e(B with \e$BB<ED$5$s!#\e(B
+      6/12    LDAP \e$BBP1~\e(B with \e$B@iMU$5$s!u8eF#$5$s!#\e(B
+      7/11    killed message \e$B5!G=DI2C!#\e(B
+      7/18    POP3 \e$B$r\e(B UIDL \e$BBP1~!#\e(B
+      9/12    biff \e$B5!G=\e(B with \e$B:72eED$5$s!u;32,$5$s!#\e(B
 @end example
 
 \e$B$/$o$7$$JQA+$O\e(B @file{ChangeLog} \e$B$r8fMw$/$@$5$$!#\e(B
@@ -5971,11 +6489,11 @@ wanderlust   wan\e$B!&\e(Bder\e$B!&\e(Blust
 
 @noindent
 \e$B$H$$$&0UL#$,$"$j$^$9!#$,!"L>A0$K$?$$$7$F?<$$0U?^$O$"$j$^$;$s!#\e(B
-(\e$B6/$$$F8@$($P!"\e(BIMAP @t{=>} \e$B$I$3$G$b%a!<%k$,FI$a$k\e(B @t{=>} \e$BJ|O2JJ\e(B ?)
+(\e$B6/$$$F8@$($P!"\e(BIMAP @result{} \e$B$I$3$G$b%a!<%k$,FI$a$k\e(B @result{} \e$BJ|O2JJ\e(B ?)
 
 elmo \e$B$O!"\e(B@samp{Elisp Library for Message Orchestration} \e$B$NN,$G$9!#\e(B
-\e$B:G=i$O$"$N@V$$$L$$$0$k$_$N$D$b$j$G$7$?$,!"\e(B
-\e$BJ|O2\e(B @t{=>} \e$BI:N.\e(B @t{=>} \e$BF;I8\e(B @t{=>} St.@: Elmo's fire @t{=>} elmo \e$B$H$$$&!"\e(B
+\e$B:G=i$O$"$N@V$$$L$$$0$k$_$N$D$b$j$G$7$?$,!"J|O2\e(B @result{} \e$BI:N.\e(B @result{}
+\e$BF;I8\e(B @result{} St.@: Elmo's fire @result{} elmo \e$B$H$$$&!"\e(B
 \e$B$=$l$C$]$$O"A[$b2DG=$G$9!#\e(B
 
 @section \e$B%3!<%I%M!<%`\e(B
@@ -5983,7 +6501,7 @@ elmo \e$B$O!"\e(B@samp{Elisp Library for Message Orchestration} \e$B$NN,$G$9!#\e(B
 \e$B3F%P!<%8%g%s$K$O%3!<%I%M!<%`$,$D$$$F$$$^$9\e(B(\e$B$[$H$s$I>iCL$G$9\e(B)\e$B!#\e(B
 \e$B$$$^$N$H$3$m\e(B 1980 \e$BG/Be$NJF%S%k%\!<%I;o%H%C%W\e(B 40 \e$B%R%C%H\e(B
 
-(@samp{http://www.summer.com.br/~pfilho/html/top40/index.html})
+(@uref{http://www.summer.com.br/~pfilho/html/top40/index.html})
 
 \e$B$+$i%"%k%U%!%Y%C%H=g$KE,Ev$K9%$-$J$b$N$r%T%C%/%"%C%W$7$F;H$C$F$$$^$9!#\e(B
 
@@ -6017,3 +6535,7 @@ elmo \e$B$O!"\e(B@samp{Elisp Library for Message Orchestration} \e$B$NN,$G$9!#\e(B
 @summarycontents
 @contents
 @bye
+
+@c Local Variables: 
+@c fill-column: 72
+@c End:
index f7c06cb..97db570 100644 (file)
@@ -1,15 +1,15 @@
-\input texinfo @c -*-texinfo -*- coding: iso-2022-jp -*-
+\input texinfo @c -*-texinfo -*-
 @c %**start of header
 @setfilename wl.info
 @settitle Wanderlust -- Yet Another Message Interface On Emacsen --
-@c @documentlanguage en
 @c %**end of header
-@c texinfo of Wanderlust
-@set Time-stamp: <00/04/26 17:31:25 teranisi>
-@set version 1.1.1
+@documentlanguage en
+@documentencoding us-ascii
+@set VERSION 2.3.0
 @synindex pg cp
 @finalout
 
+@dircategory GNU Emacs Lisp
 @direntry
 * Wanderlust: (wl).         Yet Another Message Interface On Emacsen
 @end direntry
 This file documents Wanderlust,
 Yet another message interface on Emacsen.
 
-Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi}.
-@c Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi}, @*
-@c @w{Fujikazu Okunishi}, @w{Masahiro Murata},
-@c @w{Kenichi Okada}, @w{Kaoru Takahashi}, @w{Bun Mizuhara}
-and @w{Masayuki Osada}.
+Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi},
+@w{Fujikazu Okunishi}, @w{Masahiro Murata},
+@w{Kenichi Okada}, @w{Kaoru Takahashi},
+@w{Bun Mizuhara} and @w{Masayuki Osada}.
 
-This edition is for Wanderlust version @value{version}.
+This edition is for Wanderlust version @value{VERSION}.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -50,7 +49,9 @@ into another language, under the above conditions for modified versions.
 
 @titlepage
 @sp 10
-@title Wanderlust User's Manual (ver. @value{version})
+@title Wanderlust User's Manual
+@subtitle Yet another message interface on Emacsen
+@subtitle for Wanderlust version @value{VERSION}
 @author Yuuichi Teranishi
 @author Fujikazu Okunishi
 @author Masahiro Murata
@@ -61,13 +62,12 @@ into another language, under the above conditions for modified versions.
 @page
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi}.
-@c Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi}, @*
-@c @w{Fujikazu Okunishi}, @w{Masahiro Murata},
-@c @w{Kenichi Okada}, @w{Kaoru Takahashi}, 
-@c @w{Bun Mizuhara} and @w {Masayuki Osada}
+Copyright @copyright{} 1998, 1999, 2000 @w{Yuuichi Teranishi},
+@w{Fujikazu Okunishi}, @w{Masahiro Murata},
+@w{Kenichi Okada}, @w{Kaoru Takahashi},
+@w{Bun Mizuhara} and @w{Masayuki Osada}.
 
-This manual is for Wanderlust version @value{version}.
+This manual is for Wanderlust version @value{VERSION}.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -84,9 +84,6 @@ into another language, under the above conditions for modified versions.
 @end titlepage
 
 
-@c
-@c  Top
-@c 
 @ifinfo
 @node Top, Introduction, (dir), (dir)
 @top Wanderlust User's Manual
@@ -99,10 +96,9 @@ Kenichi Okada
 Kaoru Takahashi
 Bun Mizuhara
 Masayuki Osada
-Last Modified@value{Time-stamp:}
 @end flushright
 
-This manual is for Wanderlust@value{version}.
+This manual is for Wanderlust @value{VERSION}.
 
 @end ifinfo
 
@@ -124,9 +120,6 @@ This manual is for Wanderlust@value{version}.
 @end menu
 
 
-@c
-@c  Introduction
-@c 
 @node Introduction, Start Me Up, Top, Top
 @chapter Introduction of Wanderlust
 @cindex Introduction
@@ -148,7 +141,7 @@ The main features of Wanderlust:
 @item MH-like FCC. (FCC: %Backup and FCC: $Backup is allowed).
 @item MIME compliant (by SEMI or tm).
 @item Transmission of news and mail are unified by Message transmitting draft.
-@item Graphical list of folders (XEmacs).
+@item Graphical list of folders (XEmacs and Emacs 21).
 @item View a part of message without retrieving the whole message (IMAP4).
 @item Server-side message look up (IMAP4). Multi-byte characters are allowed.
 @item Virtual Folders.
@@ -158,25 +151,50 @@ The main features of Wanderlust:
 @item Template function makes it convenient to send fixed form messages.
 @end itemize
 
-Wanderlust is supposed to run on Mules based on Emacs 19.28, 19.34, 
-Emacs 20.2 or later, XEmacs 20.4 or later, Meadow 1.00 or later(on MS Windows),
-Mule for Windows v1.22 (on MS Windows), NTEmacs(Windows NT).
-PMMule on OS/2 is also supported. Wanderlust runs even on Nemacs 3.3.2
-based on Emacs 18.55, 18.59 (with limited functionality).
 
-IMAP4 connectivity with UW imapd 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.7a,
-Cyrus imapd 1.4, Cyrus imapd 1.5.19, AIR MAIL(AIRCimapd release 2.00)
-and ExpressMail are confirmed to work with Wanderlust.
+@section Environment
+
+Wanderlust is supposed to run on following Emacsen: 
+@c Wanderlust runs even on Nemacs 3.3.2 based on Emacs 18.55, 18.59 (with
+@c limited functionality).
+
+@itemize @bullet
+@item Nemacs 3.3.2 (Caution: limited functionality)
+@item Mule 2.3 based on Emacs 19.28
+@item Mule 2.3 based on Emacs 19.34
+@item Emacs 20.2 or later
+@item XEmacs 20.4 or later
+@item Meadow 1.00 or later
+@item Mule for Windows v1.22
+@item NTEmacs 20.4 or later
+@item PMMule
+@end itemize
+
+IMAP4 connectivity with following imapd are confirmed to work with
+Wanderlust:
+
+@itemize @bullet
+@item UW imapd 4.1--4.7, 4.7a, 4.7b, 4.7c
+@item Cyrus imapd 1.4
+@item Cyrus imapd 1.5.19
+@item Cyrus imapd 1.6.22
+@item Cyrus imapd 2.0.5
+@item AIR MAIL (AIRC imapd release 2.00)
+@item Express Mail
+@item Microsoft Exchange Server 5.5
+@item Sun Internet Mail Server 4.0
+@end itemize
+
+@c LDAP connectivity with following LDAPd are confirmed to work with
+@c Wanderlust:
+
 
-@c
-@c  Start Me Up
-@c 
 @node Start Me Up, Folders, Introduction, Top
 @chapter Start up Wanderlust
 @cindex Start up
 
-
-The necessary procedure for starting Wanderlust is explained in steps here.
+The necessary procedure for starting Wanderlust is explained in steps
+here.
 
 (Of course, you need a mail/news readable environment in advance)
 
@@ -203,35 +221,38 @@ SEMI or tm must be installed to make Wanderlust work correctly.
 
 SEMI does not run on Emacs19.28 or earlier
 @footnote{SEMI runs on Emacs 19.34. @*
-@samp{http://www.jpl.org/elips/INSTALL-SEMI-ja.html} describes how to.},
+@uref{http://www.jpl.org/elips/INSTALL-SEMI-ja.html} describes how to.},
 so you must install tm, the predecessor of SEMI. (tm version 8.7 or later
 is needed.)
 
 However, SEMI is recommended because of its wider functionality.
-Partial download function in IMAP4 is enabled only when SEMI is installed.
 
 Refer to the documents of each package for detailed installation procedure.
 
 SEMI and tm can be downloaded from these sites:
 
 @example
-SEMI: ftp://ftp.m17n.org/mule/semi/
-tm:   http://cvs.m17n.org/tomo/comp/emacsen/tm/tm-8/
+@group
+SEMI:   ftp://ftp.m17n.org/pub/mule/semi/
+tm:     http://cvs.m17n.org/tomo/comp/emacsen/tm/tm-8/
+@end group
 @end example
 
 You need packages named APEL and FLIM to use SEMI.
-You can download FLIM and APEL from following URLs.
+You can download APEL and FLIM from following URLs:
 
 @example
-FLIM:     ftp://ftp.m17n.org/mule/flim/
-APEL:     ftp://ftp.m17n.org/mule/apel/
+@group
+APEL:   ftp://ftp.m17n.org/pub/mule/apel/
+FLIM:   ftp://ftp.m17n.org/pub/mule/flim/
+@end group
 @end example
 
 You have to install APEL, FLIM and SEMI in this order.
 Generally @samp{make install} will do the job.
 (In XEmacs 21, @samp{make install-package}.)
 
-Recommended combination of APEL, FLIM and SEMI are:
+Recommended combination of APEL, FLIM and SEMI are following:
 
 @itemize @minus
 @item APEL 10.2, FLIM 1.12.7 and SEMI 1.13.4
@@ -245,14 +266,16 @@ while compiling FLIM 1.12.7.
 Please install latest APEL 7.3 or later.
 @end example
 
-In this case, please comment out following lines in FLIM-CFG.
+In this case, please comment out following lines in @file{FLIM-CFG}.
 
-@example
+@lisp
+@group
 (or (fboundp 'write-region-as-binary)
     (error "Please install latest APEL 7.3 or later."))
 (or (fboundp 'insert-file-contents-as-binary)
     (error "Please install latest APEL 7.3 or later."))
-@end example
+@end group
+@end lisp
 
 You can also use many other FLIM/SEMI variants. Combination of the
 latest versions should work.  For example, following combination is
@@ -279,23 +302,29 @@ ftp://ftp.gohome.org/wl/
 Mirrored ftp/http sites:
 
 @example
+@group
 ftp://ftp.jaist.ac.jp/pub/GNU/elisp/ftp.gohome.org/wl/
-ftp://daidai.kuis.kyoto-u.ac.jp/pub/mirror/ftp.gohome.org/pub/elisp/wl/
-http://www.jpl.org/elips/
+http://www.jpl.org/elips/wl/
 http://www.ring.gr.jp/archives/text/elisp/wl/
 ftp://ftp.ring.gr.jp/pub/text/elisp/wl/
 ftp://opaopa.org/pub/mirror/elisp/wl/
+@end group
 @end example
 
 Extract the obtained package to your working directory:
 
 @example
+@group
 % cd ~/work
-% tar zxvf wl-(@var{version}).tar.gz
-% cd wl-(@var{version})
+% tar zxvf wl-@var{version}.tar.gz
+% cd wl-@var{version}
+@end group
 @end example
 
 @subsection To use SSL (Secure Socket Layer)
+@cindex SSL
+@pindex OpenSSL
+@pindex starttls
 
 SSL (Secure Socket Layer) can be used for 
 SMTP, IMAP, NNTP and POP connections in Wanderlust.
@@ -305,10 +334,10 @@ the connection establishment (generic way).
 The other one is to start SSL negotiation by invoking STARTTLS command in
 the each session.
 
-To use the formar SSL (generic SSL), you must install @file{ssl.el} in the 
-@file{utils} directory. OpenSSL command @file{openssl} is also required
-to use @file{ssl.el}. You must set PATH to the directory that OpenSSL
-commands are installed.
+To use the formar SSL (generic SSL), you must install @file{ssl.el} in
+the @file{utils} directory. OpenSSL command @command{openssl} is also
+required to use @file{ssl.el}. You must set PATH to the directory that
+OpenSSL commands are installed.
 
 To use the latter SSL(STARTTLS), you must install starttls package in
 addition to above. 
@@ -334,15 +363,17 @@ Set package installation directory to @code{LISPDIR}.
 Then, please execute following commands.
 
 @example
+@group
 % make
 % make install
+@end group
 @end example
 
 Destination directory is auto-probed if you leave @code{LISPDIR}
-in @file{Makefile} as is. (That is, leave it as NONE)
+in @file{Makefile} as is. (That is, leave it as @samp{NONE})
 
 If you are using an Emacs variant which does not merge specified directory
-to load-path (e.g. Mule 2.3 based on Emacs 19.28), 
+to @code{load-path} (e.g. Mule 2.3 based on Emacs 19.28), 
 then you will see the error message:
 
 @example
@@ -350,19 +381,19 @@ Cannot open load file: mime-setup
 @end example
 
 @noindent
-In this case, either add destination directories of custom, apel, flim and semi
-to environmental variable EMACSLOADPATH, or define load-path in @file{WL-CFG}
-in extracted directory.
+In this case, either add destination directories of custom, APEL, FLIM
+and SEMI to environmental variable @env{EMACSLOADPATH}, or define
+@code{load-path} in @file{WL-CFG} in extracted directory.
 
 If you want to use BBDB, then the necessary modules are byte-compiled and
-installed when BBDB directory is added to load-path.
+installed when BBDB directory is added to @code{load-path}.
 @xref{BBDB}.
 
-@subsection WL-CFG
+@subsection @file{WL-CFG}
 
 Contents of the file @file{WL-CFG} is loaded under installation if a file
 with that name exists in extracted directory. You can use @file{WL-CFG} to
-configure load-path to extra packages such as SEMI if needed.
+configure @code{load-path} to extra packages such as SEMI if needed.
 
 If you want to specify the install directory of Wanderlust related
 files, then set following variables in @file{WL-CFG}
@@ -392,7 +423,6 @@ such as "elmo" then add following to @file{WL-CFG}:
 (setq ELMO_PREFIX "elmo")
 @end lisp
 
-@noindent
 @subsection Install as a XEmacs package
 @cindex XEmacs package
 @cindex XEmacs package install
@@ -401,16 +431,18 @@ such as "elmo" then add following to @file{WL-CFG}:
 @c @cindex install-package
 
 It is possible to install Wanderlust as one of packages of XEmacs (21.0
-or greater). Configuration for autoload and icon-path in local
-@file{.emacs} files are no longer necessary, if you install Wanderlust
+or later). Configuration for autoload and icon-path in local
+@file{~/.emacs} files are no longer necessary, if you install Wanderlust
 as a package.
 
 Follow the next example to install Wanderlust as an XEmacs package.
 
 @example
+@group
 % vi Makefile
 % make package
 % make install-package
+@end group
 @end example
 
 package directory is auto-probed, if SEMI is installed.
@@ -418,16 +450,41 @@ package directory is auto-probed, if SEMI is installed.
 
 @subsection Run in place
 
-If wl and elmo directories are defined in load-path, then byte-compilation
-and installation are not necessary to start Wanderlust. For example,
-if package is extracted in @file{~/work}, Wanderlust can be invoked with
-following setting in @file{.emacs}.
+If wl and elmo directories are defined in @code{load-path}, then
+byte-compilation and installation are not necessary to start Wanderlust.
+For example, if package is extracted in @file{~/work}, Wanderlust can be
+invoked with following setting in @file{~/.emacs}.
 
 @lisp
-(add-to-list 'load-path "~/work/wl-(@var{version})")
-(add-to-list 'load-path "~/work/wl-(@var{version})/elmo")
+@group
+(add-to-list 'load-path "~/work/wl-@var{version}/wl")
+(add-to-list 'load-path "~/work/wl-@var{version}/elmo")
+@end group
 @end lisp
 
+@subsection Manual
+
+Manual is described in Info format. Please do following.
+
+@example
+@group
+% make info
+% make install-info
+@end group
+@end example
+
+If you install Wanderlust as a XEmacs package, Info file is already
+installed too, so there are no need of these commands.
+
+Manual directory is automatically detected. Of course, it can be
+configured by @code{INFODIR} in @file{Makefile}.
+
+You can read manual at the following URL:
+
+@example
+http://www.gohome.org/wl/doc/wl-euc_toc.html
+@end example
+
 @node Minimal Settings, Mail Addresses, Install, Start Me Up
 @section Set up .emacs
 @cindex Minimal Settings
@@ -440,34 +497,37 @@ The Wanderlust package contains two module groups.
 
 @table @samp
 @item ELMO (elmo-*.el)
-These modules show everything as folders. This is the back-end for Wanderlust.
+These modules show everything as folders. This is the back-end for WL.
 @item WL (wl-*.el)
 These modules controls the behavior of main body of Wanderlust.
 They are also the front-end for ELMO.
 @end table
 
 You can customize the  behavior of Wanderlust by changing the value
-of environmental variables which begins with @code{elmo-*} and @code{wl-*}.
+of environmental variables which begins with @code{elmo-} and @code{wl-}.
 
 The minimal requirement for settings is as the following.
 
 @lisp
-;; The setting to use SEMI/tm
+@group
+;; @r{The setting to use SEMI/tm}
 (load "mime-setup")
 
-;; autoload configuration
-;; (These are not required if Wanderlust is installed as XEmacs package)
+;; @r{autoload configuration}
+;; @r{(These are not required if Wanderlust is installed as XEmacs package)}
 (autoload 'wl "wl" "Wanderlust" t)
 (autoload 'wl-draft "wl-draft" "Write draft with Wanderlust." t)
 
-;; Directory where icons are placed (XEmacs Only). Default value is nil.
-;; (This is not required if Wanderlust is installed as XEmacs package)
+;; @r{Directory where icons are placed (XEmacs or Emacs 21). Default value
+;; is @code{nil}.}
+;; @r{(This is not required if Wanderlust is installed as XEmacs package)}
 (setq wl-icon-dir "~/work/wl/etc")
 
-;; SMTP server for mail posting. Default: "localhost"
+;; @r{SMTP server for mail posting. Default: @code{nil}}
 (setq wl-smtp-posting-server "your.smtp.server.com")
-;; NNTP server for news posting. Default: "localhost"
+;; @r{NNTP server for news posting. Default: @code{nil}}
 (setq wl-nntp-posting-server "your.nntp.server.com")
+@end group
 @end lisp
 
 @file{~/.wl} is automatically loaded when Wanderlust starts up (if such a
@@ -481,7 +541,7 @@ All above described settings except (load "mime-setup") and autoload
 configuration can be written in
 @file{~/.wl}).
 
-@subsection mail-user-agent
+@subsection @code{mail-user-agent}
 @cindex Default Mailer
 @cindex Mailer, Default
 @vindex mail-user-agent
@@ -490,12 +550,13 @@ configuration can be written in
 If you write following setting in you @file{.emacs}, you can
 start Wanderlust draft mode by typing @kbd{C-x m} (@code{compose-mail}). 
 This means it enables you to run Wanderlust as a default mail composer
- of Emacs.
+ of Emacsen.
 
 It is effective only when your Emacs can define @code{mail-user-agent}.
-@c @xref{Mail Methods, , ,emacs}.
+@xref{Mail Methods, , ,emacs-ja, The Emacs Editor}.
 
 @lisp
+@group
 (autoload 'wl-user-agent-compose "wl-draft" nil t)
 (if (boundp 'mail-user-agent)
     (setq mail-user-agent 'wl-user-agent))
@@ -506,6 +567,7 @@ It is effective only when your Emacs can define @code{mail-user-agent}.
       'wl-draft-send
       'wl-draft-kill
       'mail-send-hook))
+@end group
 @end lisp
 
 
@@ -528,30 +590,41 @@ summary buffer after Wanderlust is invoked. @refill
 The format is very simple. Like this. @refill
 
 @example
+@group
 #
 # @r{Lines begin with @samp{#} are comment.}
 # @r{Empty lines are ignored}
 #
 # @r{Format of each line:}
-# @r{email-address  ``nickname'' ``realname''}
+# @var{email-address}  "@var{nickname} "@var{realname}"
 #
 teranisi@@gohome.org            "Yuuichi"      "Yuuichi Teranishi"
 foo@@bar.gohome.org             "Mr. Foo"    "John Foo"
 bar@@foo.gohome.org             "Mr. Bar"    "Michael Bar"
+@end group
 @end example
 
 @noindent
 One line defines one persons description.
 
-Actually, in default setup, "nickname" is used in summary-mode and "real name"
-is used in draft preparation mode. This behavior is better understood if you
-try it and confirmed the function first. You can write and try a small
-definition, so you will know the idea of the address book before writing a big
-one.
+Actually, in default setup, @var{nickname} is used in summary-mode and
+@var{realname} is used in draft preparation mode. This behavior is
+better understood if you try it and confirmed the function first. You
+can write and try a small definition, so you will know the idea of the
+address book before writing a big one.
 
 And, if MH alias file is specified in variable @code{wl-alias-file},
 it is used as an address information in the draft preparation mode.
 
+If variable @code{wl-use-ldap} is non-nil (initial setting is nil),
+address completion in draft mode uses LDAP information.
+
+If you use LDAP, you have to set @code{wl-ldap-server},
+@code{wl-ldap-port} and @code{wl-ldap-base} properly. If your emacs does
+not have LDAP feature as built-in feature (Currently only XEmacs can
+have built-in LDAP feature), you have to set command exec PATH to the
+program `ldapsearch'.
+
 @node Folder Definition, Start Wanderlust, Mail Addresses, Start Me Up
 @section Folder Definition
 @cindex Folder Definition
@@ -567,11 +640,12 @@ subscribe folders from the buffer for list of folders.
 Format for @file{~/.folders} is very simple. Here is an example:
 
 @example
+@group
 #
 # @r{Lines begin with @samp{#} are comment.}
 # @r{Empty lines are ignored}
 #
-# @r{folder name}  "@r{folder nickname}"
+# @var{folder name}  "@var{folder nickname}"
 # @r{(nicknames are not necessary)}
 #
 %inbox  "Inbox"
@@ -594,6 +668,7 @@ Emacsen@{
 %#mh/expire@@localhost /
 # @r{All MH folders are included in one folder group.}
 + /
+@end group
 @end example
 
 Each line contains one folder you want to read. The definition of folders
@@ -636,9 +711,7 @@ That means the folders you defined in the @file{~/.folders} are listed
 If you start Wanderlust with prefix argument like @kbd{C-u M-x wl}, you
 can skip folder checking.
 
-@c
-@c  Folders
-@c
+
 @node Folders, Folder, Start Me Up, Top
 @chapter Wanderlust's folders 
 @cindex Folder Type
@@ -648,7 +721,7 @@ This chapter describes the folder types which Wanderlust is able to handle.
 Wanderlust uses ELMO as it's interface, so every folder types supported
 by ELMO is usable in Wanderlust.
 
-As of version @value{version}, 10 types of folders are predefined. These are
+As of version @value{VERSION}, 10 types of folders are predefined. These are
 IMAP, NNTP, LocalDir(MH), News Spool, POP, Archive, Multi, Filter, Pipe
 and Internal folder types.
 
@@ -676,59 +749,77 @@ and Internal folder types.
 
 A folder to access e-mails via IMAP4rev1 protocol (RFC 2060).
 
+Format:
+
 @example
-Format: '%' 'IMAP mailbox'[':' 'username' ['/' 'authenticate-type']]['@@' 'hostname'][':' 'port']['!']
+@group
+@samp{%} @var{mailbox} [@samp{:} @var{username} [@samp{/} @var{authenticate-type}]][@samp{@@} @var{hostname}][@samp{:} @var{port}][@samp{!}]
+@end group
+@end example
 
 You can specify
-"auth" (encoded password transmission), "cram-md5" (cram-md5 authentication)
-and "login" (plain password transmission) as authenticate-type.
-(To use cram-md5 authentication, you must install utils/sasl package.)
+'login (encoded password transmission), 'cram-md5 (CRAM-MD5
+authentication), 'digest-md5 (DIGEST-MD5 authentication) or 'plain (or
+nil, plain password transmission) as @var{authenticate-type}.
+(To use CRAM-MD5 or DIGEST-MD5 authentication, you must install @file{utils/sasl} package.)
 
 default:
 
-username  -> The value of @code{elmo-default-imap4-user}.
-             Initial setting is `USER' environment variable or
-             `LOGNAME' environment variable or return value of
-             (user-login-name).
-authenticate-type -> The value of @code{elmo-default-imap4-authenticate-type}.
+@example
+@var{username}  -> The value of @code{elmo-default-imap4-user}.
+             Initial setting is @env{USER} environment variable or
+             @env{LOGNAME} environment variable or return value of
+             @code{(user-login-name)}.
+@var{authenticate-type} -> The value of @code{elmo-default-imap4-authenticate-type}.
              Initial setting is "auth".
-hostname  -> The value of @code{elmo-default-imap4-server}.
+@var{hostname}  -> The value of @code{elmo-default-imap4-server}.
              Initial setting is "localhost".
-port -> The value of @code{elmo-default-imap4-port}.
+@var{port} -> The value of @code{elmo-default-imap4-port}.
              Initial setting is 143.
+@end example
 
-You can omit the hostname from folder names if you set
+You can omit the @var{hostname} from folder names if you set
 @code{elmo-default-imap4-server} as your main IMAP server.
-For example, you can specify a folder as @samp{foo%imap@@geteway} even
+For example, you can specify a folder as @samp{foo%imap@@gateway} even
 if you have to go through a firewall.
 
 SSL (Secure Socket Layer) connection will be used if a folder name
-ends with '!'. Or, if the value of @code{elmo-default-imap4-ssl} is non-nil,
+ends with @samp{!}. Or, if the value of @code{elmo-default-imap4-ssl} is non-nil,
 SSL will be the default connection.
-If a folder name ends with '!!', STARTTLS connection will be established.
-if the value of @code{elmo-default-imap4-ssl} is 'starttls,
+If a folder name ends with @samp{!!}, STARTTLS connection will be established.
+If the value of @code{elmo-default-imap4-ssl} is 'starttls,
 STARTTLS will be the default connection.
 
-If you specify "auth" or "cram-md5" as authentication method, the password
-is sent in encoded form. But, if your server is unable to receive an encoded
-password, authentication will fall back to "login" (that is, sending password
-in raw format) after confirmation to user. If @code{elmo-imap4-force-login}
-is non-nil, authentication will fall back to "login" without confirmation
-(default value is nil).
-
-Example: %inbox     -> IMAP mailbox "inbox"
-         %#mh/inbox -> IMAP mailbox "#mh/inbox"
-
-         %inbox:hoge -> IMAP mailbox "inbox" of user "hoge".
-         %inbox:hoge/login@@server1
-                     -> server1's IMAP mailbox "inbox"
-                        of user "hoge", with plain password authentication
-                        ("login").
+If you specify 'login, 'cram-md5 or 'digest-md5 as authentication
+method, the password is sent in encoded form. But, if your server is
+unable to receive an encoded password, authentication will fall back to
+'plain (that is, sending password in raw format) after confirmation to
+user. If @code{elmo-imap4-force-login} is non-nil, authentication will
+fall back to 'plain without confirmation (default value is nil).
+
+Example:
+
+@example
+@group
+%inbox     -> IMAP mailbox "inbox"
+%#mh/inbox -> IMAP mailbox "#mh/inbox"
+
+%inbox:hoge -> IMAP mailbox "inbox" of user "hoge".
+%inbox:hoge/login@@server1
+            -> server1's IMAP mailbox "inbox"
+               of user "hoge", with plain password authentication
+               ('plain).
+@end group
 @end example
 
 @subsection International mailbox names (Modified UTF7)
+@cindex Modified UTF7
+@cindex UTF7
+@cindex UTF8
+@pindex Mule-UCS
+@pindex ucs-conv
 
-You can use international mailbox names in 'IMAP mailbox' part, if you
+You can use international mailbox names in @var{mailbox} part, if you
 are using Emacs which can treat unicode and
 @code{elmo-imap4-use-modified-utf7} is set to non-nil value (default
 value is nil).
@@ -752,14 +843,17 @@ ucs-conv package, it can.
 You can obtain ucs-conv package from following anonymous CVS.
 
 @example
-:pserver:anonymous@@cvs.m17n.org:/cvs/root
+@group
+cvs -d :pserver:anonymous@@cvs.m17n.org:/cvs/root login
 Password: NULL (Just enter return key)
+cvs -d :pserver:anonymous@@cvs.m17n.org:/cvs/root checkout ucs-conv
+@end group
 @end example
 
-You also need utf7 conversion programs, u7tou8 and u8tou7 to use international
-mailbox name in the current XEmacs. 
-These programs are included in the UTF7 package which can be obtained 
-from following URL.
+You also need utf7 conversion programs, @code{u7tou8} and @code{u8tou7}
+to use international mailbox name in the current XEmacs.  These programs
+are included in the UTF7 package which can be obtained from following
+URL.
 
 @example
 ftp://ftp.ifcss.org/pub/software/unix/convert/utf7.tar.gz
@@ -774,26 +868,38 @@ ftp://ftp.ifcss.org/pub/software/unix/convert/utf7.tar.gz
 A folder to access USENET news via NNTP protocol (RFC 977).
 One newsgroup is treated as a folder.
 
+Format:
+
 @example
-Format: '-' 'newsgroup'[[':' 'username']['@@' 'hostname'][':' 'port']]['!']
+@group
+@samp{-} @var{newsgroup} [[@samp{:} @var{username}][@samp{@@} @var{hostname}][@samp{:} @var{port}]][@samp{!}]
+@end group
+@end example
 
 default:
-hostname  -> The value of @code{elmo-default-nntp-server}.
+@example
+@var{hostname}  -> The value of @code{elmo-default-nntp-server}.
              Initial setting is "localhost".
-username  -> The value of @code{elmo-default-nntp-user}. 
+@var{username}  -> The value of @code{elmo-default-nntp-user}. 
              Initial setting is nil.
-port      -> The value of @code{elmo-default-nntp-port}.
+@var{port}      -> The value of @code{elmo-default-nntp-port}.
              Initial setting is 119.
+@end example
 
-AUTHINFO is used as authentication method if the username is non-nil.
+AUTHINFO is used as authentication method if the @var{username} is non-nil.
 SSL will be default method if @code{elmo-default-nntp-ssl} is non-nil even
-if the folder name doesn't end with '!'
-If a folder name ends with '!!', STARTTLS connection will be established.
+if the folder name doesn't end with @samp{!}.
+If a folder name ends with @samp{!!}, STARTTLS connection will be established.
 if the value of @code{elmo-default-nntp-ssl} is 'starttls,
 STARTTLS will be the default connection.
 
-Example: -fj.rec.tv            -> Newsgroup `fj.rec.tv'.
-         -fj.rec.tv@@newsserver -> Newsgroup `fj.rec.tv' on newsserver.
+Example:
+
+@example
+@group
+-fj.rec.tv            -> Newsgroup `fj.rec.tv'.
+-fj.rec.tv@@newsserver -> Newsgroup `fj.rec.tv' on newsserver.
+@end group
 @end example
 
 @node MH Folder, Maildir Folder, NNTP Folder, Folders
@@ -804,19 +910,27 @@ Example: -fj.rec.tv            -> Newsgroup `fj.rec.tv'.
 
 A folder to access MH format mail (1 file is 1 mail).
 
+Format:
+
 @example
-Format: '+' 'directory-name'
+@samp{+} @var{directory-name}
+@end example
 
-Normally, directory paths are relative to variable
+Normally, @var{directory-name} is an relative path to the variable
 @code{elmo-localdir-folder-path} (default is @file{~/Mail}), but if it
 starts with @samp{/} or @samp{~}, then it is treated as an absolute path
 (this is also true for drive-letters).
 
 Message number is used for the name of the message file.
 
-Example: +inbox         -> "~/Mail/inbox"
-         +from/teranisi -> "~/Mail/from/teranisi"
-         +~/test        -> "~/test"
+Example:
+
+@example
+@group
++inbox         -> "~/Mail/inbox"
++from/teranisi -> "~/Mail/from/teranisi"
++~/test        -> "~/test"
+@end group
 @end example
 
 @node Maildir Folder, News Spool Folder, MH Folder, Folders
@@ -827,10 +941,13 @@ Example: +inbox         -> "~/Mail/inbox"
 
 A folder to access to Maildir format (1 file is 1 mail).
 
+Format:
+
 @example
-Format: '.' 'directory-name'
+@samp{.} [@var{directory-name}]
+@end example
 
-Normally, directory paths are relative to variable
+Normally, @var{directory-name} is a relative path to the variable
 @code{elmo-maildir-folder-path} (default is @file{~/Maildir}), but if it
 starts with @samp{/} or @samp{~}, then it is treated as an absolute path
 (this is also true for drive-letters).
@@ -841,14 +958,20 @@ message files in the @file{new} directory are moved to @file{cur}
 directory when you access to the folder. All message files contained in
 the @file{tmp} directory and not accessed for 36 hours are deleted.
 
-These behaviors are defined the @samp{http://cr.yp.to/proto/maildir.html}.
+This behavior conforms to the @uref{http://cr.yp.to/proto/maildir.html}.
 
-Example: .              -> "~/Maildir"
-         .inbox         -> "~/Maildir/inbox"
-         .from/teranisi -> "~/Maildir/from/teranisi"
-         .~/test        -> "~/test"
+Example:
+
+@example
+@group
+.              -> "~/Maildir"
+.inbox         -> "~/Maildir/inbox"
+.from/teranisi -> "~/Maildir/from/teranisi"
+.~/test        -> "~/test"
+@end group
 @end example
 
+
 @node News Spool Folder, Archive Folder, Maildir Folder, Folders
 @section News Spool Folder
 @cindex News spool Folder
@@ -859,17 +982,26 @@ This folder handles locally saved news articles which are proposed by Mew/IM.
 You can also read articles directly from a spool-file which is retrieved
 by an utility like gnspool.
 
+Format:
+
 @example
-Format: '=' 'directory-name'
+@samp{=} @var{directory-name}
+@end example
 
-directory-name is sub-directory to the directory defined by variable
-@code{elmo-localnews-folder-path} (default is "~/News")
+@var{directory-name} is a sub-directory to the directory defined by variable
+@code{elmo-localnews-folder-path} (default is @file{~/News})
 You can use @samp{.} as directory delimiter as well as @samp{/}.
 
-Example: =fj/os/os2         -> "~/News/fj/os/os2"
-         =fj.os.bsd.freebsd -> "~/News/fj/os/bsd/freebsd"
+Example:
+
+@example
+@group
+=fj/os/os2         -> "~/News/fj/os/os2"
+=fj.os.bsd.freebsd -> "~/News/fj/os/bsd/freebsd"
+@end group
 @end example
 
+
 @node Archive Folder, POP Folder, News Spool Folder, Folders
 @section Archive Folder
 @cindex Archive Folder
@@ -879,31 +1011,42 @@ Example: =fj/os/os2         -> "~/News/fj/os/os2"
 This method can handle archive files, which are compressed by utilities
 such as Info-ZIP or LHA, as one folder.
 
+Format:
+
 @example
-Format: '$' 'path-name' [';' archiver-type ';' prefix]
+@group
+@samp{$} @var{path-name} [@samp{;} @var{archiver-type} @samp{;} @var{prefix}]
+@end group
+@end example
 
-`path-name' is the relative path from @code{elmo-archive-folder-path}
-(initial setting is @file{~/Mail}).
-If path-name begins with @samp{/} or @samp{~} or `drive-letter of DOS',
-path-name is treated as absolute path.
-ange-ftp format is also permitted under the environment of ange-ftp, efs.
+@var{path-name} is the relative path from
+@code{elmo-archive-folder-path} (initial setting is @file{~/Mail}).  If
+@var{path-name} begins with @samp{/} or @samp{~} or `drive-letter of
+DOS', @var{path-name} is treated as absolute path.  ange-ftp format is
+also permitted under the environment of ange-ftp, efs.
 
-The actual file name of the archive folder is 
-@code{elmo-archive-basename}(Initial setting is "elmo-archive")
-under the path-name. If a file named path-name exists, it is treated as
-folder. The suffix is automatically decided for archiver-type.
+The actual file name of the archive folder is
+@code{elmo-archive-basename} (Initial setting is @file{elmo-archive})
+under the @var{path-name}. If a file named @var{path-name} exists, it is
+treated as folder. The suffix is automatically decided for
+@var{archiver-type}.
 
-If `archiver-type' is omitted, @code{elmo-archive-default-type}
+If @var{archiver-type} is omitted, @code{elmo-archive-default-type}
 (Initial setting is 'zip) is referred.
 
-`prefix' specifies the internal directory structure of the archive.
+@var{prefix} specifies the internal directory structure of the archive.
 For example, if the ML server is fml, @file{msend.tar.gz} has a structure like 
-@file{spool/1}, so you have to specify "spool" as `prefix'.
+@file{spool/1}, so you have to specify @samp{spool} as @var{prefix}.
 
-Example: $teranisi         -> "~/Mail/teranisi/elmo-archive.zip"
-         $bsd/freebsd;lha  -> "~/Mail/bsd/freebsd/elmo-archive.lzh"
-         $/foo@@server:~/bar;zoo     -> "~/bar/elmo-archive.zoo" on ftp server
-         $d:/msend.tar.gz;tgz;spool -> "d:/msend.tar.gz"
+Example:
+
+@example
+@group
+$teranisi         -> "~/Mail/teranisi/elmo-archive.zip"
+$bsd/freebsd;lha  -> "~/Mail/bsd/freebsd/elmo-archive.lzh"
+$/foo@@server:~/bar;zoo     -> "~/bar/elmo-archive.zoo" on ftp server
+$d:/msend.tar.gz;tgz;spool -> "d:/msend.tar.gz"
+@end group
 @end example
 
 @menu
@@ -927,8 +1070,10 @@ Example: $teranisi         -> "~/Mail/teranisi/elmo-archive.zip"
 By default, following archives are supported.
 
 @example
+@group
         LHA, Info-ZIP/UNZIP, ZOO, RAR  ;; full-access
         GNU TAR('tgz, 'tar)            ;; read-only
+@end group
 @end example
 
 If your archiver can include multiple files in one archive, you have a
@@ -968,6 +1113,7 @@ Behaviors of the following archivers are confirmed by further experiences.
          GNU tar 1.11.8 + 1.5(WIN32)
          GZIP 1.2.4
          RAR 2.06
+@end example
 
 * Caution about LHA
 
@@ -980,19 +1126,19 @@ In Win32, LHa32 is only supported (DOS version is no good).
 You have to take care about GNU tar's version because
 many version has problem on deleting file from archive.
 
-Please test --delete -f options work. Otherwise, your archive will be
-destroyed. No problem is reported on above versions of GNU tar.
-@end example
+Please test @option{--delete} @option{-f} options work. Otherwise, your
+archive will be destroyed. No problem is reported on above versions of
+GNU tar.
 
 
 @node Archive Tips, Archive Vars, Archiver, Archive Folder
 @subsection TIPS
 @cindex Archive Tips
 
-For comfortable migration, usage of wl-summary-archive() (@pxref{Archive}) or 
-Expire (@pxref{Expire}) is recommended.
-To treat archive folders created by expiration, 
-you must set non-nil value to @code{elmo-archive-treat-file}.
+For comfortable migration, usage of @code{wl-summary-archive}
+(@pxref{Archive}) or Expire (@pxref{Expire}) is recommended.  To treat
+archive folders created by expiration, you must set non-nil value to
+@code{elmo-archive-treat-file}.
 
 On the OS/2, there is a great difference between Mule2.3(19.28) and Emacs20.2
 in processing speed. For comfortable use, Emacs20 is recommended.
@@ -1005,12 +1151,14 @@ archiver starting overhead is increased (especially LHA).
 
 Of course, following is possible @t{:-)} 
 (meanings of these variables are described later.)
+
 @lisp
+@group
 (setq wl-fcc "$backup")
 (setq wl-trash-folder "$trash;lha")
+@end group
 @end lisp
 
-@noindent
 @node Archive Vars,  , Archive Tips, Archive Folder
 @subsection Variables About Archive Folder
 @cindex Archive variables
@@ -1028,16 +1176,20 @@ Define archiver @var{type}'s methods.
 Each element of the alist is following.
 
 @example
-        (action . (exec-name options))   ;; external program and its option.
-        (action . function)              ;; function
+@group
+(@var{action} . (@var{exec-name} @var{options}))   ;; external program and its option.
+(@var{action} . @var{function})              ;; function
+@end group
 @end example
 
 Currently available actions are following.
 
 @example
-        'ls, 'cat ('cat-headers)        ;; Minimal setting(read-only)
-        'mv ('mv-pipe), 'rm ('rm-pipe)  ;; full-access (with above)
-        'cp ('cp-pipe)                  ;;
+@group
+'ls, 'cat ('cat-headers)        ;; Minimal setting(read-only)
+'mv ('mv-pipe), 'rm ('rm-pipe)  ;; full-access (with above)
+'cp ('cp-pipe)                  ;;
+@end group
 @end example
 
 @noindent
@@ -1079,7 +1231,7 @@ with some margin.
 
 However, you don't have an influence of command line argument limit
 if the archiver has `actions' to receive target file information from
-standard input (rm-pipe, mv-pipe, cat-headers action).
+standard input (@code{rm-pipe}, @code{mv-pipe}, @code{cat-headers} action).
 @end table
 
 @node POP Folder, Multi Folder, Archive Folder, Folders
@@ -1092,33 +1244,45 @@ standard input (rm-pipe, mv-pipe, cat-headers action).
 
 A folder to access e-mails via POP3 protocol (RFC 1939).
 
+Format:
+
 @example
-Format: '&' ['username'][['/' 'authenticate-type']['@@' 'hostname'][':' 'port']]['!']
+@group
+@samp{&} [@var{username}][[@samp{/} @var{authenticate-type}][@samp{@@} @var{hostname}][@samp{:} @var{port}]][@samp{!}]
+@end group
+@end example
 
 You can specify
-"user"  (plain password transmission) or "apop"  (APOP authentication)
-as authenticate-type.
+@samp{user}  (plain password transmission) or @samp{apop}  (APOP authentication)
+as @var{authenticate-type}.
 
 default:
-username   -> The value of @code{elmo-default-pop3-user}.
-              Initial setting is `USER' environment variable or
-             `LOGNAME' environment variable or return value of
-             (user-login-name).
-authenticate-type -> The value of @code{elmo-default-pop3-authenticate-type}.
+@example
+@var{username}   -> The value of @code{elmo-default-pop3-user}.
+              Initial setting is @env{USER} environment variable or
+             @env{LOGNAME} environment variable or return value of
+             @code{(user-login-name)}.
+@var{authenticate-type} -> The value of @code{elmo-default-pop3-authenticate-type}.
               Initial setting is "user".
-hostname   -> The value of @code{elmo-default-pop3-server}.
+@var{hostname}   -> The value of @code{elmo-default-pop3-server}.
               Initial setting is "localhost".
-port       -> The value of @code{elmo-pop3-default-port}.
+@var{port}       -> The value of @code{elmo-default-pop3-port}.
               Initial setting is 110.
+@end example
+
+Example:
 
-Example: &hoge@@localhost -> access to localhost as user "hoge".
-         &hoge@@popserver:109 -> access to the server "popserver" on port 109
-                                 as user "hoge".
+@example
+@group
+&hoge@@localhost -> access to localhost as user "hoge".
+&hoge@@popserver:109 -> access to the server "popserver" on port 109
+                        as user "hoge".
+@end group
 @end example
 
-To use apop as an authenticate-type, @file{md5.el} is needed
+To use apop as an @var{authenticate-type}, @file{md5.el} is needed
 (XEmacs doesn't need @file{md5.el}).
-@file{md5.el} is included in @file{utils/sasl/lisp/} or Emacs/W3 package
+@file{md5.el} is included in @file{utils/sasl/lisp/} or Emacs/W3 package:
 
 @example
 http://www.cs.indiana.edu/elisp/w3/docs.html
@@ -1126,11 +1290,11 @@ http://www.cs.indiana.edu/elisp/w3/docs.html
 
 or LCD archive (GPL2).
 
-If the last character of the folder name is '!', Wanderlust connects to
+If the last character of the folder name is @samp{!}, Wanderlust connects to
 the POP server via SSL (Secure Socket Layer).  If you set non-nil
-value to @code{elmo-default-pop-ssl}, you don't have to put '!' in the
+value to @code{elmo-default-pop-ssl}, you don't have to put @samp{!} in the
 end of the folder name to use SSL. 
-If a folder name ends with '!!', STARTTLS connection will be established.
+If a folder name ends with @samp{!!}, STARTTLS connection will be established.
 if the value of @code{elmo-default-pop-ssl} is 'starttls,
 STARTTLS will be the default connection.
 
@@ -1144,20 +1308,29 @@ STARTTLS will be the default connection.
 A folder to access to a folder which collects messages from
 multiple folders virtually.
 
+Format:
+
 @example
-Format: '*' 'folder' [',' 'folder'] ... [',' 'folder']
+@group
+@samp{*} @var{folder-1} [@samp{,} @var{folder-2}] @dots{} [@samp{,} @var{folder-N}]
+@end group
+@end example
 
-After '*' character, specify multiple folders you want to collect 
-separated by ',' like folder1,folder2,@dots{},folderN.
+After @samp{*} character, specify multiple folders you want to collect
+separated by ',' like
+@samp{@var{folder-1},@var{folder-2},@dots{},@var{folder-N}}.
 
 Example:
-  *-fj.editor.xemacs,-fj.editor.mule,-fj.editor.emacs
-  -> -fj.editor.xemacs, -fj.editor.mule and -fj.editor.emacs are
-     treated as one folder.
-
-  *+inbox,-fj.rec.tv,%inbox
-  -> +inbox, -fj.rec.tv and %inbox are treated as one folder.
 
+@example
+@group
+*-fj.editor.xemacs,-fj.editor.mule,-fj.editor.emacs
+-> -fj.editor.xemacs, -fj.editor.mule and -fj.editor.emacs are
+   treated as one folder.
+
+*+inbox,-fj.rec.tv,%inbox
+-> +inbox, -fj.rec.tv and %inbox are treated as one folder.
+@end group
 @end example
 
 
@@ -1171,87 +1344,133 @@ Example:
 A folder to access to a folder which collects all messages that 
 satisfy a condition virtually.
 
+Format:
+
 @example
-Format: '/' 'condition' '/' 'target-folder'
+@samp{/} @var{condition} @samp{/} @var{target-folder}
+@end example
 
-In the 'condition' part, you can specify following.
+In the @var{condition} part, you can specify following.
 
-1. Partial filter: "first:NUMBER", "last:NUMBER"
+@enumerate
+@item
+Partial filter: @samp{first:@var{number}}, @samp{last:@var{number}}
 
-first: 'NUMBER' messages are picked from top of folder.
-last:  'NUMBER' messages are picked from bottom of folder.
+first: @var{number} messages are picked from top of folder.
+last:  @var{number} messages are picked from bottom of folder.
 
 Example:
-  /last:10/-fj.os.linux -> Latest 10 messages from -fj.os.linux are picked.
-  /first:20/%inbox      -> First 20 messages from %inbox are picked.
 
-2. Date filter: "since:DATE" "before:DATE"
+@example
+@group
+/last:10/-fj.os.linux -> Latest 10 messages from -fj.os.linux are picked.
+/first:20/%inbox      -> First 20 messages from %inbox are picked.
+@end group
+@end example
+
+@item
+Date filter: @samp{since:@var{date}}, @samp{before:@var{date}}
 
-since: only messages arrived since 'DATE' are picked.
-before: only messages arrived before 'DATE' are picked.
+since: only messages arrived since @var{date} are picked.
+before: only messages arrived before @var{date} are picked.
 
-You can specify following as 'DATE'.
+You can specify following as @var{date}.
 
+@example
+@group
 yesterday ->  a day before today.
 lastweek  ->  same day of last week.
 lastmonth ->  same day of last month.
 lastyear  ->  same day of last year.
-'NUMBER'daysago -> 'NUMBER' days ago. (e.x. '3daysago')
-'DAY'-'MONTH'-'YEAR' -> specify date directly (ex. 1-Nov-1998)
+@var{number}daysago -> @var{number} days ago. (e.x. '3daysago')
+@var{day}-@var{month}-@var{year} -> specify date directly (ex. 1-Nov-1998)
+@end group
+@end example
 
 Example:
-  /since:3daysago/+inbox -> messages arrived since 3 days ago in +inbox
-                            are picked.
-  /before:yesterday/+inbox -> messages arrived before yesterday in +inbox
-                            are picked. 
 
-3. Field filter: "FIELD=VALUE"
+@example
+@group
+/since:3daysago/+inbox -> messages arrived since 3 days ago in +inbox
+                          are picked.
+/before:yesterday/+inbox -> messages arrived before yesterday in +inbox
+                          are picked. 
+@end group
+@end example
 
-All messages that have FIELD and its value is VALUE are picked.
-'FIELD' and 'VALUE' are case insensitive.
+@item
+Field filter: @samp{@var{field}:@var{value}}
+
+All messages that have @var{field} and its value is @var{value} are picked.
+@var{field} and @var{value} are case insensitive.
 
 Example:
-  /from=teranisi/+inbox -> In +inbox, messages which have From: field
-                           and its value includes "teranisi" string are picked.
-  /body=foo/%inbox      -> In %inbox, messages which have "foo" text
-                           are picked.
 
-If you can split conditions by character "|", it is considered as OR condition.
-/tocc=xxxx/ is an abbreviation of /to=xxxx|cc=xxxx/.
+@example
+@group
+/from:teranisi/+inbox -> In +inbox, messages which have From: field
+                         and its value includes "teranisi" string are picked.
+/body:foo/%inbox      -> In %inbox, messages which have "foo" text
+                         are picked.
+@end group
+@end example
+
+@item
+Complexed condition
+
+If you combine conditions by character @samp{|}, it is considered as OR condition. @samp{&} is considered as AND condition, likewise.
+Condition can be grouped by parentheses (@samp{(}, and @samp{)}).
+
+@samp{/tocc:xxxx/} is an abbreviation of @samp{/to:xxxx|cc:xxxx/}.
+@samp{/!tocc:xxxx/} is an abbreviation of @samp{/!to:xxxx&!cc:xxxx/}.
 
 Example:
 
-  /from=teranisi|to=teranisi/+inbox
-                        -> In +inbox, messages are picked if
-                           the message's To: field includes
-                           "teranisi" or From: field includes "teranisi".
-  /tocc=teranisi/+inbox -> In +inbox, messages are picked if
-                           the message's To: field or Cc: field includes
-                          "teranisi".
+@example
+@group
+/from:teranisi&!to:teranisi/+inbox
+                      -> In +inbox, messages are picked if the message's 
+                         From: field includes "teranisi" and 
+                         To: field doesn't include "teranisi".
+
+/tocc:"Yuuichi Teranishi"/+inbox 
+                      -> In +inbox, messages are picked if the
+                         message's To: field or Cc: field includes 
+                         "Yuuichi Teranishi".
+
+/(from:yt|from:teranisi)&subject:report/+inbox
+                      -> In +inbox, messages are picked if the message's
+                         From: field includes "yt" or "teranisi", and
+                        Subject includes "report".
+@end group
+@end example
+@end enumerate
+
+@noindent
+Tip for string description:
 
+Space character, @samp{"}, @samp{/},@samp{)},@samp{|} and @samp{&}
+should be enclosed with @samp{"} in @var{value} string.  (@samp{"}
+should be escaped with @samp{\} in it).  You can enclose the string with
+@samp{"} even it does not contain these characters.
+
+@noindent
 Advanced example:
 
-  %inbox,/from=teranisi/%inbox@@server
-         -> Messages in %inbox or
-            message is in the %inbox@@server folder and it's From field
-            includes "teranisi" are collected.
-
-  /last:100//to=teranisi/*+inbox,%inbox
-         -> Latest 100 messages which is in the +inbox or %inbox folder
-            and To: field matches "teranisi".
-
-  /from=hogehoge//last:20//tocc=teranisi/%#mh/inbox@@localhost
-         -> Pick messages which have From: field and it includes "hogehoge"
-            from latest 20 messages in the %#mh/inbox@@localhost
-            and To: or Cc: field includes "teranisi".
-
-;;; --- Limit of implementation ---
-;;; In the current implementation, NNTP folder does not treat date filter and
-;;; field filter.
-;;; In IMAP4 folder, field filter only supports fields which can be 
-;;; passed directly to rfc2060's search command.
-;;; (i.e. to,cc,from,subject and body)
-;;; Localdir folder treats arbitrary field name.
+@example
+*%inbox,/from:teranisi/%inbox@@server
+       -> Messages in %inbox or
+          message is in the %inbox@@server folder and it's From field
+          includes "teranisi" are collected.
+
+/last:100//to:teranisi/*+inbox,%inbox
+       -> Latest 100 messages which is in the +inbox or %inbox folder
+          and To: field matches "teranisi".
+
+/from:hogehoge//last:20//tocc:teranisi/%#mh/inbox@@localhost
+       -> Pick messages which have From: field and it includes "hogehoge"
+          from latest 20 messages in the %#mh/inbox@@localhost
+          and To: or Cc: field includes "teranisi".
 @end example
 
 @node Pipe Folder, Internal Folder, Filter Folder, Folders
@@ -1265,22 +1484,32 @@ Advanced example:
 In the pipe folder, messages are automatically transferred from the source
 folder to destination folder.
 
+Format:
+
 @example
-Format: '|' source-folder '|' destination-folder
+@samp{|} @var{source-folder} @samp{|} @var{destination-folder}
+@end example
 
 When you access to the pipe folder, messages are automatically transferred
-from source-folder to destination-folder.
+from @var{source-folder} to @var{destination-folder}.
 It is convenient if you want to download messages to local disk via POP.
 For example, if you specify following
 
+@example
 |&username@@popserver|+inbox
+@end example
 
 and access to it, messages are downloaded automatically from
-&username@@popserver to +inbox.
+&username@@popserver to @samp{+inbox}.
 
-Example: %inbox|%myinbox   -> Download %inbox to %myinbox.
-         *&user@@popserver1,&user@@popserver2|+inbox
+Example:
+
+@example
+@group
+%inbox|%myinbox   -> Download %inbox to %myinbox.
+*&user@@popserver1,&user@@popserver2|+inbox
          -> Download from &user@@popserver1 and &user@@popserver2 to +inbox.
+@end group
 @end example
 
 After messages are moved, a hook @code{elmo-pipe-drained-hook} is called.
@@ -1293,10 +1522,15 @@ After messages are moved, a hook @code{elmo-pipe-drained-hook} is called.
 
 A folder to access to internal messages of Wanderlust.
 
+Format:
+
 @example
-Format: 'mark
-        or
-        'cache/00 - 1F
+@group
+'mark
+@r{or}
+'cache/00 - 1F
+@end group
+@end example
 
 A folder named 'mark is a special virtual folder which collects messages
 which have important mark @samp{$}.
@@ -1311,11 +1545,8 @@ message will have @samp{$} mark.
 You can access to the cached messages fetched via network by accessing
 to the folders named 'cache/00 - 1F. 00 - 1F are the name of the
 subdirectories of the cache directory (@file{~/.elmo/cache}).
-@end example
 
-@c
-@c  Folder
-@c
+
 @node Folder, Summary, Folders, Top
 @chapter Folder mode
 @cindex Folder
@@ -1342,6 +1573,7 @@ Folder mode looks like this.
 (In XEmacs, it looks much nicer @t{;-)})
 
 @example
+@group
 [-]Desktop:14186/35580/67263
    Inbox:3/10/10
    Trash:2/7/10
@@ -1355,13 +1587,14 @@ Folder mode looks like this.
      Mew:0/0/998
      Mule-Win32:0/0/1491
      fj's Emacsen:0/5/88
+@end group
 @end example
 
 
 Each line means:
 
 @example
-FOLDER-NAME:NEW-NUMBER/UNREAD-NUMBER/ALL-NUMBER
+@var{folder-name}:@var{new-number}/@var{unread-number}/@var{all-number}
 @end example
 
 @noindent
@@ -1377,7 +1610,7 @@ six children folders update its unread number status.
 
 @subsubsection Select Folder
 
-To enter summary mode of the folder, type return (or spece) key on
+To enter summary mode of the folder, type return (or space) key on
 the folder line.
 If the variable @code{wl-stay-folder-window} has non-nil value, 
 summary window appears on the right of the folder mode window.
@@ -1412,16 +1645,24 @@ structure.)
 
 @item w
 @kindex w (Folder)
-@findex wl-summary-write
+@findex wl-draft
 Create a new draft message.
-(@code{wl-summary-write})
+(@code{wl-draft})
 
 @item W
 @kindex W (Folder)
-@findex wl-summary-write-current-newsgroup
+@findex wl-folder-write-current-newsgroup
 If the current cursor point is on the NNTP folder,
 create a new draft message which already has newsgroups field.
-(@code{wl-summary-write-current-newsgroup})
+(@code{wl-folder-write-current-newsgroup})
+
+@item C-c C-o
+@kindex C-c C-o (Folder)
+@findex wl-jump-to-draft-buffer
+Move to the draft buffer if available.  If multiple draft buffer exists,
+moved to one after another.  If prefix argument is specified, load draft
+folder's message to the draft buffer and jump to it.
+(@code{wl-jump-to-draft-buffer})
 
 @item s
 @kindex s (Folder)
@@ -1449,6 +1690,12 @@ selected region.
 Update summary information of the folders in the currently selected region.
 (@code{wl-folder-sync-region})
 
+@item Z
+@kindex Z (Folder)
+@findex wl-status-update
+Sync up address book status with @file{~/.addresses}'s content.
+(@code{wl-status-update})
+
 @item P
 @kindex P (Folder)
 @findex wl-folder-prev-unread
@@ -1557,7 +1804,7 @@ Start Wanderlust's plug-status manager.
 @table @code
 @item wl-folders-file
 @vindex wl-folders-file
-The initial setting is "~/.folders".
+The initial setting is @file{~/.folders}.
 Subscribed folders are described (saved) in this file.
 
 @item wl-folder-info-save
@@ -1581,9 +1828,18 @@ The initial setting is 70.
 If the number of unread messages is more than this value,
 folder color is changed.
 
+@item wl-highlight-folder-by-numbers
+@vindex wl-highlight-folder-by-numbers
+This option controls how to highlight each line in the folder buffer.
+The default value is @code{t}, highlighting with various colors based on
+the message numbers.  If it is @code{nil}, highlighting with various
+colors based on the folder status.  In addition, if it is a number
+(e.g. @code{1}), highlighting will be done based on both the message
+numbers and the folder status.
+
 @item wl-folder-desktop-name
 @vindex wl-folder-desktop-name
-The initial setting is "Desktop".
+The initial setting is @samp{Desktop}.
 The name of top folder group.
 
 @item wl-folder-petname-alist
@@ -1600,21 +1856,26 @@ of access groups.
 
 Each element is:
 
-('regexp of access-folder' . ('subscribe-flag' 'regexp-of-folders' @dots{}))
+@example
+(@var{regexp-of-access-folder} . (@var{subscribe-flag} @var{regexp-of-folders} @dots{}))
+@end example
 
-If subscribe-flag is non-nil, folders which have name matched to
-regexp-of-folders are displayed. Otherwise, hidden.
+@noindent
+If @var{subscribe-flag} is non-nil, folders which have name matched to
+@var{regexp-of-folders} are displayed. Otherwise, hidden.
 However, already unsubscribed folder is not displayed even 
-when the subscribe-flag is non-nil. Multiple regexp-of-folders can be specified.
+when the @var{subscribe-flag} is non-nil. Multiple @var{regexp-of-folders} can be specified.
 
 Example:
 
-@example
+@lisp
+@group
 '(("^-fj$" . (t   "^-fj\\.\\(comp\\|editor\\|mail\\)"
                   "^-fj\\.\\(net\\|news\\|os\\|rec\\)"))
   ("^-$" . (t   "^-\\(fj\\|tnn\\|japan\\|gnu\\|comp\\)"))
   ("^\\+ml$" . (nil "^\\+ml$" "^\\+ml/tmp")))
-@end example
+@end group
+@end lisp
 
 @item wl-folder-hierarchy-access-folders
 @vindex wl-folder-hierarchy-access-folders
@@ -1625,13 +1886,17 @@ For example, if you specify
 @code{wl-folder-hierarchy-access-folders} like following,
 
 @lisp
+@group
 (setq wl-folder-hierarchy-access-folders
      '("-" "-alt" "-japan" "-comp" "-comp.unix"))
+@end group
 @end lisp
 
+@noindent
 such access group hierarchy is obtained.
 
 @example
+@group
    [-]-:912/912/3011
      [-]-fj:674/674/1314
        -fj.comp.announce:0/0/2
@@ -1646,6 +1911,7 @@ such access group hierarchy is obtained.
          [-]-comp.unix.bsd:0/0/23
            -comp.unix.bsd.freebsd.announce:0/0/0
      @dots{}
+@end group
 @end example
 
 If you opened @samp{-} in this example, only the direct children is created
@@ -1733,15 +1999,16 @@ Usually, access group displays all children folders, but you can set
 some folders hidden. Following operations are only available on access
 group.
 
-Command @code{wl-fldmgr-unsubscribe} (@kbd{u}) toggles
-the visibility (subscribe/unsubscribe) of the folder at current cursor point.
+Command @code{wl-fldmgr-unsubscribe} (@kbd{u}) toggles the visibility
+(subscribe/unsubscribe) of the folder at current cursor point.  Against
+this, @code{wl-fldmgr-unsubscribe-region} (@kbd{U}) hides folders in the
+specified region.
 
-Against this, @code{wl-fldmgr-unsubscribe-region} (@kbd{U}) hides folders
-in the specified region.  Note that @code{wl-fldmgr-unsubscribe-region}
-does not toggle while @code{wl-fldmgr-unsubscribe} toggles.  These two
-commands accept prefix argument and if the argument has positive number,
-the unsubscribe it.  If the prefix argument has negative value, folder
-becomes visible and if zero, folder visibility is toggled.
+Note that @code{wl-fldmgr-unsubscribe-region} does not toggle while
+@code{wl-fldmgr-unsubscribe} toggles.  These two commands accept prefix
+argument and if the argument has positive number, the unsubscribe it.
+If the prefix argument has negative value, folder becomes visible and if
+zero, folder visibility is toggled.
 
 The other commands, @code{wl-fldmgr-subscribe} and
 @code{wl-fldmgr-subscribe-region} are also prepared (not binded to the
@@ -1937,14 +2204,6 @@ List folders that are currently available.
 @findex wl-fldmgr-access-display-all
 List all folders regardless of the subscription status.
 (@code{wl-fldmgr-access-display-all})
-
-@item C-c C-o
-@kindex C-c C-o (Folder)
-@findex wl-jump-to-draft-buffer
-Move to the draft buffer if available.  If multiple draft buffer exists,
-moved to one after another.  If prefix argument is specified, load draft
-folder's message to the draft buffer and jump to it.
-(@code{wl-jump-to-draft-buffer})
 @end table
 
 
@@ -2009,8 +2268,8 @@ paste(yank) command pastes the folders on one cut or copy command
 by one paste command)
 
 @item
-You cannot cut 'Desktop' group.
-Also, you cannot paste folders at the outside of the 'Desktop'.
+You cannot cut @samp{Desktop} group.
+Also, you cannot paste folders at the outside of the @samp{Desktop}.
 
 @item
 You cannot copy folder group.
@@ -2029,24 +2288,37 @@ You cannot put same nickname to the different folders.
 @end enumerate
 
 
-@c
-@c  Summary
-@c
 @node Summary, Message, Folder, Top
 @chapter Summary Mode
 
+After you select the folder via folder mode, you enter to the summary
+mode.
+
+@menu
+* Usage of Summary Mode::       TIPS.
+* Thread Oparations::           Thread oparations.
+* Cache::                       File cache, Buffer cache, and Prefetch.
+* Auto Refile::                 Auto refile settings.
+* Sticky Summary::              Summary make sticky.
+* Key Bindings of Summary::     Key bindings.
+* Variables of Summary::        Customize Summary Mode.
+@end menu
+
+
+@node Usage of Summary Mode, Thread Oparations, Summary, Summary
 @section Usage (Tips)
 
 @subsection Summary Content
 
-After you select the folder via folder mode, you enter to the summary mode.
 In the summary mode, messages are displayed like following.
 
 @example
+@group
   377  09/16(Wed)11:57 [+1: Takuro Kitame  ] Bug?
   381  09/17(Thu)00:16 [+3: Fujikazu Okuni ] elmo-lha.el -- LHA interface
   384  09/17(Thu)01:32 [+1: Yuuichi Terani ] wl-0.6.2
   389 N09/18(Fri)01:07 [+2: Yuuichi Terani ] wl-0.6.3
+@end group
 @end example
 
 Each line displays:
@@ -2157,8 +2429,11 @@ You can jump to next unread message by typing @kbd{N} key, and @kbd{n} key
 moves cursor to the next message.
 Enter message buffer by typing @kbd{j} key.
 To operate multipart, you have to enter to the message buffer.
+@xref{Message}.
+
 
-@subsection Thread Operations
+@node Thread Oparations, Cache, Usage of Summary Mode, Summary
+@section Thread Operations
 
 For example, the following line indicates one thread (a context of a topic).
 
@@ -2171,8 +2446,10 @@ If you type @kbd{/} on this line, the thread is opened and it changes
 the appearance like following.
 
 @example
+@group
   384  09/17(Thu)01:32 [ Teranishi          ] wl-0.6.2
   388  09/17(Thu)22:34 +-[ Murata san         ]
+@end group
 @end example
 
 (Message 388 is the replied message to the message 384.)
@@ -2182,6 +2459,10 @@ With prefix argument, @kbd{/} opens all children threads.
 Commands with the key binding that begins with @kbd{t} executes commands
 on the messages in the thread.
 
+
+@node Cache, Auto Refile, Thread Oparations, Summary
+@section Cache
+
 @subsection Cache File
 
 The messages which have to access via network (e.x. IMAP, NNTP folder) 
@@ -2222,8 +2503,10 @@ This variable precedes the value of @code{wl-cache-prefetch-folder-list}.
 
 If you want to prefetch localdir and localnews also, following setting is needed.
 @lisp
+@group
 (setq wl-cache-prefetch-folder-type-list
       '(nntp imap4 localdir localnews))
+@end group
 @end lisp
 
 @item wl-cache-prefetch-folder-list
@@ -2232,7 +2515,9 @@ The initial setting is nil.
 A list of regexp of folders to enable message prefetching.
 @end table
 
-@subsection Auto Refile
+
+@node Auto Refile, Sticky Summary, Cache, Summary
+@section Auto Refile
 @vindex elmo-msgdb-extra-fields
 @vindex wl-refile-rule-alist
 @findex wl-summary-auto-refile
@@ -2246,12 +2531,14 @@ If you want to decide destination by other header fields,
 set the variable @code{elmo-msgdb-extra-fields} like following.
 
 @lisp
+@group
 (setq elmo-msgdb-extra-fields
       '("x-ml-name"
         "reply-to"
         "sender"
         "mailing-list"
         "newsgroups"))
+@end group
 @end lisp
 
 @noindent
@@ -2264,34 +2551,42 @@ refiling is decided by the value of @code{wl-refile-rule-alist}.
 @code{wl-refile-rule-alist} is a list of a rule:
 
 @example
-        (FIELD (REGEXP . TARGET)
-               (REGEXP . TARGET)
-               @dots{})
+@group
+(@var{field} (@var{regexp} . @var{target})
+       (@var{regexp} . @var{target})
+       @dots{})
+@end group
 @end example
 
-Each rule means `if FIELD value matches REGEXP, then refile to TARGET folder'.
+Each rule means `if @var{field} value matches @var{regexp},
+then refile to @var{target} folder'.
 The rule matched first is applied.
 
-FIELD is a string of field name.  You can specify a list of field name
+@var{field} is a string of field name.  You can specify a list of field name
 string, too. In this case, if one of these fields is matched, then the
 rule is fired (i.e. OR condition).
 
-REGEXP is a regular expression for field value.  TARGET is a target
-folder string. You can specify a rule at TARGET part, too.  In this
+@var{regexp} is a regular expression for field value.  @var{target} is a target
+folder string. You can specify a rule at @var{target} part, too.  In this
 case, If the field value of the rule and the current rule is matched,
 then the current rule is fired (i.e. AND condition).
 
-In TARGET part, you can refer matched substring of REGEXP.
-To refer substring, specify following in TARGET:
+In @var{target} part, you can refer matched substring of @var{regexp}.
+To refer substring, specify following in @var{target}:
 
-@example
-\&            means substitute original matched text.
-\N (number)   means substitute what matched the Nth `\(...\)'.
-@end example
+@table @samp
+@item \&
+means substitute original matched text.
+
+@item \@var{N}
+means substitute what matched the @var{N}th `\(@dots{}\)'.
+(@var{N} is a number.)
+@end table
 
 Following is an example of @code{wl-refile-rule-alist}.
 
 @lisp
+@group
 (setq wl-refile-rule-alist
       '(("x-ml-name"
          ("^Wanderlust" . "+wl")
@@ -2301,6 +2596,7 @@ Following is an example of @code{wl-refile-rule-alist}.
         ("From"
          ("me@@gohome.org" . ("To" ("you@@gohome.org" . 
                                     "+from-me-to-you"))))))
+@end group
 @end lisp
 
 After these settings, refile marks are automatically put on the condition
@@ -2318,7 +2614,9 @@ To execute auto refile on all messages, set following.
 (setq wl-summary-auto-refile-skip-marks nil)
 @end lisp
 
-@subsection Sticky Summary
+
+@node Sticky Summary, Key Bindings of Summary, Auto Refile, Summary
+@section Sticky Summary
 @cindex Summary, Sticky
 @cindex Sticky Summary
 
@@ -2337,6 +2635,8 @@ q}. Other operations in the sticky summary are same as normal summary.
 @code{wl-summary-always-sticky-folder-list} specifies the folders that are
 automatically sticked.
 
+
+@node Key Bindings of Summary, Variables of Summary, Sticky Summary, Summary
 @section Key bindings
 @cindex Keybind, Summary Mode
 @cindex Keybind, Summary Buffer
@@ -2386,6 +2686,15 @@ Display the next line of the message at the current cursor point.
 Display the message at the current cursor point if it is not displayed yet.
 (@code{wl-summary-next-line-content})
 
+@item -
+@itemx M-@key{RET}
+@kindex - (Summary)
+@kindex M-@key{RET} (Summary)
+@findex wl-summary-prev-line-content
+Display the previous line of the message at the current cursor point.
+Display the message at the current cursor point if it is not displayed yet.
+(@code{wl-summary-prev-line-content})
+
 @item /
 @kindex / (Summary)
 @findex wl-thread-open-close
@@ -2404,15 +2713,6 @@ Close all threads.
 @findex wl-thread-close-all
 (@code{wl-thread-close-all})
 
-@item -
-@itemx M-@key{RET}
-@kindex - (Summary)
-@kindex M-@key{RET} (Summary)
-@findex wl-summary-prev-line-content
-Display the previous line of the message at the current cursor point.
-Display the message at the current cursor point if it is not displayed yet.
-(@code{wl-summary-prev-line-content})
-
 @item g
 @kindex g (Summary)
 @findex wl-summary-goto-folder
@@ -2516,16 +2816,16 @@ as @samp{$}.
 
 @item w
 @kindex w (Summary)
-@findex wl-draft
+@findex wl-summary-write
 Prepare a new draft.
-(@code{wl-draft})
+(@code{wl-summary-write})
 
 @item W
 @kindex W (Summary)
-@findex wl-draft-write-current-newsgroup
+@findex wl-summary-write-current-newsgroup
 Prepare a new draft.
 If the current folder is netnews folder, Newsgroups: field is completed.
-(@code{wl-draft-write-current-newsgroup})
+(@code{wl-summary-write-current-newsgroup})
 
 @item H
 @kindex H (Summary)
@@ -2571,9 +2871,14 @@ Pipe current message's content to the external process.
 @kindex # (Summary)
 @findex wl-summary-print-message
 Print out current message's content.
-It uses ps-print module in Emacs 20.x.
+It uses @code{ps-print} module in Emacs 20.x.
 If you don't use color printer, you might want to set
-@code{wl-ps-print-buffer-func} to 'ps-print-buffer.
+@code{wl-ps-print-buffer-func} to @code{ps-print-buffer}.
+
+@lisp
+(setq wl-ps-print-buffer-func 'ps-print-buffer)
+@end lisp
+
 (@code{wl-summary-print-message})
 
 @item q
@@ -2628,11 +2933,13 @@ Synchronize summary view after prompting the update range
 (all, update, rescan, first, last).
 
 @example
+@group
 all            ...Discard current summary and update all message.
 update         ...Update the difference between summary and the folder itself.
 rescan         ...Rescan the msgdb and display again.
 rescan-noscore ...Rescan the msgdb and display again (without scoring).
 first, last    ...Move to the filter folder(partial filter).
+@end group
 @end example
 
 @noindent
@@ -2650,8 +2957,8 @@ You can sort by date, from, number and subject.
 @findex wl-summary-toggle-thread
 Toggle the threading.
 Threading status is displayed on the modeline.
-@{S@} means threading is off (Sequence) and 
-@{T@} means threading is on (Thread).
+@samp{@{S@}} means threading is off (Sequence) and 
+@samp{@{T@}} means threading is on (Thread).
 (@code{wl-summary-toggle-thread})
 
 @item l
@@ -2694,6 +3001,7 @@ Mark as read the message at the current cursor point.
 @item i
 @kindex i (Summary)
 Prefetch the message at the current cursor point.
+With prefix argument, prefetch the message even if it is cached.
 @findex wl-summary-prefetch
 (@code{wl-summary-prefetch})
 
@@ -2890,7 +3198,6 @@ With prefix argument, it affects on the all messages in the thread tree.
 @item t u
 @kindex t u (Summary)
 @findex wl-thread-unmark
-
 Unmark temporal mark on the messages which are the descendant of the
 current thread. With prefix argument, it affects on the all messages in
 the thread tree. 
@@ -3022,7 +3329,9 @@ folder's message to the draft buffer and jump to it.
 (@code{wl-jump-to-draft-buffer})
 @end table
 
-@section Customize variables
+
+@node Variables of Summary,  , Key Bindings of Summary, Summary
+@section Customiziable variables
 
 @table @code
 @item wl-summary-move-order
@@ -3073,7 +3382,7 @@ Specify language of the weekday.
 
 @item wl-summary-fix-timezone
 @vindex  wl-summary-fix-timezone
-The initial setting is "JST".
+The initial setting is @samp{JST}.
 Timezone to adjust summary's timezone.
 If nil, adjust to UTC.
 
@@ -3106,12 +3415,12 @@ If nil, max indent level is unlimited.
 
 @item wl-summary-no-from-message
 @vindex  wl-summary-no-from-message
-The initial setting is "nobody@@nowhere?".
+The initial setting is @samp{nobody@@nowhere?}.
 A string which is displayed when there's no From: field in the message.
 
 @item wl-summary-no-subject-message
 @vindex  wl-summary-no-subject-message
-The initial setting is "(WL:No Subject in original.)".
+The initial setting is @samp{(WL:No Subject in original.)}.
 A string which is displayed when there's no Subject: field in the message.
 
 @item wl-summary-width
@@ -3241,16 +3550,14 @@ The initial setting is t.
 If non-nil, messages read via POP3 are cached.
 @end table
 
-@c
-@c  Message
-@c
+
 @node Message, Draft, Summary, Top
 @chapter Message Buffer
 
 Message Buffers utilize MIME-View mode of SEMI/tm.
 For operational procedures and key bindings, refer to respective
 documents.
-@xref{MIME-View, , ,mime-ui-ja, a MIME user interface for GNU Emacs}.
+@xref{MIME-View, , ,mime-ui-en, a MIME user interface for GNU Emacs}.
 
 @kbd{p} at the top of a message or @kbd{n} at the bottom of a message
 brings you back to Summary mode.
@@ -3298,9 +3605,7 @@ its car and cdr value corresponds to the ratio of Summary and Message
 windows.
 @end table
 
-@c
-@c  Draft
-@c
+
 @node Draft, Disconnected Operations, Message, Top
 @chapter Draft Buffer
 
@@ -3329,11 +3634,10 @@ message is saved when it is sent.
 
 Multi-part editing utilize MIME edit mode of SEMI/tm.  For procedures of
 editing, refer to respective documents.
-@xref{Mail Methods, , ,mime-ui-ja, a MIME user interface for GNU Emacs}.
+@xref{MIME-Edit, , ,mime-ui-en, a MIME user interface for GNU Emacs}.
 
 @subsection Dynamic Modification of Messages
 @vindex wl-draft-config-alist
-
 @c @cindex Change Message
 @c @cindex Message, Change Dynamic
 
@@ -3349,6 +3653,7 @@ You can set @code{wl-interactive-send} to non-nil so as to confirm
 changes before sending the message.
 
 @lisp
+@group
 (setq wl-draft-config-alist
       '(((string-match "aaa.ne.jp$" (system-name))
          ;; @r{applied if the expression is non-nil}
@@ -3363,11 +3668,13 @@ changes before sending the message.
          (top . "Hello.\n")    ;; @r{inserted at the top of the body}
          (bottom . "\nBye.\n") ;; @r{inserted at the bottom of the body}
         ))
+@end group
 @end lisp
 
 The format of @code{wl-draft-config-alist} is:
 
 @example
+@group
 '(("regexp of the header" or elisp expression
   ("Field" . value(elisp expression))
    (variable . value(elisp expression))
@@ -3377,6 +3684,7 @@ The format of @code{wl-draft-config-alist} is:
   ("regexp of the header" or elisp expression
    ("Field" . value(elisp expression))
    @dots{}))
+@end group
 @end example
 
 Per default, there are 10 following sub-functions.
@@ -3384,7 +3692,7 @@ Per default, there are 10 following sub-functions.
 @example
 'header:      Inserts the specified string at the bottom of the header.
 'header-file: Inserts the specified file at the bottom of the header.
-'x-face:      Inserts "X-Face" field with the content of the specified file.
+'x-face:      Inserts @samp{X-Face:} field with the content of the specified file.
 'top:         Inserts the specified string at the top of the body.
 'top-file:    Inserts the specified file at the top of the body.
 'body:        Replaces the body with the specified string.
@@ -3423,6 +3731,7 @@ and the cdr part is nil, the field will be deleted.
 See the next example as well:
 
 @lisp
+@group
 (setq wl-draft-config-alist
       '((reply                         ;; @r{(1)}
          "X-ML-Name: \\(Wanderlust\\|emacs-mime-ja\\|apel-ja\\)"
@@ -3430,6 +3739,7 @@ See the next example as well:
          (body . "  Hello.\n")
          (template . "default")
          )))
+@end group
 @end lisp
 
 As in the (1) above, if a header regexp is prepended with @code{reply},
@@ -3463,6 +3773,7 @@ The format of @code{wl-template-alist} is almost the same as
 @code{wl-draft-config-alist}.
 
 @lisp
+@group
 (setq wl-template-alist
       '(("default"
          ("From" . wl-from)
@@ -3475,10 +3786,11 @@ The format of @code{wl-template-alist} is almost the same as
          (body-file . "~/work/report.txt")
          )
         ))
+@end group
 @end lisp
 
 As you can see, the only difference is item (template) names such as
-"default" and "report", instead of a regexp of header.
+@samp{default} and @samp{report}, instead of a regexp of header.
 Because definition of each item is the same as
 @code{wl-draft-config-alist}, you can call another template, like (a).
 
@@ -3498,13 +3810,12 @@ If @code{wl-template-visible-select} is nil, you should type the name of
 the template in the mini buffer.
 
 As shown in the example in @code{wl-draft-config-alist}, you can select
-"default" template by writing:
+@samp{default} template by writing:
 
 @example
 (template . "default")
 @end example
 
-@noindent
 @subsection Sending mail by POP-before-SMTP
 @cindex POP-before-SMTP
 
@@ -3550,8 +3861,10 @@ required.
 Refer to the following URL about POP-before-SMTP.
 
 @example
+@group
 http://spam.ayamura.org/tools/smPbS.html
 http://www.iecc.com/pop-before-smtp.html
+@end group
 @end example
 
 @section Key Bindings
@@ -3685,34 +3998,35 @@ draft buffer.
 The initial setting is t.
 If non-nil and there is an encoded X-Face string in a file
 @file{~/.xface} (the value of the variable @code{wl-x-face-file}),
-inserts it as an X-Face field in the draft buffer.
-If nil, it is not automatically inserted. Press @kbd{C-c C-a} to insert.
+inserts it as an @samp{X-Face:} field in the draft buffer.  If nil, it
+is not automatically inserted. Press @kbd{C-c C-a} to insert.
 
 @item wl-insert-message-id
 @vindex wl-insert-message-id
 The initial setting is t.
-If non-nil, Message-ID field is automatically inserted on the
+If non-nil, @samp{Message-ID:} field is automatically inserted on the
 transmission.
 
 @item wl-local-domain
 @vindex wl-local-domain
 The initial setting is nil.
 If nil, the return value of the function @code{system-name} will be
-used as the domain part of Message-ID.
+used as the domain part of @samp{Message-ID:}.
 
 If @code{system-name} does not return FQDN (i.e. the full name of the
-host, like @samp{smtp.gohome.org}), you @strong{must} set this variable to the
-string of the local domain name without hostname (like @samp{gohome.org}). 
-That is, a concatenation of @code{system-name} "." @code{wl-local-domain} 
-is used as domain part of the Message-ID.
+host, like @samp{smtp.gohome.org}), you @strong{must} set this variable
+to the string of the local domain name without hostname (like
+@samp{gohome.org}).  That is, a concatenation of @code{system-name}
+@samp{.} @code{wl-local-domain} is used as domain part of the
+@samp{Message-ID:}.
 
 If your terminal does not have global IP, set the value of
-@code{wl-message-id-domain}.
-(You might be beaten up on the Net News if you use invalid Message-ID.)
+@code{wl-message-id-domain}.  (You might be beaten up on the Net News if
+you use invalid @samp{Message-ID:}.)
 
-Moreover, 
-concatenation of @code{system-name} "." @code{wl-local-domain} 
-will be used as an argument to the HELO command in SMTP.
+Moreover, concatenation of @code{system-name} @samp{.}
+@code{wl-local-domain} will be used as an argument to the HELO command
+in SMTP.
 
 @item wl-message-id-domain
 @vindex wl-message-id-domain
@@ -3776,11 +4090,16 @@ The initial setting is 'split.
 In the case of 'full, the whole frame will be used for a reply draft
 buffer when it is prepared.
 
+@item wl-draft-use-frame
+@vindex wl-draft-use-frame
+The initial setting is nil.
+If non-nil, use new frame for the draft.
+
 @item wl-from
 @vindex wl-from
-The initial setting is the value of the variable @code{user-mail-address}.
-The value of this variable is inserted as a From field of the draft when
-it is prepared.
+The initial setting is the value of the variable
+@code{user-mail-address}.  The value of this variable is inserted as a
+@samp{From:} field of the draft when it is prepared.
 
 @item wl-envelope-from
 @vindex wl-envelope-from
@@ -3797,14 +4116,15 @@ set this variable.
 @item wl-fcc
 @vindex wl-fcc
 The initial setting is nil.
-If non-nil, the value of this variable is inserted as a FCC of the draft
-when it is prepared.
+If non-nil, the value of this variable is inserted as a @samp{Fcc:} of
+the draft when it is prepared.
+If function is specified, its return value is used.
 
 @item wl-bcc
 @vindex wl-bcc
 The initial setting is nil.
-If non-nil, the value of this variable is inserted as a Bcc of the draft
-when it is prepared.
+If non-nil, the value of this variable is inserted as a @samp{Bcc:} of
+the draft when it is prepared.
 
 @item wl-reply-subject-prefix
 @vindex wl-reply-subject-prefix
@@ -3812,12 +4132,23 @@ The initial setting is "Re: ".
 In the Subject of the reply draft, this string is prepended to the
 Subject of being replied.
 
+@item wl-draft-reply-use-address-with-full-name
+@vindex wl-draft-reply-use-address-with-full-name
+The initial setting is @code{t}.
+If non-nil, insert her full name with address when prepare a draft for
+reply a message.  If it is @code{nil}, insert her address only.
+
 @item wl-draft-enable-queuing
 @vindex wl-draft-enable-queuing
 The initial setting is t.
 This flag controls off-line transmission.  If non-nil, the draft is
 sent off-line.
 
+@item wl-draft-use-cache
+@vindex wl-draft-use-cache
+The initial setting is @code{t}.
+If non-nil, cache the message which is sent.
+
 @item wl-auto-flush-queue
 @vindex wl-auto-flush-queue
 The initial setting is t.
@@ -3828,8 +4159,8 @@ manually, press @kbd{F} in the folder mode.
 
 @item wl-draft-always-delete-myself
 @vindex wl-draft-always-delete-myself
-If non-nil, always removes your own address from To and CC when you are
-replying to the mail addressed to you.
+If non-nil, always removes your own address from @samp{To:} and
+@samp{Cc:} when you are replying to the mail addressed to you.
 
 @item wl-smtp-posting-server
 @vindex wl-smtp-posting-server
@@ -3845,9 +4176,9 @@ If nil, @code{smtp-authenticate-user} is used.
 @item wl-smtp-authenticate-type
 @vindex wl-smtp-authenticate-type
 The initial setting is nil.
-This is the authentication method for SMTP AUTH authentication.
-If nil, @code{smtp-authenticate-type} is used.
-If it is still nil, authentication will not be carried out.
+This is the authentication method for SMTP AUTH authentication.  If nil,
+@code{smtp-authenticate-type} is used.  If @code{smtp-authenticate-type}
+is still nil, authentication will not be carried out.
 
 @item wl-smtp-connection-type
 @vindex wl-smtp-connection-type
@@ -3921,27 +4252,62 @@ off-line transmission.
 @vindex wl-draft-sendlog
 The initial setting is t.
 If t, transmission log is written in @file{~/.elmo/sendlog}.
-It is written when drafts are sent by smtp or qmail, and when they are
-saved into folders by fcc or queuing (it is written even if the
-transmission fails).
-But transmission by im-wl.el is not written in the sendlog and left to
-the logging function of imput.
+It is written when:
+
+@itemize @minus
+@item drafts are sent by smtp or qmail
+@item saved into folders by fcc
+@item saved into folders by queuing
+@end itemize
+
+(it is written even if the transmission fails).
+But transmission by @file{im-wl.el} is not written in the @file{sendlog} and
+left to the logging function of imput.
+
 
 @item wl-draft-sendlog-max-size
 @vindex wl-draft-sendlog-max-size
 The initial setting is 20000 (in bytes).
 If @code{wl-draft-sendlog} is t, the log is rotated when it grows beyond 
 the size specified by this variable.
-@end table
 
+@item wl-use-ldap
+@vindex wl-use-ldap
+The initial setting is nil.
+If non-nil, address completion uses LDAP.
+
+@item wl-ldap-server
+@vindex wl-ldap-server
+The initial setting is localhost.
+LDAP server name for address completion.
+
+@item wl-ldap-port
+@vindex wl-ldap-port
+The initial setting is nil.
+If non-nil, the value is used as port number.
+
+@item wl-ldap-base
+@vindex wl-ldap-base
+The initial setting is "c=US".
+LDAP search starting point (base) for address completion.
+@end table
 
-@c
-@c  Disconnected Operations
-@c
 @node Disconnected Operations, Expire and Archive, Draft, Top
 @chapter Off-line Management
 @cindex Disconnected Operations
 
+Wanderlust has on-line and off-line states.
+
+@menu
+* Off-line State::              Wanderlust has on-line and off-line states.
+* Enable Operations::           Enable Disconeected Oparations.
+* Plugged Mode::                Switching On-line/Off-line per Server/Port.
+* Off-line State settings::     Invoking Wanderlust in the Off-line State.
+* Variables of Plugged Mode::   Customize Plugged Mode.
+@end menu
+
+
+@node Off-line State, Enable Operations, Disconnected Operations, Disconnected Operations
 @section Off-line State
 
 Wanderlust has on-line and off-line states.
@@ -3959,22 +4325,29 @@ You can invoke Wanderlust in the off-line state by setting
 In the off-line mode, @kbd{n} and @kbd{p} command in the summary mode
 ignores uncached messages.
 
+
+@node Enable Operations, Plugged Mode, Off-line State, Disconnected Operations
+@section Enable Disconeected Oparations
+
 Even in the off-line state, provided that relevant messages are cached,
 and the variable @code{elmo-enable-disconnected-operation} (described
-later) is non-nil, you can:
+later) is non-nil, you can following oparations:
+@xref{Plugged Mode}, @xref{Off-line State settings}.
 
-@itemize @minus
-@item transmit messages
-@item re-file and copy (IMAP4)
-@item create folders (IMAP4)
-@item mark (IMAP4)
-@item pre-fetch (IMAP4, NNTP)
-@end itemize
+@menu
+* Send Messages off-line::      Transmit Messages.
+* Re-file and Copy queue::      Re-file and Copy (IMAP4).
+* Creation of Folders::         Create Folders off-line (IMAP4).
+* Marking::                     Mark (IMAP4).
+* Pre-fetching Reservations::   Pre-fetch (IMAP4, NNTP).
+@end menu
 
-As soon as Wanderlust becomes on-line, such operations invoked
-off-line are reflected in the servers via network.
+As soon as Wanderlust becomes on-line, such operations invoked off-line
+are reflected in the servers via network.
 
-@section Transmission of Messages
+
+@node Send Messages off-line, Re-file and Copy queue, Enable Operations, Enable Operations
+@subsection Transmission of Messages
 
 You can send mail/news messages off-line (if you are using im-wl.el, it
 is irrelevant).  Messages sent off-line are accumulated in the queue
@@ -3985,7 +4358,9 @@ You can visit @samp{+queue} in the off-line state and confirm content
 of messages in the queue.  You can also remove messages.  Removed messages
 are not transmitted even in the on-line state.
 
-@section Re-file and Copy (IMAP4)
+
+@node Re-file and Copy queue, Creation of Folders, Send Messages off-line, Enable Operations
+@subsection Re-file and Copy (IMAP4)
 
 Re-file and copy operations to IMAP folders invoked during the off-line
 state are accumulated in the queue, and reflected in the server side
@@ -3999,19 +4374,25 @@ While the queue is processed, messages that failed to be re-filed or
 copied to the specified folders are appended to the folder
 @samp{+lost+found}.
 
-@section Creation of Folders (IMAP4)
+
+@node Creation of Folders, Marking, Re-file and Copy queue, Enable Operations
+@subsection Creation of Folders (IMAP4)
 
 You can create IMAP folders off-line.  The creation of folders are
 reflected in the servers when Wanderlust becomes on-line.  At that time, 
 if folders failed to be created on the servers for any reasons, messages
-re-filed to such folders are appended to the folder "+lost+found".
+re-filed to such folders are appended to the folder @samp{+lost+found}.
 
-@section Marking (IMAP4)
+
+@node Marking, Pre-fetching Reservations, Creation of Folders, Enable Operations
+@subsection Marking (IMAP4)
 
 Off-line changes in unread/read and importance mark @samp{$} information
 are also reflected in the servers when Wanderlust becomes on-line.
 
-@section Pre-fetching (IMAP4, NNTP)
+
+@node Pre-fetching Reservations,  , Marking, Enable Operations
+@subsection Pre-fetching (IMAP4, NNTP)
 
 You can make reservations for pre-fetching messages in IMAP or NNTP
 folders.  Reserved messages are marked with @samp{!} but not cached
@@ -4030,6 +4411,8 @@ If you want to remove caches, be sure to execute
 @code{elmo-cache-expire-by-size} does not remove caches for messages
 relevant to off-line operations.
 
+
+@node Plugged Mode, Off-line State settings, Enable Operations, Disconnected Operations
 @section Switching On-line/Off-line per Server/Port
 
 @kbd{M-t} described above switches networking states as a whole, but you 
@@ -4040,6 +4423,7 @@ wl-plugged-mode shown below, in which you can change the plugged state
 for each port.
 
 @example
+@group
 Queuing:[ON] AutoFlushQueue:[--] DisconnectedOperation:[ON]
 [ON](wl-plugged)
   [--]hosta
@@ -4050,6 +4434,7 @@ Queuing:[ON] AutoFlushQueue:[--] DisconnectedOperation:[ON]
                             %inbox(delete-msgids:1)    @dots{}@r{dop queue}
     [ON]nntp(119)
     [ON]smtp
+@end group
 @end example
 
 The first line indicates status of the following three variables, and
@@ -4057,16 +4442,18 @@ simply pressing @kbd{@key{SPC}} or @kbd{@key{RET}} in each labelled
 column modifies the values of these variables.
 
 @example
-"Queuing"               wl-draft-enable-queuing
-"AutoFlushQueue"        wl-auto-flush-queue
-"DisconnectedOperation" elmo-enable-disconnected-operation
+@group
+"Queuing"               @code{wl-draft-enable-queuing}
+"AutoFlushQueue"        @code{wl-auto-flush-queue}
+"DisconnectedOperation" @code{elmo-enable-disconnected-operation}
+@end group
 @end example
 
 where @samp{[ON]} means its value is t, and @samp{[--]} means nil.
 
 The second and after lines indicate on-line/off-line states of servers
 and ports, where @samp{[ON]} stands for on-line and @samp{[--]} for
-off-line (in XEmacs, they are shown with icons).  Pressing
+off-line (in XEmacs or Emacs 21, they are shown with icons).  Pressing
 @kbd{@key{SPC}} or @kbd{@key{RET}} in each line switches its state.
 
 "sending queue" means messages accumulated in the folder @samp{+queue}
@@ -4084,10 +4471,12 @@ hosta, and in the dop queue there are one for @samp{%inbox} and two for
 If you change (wl-plugged) in the second line, the variable
 @code{wl-plugged} is changed, so that the mode line indicator and
 plugged states of all ports are affected.
-If you change plugged states of any servers or ports, wl-plugged in the
+If you change plugged states of any servers or ports, (wl-plugged) in the
 second line is affected depending on @code{elmo-plugged-condition}
 settings and the plugged state of each port.
 
+
+@node Off-line State settings, Variables of Plugged Mode, Plugged Mode, Disconnected Operations
 @section Invoking Wanderlust in the Off-line State
 
 As described before, if you set @code{wl-plugged} to nil in @file{~/.wl}
@@ -4102,6 +4491,7 @@ plugged state of these ports or to add other ports, configure
 @code{wl-make-plugged-hook} with a function.
 
 @lisp
+@group
 (add-hook 'wl-make-plugged-hook
           '(lambda ()
              (elmo-set-plugged plugged-value(t/nil) server port)
@@ -4110,8 +4500,11 @@ plugged state of these ports or to add other ports, configure
                  ;; @r{if the port is omitted, all ports are affected}
                  ;; @r{(you cannot omit the port if you newly add the server)}
              ))
+@end group
 @end lisp
 
+
+@node Variables of Plugged Mode,  , Off-line State settings, Disconnected Operations
 @section Customizable Variables
 
 @table @code
@@ -4122,7 +4515,7 @@ the beginning.
 
 @item wl-queue-folder
 @vindex wl-queue-folder
-The initial setting is "+queue".
+The initial setting is @samp{+queue}.
 This is the folder in which messages in the transmission queue are
 accumulated.
 
@@ -4141,7 +4534,7 @@ If non-nil, off-line operations are carried out.
 
 @item elmo-lost+found-folder
 @vindex elmo-lost+found-folder
-The initial setting is "+lost+found".
+The initial setting is @samp{+lost+found}.
 This is the folder to which messages are saved when they fails to be
 appended while the off-line re-file/copy queue is processed.
 
@@ -4151,7 +4544,7 @@ The initial setting is 'one.
 The value of @code{wl-plugged} reflects the return value of the function 
 @code{elmo-plugged-p} (without arguments).
 This variable @code{elmo-plugged-condition} specifies the condition on
-which the return value of (elmo-plugged-p) should be t depending on the
+which the return value of @code{(elmo-plugged-p)} should be t depending on the
 plugged state of each port.
 
 @example
@@ -4159,7 +4552,7 @@ plugged state of each port.
 'all         : plugged if all ports are plugged.
 'independent : reflects wl-plugged (elmo-plugged) regardless of plugged
                states of the ports.
-function     : reflects the return value of the function
+@var{function}     : reflects the return value of the @var{function}
  functions available per default
  'elmo-plug-on-by-servers
              : reflects the plugged state of the servers specified by the
@@ -4174,6 +4567,7 @@ function     : reflects the return value of the function
 @end example
 
 @example
+@group
 Example 1:
  (setq elmo-plugged-condition 'all)
 Example 2:
@@ -4182,6 +4576,7 @@ Example 2:
 Example 3:
  (setq elmo-plug-on-exclude-servers '("localhost" "myname"))
  (setq elmo-plugged-condition 'elmo-plug-on-by-exclude-servers)
+@end group
 @end example
 
 @item wl-reset-plugged-alist
@@ -4194,9 +4589,7 @@ In other words, they are initialized when Emacs is restarted even if the
 value is nil.
 @end table
 
-@c
-@c  Expire and Archive
-@c
+
 @node Expire and Archive, Scoring, Disconnected Operations, Top
 @chapter Automatic Expiration and Archiving of Messages
 @cindex Expire and Archive
@@ -4231,6 +4624,7 @@ I advise you to set @code{wl-expire-use-log} to t, especially in the
 initial stage.
 
 @lisp
+@group
 (setq wl-expire-alist
       '(("^\\+trash$"   (date 14) remove)
                                   ;; @r{delete}
@@ -4244,42 +4638,43 @@ initial stage.
                            ;; @r{archive by message number (retaining numbers)}
         ("^\\+ml/.*"    (number 300 310) wl-expire-archive-number2 t)
                            ;; @r{archive by a fixed number (retaining numbers)}
-        ("^\\+nikki$"   (date 30) wl-expire-archive-date)
+        ("^\\+diary$"   (date 30) wl-expire-archive-date)
                            ;; @r{archive by year and month (numbers discarded)}
         ))
+@end group
 @end lisp
 
 Items in the list has the format of:
 
 @example
-("regexp_for_folders"  (specification_of_messages_to_be_deleted) destination)
+(@var{regexp-for-folders} @var{specification-of-messages-to-be-deleted} @var{destination})
 @end example
 
 @noindent
-The folder is examined if it matches "regexp_for_folders" from the
+The folder is examined if it matches @var{regexp-for-folders} from the
 beginning of the list.  If you invoke expiration on the folder that does
 not match any of them, nothing will happen.
 And if either the second or the third element of the item is nil,
 expiration will not take place.
 
 You can use any one of the following for
-specification_of_message_to_be_deleted:
+@var{specification-of-message-to-be-deleted}:
 
 @table @code
-@item (number n1 [n2])
+@item (number @var{n1} [@var{n2}])
 deletes messages depending on the number of messages in the folder.
 
-n1 is the number of messages which should survive deletion, for example
+@var{n1} is the number of messages which should survive deletion, for example
 if its value is 500, the newest 500 messages survive and the rests are
 deleted.
 
-n2 is the number of messages in the folder on which expiration should
-take place, which defaults to n1 + 1.  For example if its value is 510,
+@var{n2} is the number of messages in the folder on which expiration should
+take place, which defaults to @var{n1} + 1.  For example if its value is 510,
 folders with 510 or more messages are expired.
 If you configured automatic expiration, frequently used folders may
 expire every time it receive messages, and you may be annoyed with the
 long delay in reading mail.
-In that case, you can set a wide margin between n2 and n1, so that
+In that case, you can set a wide margin between @var{n2} and @var{n1}, so that
 expiration would not take place until a certain number of messages
 accumulate.
 
@@ -4289,41 +4684,41 @@ If @code{wl-expire-number-with-reserve-marks} is non-nil, the folder
 will expire so as to have 500 messages including such ones.
 Otherwise, it will have 500 messages except such ones.
 
-@item (date d1)
+@item (date @var{d1})
 deletes messages depending on the dates.
 
-Messages dated d1 or more days ago are deleted, for example if its value
-is seven, messages seven days old or more are deleted.
-Note that the date is the one in the Date field of the message, not when 
+Messages dated @var{d1} or more days ago are deleted, for example if its
+value is seven, messages seven days old or more are deleted.  Note that
+the date is the one in the @samp{Date:} field of the message, not when
 the message entered the folder.
 
-Messages with no or invalid Date field does not expire; you might have
-to delete them by hand.
+Messages with no or invalid @samp{Date:} field does not expire; you
+might have to delete them by hand.
 @end table
 
-You can use any one of the following in the place of destination:
+You can use any one of the following in the place of @var{destination}:
 
-@table @code
-@item 'remove
+@table @asis
+@item @code{'remove}
 deletes the messages instantly.
 
-@item 'trash
+@item @code{'trash}
 moves the messages to @code{wl-trash-folder}.
 
-@item string(folder)
-moves the messages to the specified folder.
+@item @var{string}(folder)
+moves the messages to the folder specified with @var{string}.
 
 It would be useful for specifying an archiving folder, but because this
 does not move important messages, it might be better to use the
 standard functions described below.
 
-@item function
-invokes the specified function.
+@item @var{function}
+invokes the specified @var{function}.
 
-To the function, three arguments are passed: a folder name, a list of
+To the @var{function}, three arguments are passed: a folder name, a list of
 messages to be deleted, and msgdb information of the summary.
 You can specify function-specific arguments after the name of the
-function.
+@var{function}.
 Note that the list contains messages with marks in
 @code{wl-summary-expire-reserve-marks}, be careful in writing your own
 function.
@@ -4346,10 +4741,10 @@ the name of the folder as follows
 (in this case, archiving folders are handled as if
 @code{elmo-archive-treat-file} were non-nil).
 
-@table @code
+@table @asis
 @item If the folder type is localdir:
-
 @code{$ArchiveDir/foldername-xxxxx.zip}
+
 For example, @samp{+ml/wl} corresponds to @samp{$ml/wl;zip}
 (@file{~/Mail/ml/wl-00100.zip}).
 
@@ -4388,9 +4783,9 @@ You can set the first argument to these three standard functions to non-nil
 in @code{wl-expire-alist} so as to retain message numbers in the folder.
 For example, it can be specified just after the name of the function:
 
-@example
+@lisp
 ("^\\+ml/wl$" (number 300 310) wl-expire-archive-number1 t)
-@end example
+@end lisp
 
 If you omit the argument, consecutive numbers from 1 are assigned for
 each archiving folder.
@@ -4415,8 +4810,9 @@ mode.  There will be no confirmation, so make sure you made no mistake
 in regexp and other settings before you set up this.
 
 @lisp
-(add-hook 'wl-summary-prepared-pre-hook
-          'wl-summary-expire)
+@group
+(add-hook 'wl-summary-prepared-pre-hook 'wl-summary-expire)
+@end group
 @end lisp
 
 In the folder mode, you can invoke expiration per group as well as per
@@ -4449,8 +4845,10 @@ If you set @code{wl-expire-use-log} to t, @file{~/.elmo/expired-log}
 should contain the log, for example:
 
 @example
+@group
 delete  +ml/wl  (593 594 595 596 597 598 599)
 move    +ml/wl -> $ml/wl-00600;tgz;wl  (600 601 602)
+@end group
 @end example
 
 The first column indicates the operation, i.e. delete, copy, or move.
@@ -4468,11 +4866,11 @@ reserved messages and the like always remain, they are recorded in
 @file{~/.elmo/expired-alist} so that they are not copied over and over
 again.  They are not recorded if copied by @code{wl-summary-archive}.
 
-If you enabled logging, usually "move" is recorded for re-filing, but
-instead "copy" and "delete" are recorded separately if reserved messages
-are involved.
-This is because it actually copies messages including reserved, then
-deletes ones except reserved in that case.
+If you enabled logging, usually @samp{move} is recorded for re-filing,
+but instead @samp{copy} and @samp{delete} are recorded separately if
+reserved messages are involved.  This is because it actually copies
+messages including reserved, then deletes ones except reserved in that
+case.
 
 @section Customizable Variables
 
@@ -4488,11 +4886,13 @@ refer to @code{wl-expire-alist} settings above.
 The initial setting is the list below.
 
 @lisp
+@group
 (list wl-summary-important-mark
       wl-summary-new-mark
       wl-summary-unread-mark
       wl-summary-unread-uncached-mark
       wl-summary-unread-cached-mark)
+@end group
 @end lisp
 
 Messages with these marks are retained in the folder, even after
@@ -4530,7 +4930,7 @@ with @code{wl-summary-expire-reserve-marks} are also retained.
 The initial setting is 'wl-expire-archive-get-folder.
 
 This variable specifies a function that returns the name of an archiving 
-folder for standard functions in the place of destination.
+folder for standard functions in the place of @var{destination}.
 You can use the following three variables for simple modification of
 folder names; if you want more complex settings, define your own
 function in this variable.
@@ -4538,30 +4938,29 @@ function in this variable.
 @code{wl-expire-archive-get-folder} can be customized by these
 variables:
 @itemize @bullet
-@item wl-expire-archive-folder-name-fmt
-@item wl-expire-archive-folder-type
-@item wl-expire-archive-folder-prefix
+@item @code{wl-expire-archive-folder-name-fmt}
+@item @code{wl-expire-archive-folder-type}
+@item @code{wl-expire-archive-folder-prefix}
 @end itemize
 
 @item wl-expire-archive-folder-name-fmt
 @vindex wl-expire-archive-folder-name-fmt
-The initial setting is "%s-%%05d;%s".
-This is a format string for archiving folders used in
+The initial setting is @samp{%s-%%05d;%s}.
+This is a @code{format} string for archiving folders used in
 @code{wl-expire-archive-number1} and @code{wl-expire-archive-number2}.
 Note that you must specify the message number by @samp{%%d}, because it
 is parsed twice by @code{format}.
 
-If you modify this, adjust @code{wl-expire-archive-folder-num-regexp} as 
+If you modify this, adjust @code{wl-expire-archive-folder-num-regexp} as
 well.
 
 @item wl-expire-archive-date-folder-name-fmt
 @vindex wl-expire-archive-date-folder-name-fmt
-The initial setting is "%s-%%04d%%02d;%s".
-This is a format string for archiving folders used in
-@code{wl-expire-archive-date}.
-Note that you must specify the message number by @samp{%%d}, because it
-is parsed twice by @code{format}.
-There should be @code{%%d} twice, one for the year and the other for the
+The initial setting is @samp{%s-%%04d%%02d;%s}.
+This is a @code{format} string for archiving folders used in
+@code{wl-expire-archive-date}.  Note that you must specify the message
+number by @samp{%%d}, because it is parsed twice by @code{format}.
+There should be @samp{%%d} twice, one for the year and the other for the
 month.
 
 If you modify this, adjust
@@ -4598,7 +4997,7 @@ resulting in
 
 @item wl-expire-archive-folder-num-regexp
 @vindex wl-expire-archive-folder-num-regexp
-The initial setting is "-\\([-0-9]+\\);".
+The initial setting is @samp{-\\([-0-9]+\\);}.
 This variable specifies the regular expression to be used for getting
 message numbers from multiple archiving folders specified by
 @code{elmo-list-folders}.
@@ -4606,7 +5005,7 @@ Set it in accordance with @code{wl-expire-archive-folder-name-fmt}.
 
 @item wl-expire-archive-date-folder-num-regexp
 @vindex wl-expire-archive-date-folder-num-regexp
-The initial setting is "-\\([-0-9]+\\);".
+The initial setting is @samp{-\\([-0-9]+\\);}.
 This is the regular expression to be used for getting message numbers
 from multiple archiving folders specified by @code{elmo-list-folders}.
 Set it in accordance with @code{wl-expire-archive-date-folder-name-fmt}.
@@ -4664,26 +5063,28 @@ archived according to their folder names, as in @code{wl-expire-alist}.
 For example:
 
 @lisp
+@group
 (setq wl-archive-alist
       '(("^\\+tmp$"     wl-archive-date)
         ("^\\+outbox$"  wl-archive-number2)
         (".*"           wl-archive-number1)
         ))
+@end group
 @end lisp
 
 Each item in the list has the following format:
 
 @example
-("folders_regexp"  deleting_function)
+(@var{folders-regexp}  @var{deleting-function})
 @end example
 
-As you can see, you can only use a function after @samp{folders_regexp}.
+As you can see, you can only use a function after @var{folders-regexp}.
 Per default, there are three functions:
 
 @itemize @bullet
-@item wl-archive-number1
-@item wl-archive-number2
-@item wl-archive-date
+@item @code{wl-archive-number1}
+@item @code{wl-archive-number2}
+@item @code{wl-archive-date}
 @end itemize
 
 As inferred from their names, they work similarly to "expire" versions,
@@ -4715,12 +5116,12 @@ The archiving folders are determined by the same logic as in
 relevant:
 
 @itemize @bullet
-@item wl-expire-archive-files
-@item wl-expire-archive-get-folder-func
-@item wl-expire-archive-folder-name-fmt
-@item wl-expire-archive-folder-type
-@item wl-expire-archive-folder-prefix
-@item wl-expire-archive-folder-num-regexp
+@item @code{wl-expire-archive-files}
+@item @code{wl-expire-archive-get-folder-func}
+@item @code{wl-expire-archive-folder-name-fmt}
+@item @code{wl-expire-archive-folder-type}
+@item @code{wl-expire-archive-folder-prefix}
+@item @code{wl-expire-archive-folder-num-regexp}
 @end itemize
 
 @subsection Customizable Variables
@@ -4737,9 +5138,6 @@ Needless to say, you can use your own function.
 @end table
 
 
-@c
-@c  Scoring
-@c
 @node Scoring, Customization, Expire and Archive, Top
 @chapter Score of the Messages
 @cindex Scoring
@@ -4748,12 +5146,13 @@ Needless to say, you can use your own function.
 Scoring is the function that associates a score (value) with each
 message, and marks as read or deletes from the summary according to it.
 
-You can put temp or important marks on essential messages, or read marks
+You can put target or important marks on essential messages, or read marks
 on the ones you do not want to read, for example spam articles.
 
 This scoring function has a capability and a format similar to the one
 that Gnus has, although there are some unsupported features and
 Wanderlust specifics.
+@xref{Scoring, , ,gnus, The gnus Newsreader}.
 
 @menu
 * Score Commands::             Score Commands
@@ -4771,12 +5170,14 @@ Wanderlust specifics.
 scores are defined, corresponding to folder names.
 
 @lisp
+@group
 (setq wl-score-folder-alist
       '(("^-.*"
          "news.SCORE"
          "my.SCORE")
         (".*"
          "all.SCORE")))
+@end group
 @end lisp
 
 If paths to the score files are omitted, the directory specified in the
@@ -4802,8 +5203,8 @@ In the summary buffer, move to an appropriate message and type @kbd{L}.
 Then type @kbd{s}, @kbd{s}, and @kbd{p} at a prompt in a mini-buffer.
 The string in Subject is presented.  Edit it and press @kbd{@key{RET}}.
 
-This makes -1000 are scored for messages with the same Subject as the
-string you entered.  That is, such a score file is created
+This makes @minus{}1000 are scored for messages with the same Subject as
+the string you entered.  That is, such a score file is created
 automatically.
 
 Then, try typing @kbd{h} and @kbd{e} in the same summary buffer.
@@ -4845,9 +5246,9 @@ If you add the same entries by @code{wl-summary-increase-score},
 @code{wl-summary-lower-score}, and @code{wl-score-edit-insert-entry},
 scores for the entry is summed up.
 
-For example, if you create @samp{from} entry with the score of -1000 by
-@kbd{L a} and again @samp{from} with -200, one entry with the score of
--1200 will be created as a result.
+For example, if you create @samp{from} entry with the score of @minus{}1000 by
+@kbd{L a} and again @samp{from} with @minus{}200, one entry with the score of
+@minus{}1200 will be created as a result.
 
 @subsubsection Creating Thread Key
 
@@ -4977,12 +5378,12 @@ Messages with scores larger than this value are attached with the
 important mark (@samp{$}).
 If nil, no important marks are attached.
 
-@item wl-summary-temp-above
-@vindex wl-summary-temp-above
+@item wl-summary-target-above
+@vindex wl-summary-target-above
 The initial setting is nil.
-Messages with scores larger than this value are attached with the temp
+Messages with scores larger than this value are attached with the target
 mark (@samp{*}).
-If nil, no temp marks are attached.
+If nil, no target marks are attached.
 
 @item wl-summary-mark-below
 @vindex wl-summary-mark-below
@@ -5008,7 +5409,7 @@ If non-nil, scoring is enabled.
 
 @item wl-score-files-dir
 @vindex wl-score-files-dir
-The initial setting is "~/.elmo/".
+The initial setting is @file{~/.elmo/}.
 The default directory for score files.
 
 @item wl-score-interactive-default-score
@@ -5068,8 +5469,10 @@ The initial setting is t.
 The format of score files are the same as Gnus, and basically you can
 use Gnus score files as they are.  But they are not fully compatible
 because some keys are not supported and there are Wanderlust specifics.
+@xref{Score File Format, , ,gnus, The gnus Newsreader}.
 
-@example
+@lisp
+@group
 (("subject"
   ("for sale" -1000 nil s)
   ("profit" -1000 nil s))
@@ -5080,10 +5483,11 @@ because some keys are not supported and there are Wanderlust specifics.
  ("chars"
   (1000000 -10 nil >))
  (important 5000)
- (temp 3000)
+ (target 3000)
  (mark 0)
  (expunge -3000))
-@end example
+@end group
+@end lisp
 
 @table @code
 @item string
@@ -5179,10 +5583,10 @@ Both @code{mark} and @code{expunge} are applied,
 i.e. messages with a score less than this value is marked as read and
 deleted from the summary.
 
-@item temp
+@item target
 Messages with a score greater than this value is attached with temp
 marks.
-The default is @code{wl-summary-temp-above}.
+The default is @code{wl-summary-target-above}.
 
 @item important
 Messages with a score greater than this value is attached with important
@@ -5210,6 +5614,7 @@ the last one only.
 Keys that can be seen by folder of types:
 
 @example
+@group
                         chars lines xref  extra
 localdir,localnews        Y     E     E     E
 nntp (supporting xover)   Y     E     E     N
@@ -5220,12 +5625,10 @@ pop3                      N     E     E     E
                 Y: can be seen
                 N: cannot be seen (ignored)
                 E: can be seen with @code{elmo-msgdb-extra-fields} settings
+@end group
 @end example
 
 
-@c
-@c  Customization
-@c
 @node Customization, Mailing List, Scoring, Top
 @chapter Customizing Wanderlust
 @cindex Customization
@@ -5233,8 +5636,10 @@ pop3                      N     E     E     E
 @menu
 * Living with other packages:: Living with other packages
 * Highlights::                 Highlights
+* Biff::                       Notify Mail arrival
 * Advanced Settings::          Advanced Settings
 * Customizable Variables::     Customizable Variables
+* Hooks::                      Hooks
 @end menu
 
 
@@ -5244,6 +5649,7 @@ pop3                      N     E     E     E
 Examples with other packages.
 
 @menu
+* imput::                       imput (im-wl.el)
 * BBDB::                        BBDB
 * supercite::                   supercite.el
 * mu-cite::                     mu-cite.el
@@ -5252,18 +5658,39 @@ Examples with other packages.
 @end menu
 
 
-@node BBDB, supercite, Living with other packages, Living with other packages
+@node imput, BBDB, Living with other packages, Living with other packages
+@subsection imput
+@pindex imput
+@cindex im-wl
+
+Place @file{util/im-wl.el} on the @code{load-path} and do the following
+settings.
+
+If imput is on the @code{exec-path} at the installation, @file{im-wl.el}
+is byte-compiled and installed.
+@xref{Install}.
+
+@lisp
+@group
+(autoload 'wl-draft-send-with-imput-async "im-wl")
+(setq wl-draft-send-func 'wl-draft-send-with-imput-async)
+@end group
+@end lisp
+
+
+@node BBDB, supercite, imput, Living with other packages
 @subsection bbdb.el
 @pindex BBDB
 
-Place @file{util/bbdb-wl.el} on the load-path and do the following
+Place @file{util/bbdb-wl.el} on the @code{load-path} and do the following
 settings.
 
-If BBDB is on the load-path at the installation, @file{bbdb-wl.el} is
+If BBDB is on the @code{load-path} at the installation, @file{bbdb-wl.el} is
 byte-compiled and installed.
 @xref{Install}.
 
 @lisp
+@group
 (require 'bbdb-wl)
 
 (bbdb-wl-setup)
@@ -5278,6 +5705,7 @@ byte-compiled and installed.
 ;; @r{automatically add mailing list fields}
 (add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook)
 (setq bbdb-auto-notes-alist '(("X-ML-Name" (".*$" ML 0))))
+@end group
 @end lisp
 
 @node supercite, mu-cite, BBDB, Living with other packages
@@ -5286,9 +5714,10 @@ byte-compiled and installed.
 @pindex supercite
 
 The same setting as usual mailers should be OK.  The following is an
-example of settings.
+example of settings:
 
 @lisp
+@group
 (autoload 'sc-cite-original "sc" nil t)
 (setq mail-yank-hooks 'sc-cite-original)
 (setq sc-preferred-header-style 1)
@@ -5296,6 +5725,7 @@ example of settings.
 (setq sc-citation-leader "")
 (setq sc-load-hook '(lambda () (require 'sc-register)))
 (setq sc-preferred-attribution 'registeredname)
+@end group
 @end lisp
 
 
@@ -5309,15 +5739,19 @@ example of settings.
 If you use mu-cite version 8.0 or earlier:
 
 @lisp
+@group
 (autoload 'mu-cite/cite-original "mu-cite" nil t)
 (setq mail-citation-hook 'mu-cite/cite-original)
+@end group
 @end lisp
 
 If you use mu-cite version 8.1 or later:
 
 @lisp
+@group
 (autoload 'mu-cite-original "mu-cite" nil t)
 (add-hook 'mail-citation-hook (function mu-cite-original))
+@end group
 @end lisp
 
 @node x-face-mule, dired-dd, mu-cite, Living with other packages
@@ -5329,32 +5763,40 @@ It depends on the version of x-face-mule.
 If you use x-face-mule 0.19 or older, do the following:
 
 @lisp
+@group
 (setq wl-highlight-x-face-func
       (function
        (lambda (beg end)
         (x-face-mule:x-face-decode-message-header))))
+@end group
+@end lisp
 
-If you use x-face-mule 0.20 or later, try the following.
+If you use x-face-mule 0.20 or later, try the following:
 
+@lisp
+@group
 (setq wl-highlight-x-face-func
       (function
        (lambda (beg end)
         (x-face-mule-x-face-decode-message-header))))
 (require 'x-face-mule)
+@end group
 @end lisp
 
 Use these settings when you use @file{x-face-mule.el} attached to
-bitmap-mule 8.0 or later.
+bitmap-mule 8.0 or later:
 
 @lisp
+@group
 (autoload 'x-face-decode-message-header "x-face-mule")
-(setq wl-highlight-x-face-func
-      (function x-face-decode-message-header))
+(setq wl-highlight-x-face-func 'x-face-decode-message-header)
+@end group
 @end lisp
 
-If there is an encoded X-Face string in a file @file{~/.xface} (the value
-of the variable @code{wl-x-face-file}), it is inserted as a X-Face field
-in the draft buffer (if @code{wl-auto-insert-x-face} is non-nil).
+If there is an encoded X-Face string in a file @file{~/.xface} (the
+value of the variable @code{wl-x-face-file}), it is inserted as a
+@samp{X-Face:} field in the draft buffer (if
+@code{wl-auto-insert-x-face} is non-nil).
 
 
 @node dired-dd,  , x-face-mule, Living with other packages
@@ -5364,11 +5806,12 @@ in the draft buffer (if @code{wl-auto-insert-x-face} is non-nil).
 @cindex Drag and Drop
 
 If you embed @file{dired-dd-mime.el} in the dired-dd package, you can
-compose multi-part by simple Drag&Drop from dired to the draft buffer
-being edited in GNU Emacs (this feature is not Wanderlust specific, but
-general-purpose for tm/SEMI).
+compose multi-part by simple Drag-and-Drop from dired to the draft
+buffer being edited in GNU Emacs (this feature is not Wanderlust
+specific, but general-purpose for tm/SEMI).
 
 @lisp
+@group
 ;; @r{dired-dd:} http://www.asahi-net.or.jp/~pi9s-nnb/dired-dd-home.html
 (add-hook
  'dired-load-hook
@@ -5380,10 +5823,11 @@ general-purpose for tm/SEMI).
     (if window-system
         (progn (require 'dired-dd)
                (require 'dired-dd-mime))))))
+@end group
 @end lisp
 
 
-@node Highlights, Advanced Settings, Living with other packages, Customization
+@node Highlights, Biff, Living with other packages, Customization
 @section Highlights
 
 @subsection Customizable Variables
@@ -5481,9 +5925,10 @@ mode, summary mode, and the like.
 @subsection Setting Colors and Fonts of the Characters
 
 If you want to change colors or fonts of the characters, you need to
-modify faces defined in Wanderlust.  Use set-face-font if you want to
-change fonts, and set-face-foreground for colors, and so on.
-You cannot write face settings in @file{.emacs}; write in @file{~/.wl}.
+modify faces defined in Wanderlust.  Use @code{set-face-font} if you
+want to change fonts, and @code{set-face-foreground} for colors, and so
+on.  You cannot write face settings in @file{.emacs}; write in
+@file{~/.wl}.
 
 For example, if you want to change the color for signatures to yellow,
 write
@@ -5506,20 +5951,20 @@ The face for field bodies of message headers.
 
 @item wl-highlight-message-important-header-contents
 The face for important parts of message headers.
-Per default, this face is used for a body of Subject field.
+Per default, this face is used for a body of @samp{Subject:} field.
 You can change its value by editing
 @code{wl-highlight-message-header-alist}.
 
 @item wl-highlight-message-important-header-contents2
 The face for secondly important parts of message headers.
-Per default, this face is used for bodies of From and To fields.
-You can change its value by editing
+Per default, this face is used for bodies of @samp{From:} and @samp{To:}
+fields.  You can change its value by editing
 @code{wl-highlight-message-header-alist}.
 
 @item wl-highlight-message-unimportant-header-contents
 The face for unimportant parts of message headers.
-Per default, this face is used for bodies of X- fields User-Agent fields.
-You can change its value by editing
+Per default, this face is used for bodies of @samp{X-} fields
+@samp{User-Agent:} fields.  You can change its value by editing
 @code{wl-highlight-message-header-alist}.
 
 @item wl-highlight-message-citation-header
@@ -5527,7 +5972,7 @@ The face for headers of quoted messages.
 
 @item wl-highlight-message-cited-text-*
 The face for texts of quoted messages.
-The last "*" is a single figure so that 10 different colors can be used
+The last @samp{*} is a single figure so that 10 different colors can be used
 according to citation levels.
 
 @item wl-highlight-message-signature
@@ -5568,7 +6013,7 @@ marks in the summary.
 The face for message lines with copy marks in the summary.
 
 @item wl-highlight-summary-target-face
-The face for message lines with temp marks @samp{*} in the summary.
+The face for message lines with target marks @samp{*} in the summary.
 
 @item wl-highlight-summary-thread-top-face
 The face for message lines that are on the top of the thread in the
@@ -5603,11 +6048,13 @@ folder mode.
 
 @item wl-highlight-folder-opened-face
 The face for open groups in the folder mode.
-It is meaningful when @code{wl-highlight-group-folder-by-numbers} is nil.
+It is meaningful when @code{wl-highlight-group-folder-by-numbers} is nil
+or a number.
 
 @item wl-highlight-folder-closed-face
 The face for close groups in the folder mode.
-It is meaningful when @code{wl-highlight-group-folder-by-numbers} is nil.
+It is meaningful when @code{wl-highlight-group-folder-by-numbers} is nil
+or a number.
 
 @item wl-highlight-folder-path-face
 The face for the path to the currently selected folder in the folder
@@ -5620,13 +6067,39 @@ The face for logo in the demo.
 The face for strings (for example, a version number) in the demo.
 @end table
 
-@node Advanced Settings, Customizable Variables, Highlights, Customization
+
+@node Biff, Advanced Settings, Highlights, Customization
+@section Notify Mail arrival
+
+Following setting is to notify mail arrival of @samp{%inbox}
+by the indicator on the modeline
+
+@lisp
+(setq wl-biff-check-folder-list '("%inbox"))
+@end lisp
+
+@subsection Customizable Variables
+@table @code
+@item wl-biff-check-folder-list
+@vindex wl-biff-check-folder-list
+The initial setting is nil.
+This is the list of folders to check mail arrival.
+If nil, wl doesn't check mail arrival.
+
+@item wl-biff-check-interval
+@vindex wl-biff-check-interval
+The initial setting is 40 (in seconds).
+Check mail arrival in this period. 
+@end table
+
+
+@node Advanced Settings, Customizable Variables, Biff, Customization
 @section Advanced Settings
 
 @menu
 * Draft for Reply::             Draft for Reply
 * Thread Format::               Appearance of Thread
-* User-Agent Header::           User-Agent Header
+* User-Agent Field::            @samp{User-Agent:} Header Field
 @end menu
 
 
@@ -5639,22 +6112,28 @@ the reply draft by simply pressing @kbd{a} in the summary mode, try the
 following settings:
 
 @lisp
+@group
 (setq wl-draft-reply-without-argument-list
       '(("Mail-Followup-To" . (("Mail-Followup-To") nil ("Newsgroups")))
         ("Followup-To" . (nil nil ("Followup-To")))
         (("X-ML-Name" "Reply-To") . (("Reply-To") nil nil))
         ("From" . (("From") ("To" "Cc") ("Newsgroups")))))
+@end group
 @end lisp
 
 @noindent
-(Only if there are both of "X-ML-Name" and "Reply-To" fields in the
-original message, Reply-To: field in the original is copied to To:
+(Only if there are both of @samp{X-ML-Name} and @samp{Reply-To} fields in the
+original message, @samp{Reply-To} field in the original is copied to @samp{To:}
 field.)
 
-@node Thread Format, User-Agent Header, Draft for Reply, Advanced Settings
+Moreover, the behavior of @kbd{a} with prefix argument can 
+be directed by @code{wl-draft-reply-with-argument-list} as well.
+
+@node Thread Format, User-Agent Field, Draft for Reply, Advanced Settings
 @subsection Appearance of Threads
 
 @example
+@group
   389  09/18(Fri)01:07 [ Teranishi         ] wl-0.6.3
   390  09/18(Fri)07:25 +-[ Tsumura-san       ]
   391  09/18(Fri)19:24 +-[ Murata-san        ]
@@ -5668,49 +6147,69 @@ field.)
   416  09/22(Tue)12:38 |           +-[ Teranishi         ]
   395  09/20(Sun)21:49 +-[ Okunishi-san      ]
   397  09/21(Mon)00:15 +-[ Okunishi-san      ]
+@end group
 @end example
 
 Settings to make appearance of threads like shown above:
 
 @lisp
+@group
 (setq wl-thread-indent-level 2)
 (setq wl-thread-have-younger-brother-str "+")
 (setq wl-thread-youngest-child-str       "+")
 (setq wl-thread-vertical-str             "|")
 (setq wl-thread-horizontal-str           "-")
 (setq wl-thread-space-str                " ")
+@end group
 @end lisp
 
 If you do not want to see branches, do the following:
 
 @lisp
+@group
 (setq wl-thread-indent-level 2)
 (setq wl-thread-have-younger-brother-str " ")
 (setq wl-thread-youngest-child-str       " ")
 (setq wl-thread-vertical-str             " ")
 (setq wl-thread-horizontal-str           " ")
 (setq wl-thread-space-str                " ")
+@end group
 @end lisp
 
 
-@node User-Agent Header,  , Thread Format, Advanced Settings
-@subsection User-Agent
+@node User-Agent Field,  , Thread Format, Advanced Settings
+@subsection User-Agent Field
+
+If you are eccentric enough to elaborate @samp{X-Mailer:} or
+@samp{User-Agent:} fields, define a function that generate appropriate
+strings as you like, and set it to
+@code{wl-generate-mailer-string-func}.
 
-If you are eccentric enough to elaborate X-Mailer or User-Agent fields,
-define a function that inserts appropriate strings as you like, and set
-it to @code{wl-generate-mailer-string-func}.
+If you do not want verbose @samp{User-Agent:} field, do the following:
+
+@lisp
+@group
+(setq wl-generate-mailer-string-func
+      (function
+       (lambda ()
+         (let ((mime-edit-insert-user-agent-field nil))
+           (wl-generate-user-agent-string)))))
+@end group
+@end lisp
 
-The following is an example.
+The following is a example:
 
 @lisp
+@group
 (setq wl-generate-mailer-string-func
       (function
        (lambda ()
-         (concat "X-Mailer: "
-                 (format "%s/%s (%s)" wl-appname wl-version wl-codename)))))
+         (format "X-Mailer: %s" (product-string-1 'wl-version)))))
+@end group
 @end lisp
 
-@node Customizable Variables,  , Advanced Settings, Customization
+
+@node Customizable Variables, Hooks, Advanced Settings, Customization
 @section Customizable Variables
 
 Customizable variables that have not been described yet:
@@ -5718,17 +6217,17 @@ Customizable variables that have not been described yet:
 @table @code
 @item wl-default-folder
 @vindex wl-default-folder
-The initial setting is "%inbox".  This is the default value for moving to
+The initial setting is @samp{%inbox}.  This is the default value for moving to
 a folder and the like.
 
 @item wl-draft-folder
 @vindex wl-draft-folder
-The initial setting is "+draft".  It is the folder to which drafts are
+The initial setting is @samp{+draft}.  It is the folder to which drafts are
 saved.  It must be a localdir folder.
 
 @item wl-trash-folder
 @vindex wl-trash-folder
-The initial setting is "+trash".  It is the wastebasket folder.
+The initial setting is @samp{+trash}.  It is the wastebasket folder.
 If you changed this variable, you had better restart Wanderlust.
 
 @item wl-interactive-exit
@@ -5744,10 +6243,14 @@ If non-nil, you are asked for confirmation when mail is sent.
 @item wl-folder-sync-range-alist
 @vindex wl-folder-sync-range-alist
 The initial setting is the list shown below:
-@example
+
+@lisp
+@group
 (("^&.*$" . "all")
  ("^\\+draft$\\|^\\+queue$" . "all"))
-@end example
+@end group
+@end lisp
+
 This is an associative list of regular expressions of folder names and
 update range of the summary.
 Update range is one of the "all", "update", "rescan", "rescan-noscore", "first"
@@ -5763,19 +6266,14 @@ updating the summary when you changed folders.
 @vindex wl-mime-charset
 The initial setting is 'x-ctext.
 This is the MIME charset for messages that are not MIME (e.g. without
-Content-Type). This value also used as default charset for summary.
-(If you want to share Summary on Nemacs and other Emacsen,
-set this value as 'iso-2022-jp.)
-
-@item wl-search-mime-charset
-@vindex wl-search-mime-charset
-The initial setting is 'iso-2022-jp.
-This is used as a MIME charset for searching.
+@samp{Content-Type:}). This value also used as default charset for
+summary.  (If you want to share Summary on Nemacs and other Emacsen, set
+this value as 'iso-2022-jp.)
 
 @item wl-highlight-folder-with-icon
 @vindex wl-highlight-folder-with-icon
-This is meaningful for XEmacs only.  The initial setting depends on
-XEmacs (t for XEmacs with icons).
+This is meaningful for XEmacs or Emacs 21..  The initial setting depends
+on (X)Emacs (t for XEmacs or Emacs 21 with icons).
 
 @item wl-strict-diff-folders
 @vindex wl-strict-diff-folders
@@ -5839,11 +6337,12 @@ This takes precedence over @code{wl-no-save-folder-list}.
 The initial setting is the list shown below:
 
 @lisp
+@group
 '(("^-alt\\.chinese" . big5)
   ("^-relcom\\." . koi8-r)
   ("^-tw\\." . big5)
-  ("^-han\\." . euc-kr)
-  )
+  ("^-han\\." . euc-kr))
+@end group
 @end lisp
 
 This is an associative list of regular expressions of folder names and
@@ -5854,7 +6353,7 @@ If a folder do not match, @code{wl-mime-charset} is used.
 @vindex wl-folder-init-load-access-folders
 The initial setting is nil.
 This is a list of access groups to be loaded specifically at the start.
-If it is  nil, @code{wl-folder-init-no-load-access-folders} is referred.
+If it is nil, @code{wl-folder-init-no-load-access-folders} is referred.
 
 @item wl-folder-init-no-load-access-folders
 @vindex wl-folder-init-no-load-access-folders
@@ -5880,18 +6379,20 @@ string           : moves the messages to the specific folder.
 @vindex wl-refile-policy-alist
 The initial setting is '(("^[-=]" . copy) (".*" . move)).
 This list determines whether messages with re-file marks are moved or
-copied.
-Each item in the list is a cons cell of a folder and copy or move.
+copied.  Each item in the list is a cons cell of a folder and
+@code{copy} or @code{move}.
 
 @item wl-x-face-file
 @vindex wl-x-face-file
-The initial setting is "~/.xface".
+The initial setting is @file{~/.xface}.
 The name of the file that contains encoded X-Face strings.
 @xref{x-face-mule}.
 
 @item wl-demo-display-logo
 @vindex wl-demo-display-logo
-If non-nil, bitmap image is shown on the opening demo.
+If non-nil, bitmap image is shown on the opening demo.  If you set
+@code{xpm} or @code{xbm}, (if possible) display selected image type
+logo.
 
 @item elmo-use-database
 @vindex  elmo-use-database
@@ -5900,8 +6401,8 @@ XEmacs (t for XEmacs with dbm).
 If non-nil, Message-ID is controlled by dbm.
 
 @item elmo-passwd-alist-file-name
-@vindex  elmo-passwd-alist-file-name
-The initial setting is "passwd".
+@vindex elmo-passwd-alist-file-name
+The initial setting is @file{passwd}.
 This is the name of the file in which passwords are saved.
 @code{elmo-passwd-alist-save} saves current passwords to the file.
 
@@ -5924,9 +6425,8 @@ and if the number of read messages is not correct.
 @vindex elmo-nntp-default-use-listgroup
 The initial setting is t.
 If non-nil, @samp{listgroup} is used for checking the total number of
-articles.
-If it is nil, @samp{group} is used.  In the latter case, the processing
-will be a little faster at the sacrifice of accuracy.
+articles.  If it is nil, @samp{group} is used.  In the latter case, the
+processing will be a little faster at the sacrifice of accuracy.
 
 @item elmo-pop3-send-command-synchronously
 @vindex elmo-pop3-send-command-synchronously
@@ -5941,14 +6441,25 @@ looking up POP3.
 The initial setting is t.
 If non-nil, you are asked for confirmation if accumulated off-line
 operations are executed.
+
+@item elmo-display-progress-threshold
+@vindex elmo-display-progress-threshold
+The initial setting is 20.
+Threshold for display of progress gauge.  If number of renewal is more than
+this value, display progress gauge.
 @end table
 
 
-@c
-@c  Mailing List
-@c
+@node Hooks,  , Customizable Variables, Customization
+@section Hooks
+
+(Not yet written)
+
+
 @node Mailing List, Addition, Customization, Top
 @chapter Wanderlust Mailing List
+@cindex Bug report
+@cindex Backtrace
 
 @display
 Wanderlust Mailing List @t{<wl@@lists.airs.net>}
@@ -5966,13 +6477,13 @@ A guide can be obtained automatically by sending mail to
 Please send bug reports or patches to the mailing list.
 You can post to the mailing list even though you are not a member of it.
 
+If you send a bug report, please attach Backtrace with it.
+@footnote{@uref{http://www.jpl.org/elips/BUGS-ja.html} describes how to in Japanese.}
+
 I would like to express my thanks to the members of the mailing list for 
 valuable advice and many pieces of code they contributed.
 
 
-@c
-@c  Addition
-@c
 @node Addition, Index, Mailing List, Top
 @chapter Additional Information
 
@@ -6002,7 +6513,16 @@ valuable advice and many pieces of code they contributed.
 1999  2/03    auto-refile by Tsumura-san.
       4/28    wl-template by Murata-san.
       5/18    Released 1.0.0 stable.
-      7/5     Scoring by Murata-san (2.1.0).
+      7/05    Scoring by Murata-san (2.1.0).
+      9/26    New plugged system by Murata-san (2.2.2).
+     12/20    Support Modified UTF7.
+2000  3/24    Released 1.1.0 stable.
+      4/03    CVS development started.
+      5/07    Thread restoration & Its speed up with Murata-san.
+      6/12    Address completion with LDAP with Chiba-san & Goto-san.
+      7/11    killed message feature.
+      7/18    Use UIDL in POP3.
+      9/12    biff feature with Satata-san & Yamaoka-san.
 @end example
 
 See @file{ChangeLog} for details.
@@ -6018,15 +6538,13 @@ wanderlust
 @end display
 
 @noindent
-but I had no profound intention.
-(if farfetched, IMAP @t{=>} you can read mail anywhere @t{=>} desire to
-wander ?)
+but I had no profound intention.  (if farfetched, IMAP @result{} you can
+read mail anywhere @result{} desire to wander ?)
 
 Elmo is the abbreviation of @samp{Elisp Library for Message
-Orchestration}.
-At first I meant the red puppet in the Sesame Street, but you may
-associate it with
-Wandering @t{=>} Drifting @t{=>} Guidepost @t{=>} St.@: Elmo's fire @t{=>} elmo.
+Orchestration}.  At first I meant the red puppet in the Sesame Street,
+but you may associate it with Wandering @result{} Drifting @result{}
+Guidepost @result{} St.@: Elmo's fire @result{} elmo.
 
 @section Code Names
 
@@ -6034,7 +6552,7 @@ Each versions has code names (they are almost jokes).
 Currently they are picked up alphabetically from the top 40 hits of
 U.S. Billboard magazines in 1980s.
 
-(@samp{http://www.summer.com.br/~pfilho/html/top40/index.html})
+(@uref{http://www.summer.com.br/~pfilho/html/top40/index.html})
 
 
 @node Index,  , Addition, Top
@@ -6066,3 +6584,7 @@ U.S. Billboard magazines in 1980s.
 @summarycontents
 @contents
 @bye
+
+@c Local Variables: 
+@c fill-column: 72
+@c End:
index 74eb903..ee902cc 100644 (file)
@@ -1,3 +1,482 @@
+2000-10-17  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-version.el (elmo-version): Up to 2.3.90.
+
+       * elmo-imap4.el (elmo-imap4-list-folder-unread): Check plugged status.
+       (elmo-imap4-list-folder-important): Ditto.
+
+2000-10-16  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-nntp.el (elmo-network-initialize-session): Fix.
+
+2000-10-16  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-nntp.el (elmo-nntp-read-msg): Don't error.
+
+2000-10-15  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-nntp.el (elmo-network-initialize-session):
+       Add starttls negotiation.
+
+2000-10-15  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * elmo-nntp.el (elmo-network-initialize-session): Read greeting
+       response.
+       (elmo-network-setup-session): Define.
+       Call `elmo-nntp-send-mode-reader' when session opened.
+
+2000-10-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-multi.el (elmo-multi-list-folder-unread): Fixed.
+
+2000-10-13  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-imap4.el (elmo-imap4-search-internal-primitive): Remove
+       an invalid SPACE character ahead of `SEARCH' command.  Move
+       a valid SPACE character following `SEARCH' from conditional
+       `format' arguments to control-strings.
+
+2000-10-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo2.el (elmo-call-func-on-markable-msgs): Return t if marking
+       was succeeded.
+
+       * elmo-util.el (elmo-folder-get-spec): Enclose with save-match-data.
+
+2000-10-12  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-localdir.el (elmo-localdir-list-folders-subr): Bind
+       `w32-get-true-file-link-count' as t.
+
+       * elmo-imap4.el (elmo-imap4-read): Abolished.
+       (Renamed to `elmo-read' and moved to elmo-util.el)
+       All other related portions are changed.
+
+       * elmo-util.el (elmo-read): New function.
+       (elmo-condition-parse-search-value): Use it.
+
+2000-10-11  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo2.el (elmo-quit): Don't use `elmo-nntp-flush-connection'.
+
+       * elmo-nntp.el (elmo-nntp-session): Define.
+       (elmo-nntp-setting): Abolished.
+       All other related portions are changed.
+       (elmo-nntp-get-server-command): Changed argument.
+       (elmo-nntp-set-server-command): Ditto.
+       (elmo-nntp-xover-p): Ditto.
+       (elmo-nntp-set-xover): Ditto.
+       (elmo-nntp-listgroup-p): Ditto.
+       (elmo-nntp-set-listgroup): Ditto.
+       (elmo-nntp-list-active-p): Ditto.
+       (elmo-nntp-set-list-active): Ditto.
+       (elmo-nntp-xhdr-p): Ditto.
+       (elmo-nntp-set-xhdr): Ditto.
+       (elmo-nntp-flush-connection): Abolished.
+       (elmo-nntp-get-connection): Abolished.
+       (elmo-nntp-get-session): New function.
+       (elmo-network-initialize-session): Defined.
+       (elmo-network-authenticate-session): Ditto.
+       (elmo-nntp-send-mode-reader): Changed argument.
+       (elmo-nntp-send-command): Changed argument.
+       All other related portions are changed.
+       (elmo-nntp-read-response): Ditto.
+       (elmo-nntp-read-raw-response): Ditto.
+       (elmo-nntp-read-contents): Ditto.
+       (elmo-nntp-read-body): Ditto.
+       (elmo-nntp-goto-folder): Abolished.
+       (elmo-nntp-select-group): New function.
+       All other related portions are changed.
+       (This function substitutes `elmo-nntp-goto-folder')
+       (elmo-nntp-msgdb-create-by-header): Rewrite.
+       (elmo-nntp-get-overview): Eliminated.
+       (elmo-nntp-get-message): Ditto.
+       (elmo-nntp-open-connection) Abolished.
+       (elmo-nntp-read-msg): Rewrite.
+       (elmo-nntp-post): Ditto.
+       (elmo-nntp-send-data): Abolished.
+       (elmo-nntp-send-buffer): New function.
+       (elmo-nntp-send-data-line): Define as inline function.
+       (elmo-nntp-get-folders-info-prepare): Use session as key.
+       (elmo-nntp-groups-read-response): Changed argument.
+       (elmo-nntp-retrieve-headers): Ditto.
+       (elmo-nntp-msgdb-create-message): Ditto.
+
+       * elmo-msgdb.el (elmo-msgdb-search-internal-primitive): Fixed problem
+       when searching by 'since' or 'before'.
+
+2000-10-11  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * elmo-version.el (toplevel): Use product-version-as-string for set
+       verstion-string, if defined.
+
+2000-10-11  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-util.el: Doc fixes.
+
+2000-10-10  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * elmo-archive.el (toplevel): Use product-provide.
+       * elmo-cache.el (toplevel): Ditto.
+       * elmo-database.el (toplevel): Ditto.
+       * elmo-date.el (toplevel): Ditto.
+       * elmo-dop.el (toplevel): Ditto.
+       * elmo-filter.el (toplevel): Ditto.
+       * elmo-imap4.el (toplevel): Ditto.
+       * elmo-internal.el (toplevel): Ditto.
+       * elmo-localdir.el (toplevel): Ditto.
+       * elmo-localnews.el (toplevel): Ditto.
+       * elmo-maildir.el (toplevel): Ditto.
+       * elmo-msgdb.el (toplevel): Ditto.
+       * elmo-multi.el (toplevel): Ditto.
+       * elmo-net.el (toplevel): Ditto.
+       * elmo-nntp.el (toplevel): Ditto.
+       * elmo-pipe.el (toplevel): Ditto.
+       * elmo-pop3.el (toplevel): Ditto.
+       * elmo-util.el (toplevel): Ditto.
+       * elmo-vars.el (toplevel): Ditto.
+       * elmo2.el (toplevel): Ditto.
+       * mmelmo-1.el (toplevel): Ditto.
+       * mmelmo-2.el (toplevel): Ditto.
+       * mmelmo-imap4-1.el (toplevel): Ditto.
+       * mmelmo-imap4-2.el (toplevel): Ditto.
+       * mmelmo-imap4.el (toplevel): Ditto.
+       * mmelmo.el (toplevel): Ditto.
+
+2000-10-10  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-dop.el (elmo-dop-flush-pending-append-operations): Add no-see.
+       (elmo-dop-call-func-on-msgs): Don't delete appends from msgs.
+
+2000-10-10  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-multi.el (elmo-multi-split-mark-alist): Copy and sort alist
+       before splitting.
+       (elmo-multi-split-number-alist): Ditto.
+
+2000-10-10  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * elmo-version.el: New file.  Use product.el.
+       * elmo2.el: Add (require 'elmo-version).
+       * elmo-vars.el (elmo-appname, elmo-version): Move to
+       elmo-version.el
+
+2000-10-09  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo2.el (elmo-copy-msgs): Set `spec' as 1st argument for
+       `elmo-msgdb-expand-path'.
+       (elmo-msgdb-load): Ditto.
+       Abolished 2nd argument. If 1st argument is not string, treat as spec.
+       (elmo-generic-list-folder-unread): Rewrite.
+       (elmo-generic-list-folder-important): Changed argument.
+       (elmo-list-folder-unread): Ditto.
+       (elmo-list-folder-important): Ditto.
+       (elmo-folder-diff): Rewrite.
+       (elmo-generic-folder-diff): New function.
+       (elmo-multi-get-number-alist-list): Abolished
+       (Renamed to elmo-multi-split-number-alist and moved to elmo-multi.el)
+       (elmo-multi-folder-diff): Moved to elmo-multi.el
+       (toplevel): Removed autoload setting of `elmo-multi-folder-diff'.
+
+       * elmo-pop3.el (elmo-pop3-list-folder): Set `spec' as 1st argument for
+       `elmo-msgdb-expand-path'.
+       (elmo-pop3-msgdb-create-as-numlist): Ditto.
+       (elmo-pop3-read-msg): Ditto.
+       (elmo-pop3-delete-msgs): Ditto.
+       (elmo-pop3-folder-diff): New alias.
+
+       * elmo-pipe.el (elmo-pipe-list-folder): Set `spec' as 1st argument for
+       `elmo-msgdb-expand-path'.
+       (elmo-pipe-list-folder-unread): Changed arguments.
+       (elmo-pipe-list-folder-important): Ditto.
+       (elmo-pipe-folder-diff): New alias.
+
+       * elmo-nntp.el (elmo-nntp-list-folder): Set `spec' as 1st argument for
+       `elmo-msgdb-expand-path'.
+       (elmo-nntp-max-of-folder): Ditto.
+       (elmo-nntp-msgdb-create): Ditto.
+       (elmo-nntp-delete-msgs): Ditto.
+       (elmo-nntp-folder-diff): New alias.
+
+       * elmo-multi.el (elmo-multi-folder-diff): New function.
+       (elmo-multi-split-mark-alist): Ditto.
+       (elmo-multi-split-number-alist): Ditto.
+       (elmo-multi-mark-alist-list): Abolished (Renamed to
+       elmo-multi-split-mark-alist).
+       (elmo-multi-list-folder-unread): Rewrite.
+       (elmo-multi-list-folder-important): Ditto.
+       (elmo-multi-list-folder): Set `spec' as 1st argument for
+       `elmo-msgdb-expand-path'.
+       (elmo-multi-sync-number-alist): Use `elmo-multi-split-number-alist'
+       instead of `elmo-multi-get-number-alist-list'.
+
+       * elmo-msgdb.el (elmo-msgdb-expand-path): Abolished 2nd argument.
+       If 1st argument is not string, treat as spec.
+       (elmo-list-folder-by-location): Set `spec' as 1st argument for
+       `elmo-msgdb-expand-path'.
+       (elmo-msgdb-flist-load): Ditto.
+       (elmo-msgdb-flist-save): Ditto.
+       (elmo-msgdb-delete-path): Ditto.
+       (elmo-msgdb-rename-path): Ditto.
+
+       * elmo-maildir.el (elmo-maildir-set-mark-msgs):
+       Set `spec' as 1st argument for `elmo-msgdb-expand-path'.
+       (elmo-maildir-delete-mark-msgs): Ditto.
+       (elmo-maildir-msgdb-create): Ditto.
+       (elmo-maildir-read-msg): Ditto.
+       (elmo-maildir-delete-msgs): Ditto.
+       (elmo-maildir-list-folder-subr): Ditto.
+       (elmo-maildir-search): Ditto.
+       (elmo-maildir-get-msg-filename): Ditto.
+       (elmo-maildir-pack-number): Ditto.
+       (elmo-maildir-folder-diff): New alias.
+
+       * elmo-localnews.el (elmo-localnews-folder-diff): New alias.
+
+       * elmo-localdir.el (elmo-localdir-list-folder-subr):
+       Set `spec' as 1st argument for `elmo-msgdb-expand-path'.
+       (elmo-localdir-folder-diff): New alias.
+
+       * elmo-internal.el (elmo-internal-list-folder-subr):
+       Set `spec' as 1st argument for `elmo-msgdb-expand-path'.
+       (elmo-internal-list-folder-by-location): Ditto.
+       (elmo-internal-msgdb-create): Ditto.
+       (elmo-internal-delete-msgs): Ditto.
+       (elmo-internal-read-msg): Ditto.
+       (elmo-internal-folder-diff): New alias.
+
+       * elmo-imap4.el (elmo-imap4-folder-diff): New function.
+       (elmo-imap4-list-folder): Set `spec' as 1st argument for
+       `elmo-msgdb-expand-path'.
+       (elmo-imap4-list-folder-unread): Changed arguments.
+       (elmo-imap4-list-folder-important): Ditto.
+
+       * elmo-filter.el (elmo-filter-list-folder-unread): Changed arguments.
+       (elmo-filter-list-folder-important): Ditto.
+       (elmo-filter-folder-diff): New function.
+
+       * elmo-dop.el (elmo-dop-folder-exists-p): Check elmo directory first.
+
+       * elmo-cache.el (elmo-cache-list-folder):
+       Set `spec' as 1st argument for `elmo-msgdb-expand-path'.
+       (elmo-cache-copy-msgs): Ditto.
+       (elmo-cache-folder-diff): New alias.
+
+       * elmo-archive.el (elmo-archive-list-folder-subr):
+       Set `spec' as 1st argument for `elmo-msgdb-expand-path'.
+       (elmo-archive-get-archive-name): Ditto.
+       (elmo-archive-create-file): Ditto.
+       (elmo-archive-append-msg): Ditto.
+       (elmo-archive-copy-msgs): Ditto.
+       (elmo-archive-copy-msgs-froms): Ditto.
+       (elmo-archive-get-msg-filename): Ditto.
+       (elmo-archive-folder-diff): New alias.
+
+2000-10-06   Daiki Ueno  <ueno@unixuser.org>
+
+       * elmo-vars.el (elmo-imap4-stream-type-alist): New variable.
+       (elmo-pop3-stream-type-alist): New variable.
+       (elmo-nntp-stream-type-alist): New variable.
+
+       * elmo-util.el (elmo-buffer-exists-p): Rewrite as function.
+       (elmo-kill-buffer): Ditto.
+       (elmo-get-network-stream-type): Add 2nd argument `stream-type-alist'.
+       (elmo-network-get-spec): Add 5th argument `stream-type-alist'.
+       (elmo-nntp-get-spec): Take into account `elmo-nntp-stream-type-alist'.
+       (elmo-pop3-get-spec): Take into account `elmo-pop3-stream-type-alist'.
+       (elmo-imap4-get-spec): Take into account
+       `elmo-imap4-stream-type-alist'.
+
+2000-10-06  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-nntp.el (elmo-nntp-list-folders): Fix for `-/'
+       (elmo-nntp-list-folders-get-cache): Ditto.
+
+2000-10-05  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-imap4.el (elmo-imap4-search-internal-primitive): Added space
+       character before 'uid'.
+
+2000-10-04  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-msgdb.el (elmo-msgdb-delete-msgs): Don't save location data.
+
+       * elmo-nntp.el (elmo-nntp-max-of-folder): Fixed.
+
+       * elmo-util.el (elmo-number-set-member): New function.
+       (elmo-number-set-append-list): Ditto.
+       (elmo-number-set-append): Ditto.
+
+       * elmo-msgdb.el (elmo-msgdb-killed-message-p):
+       Use `elmo-number-set-member'.
+       (elmo-living-messages): Ditto.
+       (elmo-msgdb-set-as-killed): Use `elmo-number-set-append'.
+       (elmo-msgdb-append-to-killed-list): Use `elmo-number-set-append-list'.
+
+       * elmo-imap4.el (elmo-imap4-folder-exists-p): Rewrite.
+       (elmo-imap4-add-to-cont-list): Abolished.
+       (elmo-imap4-make-number-set-list): Use `elmo-number-set-append'
+       instead of elmo-imap4-add-to-cont-list.
+
+       * elmo2.el (elmo-msgdb-search): Moved from elmo-msgdb.el.
+       (toplevel): Removed autoload setting for `elmo-imap4-get-connection'.
+
+       * elmo-msgdb.el (elmo-msgdb-search): Moved to elmo2.el.
+
+2000-10-03  Hiroya Murata      <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo-util.el (elmo-condition-parse-search-value):
+       Fixed date parsing.
+
+2000-10-03  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-util.el (elmo-condition-find-key-internal): New function.
+       (elmo-condition-find-key): Ditto.
+
+       * elmo-msgdb.el (elmo-msgdb-search-internal-primitive): New function.
+       (elmo-msgdb-search-internal): Ditto.
+       (elmo-msgdb-search): Ditto.
+
+2000-10-02  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-util.el (elmo-cross-device-link-error-p): Abolished.
+       (elmo-copy-file): Uncheck error condition for `add-name-to-file'.
+
+       * elmo-nntp.el (elmo-nntp-search-primitive): Decode header field.
+       (elmo-nntp-search-primitive): Fixed problem when condition is
+       'unmatch'.
+
+       * elmo-util.el (elmo-buffer-field-primitive-condition-match): Fixed.
+
+       * elmo-nntp.el (elmo-nntp-default-use-xhdr): New variable.
+       (elmo-nntp-xhdr-p): New macro.
+       (elmo-nntp-set-xhdr): Ditto.
+       (elmo-nntp-parse-xhdr-response): New function.
+       (elmo-nntp-retrieve-field): Ditto.
+       (elmo-nntp-search-primitive): Ditto.
+       (elmo-nntp-search): Implemented.
+
+       * elmo-date.el (elmo-date-make-sortable-string): New macro.
+
+       * elmo-archive.el (elmo-archive-search): Set all number list to
+       `elmo-archive-field-condition-match'
+
+       * elmo-localdir.el (elmo-localdir-search): Likewise.
+
+       * elmo-maildir.el (elmo-maildir-search): Likewise.
+
+2000-10-01  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-msgdb.el (elmo-living-messages): New function.
+       * elmo-archive.el (elmo-archive-list-folder-subr): Use it.
+       * elmo-cache.el (elmo-cache-list-folder): Ditto.
+       * elmo-dop.el (elmo-dop-list-folder): Ditto.
+       * elmo-imap4.el (elmo-imap4-list-folder): Ditto.
+       * elmo-internal.el (elmo-internal-list-folder-subr): Ditto.
+       * elmo-localdir.el (elmo-localdir-list-folder-subr): Ditto.
+       * elmo-maildir.el (elmo-maildir-list-folder-subr): Ditto.
+       * elmo-multi.el (elmo-multi-list-folder): Ditto.
+       * elmo-nntp.el (elmo-nntp-list-folder): Ditto.
+       * elmo-pipe.el (elmo-pipe-list-folder): Ditto.
+       * elmo-pop3.el (elmo-pop3-list-folder): Ditto.
+
+2000-09-29  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-maildir.el (elmo-maildir-pack-number): Implemented.
+
+       * elmo-msgdb.el (elmo-msgdb-delete-msgs): Save location data.
+
+       * elmo2.el (elmo-pack-number): Added 'maildir as allowd type.
+
+       * elmo-imap4.el (elmo-imap4-search-internal-primitive): Fixed
+       arguments for `SEARCH' command.
+       (elmo-imap4-parse-string): Set `POS' argument for char-after.
+       All other related portions are changed.
+
+       * elmo-cache.el (elmo-cache-search-all): Added argument `from-msgs'.
+
+       * elmo2.el (elmo-generic-list-folder-unread): Rewrite.
+       (elmo-list-folder-unread): Rewrite.
+       (elmo-list-folder-important): Ditto.
+
+       * elmo-util.el (elmo-filter-get-spec): Rewrite.
+       (elmo-condition-parse-error): New inline function.
+       (elmo-read-search-condition): New function.
+       (elmo-read-search-condition-internal): Ditto.
+       (elmo-parse-search-condition): Rewrite.
+       (elmo-condition-parse): New function.
+       (elmo-condition-parse-or-expr): Ditto.
+       (elmo-condition-parse-and-expr): Ditto.
+       (elmo-condition-parse-primitive): Ditto.
+       (elmo-condition-parse-search-value): Ditto.
+       (elmo-buffer-field-primitive-condition-match): Ditto.
+       (elmo-buffer-field-condition-match): Rewrite.
+       (elmo-file-field-condition-match): Ditto.
+
+       * elmo-msgdb.el (elmo-msgdb-expand-path): Use
+       `elmo-replace-msgid-as-filename' instead of `elmo-safe-filename'.
+
+       * elmo-internal.el (elmo-internal-search): Set `number' and
+       `number-list' argument of `elmo-file-field-condition-match'.
+
+       * elmo-maildir.el (elmo-maildir-search): Ditto.
+
+       * elmo-imap4.el (elmo-imap4-list-folder-unread): Use
+       `msgdb' as argument instead of `mark-alist'.
+       (elmo-imap4-list-folder-important): Use `msgdb' as argument instead of
+       `overview'.
+
+       * elmo-multi.el: Likewise.
+
+       * elmo-pipe.el: Likewise.
+
+       * elmo-imap4.el (elmo-imap4-search-internal-primitive): New function.
+       (elmo-imap4-search-internal): Rewrite.
+       (elmo-imap4-search): Ditto.
+
+       * elmo-filter.el (elmo-filter-list-folder): Rewrite.
+       (elmo-filter-list-folder-unread): Ditto.
+       (elmo-filter-list-folder-important): Ditto.
+       (elmo-filter-search): Rewrite.
+
+       * elmo-cache.el (elmo-cache-search-all): Set `number' and
+       `number-list' argument of `elmo-file-field-condition-match'.
+       (elmo-cache-search): Ditto.
+
+       * elmo-localdir.el: Likewise.
+
+       * elmo-archive.el (elmo-archive-field-condition-match): Added argument
+       number-list and pass it to `elmo-buffer-field-condition-match'.
+       (elmo-archive-field-condition-match): Pass `number-list' to
+       `elmo-archive-field-condition-match'
+
+2000-09-25  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-nntp.el (elmo-nntp-list-folder): Set current group after
+       `listgroup'.
+
+       * elmo2.el (elmo-folder-diff-async-callback): New variable.
+       (elmo-folder-diff-async-callback-data): Ditto.
+       (elmo-folder-diff-async): New function.
+
+       * elmo-net.el (elmo-network-session-name-prefix): New variable.
+       (elmo-network-session-cache-key): Use it as a prefix of the session
+       name.
+       (elmo-network-open-session): Ditto.
+
+       * elmo-imap4.el (elmo-imap4-status-callback): New local variable.
+       (elmo-imap4-status-callback-data): Ditto.
+       (elmo-imap4-server-diff-async-callback): New variable.
+       (elmo-imap4-server-diff-async-callback-data): Ditto.
+       (elmo-imap4-local-variables): Added `elmo-imap4-status-callback' and
+       `elmo-imap4-status-callback-data'.
+       (elmo-imap4-max-of-folder): Set `elmo-imap4-status-callback' and
+       `elmo-imap4-status-callback-data' as nil.
+       (elmo-imap4-server-diff): Ditto.
+       (elmo-imap4-server-diff-async-callback-1): New function.
+       (elmo-imap4-server-diff-async): Ditto.
+       (elmo-imap4-parse-status): Call `elmo-imap4-status-callback'.
+
 2000-09-24  OKAZAKI Tetsurou  <okazaki@be.to>
 
        * elmo-util.el (elmo-list-delete): Doc fix.
        * elmo2.el (elmo-crosspost-message-delete): Use `elmo-list-delete'
        instead of `elmo-delete-lists'.
 
-2000-09-11  OKAZAKI Tetsurou  <okazaki@be.to>
+2000-09-19  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-imap4.el (elmo-imap4-make-number-set-list): Copy `msg-list'
+       before `sort'.
+
+2000-09-18  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-imap4.el (elmo-imap4-literal-1): Renamed from
+       `elmo-imap4-literal-subr'.
+       (elmo-imap4-string-1): Renamed from `elmo-imap4-string-subr'.
+       (elmo-imap4-astring-1): Renamed from `elmo-imap4-astring-subr'.
+
+2000-09-15  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-archive.el (elmo-archive-list-folder-subr): Fix.
+       (elmo-archive-list-folder): Fix.
+       (elmo-archive-max-of-folder): Fix.
+
+2000-09-15  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-localdir.el (elmo-localdir-copy-msgs): Use
+        `elmo-localdir-max-of-folder' instead of 'elmo-localdir-list-folder-subr'.
+       (elmo-localdir-append-msg): Ditto.
+       (elmo-localdir-list-folder): Fix for `nonsort'.
+       (elmo-localdir-list-folder-subr): Fix for `killed'.
+       * elmo-maildir.el (elmo-maildir-list-folder): Ditto.
+       (elmo-maildir-list-folder-subr): Ditto.
+       * elmo-archive.el (elmo-archive-list-folder): Ditto.
+       (elmo-archive-list-folder-subr): Ditto.
+       * elmo-internal.el (elmo-internal-list-folder): Ditto.
+       (elmo-internal-list-folder-subr): Ditto.
+
+2000-09-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-imap4.el (elmo-imap4-parse-flag-list): Rewrite.
+
+2000-09-12  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * elmo-util.el (elmo-delete-plugged): Fix parenthesis.
+
+2000-09-11  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * mmelmo-imap4-2.el (mmelmo-imap4-get-mime-entity):
+       Clear `elmo-imap4-fetch-callback' and `elmo-imap4-fetch-callback-data'.
+
+       * elmo-imap4.el (elmo-network-initialize-session): Skip garbage output
+       before greeting.
+       (elmo-imap4-read-part): Use "body.peek" to fetch part.
+       Clear `elmo-imap4-fetch-callback' and `elmo-imap4-fetch-callback-data'.
+
+2000-09-06  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * mmelmo-imap4-2.el (mime-entity-children): Defined.
+
+       * elmo-imap4.el (elmo-imap4-mark-set-on-msgs):
+       Clear `elmo-imap4-fetch-callback' and `elmo-imap4-fetch-callback-data'
+       before STORE command.
+
+2000-09-04  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo2.el (elmo-multi-folder-diff): Fixed problem of filter folder.
+
+       * elmo-imap4.el (elmo-imap4-authenticator-alist): Added `plain' entry.
+       (elmo-imap4-send-command): Use `elmo-imap4-current-response' instead
+       of `response'.
+       (elmo-imap4-list-folders): Removed unused local variable.
+       (elmo-network-initialize-session): Ditto.
+       (elmo-imap4-delete-msg-by-id): Ditto.
+       (elmo-imap4-parse-fetch): Ditto.
+       (elmo-imap4-copy-msgs): Ditto.
+       Use `dst-spec' instead of `dst-folder'.
+       (elmo-network-authenticate-session): Check authenticate type `plain'.
+
+2000-09-01  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-imap4.el (elmo-imap4-parse-response): Use string-match for
+       garbage checking.
+       (elmo-imap4-read-part): Use `elmo-imap4-response-value-all' instead of
+       `elmo-imap4-response-value'.
+       (elmo-imap4-parse-response): Return value of `EXPUNGE'.
+
+2000-08-31  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-imap4.el (elmo-imap4-send-command):
+       Cause elmo-imap4-bye-error when current response is BYE.
+       (elmo-imap4-arrival-filter): Changed greeting response value.
+
+       * elmo2.el (elmo-imap4-bye-error): Define.
 
-       * elmo-cache.el, elmo-database.el, elmo-date.el,
+       * elmo-imap4.el (elmo-imap4-list): Don't call `elmo-imap4-commit'.
+       (elmo-imap4-server-diff): Ditto.
+       (elmo-imap4-response-bye-p): New macro.
+       (elmo-imap4-response-error-text): Get text from BYE response.
+       (elmo-imap4-read-response): Return if BYE response.
+       (elmo-imap4-accept-ok): Cause elmo-imap4-bye-error when BYE response.
+       (elmo-imap4-folder-exists-p): Ditto.
+       (elmo-imap4-commit): Do nothing when different mailbox is selected.
+       (elmo-imap4-parse-bye): New function.
+       (elmo-imap4-parse-response): Remove needless let.
+       Call `elmo-imap4-parse-bye'.
+
+2000-08-30  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-imap4.el (elmo-imap4-folder-exists-p): Don't cause an error when
+       the mailbox does not exist.
+       (elmo-imap4-parse-namespace): Copy `elmo-imap4-extra-namespace-alist'.
+
+2000-08-30  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-imap4.el (elmo-imap4-send-command): Remove unused local variable.
+
+2000-08-29  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-vars.el (elmo-search-mime-charset): Abolished.
+
+       * elmo-pop3.el (elmo-pop3-local-variables): New variable.
+       (elmo-network-initialize-session-buffer): Defined.
+
+       * mmelmo-imap4-2.el (mmelmo-imap4-parse-bodystructure-string):
+       Abolished.
+       (mmelmo-imap4-get-mime-entity): Rewrite.
+
+       * elmo2.el (elmo-error): Capitalize error message.
+
+       * elmo-net.el (elmo-network-initialize-session-buffer): New method.
+       (elmo-network-session-buffer): New macro.
+       (elmo-network-open-session): Use it.
+
+       * elmo-imap4.el: Rewrite.
+
+2000-08-27 Yoichi NAKAYAMA <yoichi@eken.phys.nagoya-u.ac.jp>
+
+       * elmo-nntp.el (Toplevel): Require 'elmo-net.
+
+2000-08-27   Daiki Ueno  <ueno@unixuser.org>
+
+       * elmo-imap4.el (elmo-imap4-make-address): Abolish.
+       (elmo-imap4-msgdb-create): Don't request ENVELOPE.
+       (elmo-imap4-create-msgdb-from-overview-string): Use
+       `elmo-msgdb-create-overview-from-buffer'.
+
+2000-08-26   Daiki Ueno  <ueno@unixuser.org>
+
+       * elmo-imap4.el (elmo-imap4-parse-namespace): Tolerate INBOX regexp.
+       (elmo-imap4-default-hierarchy-delimiter): New variable.
+       (elmo-imap4-list-folders): Use it.
+
+2000-08-23  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-net.el (elmo-network-open-session): Add user and
+       stream-type for process-buffer name.
+
+       * elmo-pop3.el (elmo-network-initialize-session): Call
+       buffer-disable-undo.
+
+       * elmo-imap4.el (elmo-network-initialize-session):
+       Set current-buffer as an argument for `buffer-disable-undo'.
+
+       * elmo-pop3.el (elmo-network-close-session): Don't use
+       `process-live-p'.
+
+       * elmo-vars.el (elmo-default-pop3-authenticate-type):
+       Set default as 'user.
+
+       * mmelmo-imap4-2.el (mmelmo-imap4-get-mime-entity): Rewrite.
+
+       * elmo2.el (elmo-quit): Don't use `elmo-pop3-flush-connection'
+       and `elmo-imap4-flush-connection'.
+
+       * elmo-util.el (toplevel): Removed workaround for timezone y2k.
+       (elmo-pop3-get-spec): Assume auth as symbol.
+       (elmo-open-network-stream): Moved to `elmo-net'.
+
+       * elmo-pop3.el (toplevel): Require 'elmo-net.
+       Define `sasl-cram-md5' to silence byte compilier.
+       (elmo-pop3-connection-cache) Abolished.
+       (elmo-pop3-authenticator-alist) New variable.
+       (elmo-pop3-session): Define.
+       (elmo-pop3-connection-get-process): Abolished.
+       (elmo-pop3-connection-get-buffer): Ditto.
+       (elmo-pop3-close-connection): Ditto.
+       (elmo-pop3-flush-connection): Ditto.
+       (elmo-pop3-get-connection): Ditto.
+       (elmo-pop3-get-session): New function.
+       (Replacement for `elmo-pop3-get-connection').
+       All other related modules are changed.
+       (elmo-network-close-session): Define.
+       (elmo-pop3-send-command): Abolished argument `buffer'.
+       All other related modules are changed.
+       (elmo-pop3-read-response): Likewise.
+       (elmo-pop3-open-connection): Abolished.
+       (elmo-pop3-auth-user): New function.
+       (elmo-pop3-auth-apop): Ditto.
+       (elmo-pop3-auth-cram-md5): Ditto.
+       (elmo-pop3-auth-scram-md5): Ditto.
+       (elmo-pop3-auth-digest-md5): Ditto.
+       (elmo-network-initialize-session): Define.
+       (elmo-network-authenticate-session): Ditto.
+       (elmo-network-setup-session): Ditto.
+
+       * elmo-imap4.el (toplevel): Require 'elmo-net.
+       (elmo-imap4-session): Define.
+       (elmo-imap4-connection-cache): Abolished.
+       (elmo-imap4-password-key): Ditto.
+       (elmo-imap4-flush-connection): Ditto.
+       (elmo-imap4-get-connection): Ditto.
+       All other related modules are changed.
+       (elmo-imap4-get-session): New function
+       (Replacement for `elmo-imap4-get-connection').
+       (elmo-imap4-read-response): Abolished argument `buffer'.
+       All other related modules are changed.
+       (elmo-imap4-send-command): Likewise.
+       (elmo-imap4-select-folder): Abolished.
+       All other related modules are changed.
+       (elmo-imap4-select-mailbox): New function.
+       (Replacement for `elmo-imap4-select-folder').
+       (elmo-imap4-auth-login): Simplify.
+       (Assume current buffer as process buffer)
+       (elmo-imap4-auth-cram-md5): Ditto.
+       (elmo-imap4-auth-digest-md5): Ditto.
+       (elmo-imap4-login): Ditto.
+       (elmo-imap4-open-connection): Abolished.
+       (elmo-imap4-open-connection-1): Abolished.
+       (elmo-network-initialize-sessoin): Define.
+       (elmo-network-authenticate-session): Ditto.
+       (elmo-network-setup-session): Ditto.
+
+       * elmo-net.el: New module.
+
+2000-08-22   Daiki Ueno  <ueno@unixuser.org>
+
+       * elmo-util.el (elmo-define-error): New function.
+
+       * elmo2.el (elmo-error): Define.
+       (elmo-open-error): Define.
+       (elmo-authenticate-error): Define.
+
+       * elmo-imap4.el (elmo-imap4-error): Abolish.
+       (elmo-imap4-error-type): Abolish.
+       (elmo-imap4-error-process): Abolish.
+       (elmo-imap4-error-message): Abolish
+       (elmo-imap4-list-folders): Don't quote lambda.
+       (elmo-imap4-create-msgdb-from-overview-string): Ditto.
+       (elmo-imap4-parse-namespace): Ditto.
+       (elmo-imap4-open-connection): Rewrite.
+       (elmo-imap4-open-connection-1): Simplified (authenticate only).
+       (elmo-imap4-get-connection): Abolish local variable `result'.
+
+2000-08-21  Kaoru Takahashi  <kaoru@kaisei.org>
+
+       * elmo-imap4.el (elmo-imap4-open-connection-1): Fixed probrem
+       wrong-type-argument error when auth is nil.
+
+2000-08-21  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-vars.el (elmo-default-imap4-stream-type): New variable.
+       (elmo-default-nntp-stream-type): Ditto.
+       (elmo-default-pop3-stream-type): Ditto.
+       (elmo-network-stream-type-alist): Ditto.
+       (elmo-default-imap4-ssl): Abolished.
+       (elmo-default-nntp-ssl): Ditto.
+       (elmo-default-pop3-ssl): Ditto.
+
+       * elmo-util.el: (toplevel): Removed needless requires.
+       (elmo-network-get-spec): Use `elmo-network-stream-type-alist'.
+       (elmo-open-network-stream): Open network stream according to
+       the value of `elmo-network-stream-type-alist'.
+       (elmo-get-network-stream-type): New function.
+       (elmo-network-stream-type-spec-string): New macro.
+       (elmo-network-stream-type-symbol): Ditto.
+       (elmo-network-stream-type-function): Ditto.
+
+       * elmo-pop3.el (elmo-pop3-get-connection): Follow up changes for
+       network-stream-type. All other related portions are changed.
+       (elmo-pop3-open-connection): Ditto.
+
+       * elmo-nntp.el (elmo-nntp-setting): Follow up changes for
+       network-stream-type. All other related portions are changed.
+
+       * elmo-imap4.el (elmo-imap4-get-connection): Follow up changes for
+       network-stream-type.All other related portions are changed.
+       (elmo-imap4-error): New macro.
+       (elmo-imap4-error-type): Ditto.
+       (elmo-imap4-error-process): Ditto.
+       (elmo-imap4-error-message): Ditto.
+       (elmo-imap4-auth-login): Use `elmo-imap4-error'.
+       (elmo-imap4-auth-cram-md5): Ditto.
+       (elmo-imap4-auth-digest-md5): Ditto.
+       (elmo-imap4-login): Ditto.
+       (elmo-imap4-open-connection): Remove password entry if authentication
+       was in vain.
+       (elmo-imap4-user-at-host): Abolished.
+       (elmo-imap4-password-key): New buffer local variable.
+       (elmo-imap4-open-connection-1): Set value of `elmo-imap4-password-key'
+       using protocol, port, auth and stream-type.
+
+       * elmo-dop.el (elmo-dop-list-folder): Use killed list.
+
+2000-08-13   Daiki Ueno  <ueno@unixuser.org>
+
+       * elmo-vars.el (elmo-default-imap4-authenticate-type): Default to nil.
+
+       * elmo-util.el (elmo-imap4-get-spec): Assume auth as symbol.
+
+       * elmo-imap4.el (elmo-imap4-user-at-host): New variable.
+       (elmo-imap4-authenticator-alist): New variable.
+       (elmo-imap4-open-connection-1): Rename from
+       elmo-imap4-open-connection.
+       (elmo-imap4-open-connection): Abolish 5th argument `passphrase';
+       only wraps elmo-imap4-open-connection-1.
+       (elmo-imap4-get-connection): Abolish local variable buffer, proc-stat,
+       user-at-host.
+       (elmo-imap4-auth-login): New function.
+       (elmo-imap4-auth-cram-md5): New function.
+       (elmo-imap4-auth-digest-md5): New function.
+       (elmo-imap4-login): New function.
+
+2000-08-12  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-maildir.el (elmo-maildir-delete-folder): Set argument of the
+       function `error'.
+
+2000-08-12  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-pop3.el (elmo-pop3-get-connection): Add `signal'.
+
+2000-08-08  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo2.el (elmo-move-msgs): Set value of `unseen'.
+
+2000-08-06  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-imap4.el (elmo-imap4-parse-overview-string): In regexps
+       for server responses, quote `*' regardless of where it appears.
+
+2000-08-03  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-maildir.el (elmo-maildir-commit): New alias.
+
+2000-08-03  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-util.el (elmo-display-progress):
+               Use `progress-feedback-with-label'.
+
+2000-08-02  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-imap4.el (elmo-imap4-quoted-specials-list): New constant.
+       (elmo-imap4-non-atom-char-regex): Ditto.
+       (elmo-imap4-non-text-char-regex): Ditto.
+       (elmo-imap4-literal-threshold): Ditto.
+       (elmo-imap4-atom-p): New function.
+       (elmo-imap4-quotable-p): Ditto.
+       (elmo-imap4-nil): Ditto.
+       (elmo-imap4-atom): Ditto.
+       (elmo-imap4-quoted): Ditto.
+       (elmo-imap4-literal-subr): Ditto.
+       (elmo-imap4-literal): Ditto.
+       (elmo-imap4-buffer-literal): Ditto.
+       (elmo-imap4-string-subr): Ditto.
+       (elmo-imap4-string): Ditto.
+       (elmo-imap4-buffer-string): Ditto.
+       (elmo-imap4-astring-subr): Ditto.
+       (elmo-imap4-astring): Ditto.
+       (elmo-imap4-buffer-astring): Ditto.
+       (elmo-imap4-nstring): Ditto.
+       (elmo-imap4-buffer-nstring): Ditto.
+       (elmo-imap4-mailbox): New alias.
+       (elmo-imap4-field-body): Ditto.
+       (elmo-imap4-userid): Ditto.
+       (elmo-imap4-password): Ditto.
+       (elmo-imap4-format-quoted): New function.
+       (elmo-imap4-send-command): Rewritten.  Accept a list of command
+       arguments and handle "atom", "quoted" and "literal" string here.
+       (elmo-imap4-list-folders): Use `elmo-imap4-mailbox' for
+       `elmo-imap4-send-command'.
+       (elmo-imap4-folder-exists-p): Likewise.
+       (elmo-imap4-create-folder): Likewise.
+       (elmo-imap4-delete-folder): Likewise.
+       (elmo-imap4-rename-folder): Likewise.
+       (elmo-imap4-max-of-folder): Likewise.
+       (elmo-imap4-check-validity): Likewise.
+       (elmo-imap4-sync-validity): Likewise.
+       (elmo-imap4-server-diff): Likewise.
+       (elmo-imap4-select-folder): Likewise.
+       (elmo-imap4-copy-msgs): Likewise.
+       (elmo-imap4-search-internal): Use `elmo-imap4-astring'.
+       (elmo-imap4-mark-set-on-msgs): Likewise.
+       (elmo-imap4-read-part): Likewise.
+       (elmo-imap4-read-msg): Likewise.
+       (elmo-imap4-open-connection): Use `elmo-imap4-userid' and
+       `elmo-imap4-password' for `elmo-imap4-send-command'.
+       (elmo-imap4-delete-msg-by-id): Use `elmo-imap4-field-body'.
+       (elmo-imap4-append-msg-by-id): Use `elmo-imap4-mailbox' and
+       `elmo-imap4-buffer-literal'.
+       (elmo-imap4-append-msg): Likewise.
+
+       * elmo-imap4.el (elmo-imap4-get-connection): Use `delq' instead of
+       `delete' for removing dead connection from the connection cache.
+       Move deletion of the process buffer after that.
+       (elmo-imap4-list): Change `defsubst' to `defun'.
+       (elmo-imap4-commit): Make error message verbose.
+       (elmo-imap4-search): Ditto.
+       (elmo-imap4-list): Ditto.
+       (elmo-imap4-select-folder): Ditto.
+       (elmo-imap4-copy-msgs): Ditto.
+       (elmo-imap4-delete-msg-by-id): Ditto.
+       (elmo-imap4-append-msg-by-id): Ditto.
+       (elmo-imap4-append-msg): Ditto.
+
+2000-07-26  Takaaki MORIYAMA <taka@airlab.cs.ritsumei.ac.jp>
+
+       * elmo-archive.el (elmo-archive-get-archive-name): Fixed problem
+       when dired is used on XEmacs.
+
+2000-07-25  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-imap4.el (elmo-imap4-process-folder-list): Use `nconc'
+       instead of `append'.
+       (elmo-imap4-commit): Use `elmo-imap4-plugged-p' instead of
+       `elmo-plugged-p' directly.
+       * elmo-pop3.el (elmo-pop3-commit): Use `elmo-pop3-plugged-p' instead
+       of `elmo-plugged-p' directly.
+
+       * elmo-pop3.el (elmo-pop3-get-connection): Split temporary variable.
+       Eliminate unused variable.  Use `memq' for checking a process status.
+       Use `cons' instead of `append' for updating the connection cache.
+       * elmo-nntp.el (elmo-nntp-get-connection): Likewise.
+       * elmo-imap4.el (elmo-imap4-get-connection): Likewise.
+
+2000-07-22  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-imap4.el (elmo-imap4-read-bytes): Advance
+       `elmo-imap4-read-point' exactly.
+
+       * mmelmo-imap4-2.el (mmelmo-imap4-get-mime-entity): Rename
+       the local variable `folder' to `mailbox'.
+       Rename the argument `fld' to `folder'.
+
+2000-07-20  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-pop3.el (elmo-pop3-commit): Do nothing when unplugged.
+       * elmo-imap4.el (elmo-imap4-commit): Ditto.
+
+2000-07-18  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-pop3.el (elmo-pop3-use-uidl): New variable.
+       (elmo-pop3-number-uidl-hash): New buffer-local variable.
+       (elmo-pop3-uidl-number-hash): Ditto.
+       (elmo-pop3-size-hash): Ditto.
+       (elmo-pop3-uidl-done): Ditto.
+       (elmo-pop3-list-done): Ditto.
+       (elmo-pop3-connection-get-process): New defmacro.
+       (elmo-pop3-connection-get-buffer): Ditto.
+       (elmo-pop3-close-connection): Delete buffer and process.
+       (elmo-pop3-flush-connection): Don't delete buffer and process.
+       (elmo-pop3-get-connection): Added optional argument `if-exists'.
+       Setup UIDL and size hash.
+       (elmo-pop3-send-command-no-erase): Deleted
+       (elmo-pop3-send-command): Added optional argument `no-erase'.
+       (elmo-pop3-parse-uidl-response): New function.
+       (elmo-pop3-parse-list-response): Set size hash.
+       (elmo-pop3-list-location): New function.
+       (elmo-pop3-list-by-uidl-subr): Ditto.
+       (elmo-pop3-list-by-list): Ditto.
+       (elmo-pop3-list-folder): Call `elmo-pop3-commit'.
+       Call `elmo-pop3-list-by-uidl-subr' or `elmo-pop3-list-by-list'.
+       (elmo-pop3-max-of-folder): Call `elmo-pop3-commit'.
+       Call `elmo-pop3-list-by-uidl-subr' if `elmo-pop3-use-uidl' is non-nil.
+       (elmo-pop3-msgdb-create-as-numlist): Added optional argument `msgdb'.
+       Use uidl.
+       (elmo-pop3-uidl-to-number): New function.
+       (elmo-pop3-number-to-uidl): Ditto.
+       (elmo-pop3-number-to-size): Ditto.
+       (elmo-pop3-msgdb-create-by-header): Added argument `loc-alist'.
+       Set number by use of uidl.
+       (elmo-pop3-msgdb-create-message): Likewise.
+       Set size, loc-alist in msgdb.
+       (elmo-pop3-read-msg): Set number by use of uidl.
+       Added optional argument `msgdb'.
+       (elmo-pop3-delete-msg): Ditto.
+       (elmo-pop3-delete-msgs): Added optional argument `msgdb'.
+       (elmo-pop3-commit): Close connection.
+
+       * elmo-pipe.el (elmo-pipe-max-of-folder):
+       Bind `elmo-pop3-use-uidl' as nil.
+       (elmo-pipe-drain): Ditto.
+       Call `elmo-commit'.
+
+       * elmo-msgdb.el (elmo-msgdb-delete-msgs): Delete location too.
+       (elmo-msgdb-overview-entity-set-size): New defsubst.
+
+2000-07-17  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-vars.el (elmo-use-killed-list): New variable
+       (Renamed from `elmo-nntp-use-killed-list').
+       (elmo-nntp-use-killed-list): Eliminated.
+
+       * elmo-msgdb.el (elmo-msgdb-expand-path):
+       Changed expanding msgdb path for elmo-multi.
+
+       * elmo-archive.el, elmo-cache.el, elmo-database.el, elmo-date.el,
        elmo-dop.el, elmo-filter.el, elmo-imap4.el, elmo-internal.el,
        elmo-localdir.el, elmo-localnews.el, elmo-maildir.el, elmo-msgdb.el,
        elmo-multi.el, elmo-nntp.el, elmo-pipe.el, elmo-pop3.el,
        mmelmo-imap4-1.el, mmelmo-imap4-2.el, mmelmo-imap4.el, mmelmo.el
        (toplevel): Deleted time-stamp line.
 
+       * elmo2.el (elmo-clear-killed ): Defined as function
+       (Abolished defining as a backend function).
+       All other related modules are changed.
+
+2000-07-14  Hiroshi Tsutsui <tsutsui@easter.kuee.kyoto-u.ac.jp>
+
+       * elmo-cache.el (elmo-cache-clear-killed): Fixed.
+
+2000-07-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-msgdb.el (elmo-msgdb-append-to-killed-list): New function.
+
+2000-07-12  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo-pop3.el (elmo-pop3-clear-killed): New alias.
+
+2000-07-11  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-nntp.el (elmo-nntp-max-of-folder): Use killed list in
+       asynchronous folder check.
+
+       * elmo2.el (elmo-move-msgs): Don't move message when buffer-size is 0.
+
+       * elmo-nntp.el (elmo-nntp-delete-msgs): Check the value of
+       `elmo-nntp-use-killed-list'.
+       (elmo-nntp-list-folder): Use killed list.
+       (elmo-nntp-max-of-folder): Ditto.
+       (elmo-nntp-msgdb-create): Set killed list.
+
+       * elmo-vars.el (elmo-nntp-use-killed-list): New user option.
+
+       * elmo2.el (elmo-clear-killed): New backend function.
+       All other related modules are changed.
+
+2000-07-07  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-util.el (elmo-imap4-spec-folder): Use
+       `elmo-imap4-spec-mailbox'; Mark as obsolete.
+       All callers changed.
+
+2000-06-22  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * mmelmo-2.el (initialize-instance):
+       Use `mime-buffer-entity-buffer-internal' instead of
+       `mime-entity-buffer'.
+
+       * mmelmo-imap4-2.el (mmelmo-imap4-mime-entity-buffer): New function.
+       (mime-entity-body): Implemented.
+       (mime-goto-header-start-point): Deleted.
+       (mime-goto-body-end-point): Ditto.
+       (mime-entity-point-min): Ditto.
+       (mime-entity-point-max): Ditto.
+       (mime-entity-children): Ditto.
+       (mime-insert-header): Use `mime-buffer-entity-buffer-internal'
+       instead of `mime-entity-buffer'.
+       (mime-entity-header-buffer): Ditto.
+       (mime-entity-body-buffer): Ditto.
+       (mime-write-entity-content): Ditto.
+
+       * pldap.el (ldap-static-if): New macro.
+       (toplevel): Use it instead of `static-if'.
+
+2000-06-19  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * pldap.el (ldap-search-basic): Don't collect 'dn' value even if it is
+       included in `attrs' argument.
+
+2000-06-16  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-util.el (elmo-get-passwd): Use old backquote style.
+
+       * pldap.el (ldap-ldif-safe-char-regexp): New constant.
+       (ldap-ldif-safe-init-char-regexp): Ditto.
+       (ldap-ldif-safe-string-regexp): Ditto.
+       (ldap/ldif-safe-string-p): New macro.
+       (ldap/ldif-insert-field): Ditto.
+       (ldap-modify): Use it.
+       (ldap-add): Ditto.
+       (ldap-search-basic): Consider `attrsonly' also when `attrs' is nil.
+       (ldap-decode-attribute): Decode only when `attr' is consp.
+       (ldap-delete): Bind `ret'.
+       (toplevel): Require 'cl at compile time.
+       Removed (require 'poe) and (require 'std11).
+       (pldap-version): Eliminated.
+       (ldap-search-basic): Removed auth and dn binding.
+       (ldap-ldif-field-name-regexp): New constant.
+       (ldap-ldif-field-head-regexp): Ditto.
+       (ldap-ldif-next-field-head-regexp): Ditto.
+       (ldap/collect-field): Use `ldap-ldif-field-head-regexp'.
+       (ldap/field-end): New function.
+       (ldap/field-body): Use it.
+       (ldap/collect-field): Ditto.
+       (ldap-search-basic): Use `ldap/field-body'.
+
+2000-06-15  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * pldap.el (ldap-default-attribute-encoder): New user option.
+       (ldap/field-body): Decode base64 string.
+       (ldap/collect-field): Ditto.
+       (ldap-encode-attribute): New function.
+       (ldap-add-entries): Use it.
+       (ldap-modify-entries): Ditto.
+       (ldap-search-entries): Enclosed decoding function with
+       `with-temp-buffer' and set as unibyte.
+       (ldap-search-basic): Set process buffer as unibyte.
+
+       * elmo-util.el (elmo-folder-identical-system-p):
+       Eliminated name space checking.
+
+       * pldap.el: New module.
+       toplevel: Changed condition to detect built-in ldap feature.
+       (ldap-delete): Enclosed call-process with `with-temp-buffer'.
+       (ldap-add): Added error handling.
+       (ldap-modify): Ditto.
+       (ldap-delete): Ditto.
+
 2000-06-03  OKAZAKI Tetsurou  <okazaki@be.to>
 
+       * elmo-localdir.el (elmo-localdir-msgdb-create-as-numlist):
+       Initialize local variables with `let'.  Inline a temporary
+       variable for the progress percentage.  Sort `setq' to reduce
+       function call in the while-loop.
+
        * mmelmo.el (mmelmo-get-original-buffer): Move `save-excursion'
        into the conditional branch.
 
+2000-05-30  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo2.el (elmo-move-msgs): Replace `append' with `nconc'.
+       Move a conditional out of the while-loop.
+
+2000-05-27  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * elmo-msgdb.el (elmo-msgdb-overview-get-entity): Use
+       elmo-msgdb-overview-get-entity-by-number.
+       (elmo-msgdb-overview-get-entity-by-number): Don't use catch and
+       throw.
+
 2000-05-26  OKAZAKI Tetsurou  <okazaki@be.to>
 
        * elmo-localdir.el (elmo-localdir-pack-number): Renamed
        the local variable for a packed number self descriptively.
-       Initialized it correctly with 1.
+
+2000-05-21  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * elmo2.el (elmo-msgdb-load): Remove elmo-msgdb-overview-hashtb.
+       * elmo-localdir.el (elmo-localdir-pack-number): Use
+       `elmo-msgdb-overview-get-entity' instead of
+       `elmo-msgdb-overview-get-entity-by-number'.
+       * elmo-msgdb.el (elmo-msgdb-overview-hashtb): Removed.
+       (elmo-msgdb-search-overview-entity): Removed.
+       (elmo-msgdb-overview-get-entity): Change argument. Get overview entity
+       by message-id or number.
+       (elmo-msgdb-delete-msgs): Use `elmo-msgdb-overview-get-entity'
+       instead of `elmo-msgdb-overview-get-entity-by-number'.
+
+2000-05-20  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * elmo-vars.el (elmo-use-overview-hashtb): New variable. If
+       non-nil, use hash table for overview.
+       (elmo-hash-maximum-size): New variable.
+       * elmo-msgdb.el (elmo-msgdb-overview-hashtb): New variable.
+       (elmo-msgdb-make-overview-hashtb): New function.
+       (elmo-msgdb-clear-overview-hashtb): New function.
+       (elmo-clear-hash-val): New macro.
+       All other related modules are changed.
+
+2000-05-18  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo2.el (elmo-move-msgs): If there's other message with
+       same message-id, don't use cache.
+
+2000-05-18  Nishimoto Masaki <nishimoto@gaju.org>
+
+       * elmo-localdir.el (elmo-localdir-pack-number): Fixed problem when
+       number is already packed.
+
+2000-05-15  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * elmo-vars.el: Doc fixes. Trim trailing whitespace.
+
+2000-05-12  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * elmo-vars.el (elmo-display-progress-threshold): New variable.
+       All other related modules are changed.
 
 2000-05-11  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-msgdb.el (elmo-msgdb-sort-by-date): Fixed a problem
        of refiling failure on Maildir.
 
+2000-05-10  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * elmo-msgdb.el (elmo-msgdb-get-decoded-cache): get string of
+       decoded mime-charset with cache.
+       (elmo-msgdb-overview-entity-get-from): Ditto.
+       (elmo-msgdb-overview-entity-get-subject): Ditto.
+       * elmo-vars.el (elmo-use-decoded-cache): New variable.
+
+2000-05-10  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-utils.el (elmo-get-passwd): Set timeout of password.
+       (elmo-remove-passwd): Fill password with 0 before erase.
+       * elmo-vars.el (elmo-passwd-life-time): New variable.
+
 \f
 2000-05-10  Yuuichi Teranishi  <teranisi@gohome.org>
 
index 20361fd..6bb7c80 100644 (file)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Scan Folder
 
-(defsubst elmo-archive-list-folder-subr (file type prefix &optional nonsort)
+(defsubst elmo-archive-list-folder-subr (spec &optional nonsort)
   "*Returns list of number-file(int, not string) in archive FILE.
 TYPE specifies the archiver's symbol."
-  (let* ((method (elmo-archive-get-method type 'ls))
+  (let* ((type (nth 2 spec))
+        (prefix (nth 3 spec))
+         (file (elmo-archive-get-archive-name (nth 1 spec) type spec))
+        (method (elmo-archive-get-method type 'ls))
         (args (list file))
         (file-regexp (format (elmo-archive-get-regexp type)
                              (elmo-concat-path (regexp-quote prefix) "")))
-        buf file-list header-end)
+        (killed (and elmo-use-killed-list
+                     (elmo-msgdb-killed-list-load
+                      (elmo-msgdb-expand-path spec))))
+        numbers buf file-list header-end)
     (when (file-exists-p file)
       (save-excursion
        (set-buffer (setq buf (get-buffer-create " *ELMO ARCHIVE ls*")))
@@ -258,20 +264,18 @@ TYPE specifies the archiver's symbol."
                                                  (match-string 1))))))
        (kill-buffer buf)))
     (if nonsort
-       (cons (or (elmo-max-of-list file-list) 0) (length file-list))
-      (sort file-list '<))))
+       (cons (or (elmo-max-of-list file-list) 0)
+             (if killed
+                 (- (length file-list) (length killed))
+               (length file-list)))
+      (setq numbers (sort file-list '<))
+      (elmo-living-messages numbers killed))))
 
 (defun elmo-archive-list-folder (spec)
-  (let* ((type (nth 2 spec))
-        (prefix (nth 3 spec))
-        (arc (elmo-archive-get-archive-name (nth 1 spec) type spec)))
-    (elmo-archive-list-folder-subr arc type prefix)))
+  (elmo-archive-list-folder-subr spec))
 
 (defun elmo-archive-max-of-folder (spec)
-  (let* ((type (nth 2 spec))
-        (prefix (nth 3 spec))
-         (arc (elmo-archive-get-archive-name (nth 1 spec) type spec)))
-    (elmo-archive-list-folder-subr arc type prefix t)))
+  (elmo-archive-list-folder-subr spec t))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -297,7 +301,10 @@ TYPE specifies the archiver's symbol."
          (expand-file-name
           (concat folder suffix)
           elmo-archive-folder-path))
-      (if (and (not (find-file-name-handler dir 'copy-file)) ; dir is local.
+      (if (and (let ((handler (find-file-name-handler dir 'copy-file))) ; dir is local.
+                (or (not handler)
+                    (if (featurep 'xemacs)
+                        (eq handler 'dired-handler-fn))))
               (or (not (file-exists-p dir))
                   (file-directory-p dir)))
          (expand-file-name
@@ -309,7 +316,7 @@ TYPE specifies the archiver's symbol."
            (progn
              (setq filename (expand-file-name
                              (concat elmo-archive-basename suffix)
-                             (setq dbdir (elmo-msgdb-expand-path nil spec))))
+                             (setq dbdir (elmo-msgdb-expand-path spec))))
              (if (file-directory-p dbdir)
                  (); ok.
                (if (file-exists-p dbdir)
@@ -356,7 +363,7 @@ TYPE specifies the archiver's symbol."
 (defun elmo-archive-create-file (archive type spec)
   (save-excursion
     (let* ((tmp-dir (directory-file-name
-                    (elmo-msgdb-expand-path nil spec)))
+                    (elmo-msgdb-expand-path spec)))
            (dummy elmo-archive-dummy-file)
            (method (or (elmo-archive-get-method type 'create)
                       (elmo-archive-get-method type 'mv)))
@@ -473,7 +480,7 @@ TYPE specifies the archiver's symbol."
         (next-num (or msg
                       (1+ (if (file-exists-p arc)
                               (car (elmo-archive-max-of-folder spec)) 0))))
-        (tmp-dir (elmo-msgdb-expand-path nil spec))
+        (tmp-dir (elmo-msgdb-expand-path spec))
         newfile)
     (when (null method)
       (ding)
@@ -512,7 +519,7 @@ TYPE specifies the archiver's symbol."
                (1+ (car (elmo-archive-max-of-folder dst-spec)))))
         (src-dir (elmo-localdir-get-folder-directory src-spec))
         (tmp-dir
-         (file-name-as-directory (elmo-msgdb-expand-path nil dst-spec)))
+         (file-name-as-directory (elmo-msgdb-expand-path dst-spec)))
         (do-link t)
         src tmp newfile tmp-msgs)
     (when (not (elmo-archive-folder-exists-p dst-spec))
@@ -576,7 +583,7 @@ TYPE specifies the archiver's symbol."
         (p-method (elmo-archive-get-method src-type 'ext-pipe))
         (n-method (elmo-archive-get-method src-type 'ext))
         (tmp-dir
-         (file-name-as-directory (elmo-msgdb-expand-path nil src-spec)))
+         (file-name-as-directory (elmo-msgdb-expand-path src-spec)))
         (tmp-msgs (mapcar '(lambda (x) (elmo-concat-path
                                         prefix
                                         (int-to-string x)))
@@ -833,11 +840,12 @@ TYPE specifies the archiver's symbol."
                     mark-alist
                     (elmo-msgdb-overview-entity-get-number entity)
                     gmark))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) num))
-       (elmo-display-progress
-        'elmo-archive-msgdb-create-as-numlist-subr1 "Creating msgdb..."
-        percent)
+       (when (> num elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) num))
+         (elmo-display-progress
+          'elmo-archive-msgdb-create-as-numlist-subr1 "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (kill-buffer tmp-buf)
       (message "Creating msgdb...done.")
@@ -895,11 +903,12 @@ TYPE specifies the archiver's symbol."
 ;      (setq mark-alist (append mark-alist (nth 2 result))))
        (t                      ;; unknown format
        (error "unknown format!")))
-      (setq i (+ n i))
-      (setq percent (/ (* i 100) num))
-      (elmo-display-progress
-       'elmo-archive-msgdb-create-as-numlist-subr2 "Creating msgdb..."
-       percent))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (+ n i))
+       (setq percent (/ (* i 100) num))
+       (elmo-display-progress
+        'elmo-archive-msgdb-create-as-numlist-subr2 "Creating msgdb..."
+        percent)))
     (kill-buffer buf)
     (list overview number-alist mark-alist)) )
 
@@ -957,7 +966,8 @@ TYPE specifies the archiver's symbol."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Search functions
 
-(defsubst elmo-archive-field-condition-match (spec number condition prefix)
+(defsubst elmo-archive-field-condition-match (spec number number-list
+                                                  condition prefix)
   (save-excursion
     (let* ((type (nth 2 spec))
           (arc (elmo-archive-get-archive-name (nth 1 spec) type spec))
@@ -969,7 +979,7 @@ TYPE specifies the archiver's symbol."
          (elmo-archive-call-method method args t))
         (elmo-set-buffer-multibyte default-enable-multibyte-characters)
         (decode-mime-charset-region (point-min)(point-max) elmo-mime-charset)
-        (elmo-buffer-field-condition-match condition))))))
+        (elmo-buffer-field-condition-match condition number number-list))))))
 
 (defun elmo-archive-search (spec condition &optional from-msgs)
   (let* (;;(args (elmo-string-to-list key))
@@ -980,16 +990,18 @@ TYPE specifies the archiver's symbol."
         (num (length msgs))
         (i 0)
         (case-fold-search nil)
-        ret-val)
+        number-list ret-val)
+    (setq number-list msgs)
     (while msgs
-      (if (elmo-archive-field-condition-match spec (car msgs)
+      (if (elmo-archive-field-condition-match spec (car msgs) number-list
                                              condition
                                              (nth 3 spec))
          (setq ret-val (cons (car msgs) ret-val)))
-      (setq i (1+ i))
-      (elmo-display-progress
-       'elmo-archive-search "Searching..."
-       (/ (* i 100) num))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (elmo-display-progress
+        'elmo-archive-search "Searching..."
+        (/ (* i 100) num)))
       (setq msgs (cdr msgs)))
     (nreverse ret-val)))
 
@@ -1037,7 +1049,7 @@ TYPE specifies the archiver's symbol."
   nil)
 
 (defun elmo-archive-get-msg-filename (spec number &optional loc-alist)
-  (let ((tmp-dir (file-name-as-directory (elmo-msgdb-expand-path nil spec)))
+  (let ((tmp-dir (file-name-as-directory (elmo-msgdb-expand-path spec)))
        (prefix (nth 3 spec)))
     (expand-file-name
      (elmo-concat-path prefix (int-to-string number))
@@ -1050,9 +1062,12 @@ TYPE specifies the archiver's symbol."
 (defalias 'elmo-archive-list-folder-important
   'elmo-generic-list-folder-important)
 (defalias 'elmo-archive-commit 'elmo-generic-commit)
+(defalias 'elmo-archive-folder-diff 'elmo-generic-folder-diff)
 
 ;;; End
 (run-hooks 'elmo-archive-load-hook)
-(provide 'elmo-archive)
+
+(require 'product)
+(product-provide (provide 'elmo-archive) (require 'elmo-version))
 
 ;;; elmo-archive.el ends here
index cf3482a..604bcb6 100644 (file)
@@ -202,11 +202,13 @@ If KBYTES is kilo bytes (This value must be float)."
                                    (lambda (x y)
                                      (< (cdr x)
                                         (cdr y))))))))
-      (setq i (+ i 1))
-      (elmo-display-progress
-       'elmo-cache-get-sorted-cache-file-list "Collecting cache info..."
-       (/ (* i 100) num))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (+ i 1))
+       (elmo-display-progress
+        'elmo-cache-get-sorted-cache-file-list "Collecting cache info..."
+        (/ (* i 100) num)))
       (setq dirs (cdr dirs)))
+    (message "Collecting cache info...done.")
     ret-val))
 
 (defun elmo-cache-expire-by-age (&optional days)
@@ -281,25 +283,31 @@ If KBYTES is kilo bytes (This value must be float)."
 (defun elmo-cache-search-all (folder condition from-msgs)
   (let* ((number-alist (elmo-msgdb-number-load
                        (elmo-msgdb-expand-path folder)))
-        (nalist number-alist)
+        (number-list (or from-msgs (mapcar 'car number-alist)))
         (num (length number-alist))
         cache-file
         ret-val
         case-fold-search msg
         percent i)
     (setq i 0)
-    (while nalist
-      (if (and (setq cache-file (elmo-cache-exists-p (cdr (car nalist))
+    (while number-alist
+      (if (and (memq (car (car number-alist)) number-list)
+              (setq cache-file (elmo-cache-exists-p (cdr (car
+                                                          number-alist))
                                                     folder
-                                                    (car (car nalist))))
-              (elmo-file-field-condition-match cache-file condition))
-         (setq ret-val (append ret-val (list (caar nalist)))))
-      (setq i (1+ i))
-      (setq percent (/ (* i 100) num))
-      (elmo-display-progress
-       'elmo-cache-search-all "Searching..."
-       percent)
-      (setq nalist (cdr nalist)))
+                                                    (car (car
+                                                          number-alist))))
+              (elmo-file-field-condition-match cache-file condition
+                                               (car (car number-alist))
+                                               number-list))
+         (setq ret-val (append ret-val (list (caar number-alist)))))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (setq percent (/ (* i 100) num))
+       (elmo-display-progress
+        'elmo-cache-search-all "Searching..."
+        percent))
+      (setq number-alist (cdr number-alist)))
     ret-val))
 
 (defun elmo-cache-collect-sub-directories (init dir &optional recursively)
@@ -532,11 +540,12 @@ Returning its cache buffer."
                     mark-alist
                     num
                     gmark))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) len))
-       (elmo-display-progress
-        'elmo-cache-msgdb-create-as-numlist "Creating msgdb..."
-        percent)
+       (when (> len elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) len))
+         (elmo-display-progress
+          'elmo-cache-msgdb-create-as-numlist "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (message "Creating msgdb...done.")
       (list overview number-alist mark-alist))))
@@ -651,7 +660,12 @@ Returning its cache buffer."
                       msgs)))))
 
 (defun elmo-cache-list-folder (spec); called by elmo-cache-search()
-  (elmo-cache-list-folder-subr spec))
+  (let ((killed (and elmo-use-killed-list
+                    (elmo-msgdb-killed-list-load
+                     (elmo-msgdb-expand-path spec))))
+       numbers)
+    (setq numbers (elmo-cache-list-folder-subr spec))
+    (elmo-living-messages numbers killed)))
 
 (defun elmo-cache-max-of-folder (spec)
   (elmo-cache-list-folder-subr spec t))
@@ -682,12 +696,15 @@ Returning its cache buffer."
            (elmo-msgid-to-cache
             (cdr (assq (car msgs) number-alist)))
            (elmo-cache-get-folder-directory spec))
-                                           condition)
+          condition
+          (car msgs)
+          msgs)
          (setq ret-val (cons (car msgs) ret-val)))
-      (setq i (1+ i))
-      (elmo-display-progress
-       'elmo-cache-search "Searching..."
-       (/ (* i 100) num))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (elmo-display-progress
+        'elmo-cache-search "Searching..."
+        (/ (* i 100) num)))
       (setq msgs (cdr msgs)))
     (nreverse ret-val)))
 
@@ -699,7 +716,7 @@ Returning its cache buffer."
        (next-num (1+ (car (elmo-cache-list-folder-subr dst-spec t))))
        (number-alist
         (elmo-msgdb-number-load
-         (elmo-msgdb-expand-path nil src-spec))))
+         (elmo-msgdb-expand-path src-spec))))
     (if same-number (error "Not implemented"))
     (while msgs
       (elmo-copy-file
@@ -733,7 +750,9 @@ Returning its cache buffer."
 (defalias 'elmo-cache-list-folder-important
   'elmo-generic-list-folder-important)
 (defalias 'elmo-cache-commit 'elmo-generic-commit)
+(defalias 'elmo-cache-folder-diff 'elmo-generic-folder-diff)
 
-(provide 'elmo-cache)
+(require 'product)
+(product-provide (provide 'elmo-cache) (require 'elmo-version))
 
 ;;; elmo-cache.el ends here
index dc8b185..86d91b5 100644 (file)
@@ -68,6 +68,7 @@
                                    elmo-database-msgid-filename))))
     (and match (read match))))
 
-(provide 'elmo-database)
+(require 'product)
+(product-provide (provide 'elmo-database) (require 'elmo-version))
 
 ;;; elmo-database.el ends here
index 5e8ad89..1a7a5cb 100644 (file)
               "0:00")
             (cadr timezone)) nil nil)))
 
-(provide 'elmo-date)
+(defmacro elmo-date-make-sortable-string (datevec)
+  "Make a sortable string from DATEVEC."
+  (` (timezone-make-sortable-date
+      (aref (, datevec) 0)
+      (aref (, datevec) 1)
+      (aref (, datevec) 2)
+      (aref (, datevec) 3))))
+
+(require 'product)
+(product-provide (provide 'elmo-date) (require 'elmo-version))
 
 ;;; elmo-date.el ends here
index 0c278c6..0aeb228 100644 (file)
@@ -277,14 +277,16 @@ even an operation concerns the unplugged folder."
                '(imap4 nntp pop3 filter pipe))
          (and (elmo-multi-p folder) (not (elmo-folder-local-p folder))))
       (if elmo-enable-disconnected-operation
-         (let* ((number-alist (elmo-msgdb-number-load
-                               (elmo-msgdb-expand-path folder)))
+         (let* ((path (elmo-msgdb-expand-path folder))
+                (number-alist (elmo-msgdb-number-load path))
                 (number-list (mapcar 'car number-alist))
                 (append-list (elmo-dop-append-list-load folder))
                 (append-num (length append-list))
+                (killed (and elmo-use-killed-list
+                             (elmo-msgdb-killed-list-load path)))
                 alreadies
-                (i 0)
-                max-num)
+                max-num
+                (i 0))
            (while append-list
              (if (rassoc (car append-list) number-alist)
                  (setq alreadies (append alreadies
@@ -299,7 +301,7 @@ even an operation concerns the unplugged folder."
                    (append number-list
                            (list (+ max-num i 1))))
              (setq i (+ 1 i)))
-           number-list)
+           (elmo-living-messages number-list killed))
        (error "Unplugged"))
     ;; not imap4 folder...list folder
     (elmo-call-func folder "list-folder")))
@@ -313,10 +315,10 @@ even an operation concerns the unplugged folder."
        matched)
     (if (eq (elmo-folder-get-type folder) 'imap4)
        (progn
-         (while append-list
-           (if (setq matched (car (rassoc (car append-list) number-alist)))
-               (setq msgs (delete matched msgs)))
-           (setq append-list (cdr append-list)))
+;;       (while append-list
+;;         (if (setq matched (car (rassoc (car append-list) number-alist)))
+;;             (setq msgs (delete matched msgs)))
+;;         (setq append-list (cdr append-list)))
          (if msgs
              (elmo-dop-queue-append folder func-name msgs)))
       ;; maildir... XXX hard coding.....
@@ -377,7 +379,7 @@ even an operation concerns the unplugged folder."
     (when resume
       ;; Resume msgdb changed by elmo-dop-msgdb-create.
       (let* ((resumed-list (elmo-dop-append-list-load folder t))
-            (number-alist (elmo-msgdb-number-load
+            (number-alist (elmo-msgdb-number-load 
                            (elmo-msgdb-expand-path folder)))
             (appendings append-list)
             pair dels)
@@ -388,22 +390,26 @@ even an operation concerns the unplugged folder."
          (setq appendings (cdr appendings)))
        (elmo-dop-append-list-save folder resumed-list t)))
     (while appendings
-      (setq failure nil)
-      (setq file-string (elmo-get-file-string  ; message string
-                        (elmo-cache-get-path
-                         (car appendings))))
-      (when file-string
-       (condition-case ()
-           (elmo-append-msg folder file-string (car appendings))
-         (quit  (setq failure t))
-         (error (setq failure t)))
-       (setq i (+ 1 i))
-       (message (format "Appending queued messages...%d" i))
-       (if failure
-           (elmo-append-msg elmo-lost+found-folder
-                            file-string (car appendings))))
-      (elmo-dop-unlock-message (car appendings))
-      (setq appendings (cdr appendings)))
+      (let* ((seen-list (elmo-msgdb-seen-load 
+                        (elmo-msgdb-expand-path folder))))
+       (setq failure nil)
+       (setq file-string (elmo-get-file-string  ; message string
+                          (elmo-cache-get-path
+                           (car appendings))))
+       (when file-string
+         (condition-case ()
+             (elmo-append-msg folder file-string (car appendings) nil
+                              (not (member (car appendings) seen-list)))
+           (quit  (setq failure t))
+           (error (setq failure t)))
+         (setq i (+ 1 i))
+         (message (format "Appending queued messages...%d" i))
+         (if failure
+             (elmo-append-msg elmo-lost+found-folder
+                              file-string (car appendings) nil
+                              (not (member (car appendings) seen-list)))))
+       (elmo-dop-unlock-message (car appendings))
+       (setq appendings (cdr appendings))))
     ;; All pending append operation is flushed.
     (elmo-dop-append-list-save folder nil)
     (elmo-commit folder)
@@ -417,10 +423,11 @@ even an operation concerns the unplugged folder."
   (message "Appending queued messages...done."))
 
 (defun elmo-dop-folder-exists-p (folder)
-  (if (and elmo-enable-disconnected-operation
-          (eq (elmo-folder-get-type folder) 'imap4))
-      (file-exists-p (elmo-msgdb-expand-path folder))
-    (elmo-call-func folder "folder-exists-p")))
+  (or (file-exists-p (elmo-msgdb-expand-path folder))
+      (if (and elmo-enable-disconnected-operation
+              (eq (elmo-folder-get-type folder) 'imap4))
+         (file-exists-p (elmo-msgdb-expand-path folder))
+       (elmo-call-func folder "folder-exists-p"))))
 
 (defun elmo-dop-create-folder (folder)
   (if (eq (elmo-folder-get-type folder) 'imap4)
@@ -537,11 +544,12 @@ even an operation concerns the unplugged folder."
                      (setq mark-alist
                            (elmo-msgdb-mark-append
                             mark-alist (car numlist) gmark)))))
-             (setq i (1+ i))
-             (setq percent (/ (* i 100) num))
-             (elmo-display-progress
-              'elmo-dop-msgdb-create-as-numlist "Creating msgdb..."
-              percent)
+             (when (> num elmo-display-progress-threshold)
+               (setq i (1+ i))
+               (setq percent (/ (* i 100) num))
+               (elmo-display-progress
+                'elmo-dop-msgdb-create-as-numlist "Creating msgdb..."
+                percent))
              (setq numlist (cdr numlist)))
            (list overview number-alist mark-alist))
        (error "Unplugged"))
@@ -549,6 +557,7 @@ even an operation concerns the unplugged folder."
     (elmo-call-func folder "msgdb-create" numlist new-mark already-mark
                    seen-mark important-mark seen-list)))
 
-(provide 'elmo-dop)
+(require 'product)
+(product-provide (provide 'elmo-dop) (require 'elmo-version))
 
 ;;; elmo-dop.el ends here
index 810a314..31b5300 100644 (file)
   (elmo-call-func (nth 2 spec) "delete-msgs" msgs))
 
 (defun elmo-filter-list-folder (spec)
-  (let ((filter (nth 1 spec))
-       (folder (nth 2 spec))
-       msgs)
-    (cond
-     ((vectorp filter)
-      (cond ((string= (elmo-filter-key filter)
-                     "last")
-            (setq msgs (elmo-list-folder folder))
-            (nthcdr (max (- (length msgs)
-                            (string-to-int (elmo-filter-value filter)))
-                         0)
-                    msgs))
-           ((string= (elmo-filter-key filter)
-                     "first")
-            (setq msgs (elmo-list-folder folder))
-            (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
-                                msgs)))
-              (mapcar '(lambda (x)
-                         (delete x msgs)) rest))
-            msgs)))
-     ((listp filter)
-      (elmo-search folder filter)))))
-
-(defun elmo-filter-list-folder-unread (spec mark-alist unread-marks)
-  (let ((filter (nth 1 spec))
-       (folder (nth 2 spec))
-       msgs pair)
-    (cond
-     ((vectorp filter)
-      (cond ((string= (elmo-filter-key filter)
-                     "last")
-            (setq msgs (elmo-list-folder-unread folder mark-alist
-                                                unread-marks))
-            (nthcdr (max (- (length msgs)
-                            (string-to-int (elmo-filter-value filter)))
-                         0)
-                    msgs))
-           ((string= (elmo-filter-key filter)
-                     "first")
-            (setq msgs (elmo-list-folder-unread folder
-                                                mark-alist
-                                                unread-marks))
-            (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
-                                msgs)))
-              (mapcar '(lambda (x)
-                         (delete x msgs)) rest))
-            msgs)))
-     ((listp filter)
-      (elmo-list-filter
-       (elmo-search folder filter)
-       (elmo-list-folder-unread folder mark-alist unread-marks))))))
-
-(defun elmo-filter-list-folder-important (spec overview)
-  (let ((filter (nth 1 spec))
-       (folder (nth 2 spec))
-       msgs pair)
-    (cond
-     ((vectorp filter)
-      (cond ((string= (elmo-filter-key filter)
-                     "last")
-            (setq msgs (elmo-list-folder-important folder overview))
-            (nthcdr (max (- (length msgs)
-                            (string-to-int (elmo-filter-value filter)))
-                         0)
-                    msgs))
-           ((string= (elmo-filter-key filter)
-                     "first")
-            (setq msgs (elmo-list-folder-important folder overview))
-            (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
-                                msgs)))
-              (mapcar '(lambda (x)
-                         (delete x msgs)) rest))
-            msgs)))
-     ((listp filter)
-      (elmo-list-filter
-       (mapcar
-       '(lambda (x) (elmo-msgdb-overview-entity-get-number x))
-       overview)
-       (elmo-list-folder-important folder overview))))))
+  (elmo-search (nth 2 spec) (nth 1 spec)))
+
+(defun elmo-filter-list-folder-unread (spec number-alist mark-alist
+                                           unread-marks)
+  (elmo-list-filter
+   (mapcar 'car number-alist)
+   (elmo-list-folder-unread
+    (nth 2 spec) number-alist mark-alist unread-marks)))
+
+(defun elmo-filter-list-folder-important (spec number-alist)
+  (elmo-list-filter
+   (mapcar 'car number-alist)
+   (elmo-list-folder-important (nth 2 spec) number-alist)))
+
+(defun elmo-filter-folder-diff (spec folder &optional number-list)
+  (if (or (elmo-multi-p folder)
+         (not (and (vectorp (nth 1 spec))
+                   (string-match "^first$\\|^last$"
+                                 (elmo-filter-key (nth 1 spec))))))
+      (cons nil (cdr (elmo-folder-diff (nth 2 spec))))
+    (elmo-generic-folder-diff spec folder number-list)))
 
 (defun elmo-filter-max-of-folder (spec)
   (elmo-max-of-folder (nth 2 spec)))
 (defun elmo-filter-create-folder (spec)
   (elmo-create-folder (nth 2 spec)))
 
-(defun elmo-filter-search (spec condition &optional numlist)
+(defun elmo-filter-search (spec condition &optional from-msgs)
   ;; search from messages in this folder
   (elmo-list-filter
-   numlist
-   (elmo-call-func (nth 2 spec) "search" condition
-                  (elmo-filter-list-folder spec))))
+   from-msgs
+   (elmo-search (nth 2 spec) condition
+               (elmo-filter-list-folder spec))))
 
 (defun elmo-filter-use-cache-p (spec number)
   (elmo-call-func (nth 2 spec) "use-cache-p" number))
 (defun elmo-filter-server-diff (spec)
   (elmo-call-func (nth 2 spec) "server-diff"))
 
-(provide 'elmo-filter)
+(require 'product)
+(product-provide (provide 'elmo-filter) (require 'elmo-version))
 
 ;;; elmo-filter.el ends here
index 308599e..f91a04f 100644 (file)
 
 ;;; Commentary:
 ;; 
+;; Origin of IMAP parser part is imap.el, included in Gnus.
+;;
+;;    Copyright (C) 1998, 1999, 2000
+;;    Free Software Foundation, Inc.
+;;    Author: Simon Josefsson <jas@pdc.kth.se>
+;;
 
 (require 'elmo-vars)
 (require 'elmo-util)
 (require 'elmo-msgdb)
 (require 'elmo-date)
 (require 'elmo-cache)
+(require 'elmo-net)
 (require 'utf7)
 
 ;;; Code:
   (defun-maybe sasl-digest-md5-digest-response
     (digest-challenge username passwd serv-type host &optional realm))
   (defun-maybe starttls-negotiate (a))
-  (defun-maybe elmo-generic-list-folder-unread (spec mark-alist unread-marks))
+  (defun-maybe elmo-generic-list-folder-unread (spec number-alist mark-alist unread-marks))
+  (defun-maybe elmo-generic-folder-diff (spec folder number-list))
   (defsubst-maybe utf7-decode-string (string &optional imap) string))
 
 (defvar elmo-imap4-use-lock t
   "USE IMAP4 with locking process.")
 ;;
-;; internal variables
+;;; internal variables
 ;;
 (defvar elmo-imap4-seq-prefix "elmo-imap4")
 (defvar elmo-imap4-seqno 0)
-(defvar elmo-imap4-connection-cache nil
-  "Cache of imap connection.")
 (defvar elmo-imap4-use-uid t
   "Use UID as message number.")
 
-;; buffer local variable
-(defvar elmo-imap4-read-point 0)
+(defvar elmo-imap4-current-response nil)
+(defvar elmo-imap4-status nil)
+(defvar elmo-imap4-reached-tag "elmo-imap40")
+
+;;; buffer local variables
 
 (defvar elmo-imap4-extra-namespace-alist
   '(("^{.*/nntp}.*$" . ".")) ; Default is for UW's remote nntp mailbox...
   "Extra namespace alist. A list of cons cell like: (REGEXP . DELIMITER) ")
+(defvar elmo-imap4-default-hierarchy-delimiter "/")
 
-;; buffer local variable
 (defvar elmo-imap4-server-capability nil)
 (defvar elmo-imap4-server-namespace nil)
 
-(defvar elmo-imap4-lock nil)
+(defvar elmo-imap4-parsing nil) ; indicates parsing.
+
+(defvar elmo-imap4-fetch-callback nil)
+(defvar elmo-imap4-fetch-callback-data nil)
+(defvar elmo-imap4-status-callback nil)
+(defvar elmo-imap4-status-callback-data nil)
+
+(defvar elmo-imap4-server-diff-async-callback nil)
+(defvar elmo-imap4-server-diff-async-callback-data nil)
+
+;;; progress...(no use?)
+(defvar elmo-imap4-count-progress nil)
+(defvar elmo-imap4-count-progress-message nil)
+(defvar elmo-imap4-progress-count nil)
+
+;;; XXX Temporal implementation
+(defvar elmo-imap4-current-msgdb nil)
+
+(defvar elmo-imap4-local-variables
+  '(elmo-imap4-status
+    elmo-imap4-current-response
+    elmo-imap4-seqno
+    elmo-imap4-parsing
+    elmo-imap4-reached-tag
+    elmo-imap4-count-progress
+    elmo-imap4-count-progress-message
+    elmo-imap4-progress-count
+    elmo-imap4-fetch-callback
+    elmo-imap4-fetch-callback-data
+    elmo-imap4-status-callback
+    elmo-imap4-status-callback-data
+    elmo-imap4-current-msgdb))
+
+(defvar elmo-imap4-authenticator-alist
+  '((login     elmo-imap4-auth-login)
+    (cram-md5  elmo-imap4-auth-cram-md5)
+    (digest-md5 elmo-imap4-auth-digest-md5)
+    (plain      elmo-imap4-login))
+  "Definition of authenticators.")
+
+;;;;
+
+(defconst elmo-imap4-quoted-specials-list '(?\\ ?\"))
+
+(defconst elmo-imap4-non-atom-char-regex
+  (eval-when-compile
+    (concat "[^" "]!#$&'+,./0-9:;<=>?@A-Z[^_`a-z|}~-" "]")))
+
+(defconst elmo-imap4-non-text-char-regex
+  (eval-when-compile
+    (concat "[^"
+           "]\x01-\x09\x0b\x0c\x0e-\x1f\x7f !\"#$%&'()*+,./0-9:;<=>?@A-Z[\\^_`a-z{|}~-"
+           "]")))
+
+(defconst elmo-imap4-literal-threshold 1024
+ "Limitation of characters that can be used in a quoted string.")
 
 ;; For debugging.
 (defvar elmo-imap4-debug nil
   "Non-nil forces IMAP4 folder as debug mode.
 Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"")
 
+(defvar elmo-imap4-debug-inhibit-logging nil)
+
+;;; 
+
+(eval-and-compile
+  (luna-define-class elmo-imap4-session (elmo-network-session)
+                    (capability current-mailbox read-only))
+  (luna-define-internal-accessors 'elmo-imap4-session))
+
+;;; imap4 spec
+
+(defsubst elmo-imap4-spec-mailbox (spec)
+  (nth 1 spec))
+
+(defsubst elmo-imap4-spec-username (spec)
+  (nth 2 spec))
+
+(defsubst elmo-imap4-spec-auth (spec)
+  (nth 3 spec))
+
+(defsubst elmo-imap4-spec-hostname (spec)
+  (nth 4 spec))
+
+(defsubst elmo-imap4-spec-port (spec)
+  (nth 5 spec))
+
+(defsubst elmo-imap4-spec-stream-type (spec)
+  (nth 6 spec))
+
+
+;;; Debug
+
 (defsubst elmo-imap4-debug (message &rest args)
   (if elmo-imap4-debug
       (with-current-buffer (get-buffer-create "*IMAP4 DEBUG*")
        (goto-char (point-max))
-       (insert (apply 'format message args) "\n"))))
-
-(defun elmo-imap4-flush-connection ()
-  (interactive)
-  (let ((cache elmo-imap4-connection-cache)
-       buffer process)
-    (while cache
-      (setq buffer (car (cdr (car cache))))
-      (if buffer (kill-buffer buffer))
-      (setq process (car (cdr (cdr (car cache)))))
-      (if process (delete-process process))
-      (setq cache (cdr cache)))
-    (setq elmo-imap4-connection-cache nil)))
-
-(defsubst elmo-imap4-get-process (spec)
-  (elmo-imap4-connection-get-process (elmo-imap4-get-connection spec)))
-
-(defun elmo-imap4-process-folder-list (string)
-  (with-temp-buffer
-    (let ((case-fold-search t)
-         mailbox-list val)
-      (elmo-set-buffer-multibyte nil)
-      (insert string)
+       (if elmo-imap4-debug-inhibit-logging
+           (insert "NO LOGGING\n")
+         (insert (apply 'format message args) "\n")))))
+
+;;; Response
+
+(defmacro elmo-imap4-response-continue-req-p (response)
+  "Returns non-nil if RESPONSE is '+' response."
+  (` (assq 'continue-req (, response))))
+
+(defmacro elmo-imap4-response-ok-p (response)
+  "Returns non-nil if RESPONSE is an 'OK' response."
+  (` (assq 'ok (, response))))
+
+(defmacro elmo-imap4-response-bye-p (response)
+  "Returns non-nil if RESPONSE is an 'BYE' response."
+  (` (assq 'bye (, response))))
+
+(defmacro elmo-imap4-response-value (response symbol)
+  "Get value of the SYMBOL from RESPONSE."
+  (` (nth 1 (assq (, symbol) (, response)))))
+
+(defsubst elmo-imap4-response-value-all (response symbol)
+  "Get all value of the SYMBOL from RESPONSE."
+  (let (matched)
+    (while response
+      (if (eq (car (car response)) symbol)
+         (setq matched (nconc matched (nth 1 (car response)))))
+      (setq response (cdr response)))
+    matched))
+
+(defmacro elmo-imap4-response-error-text (response)
+  "Returns text of NO, BAD, BYE response."
+  (` (nth 1 (or (elmo-imap4-response-value (, response) 'no)
+               (elmo-imap4-response-value (, response) 'bad)
+               (elmo-imap4-response-value (, response) 'bye)))))
+
+(defmacro elmo-imap4-response-bodydetail-text (response)
+  "Returns text of BODY[section]<partial>"
+  (` (nth 3 (assq 'bodydetail (, response)))))
+
+;;; Session commands.
+
+; (defun elmo-imap4-send-command-wait (session command)
+;   "Send COMMAND to the SESSION and wait for response.
+; Returns RESPONSE (parsed lisp object) of IMAP session."
+;   (elmo-imap4-read-response session
+;                          (elmo-imap4-send-command
+;                           session
+;                           command)))
+
+(defun elmo-imap4-send-command-wait (session command)
+  "Send COMMAND to the SESSION.
+Returns RESPONSE (parsed lisp object) of IMAP session.
+If response is not `OK', causes error with IMAP response text."
+  (elmo-imap4-accept-ok session
+                       (elmo-imap4-send-command
+                        session
+                        command)))
+
+(defun elmo-imap4-send-command (session command)
+  "Send COMMAND to the SESSION.
+Returns a TAG string which is assigned to the COMAND."
+  (let* ((command-args (if (listp command)
+                          command
+                        (list command)))
+        (process (elmo-network-session-process-internal session))
+        cmdstr tag token kind)
+    (with-current-buffer (process-buffer process)
+      (setq tag (concat elmo-imap4-seq-prefix
+                       (number-to-string
+                        (setq elmo-imap4-seqno (+ 1 elmo-imap4-seqno)))))
+      (setq cmdstr (concat tag " "))
+      ;; (erase-buffer) No need.
       (goto-char (point-min))
-      ;; XXX This doesn't consider literal name response.
-      (while (re-search-forward
-             "\\* LIST (\\([^)]*\\)) \"[^\"]*\" \\([^\n]*\\)$" nil t)
-       (unless (string-match "noselect"
-                             (elmo-match-buffer 1))
-         (setq val (elmo-match-buffer 2))
-         (if (string-match "^\"\\(.*\\)\"$" val)
-             (setq val (match-string 1 val)))
-         (setq mailbox-list
-               (append mailbox-list
-                       (list val)))))
-      mailbox-list)))
-
+      (if (elmo-imap4-response-bye-p elmo-imap4-current-response)
+         (signal 'elmo-imap4-bye-error
+                 (list (elmo-imap4-response-error-text
+                        elmo-imap4-current-response))))
+      (setq elmo-imap4-current-response nil)
+      (if elmo-imap4-parsing
+         (error "IMAP process is running. Please wait (or plug again.)"))
+      (setq elmo-imap4-parsing t)
+      (elmo-imap4-debug "<-(%s)- %s" tag command)
+      (while (setq token (car command-args))
+       (cond ((stringp token)   ; formatted
+              (setq cmdstr (concat cmdstr token)))
+             ((listp token)     ; unformatted
+              (setq kind (car token))
+              (cond ((eq kind 'atom)
+                     (setq cmdstr (concat cmdstr (nth 1 token))))
+                    ((eq kind 'quoted)
+                     (setq cmdstr (concat
+                                   cmdstr
+                                   (elmo-imap4-format-quoted (nth 1 token)))))
+                    ((eq kind 'literal)
+                     (setq cmdstr (concat cmdstr
+                                          (format "{%d}" (nth 2 token))))
+                     (process-send-string process cmdstr)
+                     (process-send-string process "\r\n")
+                     (setq cmdstr nil)
+                     (elmo-imap4-accept-continue-req session)
+                     (cond ((stringp (nth 1 token))
+                            (setq cmdstr (nth 1 token)))
+                           ((bufferp (nth 1 token))
+                            (with-current-buffer (nth 1 token)
+                              (process-send-region
+                               process
+                               (point-min)
+                               (+ (point-min) (nth 2 token)))))
+                           (t
+                            (error "Wrong argument for literal"))))
+                    (t
+                     (error "Unknown token kind %s" kind))))
+             (t
+              (error "Invalid argument")))
+       (setq command-args (cdr command-args)))
+      (if cmdstr
+         (process-send-string process cmdstr))
+      (process-send-string process "\r\n")
+      tag)))
+
+(defun elmo-imap4-send-string (session string)
+  "Send STRING to the SESSION."
+  (with-current-buffer (process-buffer
+                       (elmo-network-session-process-internal session))
+    (setq elmo-imap4-current-response nil)
+    (goto-char (point-min))
+    (elmo-imap4-debug "<-- %s" string)
+    (process-send-string (elmo-network-session-process-internal session)
+                        string)
+    (process-send-string (elmo-network-session-process-internal session)
+                        "\r\n")))
+
+(defun elmo-imap4-read-response (session tag)
+  "Read parsed response from SESSION.
+TAG is the tag of the command"
+  (with-current-buffer (process-buffer
+                       (elmo-network-session-process-internal session))
+    (while (not (or (string= tag elmo-imap4-reached-tag)
+                   (elmo-imap4-response-bye-p elmo-imap4-current-response)))
+      (when (memq (process-status
+                  (elmo-network-session-process-internal session))
+                 '(open run))
+       (accept-process-output (elmo-network-session-process-internal session)
+                              1)))
+    (elmo-imap4-debug "=>%s" (prin1-to-string elmo-imap4-current-response))
+    (setq elmo-imap4-parsing nil)
+    elmo-imap4-current-response))
+
+(defsubst elmo-imap4-read-untagged (process)
+  (with-current-buffer (process-buffer process)
+    (while (not elmo-imap4-current-response)
+      (accept-process-output process 1))
+    (elmo-imap4-debug "=>%s" (prin1-to-string elmo-imap4-current-response))
+    elmo-imap4-current-response))
+
+(defun elmo-imap4-read-continue-req (session)
+  "Returns a text following to continue-req in SESSION.
+If response is not `+' response, returns nil."
+  (elmo-imap4-response-value
+   (elmo-imap4-read-untagged
+    (elmo-network-session-process-internal session))
+   'continue-req))
+
+(defun elmo-imap4-accept-continue-req (session)
+  "Returns non-nil if `+' (continue-req) response is arrived in SESSION.
+If response is not `+' response, cause an error."
+  (let (response)
+    (setq response
+         (elmo-imap4-read-untagged
+          (elmo-network-session-process-internal session)))
+    (or (elmo-imap4-response-continue-req-p response)
+       (error "IMAP error: %s"
+              (or (elmo-imap4-response-error-text response)
+                  "No continut-req from server.")))))
+
+(defun elmo-imap4-read-ok (session tag)
+  "Returns non-nil if `OK' response of the command with TAG is arrived
+in SESSION. If response is not `OK' response, returns nil."
+  (elmo-imap4-response-ok-p
+   (elmo-imap4-read-response session tag)))
+
+(defun elmo-imap4-accept-ok (session tag)
+  "Accept only `OK' response from SESSION.
+If response is not `OK' response, causes error with IMAP response text."
+  (let ((response (elmo-imap4-read-response session tag)))
+    (if (elmo-imap4-response-ok-p response)
+       response
+      (if (elmo-imap4-response-bye-p response)
+         (signal 'elmo-imap4-bye-error
+                 (list (elmo-imap4-response-error-text response)))
+       (error "IMAP error: %s"
+              (or (elmo-imap4-response-error-text response)
+                  "No `OK' response from server."))))))
+;;;
+
+(defun elmo-imap4-session-check (session)
+  (elmo-imap4-send-command-wait session "check"))
+
+(defun elmo-imap4-atom-p (string)
+  "Return t if STRING is an atom defined in rfc2060."
+  (if (string= string "")
+      nil
+    (save-match-data
+      (not (string-match elmo-imap4-non-atom-char-regex string)))))
+
+(defun elmo-imap4-quotable-p (string)
+  "Return t if STRING can be formatted as a quoted defined in rfc2060."
+  (save-match-data
+    (not (string-match elmo-imap4-non-text-char-regex string))))
+
+(defun elmo-imap4-nil (string)
+  "Return a list represents the special atom \"NIL\" defined in rfc2060, \
+if STRING is nil.
+Otherwise return nil."
+  (if (eq string nil)
+      (list 'atom "NIL")))
+
+(defun elmo-imap4-atom (string)
+  "Return a list represents STRING as an atom defined in rfc2060.
+Return nil if STRING is not an atom.  See `elmo-imap4-atom-p'."
+  (if (elmo-imap4-atom-p string)
+      (list 'atom string)))
+
+(defun elmo-imap4-quoted (string)
+  "Return a list represents STRING as a quoted defined in rfc2060.
+Return nil if STRING can not be formatted as a quoted.  See `elmo-imap4-quotable-p'."
+  (if (elmo-imap4-quotable-p string)
+      (list 'quoted string)))
+
+(defun elmo-imap4-literal-1 (string-or-buffer length)
+  "Internal function for `elmo-imap4-literal' and `elmo-imap4-buffer-literal'.
+Return a list represents STRING-OR-BUFFER as a literal defined in rfc2060.
+STRING-OR-BUFFER must be an encoded string or a single-byte string or a single-byte buffer.
+LENGTH must be the number of octets for STRING-OR-BUFFER."
+  (list 'literal string-or-buffer length))
+
+(defun elmo-imap4-literal (string)
+  "Return a list represents STRING as a literal defined in rfc2060.
+STRING must be an encoded or a single-byte string."
+  (elmo-imap4-literal-1 string (length string)))
+
+(defun elmo-imap4-buffer-literal (buffer)
+  "Return a list represents BUFFER as a literal defined in rfc2060.
+BUFFER must be a single-byte buffer."
+  (elmo-imap4-literal-1 buffer (with-current-buffer buffer
+                                (buffer-size))))
+
+(defun elmo-imap4-string-1 (string length)
+  "Internal function for `elmo-imap4-string' and `elmo-imap4-buffer-string'.
+Return a list represents STRING as a string defined in rfc2060.
+STRING must be an encoded or a single-byte string.
+LENGTH must be the number of octets for STRING."
+  (or (elmo-imap4-quoted string)
+      (elmo-imap4-literal-1 string length)))
+
+(defun elmo-imap4-string (string)
+  "Return a list represents STRING as a string defined in rfc2060.
+STRING must be an encoded or a single-byte string."
+  (let ((length (length string)))
+    (if (< elmo-imap4-literal-threshold length)
+       (elmo-imap4-literal-1 string length)
+      (elmo-imap4-string-1 string length))))
+
+(defun elmo-imap4-buffer-string (buffer)
+  "Return a list represents BUFFER as a string defined in rfc2060.
+BUFFER must be a single-byte buffer."
+  (let ((length (with-current-buffer buffer
+                 (buffer-size))))
+    (if (< elmo-imap4-literal-threshold length)
+       (elmo-imap4-literal-1 buffer length)
+      (elmo-imap4-string-1 (with-current-buffer buffer
+                            (buffer-string))
+                          length))))
+
+(defun elmo-imap4-astring-1 (string length)
+  "Internal function for `elmo-imap4-astring' and `elmo-imap4-buffer-astring'.
+Return a list represents STRING as an astring defined in rfc2060.
+STRING must be an encoded or a single-byte string.
+LENGTH must be the number of octets for STRING."
+  (or (elmo-imap4-atom string)
+      (elmo-imap4-string-1 string length)))
+
+(defun elmo-imap4-astring (string)
+  "Return a list represents STRING as an astring defined in rfc2060.
+STRING must be an encoded or a single-byte string."
+  (let ((length (length string)))
+    (if (< elmo-imap4-literal-threshold length)
+       (elmo-imap4-literal-1 string length)
+      (elmo-imap4-astring-1 string length))))
+
+(defun elmo-imap4-buffer-astring (buffer)
+  "Return a list represents BUFFER as an astring defined in rfc2060.
+BUFFER must be a single-byte buffer."
+  (let ((length (with-current-buffer buffer
+                 (buffer-size))))
+    (if (< elmo-imap4-literal-threshold length)
+       (elmo-imap4-literal-1 buffer length)
+      (elmo-imap4-astring-1 (with-current-buffer buffer
+                             (buffer-string))
+                           length))))
+
+(defun elmo-imap4-nstring (string)
+  "Return a list represents STRING as a nstring defined in rfc2060.
+STRING must be an encoded or a single-byte string."
+   (or (elmo-imap4-nil string)
+       (elmo-imap4-string string)))
+
+(defun elmo-imap4-buffer-nstring (buffer)
+  "Return a list represents BUFFER as a nstring defined in rfc2060.
+BUFFER must be a single-byte buffer."
+   (or (elmo-imap4-nil buffer)
+       (elmo-imap4-buffer-string buffer)))
+
+(defalias 'elmo-imap4-mailbox 'elmo-imap4-astring)
+(defalias 'elmo-imap4-field-body 'elmo-imap4-astring)
+(defalias 'elmo-imap4-userid 'elmo-imap4-astring)
+(defalias 'elmo-imap4-password 'elmo-imap4-astring)
+
+(defun elmo-imap4-format-quoted (string)
+  "Return STRING in a form of the quoted-string defined in rfc2060."
+  (concat "\""
+         (std11-wrap-as-quoted-pairs string elmo-imap4-quoted-specials-list)
+         "\""))
+
+(defsubst elmo-imap4-response-get-selectable-mailbox-list (response)
+  (delq nil
+       (mapcar
+        (lambda (entry)
+          (if (and (eq 'list (car entry))
+                   (not (member "\\NoSelect" (nth 1 (nth 1 entry)))))
+              (car (nth 1 entry))))
+        response)))
+
+;;; Backend methods.
 (defun elmo-imap4-list-folders (spec &optional hierarchy)
-  (save-excursion
-    (let* ((root (elmo-imap4-spec-folder spec))
-          (process (elmo-imap4-get-process spec))
-          (delim (or
+  (let* ((root (elmo-imap4-spec-mailbox spec))
+        (session (elmo-imap4-get-session spec))
+        (delim (or
                 (cdr
-                 (elmo-string-matched-assoc root
-                                            (save-excursion
-                                              (set-buffer
-                                               (process-buffer process))
-                                              elmo-imap4-server-namespace)))
-                "/"))
-          response result append-serv ssl)
-      ;; Append delimiter
-      (if (and root
-              (not (string= root ""))
-              (not (string-match (concat "\\(.*\\)"
-                                         (regexp-quote delim)
-                                         "\\'")
-                                 root)))
-         (setq root (concat root delim)))
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format "list \"%s\" *" root))
-      (setq response (elmo-imap4-read-response (process-buffer process)
-                                              process))
-      (setq result (elmo-imap4-process-folder-list response))
-      (unless (string= (elmo-imap4-spec-username spec)
-                      elmo-default-imap4-user)
-       (setq append-serv (concat ":" (elmo-imap4-spec-username spec))))
-      (unless (string= (elmo-imap4-spec-hostname spec)
-                      elmo-default-imap4-server)
-       (setq append-serv (concat append-serv "@" (elmo-imap4-spec-hostname
-                                                  spec))))
-      (unless (eq (elmo-imap4-spec-port spec)
-                 elmo-default-imap4-port)
-       (setq append-serv (concat append-serv ":"
-                                 (int-to-string
-                                  (elmo-imap4-spec-port spec)))))
-      (unless (eq (setq ssl (elmo-imap4-spec-ssl spec))
-                 elmo-default-imap4-ssl)
-       (if ssl
-           (setq append-serv (concat append-serv "!")))
-       (if (eq ssl 'starttls)
-           (setq append-serv (concat append-serv "!"))))
-      (mapcar '(lambda (fld)
-                (concat "%" (elmo-imap4-decode-folder-string fld)
-                        (and append-serv
-                             (eval append-serv))))
-             result))))
+                 (elmo-string-matched-assoc
+                  root
+                  (with-current-buffer (elmo-network-session-buffer session)
+                    elmo-imap4-server-namespace)))
+                elmo-imap4-default-hierarchy-delimiter))
+        result append-serv type)
+    ;; Append delimiter
+    (if (and root
+            (not (string= root ""))
+            (not (string-match (concat "\\(.*\\)"
+                                       (regexp-quote delim)
+                                       "\\'")
+                               root)))
+       (setq root (concat root delim)))
+    (setq result (elmo-imap4-response-get-selectable-mailbox-list
+                 (elmo-imap4-send-command-wait
+                  session
+                  (list "list " (elmo-imap4-mailbox root) " *"))))
+    (unless (string= (elmo-imap4-spec-username spec)
+                    elmo-default-imap4-user)
+      (setq append-serv (concat ":" (elmo-imap4-spec-username spec))))
+    (unless (string= (elmo-imap4-spec-hostname spec)
+                    elmo-default-imap4-server)
+      (setq append-serv (concat append-serv "@" (elmo-imap4-spec-hostname
+                                                spec))))
+    (unless (eq (elmo-imap4-spec-port spec)
+               elmo-default-imap4-port)
+      (setq append-serv (concat append-serv ":"
+                               (int-to-string
+                                (elmo-imap4-spec-port spec)))))
+    (setq type (elmo-imap4-spec-stream-type spec))
+    (unless (eq (elmo-network-stream-type-symbol type)
+               elmo-default-imap4-stream-type)
+      (if type
+         (setq append-serv (concat append-serv
+                                   (elmo-network-stream-type-spec-string
+                                    type)))))
+    (mapcar (lambda (fld)
+             (concat "%" (elmo-imap4-decode-folder-string fld)
+                     (and append-serv
+                          (eval append-serv))))
+           result)))
 
 (defun elmo-imap4-folder-exists-p (spec)
-  (let ((process (elmo-imap4-get-process spec)))
-    (elmo-imap4-send-command (process-buffer process)
-                            process
-                            (format "status \"%s\" (messages)"
-                                    (elmo-imap4-spec-folder spec)))
-    (elmo-imap4-read-response (process-buffer process) process)))
+  (let ((session (elmo-imap4-get-session spec)))
+    (if (string=
+        (elmo-imap4-session-current-mailbox-internal session)
+        (elmo-imap4-spec-mailbox spec))
+       t
+      (condition-case nil
+         (elmo-imap4-session-select-mailbox
+          session
+          (elmo-imap4-spec-mailbox spec)
+          'force)
+       (error nil)))))
 
 (defun elmo-imap4-folder-creatable-p (spec)
   t)
 
 (defun elmo-imap4-create-folder-maybe (spec dummy)
-  "Create folder if necessary."
-  (if (not (elmo-imap4-folder-exists-p spec))
-      (elmo-imap4-create-folder spec)))
+  (unless (elmo-imap4-folder-exists-p spec)
+    (elmo-imap4-create-folder spec)))
 
 (defun elmo-imap4-create-folder (spec)
-  (let ((process (elmo-imap4-get-process spec))
-       (folder (elmo-imap4-spec-folder spec)))
-    (when folder
-;;     For UW imapd 4.6, this workaround is needed to create #mh mailbox.
-;      (if (string-match "^\\(#mh/\\).*[^/]$" folder)
-;        (setq folder (concat folder "/"))) ;; make directory
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format "create %s" folder))
-      (if (null (elmo-imap4-read-response (process-buffer process)
-                                         process))
-         (error "Create folder %s failed" folder)
-       t))))
+  (elmo-imap4-send-command-wait
+   (elmo-imap4-get-session spec)
+   (list "create " (elmo-imap4-mailbox
+                   (elmo-imap4-spec-mailbox spec)))))
 
 (defun elmo-imap4-delete-folder (spec)
-  (let ((process (elmo-imap4-get-process spec))
+  (let ((session (elmo-imap4-get-session spec))
        msgs)
-    (when (elmo-imap4-spec-folder spec)
+    (when (elmo-imap4-spec-mailbox spec)
       (when (setq msgs (elmo-imap4-list-folder spec))
        (elmo-imap4-delete-msgs spec msgs))
-      (elmo-imap4-send-command (process-buffer process) process "close")
-      (elmo-imap4-read-response (process-buffer process) process)
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format "delete %s"
-                                      (elmo-imap4-spec-folder spec)))
-      (if (null (elmo-imap4-read-response (process-buffer process)
-                                         process))
-         (error "Delete folder %s failed" (elmo-imap4-spec-folder spec))
-       t))))
+      ;; (elmo-imap4-send-command-wait session "close")
+      (elmo-imap4-send-command-wait
+       session
+       (list "delete "
+            (elmo-imap4-mailbox (elmo-imap4-spec-mailbox spec)))))))
 
 (defun elmo-imap4-rename-folder (old-spec new-spec)
-  (let ((process (elmo-imap4-get-process old-spec)))
-    (when (elmo-imap4-spec-folder old-spec)
-      (elmo-imap4-send-command (process-buffer process) process "close")
-      (elmo-imap4-read-response (process-buffer process) process)
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format "rename %s %s"
-                                      (elmo-imap4-spec-folder old-spec)
-                                      (elmo-imap4-spec-folder new-spec)))
-      (if (null (elmo-imap4-read-response (process-buffer process) process))
-         (error "Rename folder from %s to %s failed"
-                (elmo-imap4-spec-folder old-spec)
-                (elmo-imap4-spec-folder new-spec))
-       t))))
+  ;;(elmo-imap4-send-command-wait session "close")
+  (elmo-imap4-send-command-wait
+   (elmo-imap4-get-session old-spec)
+   (list "rename "
+        (elmo-imap4-mailbox
+         (elmo-imap4-spec-mailbox old-spec))
+        " "
+        (elmo-imap4-mailbox
+         (elmo-imap4-spec-mailbox new-spec)))))
 
 (defun elmo-imap4-max-of-folder (spec)
-  (save-excursion
-    (let* ((process (elmo-imap4-get-process spec))
-          response)
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format "status \"%s\" (uidnext messages)"
-                                      (elmo-imap4-spec-folder spec)))
-      (setq response (elmo-imap4-read-response (process-buffer process)
-                                              process))
-      (when (and response (string-match
-                          "\\* STATUS [^(]* \\(([^)]*)\\)" response))
-       (setq response (read (downcase (elmo-match-string 1 response))))
-       (cons (- (cadr (memq 'uidnext response)) 1)
-             (cadr (memq 'messages response)))))))
-
-(defun elmo-imap4-get-connection (spec)
-  (let* ((user   (elmo-imap4-spec-username spec))
-        (server (elmo-imap4-spec-hostname spec))
-        (port   (elmo-imap4-spec-port spec))
-        (auth   (elmo-imap4-spec-auth spec))
-        (ssl    (elmo-imap4-spec-ssl spec))
-        (user-at-host (format "%s@%s" user server))
-        ret-val result buffer process proc-stat
-        user-at-host-on-port)
-    (if (not (elmo-plugged-p server port))
-       (error "Unplugged"))
-    (setq user-at-host-on-port
-         (concat user-at-host ":" (int-to-string port)
-                 (if (eq ssl 'starttls) "!!" (if ssl "!"))))
-    (setq ret-val (assoc user-at-host-on-port
-                        elmo-imap4-connection-cache))
-    (if (and ret-val
-            (or (eq (setq proc-stat
-                          (process-status (cadr (cdr ret-val))))
-                    'closed)
-                (eq proc-stat 'exit)))
-       ;; connection is closed...
-       (progn
-         (kill-buffer (car (cdr ret-val)))
-         (setq elmo-imap4-connection-cache
-               (delete ret-val elmo-imap4-connection-cache))
-         (setq ret-val nil)))
-    (if ret-val
-       (progn
-         (setq ret-val (cdr ret-val)) ;; connection cache exists.
-         ret-val)
-      (setq result
-           (elmo-imap4-open-connection server user auth port
-                                       (elmo-get-passwd user-at-host)
-                                       ssl))
-      (if (null result)
-         (error "Connection failed"))
-      (elmo-imap4-debug "Connected to %s" user-at-host-on-port)
-      (setq buffer (car result))
-      (setq process (cdr result))
-      (when (and process (null buffer))
-       (elmo-remove-passwd user-at-host)
-       (delete-process process)
-       (error "Login failed"))
-      (setq elmo-imap4-connection-cache
-           (append elmo-imap4-connection-cache
-                   (list
-                    (cons user-at-host-on-port
-                          (setq ret-val (list buffer process
-                                              ""; current-folder..
-                                              ))))))
-      ret-val)))
-
-(defun elmo-imap4-process-filter (process output)
-  (save-match-data
-    (with-current-buffer (process-buffer process)
-      (goto-char (point-max))
-      (insert output)
-      (forward-line -1)
-      (beginning-of-line)
-      (if (looking-at (concat
-                      "\\(^"
-                      elmo-imap4-seq-prefix
-                      (int-to-string elmo-imap4-seqno)
-                      "\\|^\\* OK\\|^\\* BYE\\'\\|^\\+\\)[^\n]*\n\\'"))
-         (progn
-           (setq elmo-imap4-lock nil) ; unlock process buffer.
-           (elmo-imap4-debug "unlock(%d) %s" elmo-imap4-seqno output))
-       (elmo-imap4-debug "continue(%d) %s" elmo-imap4-seqno output))
-      (goto-char (point-max)))))
-
-(defun elmo-imap4-read-response (buffer process &optional not-command)
-  (save-excursion
-    (set-buffer buffer)
-    (let ((case-fold-search nil)
-         (response-string nil)
-         (response-continue t)
-         (return-value nil)
-         match-end)
-      (while response-continue
-       (goto-char elmo-imap4-read-point)
-       (while (not (search-forward "\r\n" nil t))
-         (accept-process-output process)
-         (goto-char elmo-imap4-read-point))
-       
-       (setq match-end (point))
-       (setq response-string
-             (buffer-substring elmo-imap4-read-point (- match-end 2)))
-       (goto-char elmo-imap4-read-point)
-       (if (looking-at (format "%s[0-9]+ OK.*$\\|\\+.*$"
-                               elmo-imap4-seq-prefix))
-           (progn (setq response-continue nil)
-                  (setq elmo-imap4-read-point match-end)
-                  (setq return-value
-                        (if return-value
-                            (concat return-value "\n" response-string)
-                          response-string)))
-         (if (looking-at (format "\\(. BYE.*\\|%s[0-9]+ \\(NO\\|BAD\\).*\\)$"
-                                 elmo-imap4-seq-prefix))
-             (progn (setq response-continue nil)
-                    (setq elmo-imap4-read-point match-end)
-                    (elmo-imap4-debug "error response: %s" response-string)
-                    (setq return-value nil))
-           (setq elmo-imap4-read-point match-end)
-           (if not-command
-               (setq response-continue nil))
-           (setq return-value
-                 (if return-value
-                     (concat return-value "\n" response-string)
-                   response-string)))
-         (setq elmo-imap4-read-point match-end)))
-      return-value)))
-
-(defun elmo-imap4-read-contents (buffer process)
-  "Read OK response"
-  (save-excursion
-    (set-buffer buffer)
-    (let ((case-fold-search nil)
-         (response-string nil)
-         match-end)
-      (goto-char elmo-imap4-read-point)
-      (while (not (re-search-forward
-                  (format "%s[0-9]+ \\(NO\\|BAD\\|OK\\).*$"
-                          elmo-imap4-seq-prefix)
-                  nil t))
-       (accept-process-output process)
-       (goto-char elmo-imap4-read-point))
-      (beginning-of-line)
-      (setq match-end (point))
-      (setq response-string (buffer-substring
-                            elmo-imap4-read-point match-end))
-      (if (eq (length response-string) 0)
-         nil
-       response-string))))
-
-(defun elmo-imap4-read-bytes (buffer process bytes)
-  (save-excursion
-    (set-buffer buffer)
-    (let ((case-fold-search nil)
-         (return-value nil)
-         start gc-message)
-      (setq start elmo-imap4-read-point);; starting point
-      (while (< (point-max) (+ start bytes))
-       (accept-process-output process))
-      (setq return-value (buffer-substring
-                         start (+ start bytes)))
-      (setq return-value (elmo-delete-cr return-value))
-      (setq elmo-imap4-read-point bytes)
-      return-value)))
-
-(defun elmo-imap4-read-body (buffer process bytes outbuf)
-  (let (start gc-message ret-val)
-    (with-current-buffer buffer
-      (setq start elmo-imap4-read-point)
-      (while (< (point-max) (+ start bytes))
-       (accept-process-output process))
-      (with-current-buffer outbuf
-       (erase-buffer)
-       (insert-buffer-substring buffer start (+ start bytes))
-       (setq ret-val (elmo-delete-cr-get-content-type)))
-      (setq elmo-imap4-read-point (+ start bytes))
-      ret-val)))
-  
-(defun elmo-imap4-noop (connection)
-  (let ((buffer (car connection))
-       (process (cadr connection)))
-    (save-excursion
-      (elmo-imap4-send-command buffer
-                              process "noop")
-      (elmo-imap4-read-response buffer process))))
+  (let ((session (elmo-imap4-get-session spec))
+       status)
+    (with-current-buffer (elmo-network-session-buffer session)
+      (setq elmo-imap4-status-callback nil)
+      (setq elmo-imap4-status-callback-data nil))
+    (setq status (elmo-imap4-response-value
+                 (elmo-imap4-send-command-wait
+                  session
+                  (list "status "
+                        (elmo-imap4-mailbox
+                         (elmo-imap4-spec-mailbox spec))
+                        " (uidnext messages)"))
+                 'status))
+    (cons
+     (- (elmo-imap4-response-value status 'uidnext) 1)
+     (elmo-imap4-response-value status 'messages))))
+
+(defun elmo-imap4-folder-diff (spec folder &optional number-list)
+  (if elmo-use-server-diff
+      (elmo-imap4-server-diff spec)
+    (elmo-generic-folder-diff spec folder number-list)))
+    
+(defun elmo-imap4-get-session (spec &optional if-exists)
+  (elmo-network-get-session
+   'elmo-imap4-session
+   "IMAP"
+   (elmo-imap4-spec-hostname spec)
+   (elmo-imap4-spec-port spec)
+   (elmo-imap4-spec-username spec)
+   (elmo-imap4-spec-auth spec)
+   (elmo-imap4-spec-stream-type spec)
+   if-exists))
 
 (defun elmo-imap4-commit (spec)
-  (save-excursion
-    (let ((connection (elmo-imap4-get-connection spec))
-         response ret-val beg end)
-      (and (not (null (elmo-imap4-spec-folder spec)))
-          (if (not (string= (elmo-imap4-connection-get-cwf connection)
-                            (elmo-imap4-spec-folder spec)))
-              (if (null (setq response
-                              (elmo-imap4-select-folder
-                               (elmo-imap4-spec-folder spec)
-                               connection)))
-                  (error "Select folder failed"))
-            (if elmo-imap4-use-select-to-update-status
-                (elmo-imap4-select-folder
-                 (elmo-imap4-spec-folder spec)
-                 connection)
-              (elmo-imap4-check connection)))))))
-
-(defun elmo-imap4-check (connection)
-  (let ((process (elmo-imap4-connection-get-process connection)))
-    (save-excursion
-      (elmo-imap4-send-command (process-buffer process)
-                              process "check")
-      (elmo-imap4-read-response (process-buffer process) process))))
-
-(defun elmo-imap4-select-folder (folder connection)
-  (let ((process (elmo-imap4-connection-get-process connection))
-       response)
-    (save-excursion
+  (if (elmo-imap4-plugged-p spec)
+      (let ((session (elmo-imap4-get-session spec 'if-exists)))
+       (when session
+         (if (string=
+              (elmo-imap4-session-current-mailbox-internal session)
+              (elmo-imap4-spec-mailbox spec))
+             (if elmo-imap4-use-select-to-update-status
+                 (elmo-imap4-session-select-mailbox
+                  session
+                  (elmo-imap4-spec-mailbox spec)
+                  'force)            
+               (elmo-imap4-session-check session)))))))
+  
+(defun elmo-imap4-session-select-mailbox (session mailbox &optional force)
+  (when (or force
+           (not (string=
+                 (elmo-imap4-session-current-mailbox-internal session)
+                 mailbox)))
+    (let (response)
       (unwind-protect
-         (progn
-           (elmo-imap4-send-command (process-buffer process)
-                                    process (format "select \"%s\""
-                                                    folder))
-           (setq response (elmo-imap4-read-response
-                           (process-buffer process) process)))
-       (if (null response)
+         (setq response
+               (elmo-imap4-read-response
+                session
+                (elmo-imap4-send-command
+                 session
+                 (list
+                  "select "
+                  (elmo-imap4-mailbox mailbox)))))
+       (if (elmo-imap4-response-ok-p response)
            (progn
-             (setcar (cddr connection) nil)
-             (error "Select folder failed"))
-         (setcar (cddr connection) folder))))
-    response))
+             (elmo-imap4-session-set-current-mailbox-internal session mailbox)
+             (elmo-imap4-session-set-read-only-internal
+              session
+              (nth 1 (assq 'read-only (assq 'ok response)))))
+         (elmo-imap4-session-set-current-mailbox-internal session nil)
+         (error (or
+                 (elmo-imap4-response-error-text response)
+                 (format "Select %s failed" mailbox))))))))
 
 (defun elmo-imap4-check-validity (spec validity-file)
-  "get uidvalidity value from server and compare it with validity-file."
-  (let* ((process (elmo-imap4-get-process spec))
-        response)
-    (save-excursion
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format "status \"%s\" (uidvalidity)"
-                                      (elmo-imap4-spec-folder spec)))
-      (setq response (elmo-imap4-read-response
-                     (process-buffer process) process))
-      (if (string-match "UIDVALIDITY \\([0-9]+\\)" response)
-         (string= (elmo-get-file-string validity-file)
-                  (elmo-match-string 1 response))
-       nil))))
+  ;; Not used.
+;  (elmo-imap4-send-command-wait
+;   (elmo-imap4-get-session spec)
+;   (list "status "
+;       (elmo-imap4-mailbox
+;        (elmo-imap4-spec-mailbox spec))
+;       " (uidvalidity)")))
+  )
 
 (defun elmo-imap4-sync-validity  (spec validity-file)
-  "get uidvalidity value from server and save it to validity-file."
-  (let* ((process (elmo-imap4-get-process spec))
-        response)
-    (save-excursion
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format "status \"%s\" (uidvalidity)"
-                                      (elmo-imap4-spec-folder spec)))
-      (setq response (elmo-imap4-read-response
-                     (process-buffer process) process))
-      (if (string-match "UIDVALIDITY \\([0-9]+\\)" response)
-         (progn
-           (elmo-save-string
-            (elmo-match-string 1 response)
-            validity-file)
-           t)
-       nil))))
-
-(defsubst elmo-imap4-list (spec str)
-  (save-excursion
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          response ret-val beg end)
-      (and (elmo-imap4-spec-folder spec)
-          (if (not (string= (elmo-imap4-connection-get-cwf connection)
-                            (elmo-imap4-spec-folder spec)))
-              (if (null (setq response
-                              (elmo-imap4-select-folder
-                               (elmo-imap4-spec-folder spec)
-                               connection)))
-                  (error "Select folder failed"))
-            ;; for status update.
-            (if elmo-imap4-use-select-to-update-status
-                (elmo-imap4-select-folder (elmo-imap4-spec-folder spec)
-                                          connection)
-              (unless (elmo-imap4-check connection)
-                ;; Check failed...not selected??
-                (elmo-imap4-select-folder (elmo-imap4-spec-folder spec)
-                                          connection)))))
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format (if elmo-imap4-use-uid
-                                          "uid search %s"
-                                        "search %s") str))
-      (setq response (elmo-imap4-read-response (process-buffer process)
-                                              process))
-      (if (and response (string-match "\\* SEARCH" response))
-         (progn
-           (setq response (substring response (match-end 0)))
-           (if (string-match "\n" response)
-               (progn
-                 (setq end (match-end 0))
-                 (setq ret-val (read (concat "(" (substring
-                                                  response
-                                                  0 end) ")"))))
-             (error "SEARCH failed"))))
-      ret-val)))
+  ;; Not used.
+  )
 
-(defun elmo-imap4-list-folder (spec)
-  (elmo-imap4-list spec "all"))
+(defun elmo-imap4-list (spec flag)
+  (let ((session (elmo-imap4-get-session spec)))
+    (elmo-imap4-session-select-mailbox session
+                                      (elmo-imap4-spec-mailbox spec))
+    (elmo-imap4-response-value
+     (elmo-imap4-send-command-wait
+      session
+      (format (if elmo-imap4-use-uid "uid search %s"
+               "search %s") flag))
+     'search)))
 
-(defun elmo-imap4-list-folder-unread (spec mark-alist unread-marks)
-  (if (elmo-imap4-use-flag-p spec)
+(defun elmo-imap4-list-folder (spec)
+  (let ((killed (and elmo-use-killed-list
+                    (elmo-msgdb-killed-list-load
+                     (elmo-msgdb-expand-path spec))))
+       numbers)
+    (setq numbers (elmo-imap4-list spec "all"))
+    (elmo-living-messages numbers killed)))
+
+(defun elmo-imap4-list-folder-unread (spec number-alist mark-alist
+                                          unread-marks)
+  (if (and (elmo-imap4-plugged-p spec)
+          (elmo-imap4-use-flag-p spec))
       (elmo-imap4-list spec "unseen")
-    (elmo-generic-list-folder-unread spec mark-alist unread-marks)))
+    (elmo-generic-list-folder-unread spec number-alist mark-alist
+                                    unread-marks)))
 
-(defun elmo-imap4-list-folder-important (spec overview)
-  (and (elmo-imap4-use-flag-p spec)
-       (elmo-imap4-list spec "flagged")))
+(defun elmo-imap4-list-folder-important (spec number-alist)
+  (if (and (elmo-imap4-plugged-p spec)
+          (elmo-imap4-use-flag-p spec))
+      (elmo-imap4-list spec "flagged")))
+
+(defmacro elmo-imap4-detect-search-charset (string)
+  (` (with-temp-buffer
+       (insert (, string))
+       (detect-mime-charset-region (point-min) (point-max)))))
 
-(defun elmo-imap4-search-internal (process buffer filter)
+(defun elmo-imap4-search-internal-primitive (spec session filter from-msgs)
   (let ((search-key (elmo-filter-key filter))
-       word response)
+       (imap-search-keys '("bcc" "body" "cc" "from" "subject" "to"))
+       charset)
     (cond
+     ((string= "last" search-key)
+      (let ((numbers (or from-msgs (elmo-imap4-list-folder spec))))
+       (nthcdr (max (- (length numbers)
+                       (string-to-int (elmo-filter-value filter)))
+                    0)
+               numbers)))
+     ((string= "first" search-key)
+      (let* ((numbers (or from-msgs (elmo-imap4-list-folder spec)))
+            (rest (nthcdr (string-to-int (elmo-filter-value filter) )
+                          numbers)))
+       (mapcar '(lambda (x) (delete x numbers)) rest)
+       numbers))
      ((or (string= "since" search-key)
          (string= "before" search-key))
       (setq search-key (concat "sent" search-key))
-      (elmo-imap4-send-command buffer process
-                              (format
-                               (if elmo-imap4-use-uid
-                                   "uid search %s %s"
-                                 " search %s %s")
-                               search-key
-                               (elmo-date-get-description
-                                (elmo-date-get-datevec
-                                 (elmo-filter-value filter))))))
+      (elmo-imap4-response-value
+       (elmo-imap4-send-command-wait session
+                                    (format
+                                     (if elmo-imap4-use-uid
+                                         "uid search %s%s%s %s"
+                                       "search %s%s%s %s")
+                                     (if from-msgs
+                                         (concat
+                                          (if elmo-imap4-use-uid "uid ")
+                                          (cdr
+                                           (car 
+                                            (elmo-imap4-make-number-set-list
+                                             from-msgs)))
+                                          " ")
+                                       "")
+                                     (if (eq (elmo-filter-type filter)
+                                             'unmatch)
+                                         "not " "")
+                                     search-key
+                                     (elmo-date-get-description
+                                      (elmo-date-get-datevec
+                                       (elmo-filter-value filter)))))
+       'search))
      (t
-      (setq word (encode-mime-charset-string (elmo-filter-value filter)
-                                            elmo-search-mime-charset))
-      (elmo-imap4-send-command buffer process
-                              (format
-                               (if elmo-imap4-use-uid
-                                   "uid search CHARSET %s%s %s {%d}"
-                                 " search CHARSET %s%s %s {%d}")
-                               (symbol-name elmo-search-mime-charset)
-                               (if (eq (elmo-filter-type filter) 'unmatch)
-                                   " not" "")
-                               (elmo-filter-key filter)
-                               (length word)))
-      (if (null (elmo-imap4-read-response buffer process t))
-         (error "Searching failed because of server capability??"))
-      (elmo-imap4-send-string buffer process word)))
-    (if (null (setq response (elmo-imap4-read-response buffer process)))
-       (error "Search failed for %s" (elmo-filter-key filter)))
-    (if (string-match "^\\* SEARCH\\([^\n]*\\)$" response)
-       (read (concat "(" (elmo-match-string 1 response) ")"))
-      (error "SEARCH failed"))))
+      (setq charset
+           (if (eq (length (elmo-filter-value filter)) 0)
+               (setq charset 'us-ascii)
+             (elmo-imap4-detect-search-charset
+              (elmo-filter-value filter))))
+      (elmo-imap4-response-value
+       (elmo-imap4-send-command-wait session
+                                    (list
+                                     (if elmo-imap4-use-uid "uid ")
+                                     "search "
+                                     "CHARSET "
+                                     (elmo-imap4-astring
+                                      (symbol-name charset))
+                                     " "
+                                     (if from-msgs
+                                         (concat
+                                          (if elmo-imap4-use-uid "uid ")
+                                          (cdr
+                                           (car
+                                            (elmo-imap4-make-number-set-list
+                                             from-msgs)))
+                                          " ")
+                                       "")
+                                     (if (eq (elmo-filter-type filter)
+                                             'unmatch)
+                                         "not " "")
+                                     (format "%s%s "
+                                             (if (member
+                                                  (elmo-filter-key filter)
+                                                  imap-search-keys)
+                                                 ""
+                                               "header ")
+                                             (elmo-filter-key filter))
+                                     (elmo-imap4-astring
+                                      (encode-mime-charset-string
+                                       (elmo-filter-value filter) charset))))
+       'search)))))
+
+(defun elmo-imap4-search-internal (spec session condition from-msgs)
+  (let (result)
+    (cond
+     ((vectorp condition)
+      (setq result (elmo-imap4-search-internal-primitive
+                   spec session condition from-msgs)))
+     ((eq (car condition) 'and)
+      (setq result (elmo-imap4-search-internal spec session (nth 1 condition)
+                                              from-msgs)
+           result (elmo-list-filter result
+                                    (elmo-imap4-search-internal
+                                     spec session (nth 2 condition)
+                                     from-msgs))))
+     ((eq (car condition) 'or)
+      (setq result (elmo-imap4-search-internal
+                   spec session (nth 1 condition) from-msgs)
+           result (elmo-uniq-list
+                   (nconc result
+                          (elmo-imap4-search-internal
+                           spec session (nth 2 condition) from-msgs)))
+           result (sort result '<))))))
+    
 
 (defun elmo-imap4-search (spec condition &optional from-msgs)
   (save-excursion
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          response ret-val len word)
-      (if (and (elmo-imap4-spec-folder spec)
-              (not (string= (elmo-imap4-connection-get-cwf connection)
-                            (elmo-imap4-spec-folder spec)))
-              (null (elmo-imap4-select-folder
-                     (elmo-imap4-spec-folder spec) connection)))
-         (error "Select folder failed"))
-      (while condition
-       (setq response (elmo-imap4-search-internal process
-                                                  (process-buffer process)
-                                                  (car condition)))
-       (setq ret-val (nconc ret-val response))
-       (setq condition (cdr condition)))
-      (if from-msgs
-         (elmo-list-filter
-          from-msgs
-          (elmo-uniq-list (sort ret-val '<)))
-       (elmo-uniq-list (sort ret-val '<))))))
-
-(defsubst elmo-imap4-value (value)
-  (if (eq value 'NIL) nil
-    value))
+    (let ((session (elmo-imap4-get-session spec)))
+      (elmo-imap4-session-select-mailbox
+       session
+       (elmo-imap4-spec-mailbox spec))
+      (elmo-imap4-search-internal spec session condition from-msgs))))
 
-(defmacro elmo-imap4-nth (pos list)
-  (` (let ((value (nth (, pos) (, list))))
-       (if (eq 'NIL value)
-          nil
-        value))))
-  
 (defun elmo-imap4-use-flag-p (spec)
   (not (string-match elmo-imap4-disuse-server-flag-mailbox-regexp
-                    (elmo-imap4-spec-folder spec))))
-
-(defsubst elmo-imap4-make-address (name mbox host)
-  (cond (name
-        (concat name " <" mbox "@" host ">"))
-       (t
-        (concat mbox "@" host))))
+                    (elmo-imap4-spec-mailbox spec))))
 
 (static-cond
  ((fboundp 'float)
   ;; Emacs can parse dot symbol.
   (defvar elmo-imap4-rfc822-size "RFC822\.SIZE")
+  (defvar elmo-imap4-rfc822-text "RFC822\.TEXT")
+  (defvar elmo-imap4-rfc822-header "RFC822\.HEADER")
+  (defvar elmo-imap4-rfc822-size "RFC822\.SIZE")
   (defvar elmo-imap4-header-fields "HEADER\.FIELDS")
   (defmacro elmo-imap4-replace-dot-symbols ()) ;; noop
+  (defalias 'elmo-imap4-fetch-read 'read)
   )
  (t
-  ;; Cannot parse dot symbol, replace it.
+  ;;; For Nemacs.
+  ;; Cannot parse dot symbol.
   (defvar elmo-imap4-rfc822-size "RFC822_SIZE")
   (defvar elmo-imap4-header-fields "HEADER_FIELDS")
-  (defmacro elmo-imap4-replace-dot-symbols ()
-    (goto-char (point-min))
-    (while (re-search-forward "RFC822\\.SIZE" nil t)
-      (replace-match elmo-imap4-rfc822-size))
-    (goto-char (point-min))
-    (while (re-search-forward "HEADER\\.FIELDS" nil t)
-      (replace-match elmo-imap4-header-fields))
-    (goto-char (point-min)))))
-
-(defsubst elmo-imap4-make-attributes-object (string)
-  (save-match-data
-    (elmo-set-work-buf
-     (elmo-set-buffer-multibyte nil)
-     (insert string)
-     (goto-char (point-min))
-     (let ((case-fold-search t))
-       (goto-char (point-min))
-       (while (re-search-forward "{\\([0-9]+\\)}\r\n" nil t)
-        (let (str)
-          (goto-char (+ (point)
-                        (string-to-int (elmo-match-buffer 1))))
-          (setq str (save-match-data
-                      (elmo-replace-in-string
-                       (buffer-substring (match-end 0) (point))
-                       "\r" "")))
-          (delete-region (match-beginning 0) (point))
-          (insert (prin1-to-string str))))
-       (goto-char (point-min))
-       (elmo-imap4-replace-dot-symbols)
-       (read (current-buffer))))))
-
-
-(defun elmo-imap4-parse-overview-string (string)
-  (if (null string)
-      (error "Getting overview failed"))
-  (with-temp-buffer
-    (let (ret-val beg attr number)
-      (elmo-set-buffer-multibyte nil)
-      (insert string)
-      (goto-char (point-min))
-      (setq beg (point))
-      (if (re-search-forward "^\* \\([0-9]+\\) FETCH"
-                            nil t)
-         (progn
-           (setq beg (point))
-           (unless elmo-imap4-use-uid
-             (setq number (string-to-int (elmo-match-buffer 1))))
-           (while (re-search-forward
-                   "^\* \\([0-9]+\\) FETCH"
-                   nil t)
-             (setq attr (elmo-imap4-make-attributes-object
-                         (buffer-substring beg (match-beginning 0))))
-             (setq beg (point))
-             (unless elmo-imap4-use-uid
-               (setq attr(nconc (list 'UID number) attr))
-               (setq number (string-to-int (elmo-match-buffer 1))))
-             (setq ret-val (cons attr ret-val)))
-           ;; process last one...
-           (setq attr (elmo-imap4-make-attributes-object
-                       (buffer-substring beg (point-max))))
-           (unless elmo-imap4-use-uid
-             (setq attr(nconc (list 'UID number) attr)))
-           (setq ret-val (cons attr ret-val))))
-      (nreverse ret-val))))
-
-(defun elmo-imap4-create-msgdb-from-overview-string (str
-                                                    folder
-                                                    new-mark
-                                                    already-mark
-                                                    seen-mark
-                                                    important-mark
-                                                    seen-list
-                                                    &optional numlist)
-  (let ((case-fold-search t)
-       (size-sym (intern elmo-imap4-rfc822-size))
-       overview attr-list attr pair section
-       number important message-id from-list from-string
-       to-string cc-string
-       number-alist mark-alist
-       reference subject date-string size flags gmark seen
-       index extras extra-fields sym value)
-    (setq attr-list (elmo-imap4-parse-overview-string str))
-    (while attr-list
-      (setq attr (car attr-list))
-      ;; Remove section data. (origin octed is not considered.(OK?))
-      (setq section (cadr (memq 'BODY attr)))
-      (if (vectorp section)
-         (delq section attr))
-      ;; number
-      (setq number (cadr (memq 'UID attr)))
-      (when (or (null numlist)
-               (memq number numlist))
-       (while attr
-         (setq sym (car attr))
-         (setq value (cadr attr))
-         (setq attr (cdr (cdr attr)))
-         (cond
-          ((eq sym 'UID))
-          ;; noop
-          ((eq sym 'FLAGS)
-           (setq flags value))
-          ((eq sym size-sym)
-           (setq size value))
-          ((eq sym 'BODY)
-           (setq extra-fields (elmo-collect-field-from-string value t)))
-          ((eq sym 'ENVELOPE)
-           ;; According to rfc2060,
-           ;; 0 date, 1 subject, 2 from, 3 sender,
-           ;; 4 reply-to, 5 to, 6 cc, 7 bcc, 8 in-reply-to, 9 message-id.
-           (setq date-string (elmo-imap4-nth 0 value))
-           (setq subject (elmo-mime-string (or (elmo-imap4-nth 1 value)
-                                               elmo-no-subject)))
-           (setq from-list (car (elmo-imap4-nth 2 value)))
-           (setq from-string (or
-                              (and (or (elmo-imap4-nth 0 from-list)
-                                       (elmo-imap4-nth 2 from-list)
-                                       (elmo-imap4-nth 3 from-list))
-                                   (elmo-delete-char
-                                    ?\"
-                                    (elmo-imap4-make-address
-                                     (elmo-imap4-nth 0 from-list)
-                                     (elmo-imap4-nth 2 from-list)
-                                     (elmo-imap4-nth 3 from-list))
-                                    'uni))
-                              elmo-no-from))
-           (setq to-string (mapconcat
-                            '(lambda (to)
-                               (elmo-imap4-make-address
-                                (elmo-imap4-nth 0 to)
-                                (elmo-imap4-nth 2 to)
-                                (elmo-imap4-nth 3 to)))
-                            (elmo-imap4-nth 5 value) ","))
-           (setq cc-string (mapconcat
-                            '(lambda (cc)
-                               (elmo-imap4-make-address
-                                (elmo-imap4-nth 0 cc)
-                                (elmo-imap4-nth 2 cc)
-                                (elmo-imap4-nth 3 cc)))
-                            (elmo-imap4-nth 6 value) ","))
-           (setq reference (elmo-msgdb-get-last-message-id
-                            (elmo-imap4-nth 8 value)))
-           (setq message-id (elmo-imap4-nth 9 value)))))
-       (when (setq pair (assoc "references" extra-fields))
-         (setq extra-fields (delq pair extra-fields)))
-       (unless reference
-         (setq reference (elmo-msgdb-get-last-message-id (cdr pair))))
-       (setq overview
-             (elmo-msgdb-append-element
-              overview
-              (cons message-id
-                    (vector number
-                            reference
-                            (elmo-mime-string from-string)
-                            (elmo-mime-string subject)
-                            date-string
-                            to-string
-                            cc-string
-                            size
-                            extra-fields))))
-       (if (memq 'Flagged flags)
-           (elmo-msgdb-global-mark-set message-id important-mark))
-       (setq number-alist
-             (elmo-msgdb-number-add number-alist number message-id))
-       (setq seen (member message-id seen-list))
-       (if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
-                           (if (elmo-cache-exists-p message-id) ;; XXX
-                               (if (or (memq 'Seen flags) seen)
-                                   nil
-                                 already-mark)
-                             (if (or (memq 'Seen flags) seen)
-                                 (if elmo-imap4-use-cache
-                                     seen-mark)
-                               new-mark))))
-           (setq mark-alist (elmo-msgdb-mark-append
-                             mark-alist
-                             number
-                             ;; managing mark with message-id is evil.
-                             gmark))))
-      (setq attr-list (cdr attr-list)))
-    (list overview number-alist mark-alist)))
-
-(defun elmo-imap4-add-to-cont-list (cont-list msg)
-  (let ((elist cont-list)
-       (ret-val cont-list)
-       entity found)
-    (while (and elist (not found))
-      (setq entity (car elist))
-      (cond
-       ((and (consp entity)
-            (eq (+ 1 (cdr entity)) msg))
-       (setcdr entity msg)
-       (setq found t))
-       ((and (integerp entity)
-            (eq (+ 1 entity) msg))
-       (setcar elist (cons entity msg))
-       (setq found t))
-       ((or (and (integerp entity) (eq entity msg))
-           (and (consp entity)
-                (<= (car entity) msg)
-                (<= msg (cdr entity)))) ; included
-       (setq found t))); noop
-      (setq elist (cdr elist)))
-    (if (not found)
-       (setq ret-val (append cont-list (list msg))))
-    ret-val))
+  (defvar elmo-imap4-rfc822-size "RFC822_SIZE")
+  (defvar elmo-imap4-rfc822-text "RFC822_TEXT")
+  (defvar elmo-imap4-rfc822-header "RFC822_HEADER")
+  (defvar elmo-imap4-header-fields "HEADER_FIELDS")
+  (defun elmo-imap4-fetch-read (buffer)
+    (with-current-buffer buffer
+      (let ((beg (point))
+           token)
+       (when (re-search-forward "[[ ]" nil t)
+         (goto-char (match-beginning 0))
+         (setq token (buffer-substring beg (point)))
+         (cond ((string= token "RFC822.SIZE")
+                (intern elmo-imap4-rfc822-size))
+               ((string= token "RFC822.HEADER")
+                (intern elmo-imap4-rfc822-header))
+               ((string= token "RFC822.TEXT")
+                (intern elmo-imap4-rfc822-text))
+               ((string= token "HEADER\.FIELDS")
+                (intern elmo-imap4-header-fields))
+               (t (goto-char beg)
+                  (elmo-read (current-buffer))))))))))
 
 (defun elmo-imap4-make-number-set-list (msg-list &optional chop-length)
   "Make RFC2060's message set specifier from MSG-LIST.
@@ -862,7 +904,7 @@ NUMBER is contained message number in SET-STRING.
 Every SET-STRING does not contain number of messages longer than CHOP-LENGTH.
 If CHOP-LENGTH is not specified, message set is not chopped."
   (let (count cont-list set-list)
-    (setq msg-list (sort msg-list '<))
+    (setq msg-list (sort (copy-sequence msg-list) '<))
     (while msg-list
       (setq cont-list nil)
       (setq count 0)
@@ -871,7 +913,7 @@ If CHOP-LENGTH is not specified, message set is not chopped."
       (while (and (not (null msg-list))
                  (< count chop-length))
        (setq cont-list
-             (elmo-imap4-add-to-cont-list
+             (elmo-number-set-append
               cont-list (car msg-list)))
        (incf count)
        (setq msg-list (cdr msg-list)))
@@ -899,36 +941,27 @@ If CHOP-LENGTH is not specified, message set is not chopped."
 (defun elmo-imap4-mark-set-on-msgs (spec msgs mark &optional unmark no-expunge)
   "SET flag of MSGS as MARK.
 If optional argument UNMARK is non-nil, unmark."
-  (save-excursion
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          (msg-list (copy-sequence msgs))
-          set-list ent)
-      (if (and (elmo-imap4-spec-folder spec)
-              (not (string= (elmo-imap4-connection-get-cwf connection)
-                            (elmo-imap4-spec-folder spec)))
-              (null (elmo-imap4-select-folder
-                     (elmo-imap4-spec-folder spec) connection)))
-         (error "Select folder failed"))
-      (setq set-list (elmo-imap4-make-number-set-list msg-list))
-      (when set-list
-       (elmo-imap4-send-command (process-buffer process)
-                                process
-                                (format
-                                 (if elmo-imap4-use-uid
-                                     "uid store %s %sflags.silent (%s)"
-                                   "store %s %sflags.silent (%s)")
-                                 (cdr (car set-list))
-                                 (if unmark "-" "+")
-                                 mark))
-       (unless (elmo-imap4-read-response (process-buffer process) process)
-         (error "Store %s flag failed" mark))
-       (unless no-expunge
-         (elmo-imap4-send-command
-          (process-buffer process) process "expunge")
-         (unless (elmo-imap4-read-response (process-buffer process) process)
-           (error "Expunge failed"))))
-      t)))
+  (let ((session (elmo-imap4-get-session spec))
+       set-list)
+    (elmo-imap4-session-select-mailbox session
+                                      (elmo-imap4-spec-mailbox spec))
+    (setq set-list (elmo-imap4-make-number-set-list msgs))
+    (when set-list
+      (with-current-buffer (elmo-network-session-buffer session)
+       (setq elmo-imap4-fetch-callback nil)
+       (setq elmo-imap4-fetch-callback-data nil))
+      (elmo-imap4-send-command-wait
+       session
+       (format
+       (if elmo-imap4-use-uid
+           "uid store %s %sflags.silent (%s)"
+         "store %s %sflags.silent (%s)")
+       (cdr (car set-list))
+       (if unmark "-" "+")
+       mark))
+      (unless no-expunge
+       (elmo-imap4-send-command-wait session "expunge")))
+    t))
 
 (defun elmo-imap4-mark-as-important (spec msgs)
   (and (elmo-imap4-use-flag-p spec)
@@ -960,273 +993,256 @@ If optional argument UNMARK is non-nil, unmark."
   (elmo-imap4-msgdb-create spec numlist new-mark already-mark
                           seen-mark important-mark seen-list t))
 
-(defun elmo-imap4-msgdb-create (spec numlist new-mark already-mark seen-mark
-                                    important-mark seen-list &optional as-num)
+;; Current buffer is process buffer.
+(defun elmo-imap4-fetch-callback (element app-data)
+  (funcall elmo-imap4-fetch-callback
+          (with-temp-buffer
+            (insert (or (elmo-imap4-response-bodydetail-text element)
+                        ""))
+            ;; Delete CR.
+            (goto-char (point-min))
+            (while (search-forward "\r\n" nil t)
+              (replace-match "\n"))
+            (elmo-msgdb-create-overview-from-buffer
+             (elmo-imap4-response-value element 'uid)
+             (elmo-imap4-response-value element 'rfc822size)))
+          (elmo-imap4-response-value element 'flags)
+          app-data))
+
+;;
+;; app-data:
+;; 0: new-mark 1: already-mark 2: seen-mark 3: important-mark
+;; 4: seen-list 5: as-number
+(defun elmo-imap4-fetch-callback-1 (entity flags app-data)
+  "A msgdb entity callback function."
+  (let ((seen (member (car entity) (nth 4 app-data)))
+       mark)
+    (if (member "\\Flagged" flags)
+       (elmo-msgdb-global-mark-set (car entity) (nth 3 app-data)))
+    (setq mark (or (elmo-msgdb-global-mark-get (car entity))
+                  (if (elmo-cache-exists-p (car entity)) ;; XXX
+                      (if (or (member "\\Seen" flags) seen)
+                          nil
+                        (nth 1 app-data))
+                    (if (or (member "\\Seen" flags) seen)
+                        (if elmo-imap4-use-cache
+                            (nth 2 app-data))
+                      (nth 0 app-data)))))
+    (setq elmo-imap4-current-msgdb
+         (elmo-msgdb-append
+          elmo-imap4-current-msgdb
+          (list (list entity)
+                (list (cons (elmo-msgdb-overview-entity-get-number entity)
+                            (car entity)))
+                (if mark
+                    (list
+                     (list (elmo-msgdb-overview-entity-get-number entity)
+                           mark))))))))
+
+(defun elmo-imap4-msgdb-create (spec numlist &rest args)
   "Create msgdb for SPEC."
   (when numlist
-    (save-excursion
-      (let* ((connection (elmo-imap4-get-connection spec))
-            (process    (elmo-imap4-connection-get-process connection))
-            (filter     (and as-num numlist))
-            (case-fold-search t)
-            (extra-fields (if elmo-msgdb-extra-fields
-                              (concat " " (mapconcat
-                                           'identity
-                                           elmo-msgdb-extra-fields " "))
-                            ""))
-            rfc2060 count ret-val set-list ov-str length)
-       (setq rfc2060 (with-current-buffer (process-buffer process)
-                       (if (memq 'imap4rev1 elmo-imap4-server-capability)
-                           t
-                         (if (memq 'imap4 elmo-imap4-server-capability)
-                             nil
-                           (error "No IMAP4 capability!!")))))
-       (setq count 0)
-       (setq length (length numlist))
-       (setq set-list (elmo-imap4-make-number-set-list
-                       numlist
-                       elmo-imap4-overview-fetch-chop-length))
-       (message "Getting overview...")
-       (if (and (elmo-imap4-spec-folder spec)
-                (not (string= (elmo-imap4-connection-get-cwf connection)
-                              (elmo-imap4-spec-folder spec)))
-                (null (elmo-imap4-select-folder
-                       (elmo-imap4-spec-folder spec) connection)))
-           (error "Select imap folder %s failed"
-                  (elmo-imap4-spec-folder spec)))
+    (let ((session (elmo-imap4-get-session spec))
+         (headers
+          (append
+           '("Subject" "From" "To" "Cc" "Date"
+             "Message-Id" "References" "In-Reply-To")
+           elmo-msgdb-extra-fields))
+         (total 0)
+         (length (length numlist))
+         rfc2060 set-list)
+      (setq rfc2060 (memq 'imap4rev1
+                         (elmo-imap4-session-capability-internal
+                          session)))
+      (message "Getting overview...")
+      (elmo-imap4-session-select-mailbox session
+                                        (elmo-imap4-spec-mailbox spec))
+      (setq set-list (elmo-imap4-make-number-set-list
+                     numlist
+                     elmo-imap4-overview-fetch-chop-length))
+      ;; Setup callback.
+      (with-current-buffer (elmo-network-session-buffer session)
+       (setq elmo-imap4-current-msgdb nil
+             elmo-imap4-fetch-callback 'elmo-imap4-fetch-callback-1
+             elmo-imap4-fetch-callback-data args)
        (while set-list
-         (elmo-imap4-send-command
-          (process-buffer process)
-          process
+         (elmo-imap4-send-command-wait
+          session
           ;; get overview entity from IMAP4
-          (format
-           (if rfc2060
-               (concat
-                (if elmo-imap4-use-uid "uid " "")
-                "fetch %s (envelope body.peek[header.fields (references"
-                extra-fields
-                ")] rfc822.size flags)")
-             (concat
-              (if elmo-imap4-use-uid "uid " "")
-              "fetch %s (envelope rfc822.size flags)"))
-           (cdr (car set-list))))
-         ;; process string while waiting for response
-         (with-current-buffer (process-buffer process)
-           (if ov-str
-               (setq ret-val
-                     (elmo-msgdb-append
-                      ret-val
-                      (elmo-imap4-create-msgdb-from-overview-string
-                       ov-str
-                       (elmo-imap4-spec-folder spec)
-                       new-mark already-mark seen-mark important-mark
-                       seen-list filter)))))
-         (setq count (+ count (car (car set-list))))
-         (setq ov-str (elmo-imap4-read-contents (process-buffer process)
-                                                process))
-         (elmo-display-progress
-          'elmo-imap4-msgdb-create "Getting overview..."
-          (/ (* count 100) length))
+          (format "%sfetch %s (%s rfc822.size flags)"
+                  (if elmo-imap4-use-uid "uid " "")
+                  (cdr (car set-list))
+                  (if rfc2060
+                      (format "body.peek[header.fields %s]" headers)
+                    (format "%s" headers))))
+         (when (> length elmo-display-progress-threshold)
+           (setq total (+ total (car (car set-list))))
+           (elmo-display-progress
+            'elmo-imap4-msgdb-create "Getting overview..."
+            (/ (* total 100) length)))
          (setq set-list (cdr set-list)))
-       ;; process last one.
-       (with-current-buffer (process-buffer process)
-         (if ov-str
-             (setq ret-val
-                   (elmo-msgdb-append
-                    ret-val
-                    (elmo-imap4-create-msgdb-from-overview-string
-                     ov-str
-                     (elmo-imap4-spec-folder spec)
-                     new-mark already-mark seen-mark important-mark
-                     seen-list filter)))))
        (message "Getting overview...done.")
-       ret-val))))
-
-(defun elmo-imap4-parse-response (string)
-  (if (string-match "^\\*\\(.*\\)$" string)
-      (read (concat "(" (elmo-match-string 1 string) ")"))))
+       elmo-imap4-current-msgdb))))
 
 (defun elmo-imap4-parse-capability (string)
   (if (string-match "^\\*\\(.*\\)$" string)
-      (read (concat "(" (downcase (elmo-match-string 1 string)) ")"))))
-
-(defun elmo-imap4-parse-namespace (obj)
-  (let ((ns (cdr obj))
-       (i 0)
-       prefix delim
-       cur namespace-alist)
-    ;; 0: personal, 1: other, 2: shared
-    (while (< i 3)
-      (setq cur (elmo-imap4-nth i ns))
-      (incf i)
-      (while cur
-       (setq prefix (elmo-imap4-nth 0 (car cur)))
-       (setq delim    (elmo-imap4-nth 1 (car cur)))
-       (if (and prefix delim
-                (string-match (concat "\\(.*\\)"
-                                      (regexp-quote delim)
-                                      "\\'")
-                              prefix))
-           (setq prefix (substring prefix (match-beginning 1)(match-end 1))))
-       (setq namespace-alist (nconc namespace-alist
-                                    (list (cons
-                                           (concat "^" (regexp-quote prefix)
-                                                   ".*$")
-                                           delim))))
-       (setq cur (cdr cur))))
-    (append
-     elmo-imap4-extra-namespace-alist
-     (sort namespace-alist
-          '(lambda (x y)
-             (> (length (car x))
-                (length (car y))))))))
-
-(defun elmo-imap4-open-connection (imap4-server user auth port passphrase ssl)
-  "Open Imap connection and returns
-the list of (process session-buffer current-working-folder).
-Return nil if connection failed."
-  (let ((process nil)
-       (host imap4-server)
-       process-buffer ret-val response capability)
-    (catch 'done
-      (as-binary-process
-       (setq process-buffer
-            (get-buffer-create (format " *IMAP session to %s:%d" host port)))
-       (save-excursion
-        (set-buffer process-buffer)
-        (elmo-set-buffer-multibyte nil)
-        (make-variable-buffer-local 'elmo-imap4-server-capability)
-        (make-variable-buffer-local 'elmo-imap4-lock)
-        (erase-buffer))
-       (setq process
-            (elmo-open-network-stream "IMAP" process-buffer host port ssl))
-       (and (null process) (throw 'done nil))
-       (set-process-filter process 'elmo-imap4-process-filter)
-       ;; flush connections when exiting...
-       (save-excursion
-        (set-buffer process-buffer)
-        (make-local-variable 'elmo-imap4-read-point)
-        (setq elmo-imap4-read-point (point-min))
-        (if (null (setq response
-                        (elmo-imap4-read-response process-buffer process t)))
-            (throw 'done nil)
-          (when (string-match "^\\* PREAUTH" response)
-            (setq ret-val (cons process-buffer process))
-            (throw 'done nil)))
-        (elmo-imap4-send-command process-buffer process "capability")
-        (setq elmo-imap4-server-capability
-              (elmo-imap4-parse-capability
-               (elmo-imap4-read-response process-buffer process)))
-        (setq capability elmo-imap4-server-capability)
-        (if (eq ssl 'starttls)
-            (if (and (memq 'starttls capability)
-                     (progn
-                       (elmo-imap4-send-command process-buffer process "starttls")
-                       (setq response
-                             (elmo-imap4-read-response process-buffer process)))
-                     
-                     (string-match
-                      (concat "^\\(" elmo-imap4-seq-prefix
-                              (int-to-string elmo-imap4-seqno)
-                              "\\|\\*\\) OK")
-                      response))
-                (starttls-negotiate process)
-              (error "STARTTLS aborted")))
-        (if (or (and (string= "auth" auth)
-                     (not (memq 'auth=login capability)))
-                (and (string= "cram-md5" auth)
-                     (not (memq 'auth=cram-md5 capability)))
-                (and (string= "digest-md5" auth)
-                     (not (memq 'auth=digest-md5 capability))))
-            (if (or elmo-imap4-force-login
-                    (y-or-n-p
-                     (format
-                      "There's no %s capability in server. continue?" auth)))
-                (setq auth "login")
-              (error "Login aborted")))
-        (cond
-         ((string= "auth" auth)
-          (elmo-imap4-send-command
-           process-buffer process "authenticate login" 'no-lock)
-          ;; Base64
-          (when (null (elmo-imap4-read-response process-buffer process t))
-            (setq ret-val (cons nil process))
-            (throw 'done nil))
-          (elmo-imap4-send-string
-           process-buffer process (elmo-base64-encode-string user))
-          (when (null (elmo-imap4-read-response process-buffer process t))
-            (setq ret-val (cons nil process))
-            (throw 'done nil))
-          (elmo-imap4-send-string
-           process-buffer process (elmo-base64-encode-string passphrase))
-          (when (null (elmo-imap4-read-response process-buffer process))
-            (setq ret-val (cons nil process))
-            (throw 'done nil))
-          (setq ret-val (cons process-buffer process)))
-         ((string= "cram-md5" auth)
-          (elmo-imap4-send-command
-           process-buffer process "authenticate cram-md5" 'no-lock)
-          (when (null (setq response
-                            (elmo-imap4-read-response
-                             process-buffer process t)))
-            (setq ret-val (cons nil process))
-            (throw 'done nil))
-          (setq response (cadr (split-string response " ")))
-          (elmo-imap4-send-string
-           process-buffer process
-           (elmo-base64-encode-string
-            (sasl-cram-md5 user passphrase
-                           (elmo-base64-decode-string response))))
-          (when (null (elmo-imap4-read-response process-buffer process))
-            (setq ret-val (cons nil process))
-            (throw 'done nil))
-          (setq ret-val (cons process-buffer process)))
-         ((string= "digest-md5" auth)
-          (elmo-imap4-send-command
-           process-buffer process "authenticate digest-md5" 'no-lock)
-          (when (null (setq response
-                            (elmo-imap4-read-response
-                             process-buffer process t)))
-            (setq ret-val (cons nil process))
-            (throw 'done nil))
-          (setq response (cadr (split-string response " ")))
-          (elmo-imap4-send-string
-           process-buffer process
-           (elmo-base64-encode-string
-            (sasl-digest-md5-digest-response
-             (elmo-base64-decode-string response)
-             user passphrase "imap" host)
-            'no-line-break))
-          (when (null (elmo-imap4-read-response
-                       process-buffer process t))
-            (setq ret-val (cons nil process))
-            (throw 'done nil))
-          (elmo-imap4-send-string process-buffer process "")
-          (when (null (elmo-imap4-read-response process-buffer process))
-            (setq ret-val (cons nil process))
-            (throw 'done nil))
-          (setq ret-val (cons process-buffer process)))
-         (t ;; not auth... try login
-          (elmo-imap4-send-command
-           process-buffer process
-           (format "login %s \"%s\"" user
-                   (elmo-replace-in-string passphrase
-                                           "\"" "\\\\\""))
-           nil 'no-log) ;; No LOGGING.
-          (if (null (elmo-imap4-read-response process-buffer process))
-              (setq ret-val (cons nil process))
-            (setq ret-val (cons process-buffer process)))))
-        ;; get namespace of server if possible.
-        (when (memq 'namespace elmo-imap4-server-capability)
-          (elmo-imap4-send-command process-buffer process "namespace")
-          (setq elmo-imap4-server-namespace
-                (elmo-imap4-parse-namespace
-                 (elmo-imap4-parse-response
-                  (elmo-imap4-read-response process-buffer process))))))))
-    ret-val))
-           
-(defun elmo-imap4-get-seqno ()
-  (setq elmo-imap4-seqno (+ 1 elmo-imap4-seqno)))
+      (elmo-read
+       (concat "(" (downcase (elmo-match-string 1 string)) ")"))))
+
+;; Current buffer is process buffer.
+(defun elmo-imap4-auth-login (session)
+  (let ((tag (elmo-imap4-send-command session "authenticate login"))
+       (elmo-imap4-debug-inhibit-logging t))
+    (or (elmo-imap4-read-continue-req session)
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-login)))
+    (elmo-imap4-send-string session
+                           (elmo-base64-encode-string
+                            (elmo-network-session-user-internal session)))
+    (or (elmo-imap4-read-continue-req session)
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-login)))
+    (elmo-imap4-send-string session
+                           (elmo-base64-encode-string
+                            (elmo-get-passwd
+                             (elmo-network-session-password-key session))))
+    (or (elmo-imap4-read-ok session tag)
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-login)))
+    (setq elmo-imap4-status 'auth)))
+
+(defun elmo-imap4-auth-cram-md5 (session)
+  (let ((tag (elmo-imap4-send-command session "authenticate cram-md5"))
+       (elmo-imap4-debug-inhibit-logging t)
+       response)
+    (or (setq response (elmo-imap4-read-continue-req session))
+       (signal 'elmo-authenticate-error
+               '(elmo-imap4-auth-cram-md5)))
+    (elmo-imap4-send-string
+     session
+     (elmo-base64-encode-string
+      (sasl-cram-md5 (elmo-network-session-user-internal session)
+                    (elmo-get-passwd
+                     (elmo-network-session-password-key session))
+                    (elmo-base64-decode-string response))))
+    (or (elmo-imap4-read-ok session tag)
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-cram-md5)))))
+
+(defun elmo-imap4-auth-digest-md5 (session)
+  (let ((tag (elmo-imap4-send-command session "authenticate digest-md5"))
+       (elmo-imap4-debug-inhibit-logging t)
+       response)
+    (or (setq response (elmo-imap4-read-continue-req session))
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-digest-md5)))
+    (elmo-imap4-send-string
+     session
+     (elmo-base64-encode-string
+      (sasl-digest-md5-digest-response
+       (elmo-base64-decode-string response)
+       (elmo-network-session-user-internal session)
+       (elmo-get-passwd (elmo-network-session-password-key session))
+       "imap"
+       (elmo-network-session-password-key session))
+      'no-line-break))
+    (or (setq response (elmo-imap4-read-continue-req session))
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-digest-md5)))
+    (elmo-imap4-send-string session "")
+    (or (elmo-imap4-read-ok session tag)
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-digest-md5)))))
+
+(defun elmo-imap4-login (session)
+  (let ((elmo-imap4-debug-inhibit-logging t))
+    (or
+     (elmo-imap4-read-ok
+      session
+      (elmo-imap4-send-command
+       session
+       (list "login "
+            (elmo-imap4-userid (elmo-network-session-user-internal session))
+            " "
+            (elmo-imap4-password
+             (elmo-get-passwd (elmo-network-session-password-key session))))))
+     (signal 'elmo-authenticate-error '(login)))))
+  
+(luna-define-method
+  elmo-network-initialize-session-buffer :after ((session
+                                                 elmo-imap4-session) buffer)
+  (with-current-buffer buffer
+    (mapcar 'make-variable-buffer-local elmo-imap4-local-variables)
+    (setq elmo-imap4-seqno 0)
+    (setq elmo-imap4-status 'initial)))
+
+(luna-define-method elmo-network-initialize-session ((session
+                                                     elmo-imap4-session))
+  (let ((process (elmo-network-session-process-internal session))
+       capability)
+    (with-current-buffer (process-buffer process)
+      ;; Skip garbage output from process before greeting.
+      (while (and (memq (process-status process) '(open run))
+                 (goto-char (point-max))
+                 (forward-line -1)
+                 (not (elmo-imap4-parse-greeting)))
+       (accept-process-output process 1))
+      (set-process-filter process 'elmo-imap4-arrival-filter)
+      (set-process-sentinel process 'elmo-imap4-sentinel)
+;;      (while (and (memq (process-status process) '(open run))
+;;               (eq elmo-imap4-status 'initial))
+;;        (message "Waiting for server response...")
+;;       (accept-process-output process 1))
+;;      (message "")
+      (unless (memq elmo-imap4-status '(nonauth auth))
+       (signal 'elmo-open-error
+               (list 'elmo-network-initialize-session)))
+      (elmo-imap4-session-set-capability-internal
+       session
+       (elmo-imap4-response-value
+       (elmo-imap4-send-command-wait session "capability")
+       'capability))
+      (when (eq (elmo-network-stream-type-symbol
+                (elmo-network-session-stream-type-internal session))
+               'starttls)
+       (or (memq 'starttls capability)
+           (signal 'elmo-open-error
+                   '(elmo-network-initialize-session)))
+       (elmo-imap4-send-command-wait session "starttls")
+       (starttls-negotiate process)))))
+
+(luna-define-method elmo-network-authenticate-session ((session
+                                                       elmo-imap4-session))
+ (with-current-buffer (process-buffer
+                      (elmo-network-session-process-internal session))
+   (unless (eq elmo-imap4-status 'auth)
+     (unless (or (not (elmo-network-session-auth-internal session))
+                (eq (elmo-network-session-auth-internal session) 'plain)
+                (and (memq (intern
+                            (format "auth=%s"
+                                    (elmo-network-session-auth-internal
+                                     session)))
+                           (elmo-imap4-session-capability-internal session))
+                     (assq
+                      (elmo-network-session-auth-internal session)
+                      elmo-imap4-authenticator-alist)))
+       (if (or elmo-imap4-force-login
+              (y-or-n-p
+               (format
+                "There's no %s capability in server. continue?"
+                (elmo-network-session-auth-internal session))))
+          (elmo-network-session-set-auth-internal session nil)
+        (signal 'elmo-open-error
+                '(elmo-network-initialize-session))))
+     (let ((authenticator
+           (if (elmo-network-session-auth-internal session)
+               (nth 1 (assq
+                       (elmo-network-session-auth-internal session)
+                       elmo-imap4-authenticator-alist))
+             'elmo-imap4-login)))
+       (funcall authenticator session)))))
+
+(luna-define-method elmo-network-setup-session ((session
+                                                elmo-imap4-session))
+  (with-current-buffer (elmo-network-session-buffer session)
+    (when (memq 'namespace (elmo-imap4-session-capability-internal session))
+      (setq elmo-imap4-server-namespace
+           (elmo-imap4-response-value
+            (elmo-imap4-send-command-wait session "namespace")
+            'namespace)))))
 
 (defun elmo-imap4-setup-send-buffer (string)
   (let ((tmp-buf (get-buffer-create " *elmo-imap4-setup-send-buffer*")))
@@ -1245,134 +1261,54 @@ Return nil if connection failed."
          (replace-match "\r\n"))))
     tmp-buf))
 
-(defun elmo-imap4-send-command (buffer process command &optional no-lock
-                                      no-log)
-  "Send COMMAND string to server with sequence number."
-  (save-excursion
-    (set-buffer buffer)
-    (when (and elmo-imap4-use-lock
-              elmo-imap4-lock)
-      (elmo-imap4-debug "send: (%d) is still locking." elmo-imap4-seqno)
-      (error "IMAP4 process is locked; Please try later (or plug again)"))
-    (erase-buffer)
-    (goto-char (point-min))
-    (setq elmo-imap4-read-point (point))
-    (unless no-lock
-      ;; for debug.
-      (if no-log
-         (elmo-imap4-debug "lock(%d): (No-logging command)." (+ elmo-imap4-seqno 1))
-       (elmo-imap4-debug "lock(%d): %s" (+ elmo-imap4-seqno 1) command))
-      (setq elmo-imap4-lock t))
-    (process-send-string process (concat (format "%s%d "
-                                                elmo-imap4-seq-prefix
-                                                (elmo-imap4-get-seqno))
-                                        command))
-    (process-send-string process "\r\n")))
-
-(defun elmo-imap4-send-string (buffer process string)
-  "Send STRING to server."
-  (save-excursion
-    (set-buffer buffer)
-    (erase-buffer)
-    (goto-char (point-min))
-    (setq elmo-imap4-read-point (point))
-    (process-send-string process string)
-    (process-send-string process "\r\n")))
-
 (defun elmo-imap4-read-part (folder msg part)
-  (save-excursion
-    (let* ((spec (elmo-folder-get-spec folder))
-          (connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          response ret-val bytes)
-      (when (elmo-imap4-spec-folder spec)
-       (when (not (string= (elmo-imap4-connection-get-cwf connection)
-                           (elmo-imap4-spec-folder spec)))
-         (if (null (setq response
-                         (elmo-imap4-select-folder
-                          (elmo-imap4-spec-folder spec) connection)))
-             (error "Select folder failed")))
-       (elmo-imap4-send-command (process-buffer process)
-                                process
-                                (format
-                                 (if elmo-imap4-use-uid
-                                     "uid fetch %s body.peek[%s]"
-                                   "fetch %s body.peek[%s]")
-                                 msg part))
-       (if (null (setq response (elmo-imap4-read-response
-                                 (process-buffer process)
-                                 process t)))
-           (error "Fetch failed"))
-       (save-match-data
-         (while (string-match "^\\* OK" response)
-           (if (null (setq response (elmo-imap4-read-response
-                                     (process-buffer process)
-                                     process t)))
-               (error "Fetch failed"))))
-       (save-match-data
-         (if (string-match ".*{\\([0-9]+\\)}" response)
-             (setq bytes
-                   (string-to-int
-                    (elmo-match-string 1 response)))
-           (error "Fetch failed")))
-       (if (null (setq response (elmo-imap4-read-bytes
-                                 (process-buffer process) process bytes)))
-           (error "Fetch message failed"))
-       (setq ret-val response)
-       (elmo-imap4-read-response (process-buffer process)
-                                 process)) ;; ignore remaining..
-      ret-val)))
+  (let* ((spec (elmo-folder-get-spec folder))
+        (session (elmo-imap4-get-session spec)))
+    (elmo-imap4-session-select-mailbox session
+                                      (elmo-imap4-spec-mailbox spec))
+    (with-current-buffer (elmo-network-session-buffer session)
+      (setq elmo-imap4-fetch-callback nil)
+      (setq elmo-imap4-fetch-callback-data nil))
+    (elmo-delete-cr
+     (elmo-imap4-response-bodydetail-text
+      (elmo-imap4-response-value-all
+       (elmo-imap4-send-command-wait session
+                                    (format
+                                     (if elmo-imap4-use-uid
+                                         "uid fetch %s body.peek[%s]"
+                                       "fetch %s body.peek[%s]")
+                                     msg part))
+       'fetch)))))
 
 (defun elmo-imap4-prefetch-msg (spec msg outbuf)
   (elmo-imap4-read-msg spec msg outbuf 'unseen))
 
 (defun elmo-imap4-read-msg (spec msg outbuf
                                 &optional leave-seen-flag-untouched)
-  (save-excursion
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          response ret-val bytes)
-      (as-binary-process
-       (when (elmo-imap4-spec-folder spec)
-        (when (not (string= (elmo-imap4-connection-get-cwf connection)
-                            (elmo-imap4-spec-folder spec)))
-          (if (null (setq response
-                          (elmo-imap4-select-folder
-                           (elmo-imap4-spec-folder spec)
-                           connection)))
-              (error "Select folder failed")))
-        (elmo-imap4-send-command (process-buffer process)
-                                 process
-                                 (format
-                                  (if elmo-imap4-use-uid
-                                      "uid fetch %s body%s[]"
-                                    "fetch %s body%s[]")
-                                  msg
-                                  (if leave-seen-flag-untouched
-                                      ".peek" "")))
-        (if (null (setq response (elmo-imap4-read-response
-                                  (process-buffer process)
-                                  process t)))
-            (error "Fetch failed"))
-        (save-match-data
-          (while (string-match "^\\* OK" response)
-            (if (null (setq response (elmo-imap4-read-response
-                                      (process-buffer process)
-                                      process t)))
-                (error "Fetch failed"))))
-        (save-match-data
-          (if (string-match ".*{\\([0-9]+\\)}" response)
-              (setq bytes
-                    (string-to-int
-                     (elmo-match-string 1 response)))
-            (error "Fetch failed")))
-        (setq ret-val (elmo-imap4-read-body
-                       (process-buffer process)
-                       process bytes outbuf))
-        (elmo-imap4-read-response (process-buffer process)
-                                  process)) ;; ignore remaining..
-       )
-      ret-val)))
+  (let ((session (elmo-imap4-get-session spec))
+       response)
+    (elmo-imap4-session-select-mailbox session
+                                      (elmo-imap4-spec-mailbox spec))
+    (with-current-buffer (elmo-network-session-buffer session)
+      (setq elmo-imap4-fetch-callback nil)
+      (setq elmo-imap4-fetch-callback-data nil))
+    (setq response
+         (elmo-imap4-send-command-wait session
+                                       (format
+                                        (if elmo-imap4-use-uid
+                                            "uid fetch %s rfc822%s"
+                                          "fetch %s rfc822%s")
+                                        msg
+                                        (if leave-seen-flag-untouched
+                                            ".peek" ""))))
+    (and (setq response (elmo-imap4-response-value
+                        (elmo-imap4-response-value-all
+                         response 'fetch )
+                        'rfc822))
+        (with-current-buffer outbuf
+          (erase-buffer)
+          (insert response)
+          (elmo-delete-cr-get-content-type)))))
 
 (defun elmo-imap4-setup-send-buffer-from-file (file)
   (let ((tmp-buf (get-buffer-create
@@ -1402,160 +1338,120 @@ Return nil if connection failed."
       (message "Deleting message...%d/%d" i num)
       (elmo-imap4-delete-msg-by-id spec (car message-ids))
       (setq message-ids (cdr message-ids)))
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection)))
-      (elmo-imap4-send-command (process-buffer process)
-                              process "expunge")
-      (if (null (elmo-imap4-read-response (process-buffer process)
-                                         process))
-         (error "Expunge failed")))))
+    (elmo-imap4-send-command-wait (elmo-imap4-get-session spec) "expunge")))
 
 (defun elmo-imap4-delete-msg-by-id (spec msgid)
-  (save-excursion
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          ;;(size (length string))
-          response msgs)
-      (if (and (elmo-imap4-spec-folder spec)
-              (not (string= (elmo-imap4-connection-get-cwf connection)
-                            (elmo-imap4-spec-folder spec)))
-              (null (elmo-imap4-select-folder
-                     (elmo-imap4-spec-folder spec)
-                     connection)))
-         (error "Select folder failed"))
-      (save-excursion
-       (elmo-imap4-send-command (process-buffer process)
-                                process
-                                (format
-                                 (if elmo-imap4-use-uid
-                                     "uid search header message-id \"%s\""
-                                   "search header message-id \"%s\"")
-                                 msgid))
-       (setq response (elmo-imap4-read-response
-                       (process-buffer process) process))
-       (if (and response
-                (string-match "^\\* SEARCH\\([^\n]*\\)$" response))
-           (setq msgs (read (concat "(" (elmo-match-string 1 response) ")")))
-         (error "SEARCH failed"))
-       (elmo-imap4-delete-msgs-no-expunge spec msgs)))))
+  (let ((session (elmo-imap4-get-session spec)))
+    (elmo-imap4-session-select-mailbox session
+                                      (elmo-imap4-spec-mailbox spec))
+    (elmo-imap4-delete-msgs-no-expunge
+     spec
+     (elmo-imap4-response-value
+      (elmo-imap4-send-command-wait session
+                                   (list
+                                    (if elmo-imap4-use-uid
+                                        "uid search header message-id "
+                                      "search header message-id ")
+                                    (elmo-imap4-field-body msgid)))
+      'search))))
 
 (defun elmo-imap4-append-msg-by-id (spec msgid)
-  (save-excursion
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          send-buf)
-      (if (and (elmo-imap4-spec-folder spec)
-              (not (string= (elmo-imap4-connection-get-cwf connection)
-                            (elmo-imap4-spec-folder spec)))
-              (null (elmo-imap4-select-folder
-                     (elmo-imap4-spec-folder spec) connection)))
-         (error "Select folder failed"))
-      (save-excursion
-       (setq send-buf (elmo-imap4-setup-send-buffer-from-file
-                       (elmo-cache-get-path msgid)))
-       (set-buffer send-buf)
-       (elmo-imap4-send-command (process-buffer process)
-                                process
-                                (format "append %s (\\Seen) {%d}"
-                                        (elmo-imap4-spec-folder spec)
-                                        (buffer-size)))
-       (process-send-string process (buffer-string))
-       (process-send-string process "\r\n") ; finished appending.
-       )
-      (kill-buffer send-buf)
-      (if (null (elmo-imap4-read-response (process-buffer process)
-                                         process))
-         (error "Append failed")))
-    t))
+  (let ((session (elmo-imap4-get-session spec))
+       send-buf)
+    (elmo-imap4-session-select-mailbox session
+                                      (elmo-imap4-spec-mailbox spec))
+    (setq send-buf (elmo-imap4-setup-send-buffer-from-file
+                   (elmo-cache-get-path msgid)))
+    (unwind-protect
+       (elmo-imap4-send-command-wait
+        session
+        (list
+         "append "
+         (elmo-imap4-mailbox (elmo-imap4-spec-mailbox spec))
+         " (\\Seen) "
+         (elmo-imap4-buffer-literal send-buf)))
+      (kill-buffer send-buf)))
+  t)
 
 (defun elmo-imap4-append-msg (spec string &optional msg no-see)
-  (save-excursion
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          send-buf)
-      (if (and (elmo-imap4-spec-folder spec)
-              (not (string= (elmo-imap4-connection-get-cwf connection)
-                            (elmo-imap4-spec-folder spec)))
-              (null (elmo-imap4-select-folder (elmo-imap4-spec-folder spec)
-                                              connection)))
-         (error "Select folder failed"))
-      (save-excursion
-       (setq send-buf (elmo-imap4-setup-send-buffer string))
-       (set-buffer send-buf)
-       (elmo-imap4-send-command (process-buffer process)
-                                process
-                                (format "append %s %s{%d}"
-                                        (elmo-imap4-spec-folder spec)
-                                        (if no-see "" "(\\Seen) ")
-                                        (buffer-size)))
-       (if (null (elmo-imap4-read-response (process-buffer process)
-                                           process))
-           (error "Cannot append messages to this folder"))
-       (process-send-string process (buffer-string))
-       (process-send-string process "\r\n") ; finished appending.
-       )
-      (kill-buffer send-buf)
-      (current-buffer)
-      (if (null (elmo-imap4-read-response (process-buffer process)
-                                         process))
-         (error "Append failed")))
-    t))
+  (let ((session (elmo-imap4-get-session spec))
+       send-buf)
+    (elmo-imap4-session-select-mailbox session
+                                      (elmo-imap4-spec-mailbox spec))
+    (setq send-buf (elmo-imap4-setup-send-buffer string))
+    (unwind-protect
+       (elmo-imap4-send-command-wait
+        session
+        (list
+         "append "
+         (elmo-imap4-mailbox (elmo-imap4-spec-mailbox spec))
+         (if no-see " " " (\\Seen) ")
+         (elmo-imap4-buffer-literal send-buf)))
+      (kill-buffer send-buf)))
+  t)
 
-(defun elmo-imap4-copy-msgs (dst-spec msgs src-spec &optional expunge-it same-number)
+(defun elmo-imap4-copy-msgs (dst-spec
+                            msgs src-spec &optional expunge-it same-number)
   "Equivalence of hostname, username is assumed."
-  (save-excursion
-    (let* ((src-folder (elmo-imap4-spec-folder src-spec))
-          (dst-folder (elmo-imap4-spec-folder dst-spec))
-          (connection (elmo-imap4-get-connection src-spec))
-          (process (elmo-imap4-connection-get-process connection))
-          (mlist msgs))
-      (if (and src-folder
-              (not (string= (elmo-imap4-connection-get-cwf connection)
-                            src-folder))
-              (null (elmo-imap4-select-folder
-                     src-folder connection)))
-         (error "Select folder failed"))
-      (while mlist
-       (elmo-imap4-send-command (process-buffer process)
-                                process
-                                (format
-                                 (if elmo-imap4-use-uid
-                                     "uid copy %s %s"
-                                   "copy %s %s")
-                                 (car mlist) dst-folder))
-       (if (null (elmo-imap4-read-response (process-buffer process)
-                                           process))
-           (error "Copy failed")
-         (setq mlist (cdr mlist))))
-      (when expunge-it
-       (elmo-imap4-send-command (process-buffer process)
-                                process "expunge")
-       (if (null (elmo-imap4-read-response (process-buffer process)
-                                           process))
-           (error "Expunge failed")))
-      t)))
+  (let ((session (elmo-imap4-get-session src-spec)))
+    (elmo-imap4-session-select-mailbox session
+                                      (elmo-imap4-spec-mailbox src-spec))
+    (while msgs
+      (elmo-imap4-send-command-wait session
+                                   (list
+                                    (format
+                                     (if elmo-imap4-use-uid
+                                         "uid copy %s "
+                                       "copy %s ")
+                                     (car msgs))
+                                    (elmo-imap4-mailbox
+                                     (elmo-imap4-spec-mailbox dst-spec))))
+      (setq msgs (cdr msgs)))
+    (when expunge-it
+      (elmo-imap4-send-command-wait session "expunge"))
+    t))
+
+(defun elmo-imap4-server-diff-async-callback-1 (status data)
+  (funcall elmo-imap4-server-diff-async-callback
+          (cons (elmo-imap4-response-value status 'unseen)
+                (elmo-imap4-response-value status 'messages))
+          data))
+
+(defun elmo-imap4-server-diff-async (spec)
+  (let ((session (elmo-imap4-get-session spec)))
+    ;; commit.
+    ;; (elmo-imap4-commit spec)
+    (with-current-buffer (elmo-network-session-buffer session)
+      (setq elmo-imap4-status-callback
+           'elmo-imap4-server-diff-async-callback-1)
+      (setq elmo-imap4-status-callback-data
+           elmo-imap4-server-diff-async-callback-data))
+    (elmo-imap4-send-command session
+                            (list
+                             "status "
+                             (elmo-imap4-mailbox
+                              (elmo-imap4-spec-mailbox spec))
+                             " (unseen messages)"))))
 
 (defun elmo-imap4-server-diff (spec)
-  "get server status"
-  (save-excursion
-    (let* ((connection (elmo-imap4-get-connection spec))
-          (process (elmo-imap4-connection-get-process connection))
-          response)
-      ;; commit when same folder.
-      (if (string= (elmo-imap4-connection-get-cwf connection)
-                  (elmo-imap4-spec-folder spec))
-         (elmo-imap4-commit spec))
-      (elmo-imap4-send-command (process-buffer process)
-                              process
-                              (format
-                               "status \"%s\" (unseen messages)"
-                               (elmo-imap4-spec-folder spec)))
-      (setq response (elmo-imap4-read-response
-                     (process-buffer process) process))
-      (when (string-match "\\* STATUS [^(]* \\(([^)]*)\\)" response)
-       (setq response (read (downcase (elmo-match-string 1 response))))
-       (cons (cadr (memq 'unseen response))
-             (cadr (memq 'messages response)))))))
+  "Get server status"
+  (let ((session (elmo-imap4-get-session spec))
+       response)
+    ;; commit.
+;    (elmo-imap4-commit spec)
+    (with-current-buffer (elmo-network-session-buffer session)
+      (setq elmo-imap4-status-callback nil)
+      (setq elmo-imap4-status-callback-data nil))
+    (setq response
+         (elmo-imap4-send-command-wait session
+                                       (list
+                                        "status "
+                                        (elmo-imap4-mailbox
+                                         (elmo-imap4-spec-mailbox spec))
+                                        " (unseen messages)")))
+    (setq response (elmo-imap4-response-value response 'status))
+    (cons (elmo-imap4-response-value response 'unseen)
+         (elmo-imap4-response-value response 'messages))))
 
 (defun elmo-imap4-use-cache-p (spec number)
   elmo-imap4-use-cache)
@@ -1565,7 +1461,11 @@ Return nil if connection failed."
 
 (defun elmo-imap4-port-label (spec)
   (concat "imap4"
-         (if (nth 6 spec) "!ssl" "")))
+         (if (elmo-imap4-spec-stream-type spec)
+             (concat "!" (symbol-name
+                          (elmo-network-stream-type-symbol
+                           (elmo-imap4-spec-stream-type spec)))))))
+             
 
 (defsubst elmo-imap4-portinfo (spec)
   (list (elmo-imap4-spec-hostname spec) (elmo-imap4-spec-port spec)))
@@ -1582,6 +1482,615 @@ Return nil if connection failed."
 
 (defalias 'elmo-imap4-sync-number-alist 'elmo-generic-sync-number-alist)
 
-(provide 'elmo-imap4)
+;;; IMAP parser.
+
+(defvar elmo-imap4-server-eol "\r\n"
+  "The EOL string sent from the server.")
+
+(defvar elmo-imap4-client-eol "\r\n"
+  "The EOL string we send to the server.")
+
+(defvar elmo-imap4-status nil)
+(defvar elmo-imap4-reached-tag nil)
+
+(defun elmo-imap4-find-next-line ()
+  "Return point at end of current line, taking into account literals.
+Return nil if no complete line has arrived."
+  (when (re-search-forward (concat elmo-imap4-server-eol "\\|{\\([0-9]+\\)}"
+                                  elmo-imap4-server-eol)
+                          nil t)
+    (if (match-string 1)
+       (if (< (point-max) (+ (point) (string-to-number (match-string 1))))
+           nil
+         (goto-char (+ (point) (string-to-number (match-string 1))))
+         (elmo-imap4-find-next-line))
+      (point))))
+
+(defun elmo-imap4-sentinel (process string)
+  (delete-process process))
+
+(defun elmo-imap4-arrival-filter (proc string)
+  "IMAP process filter."
+  (with-current-buffer (process-buffer proc)
+    (elmo-imap4-debug "-> %s" string)
+    (goto-char (point-max))
+    (insert string)
+    (let (end)
+      (goto-char (point-min))
+      (while (setq end (elmo-imap4-find-next-line))
+       (save-restriction
+         (narrow-to-region (point-min) end)
+         (delete-backward-char (length elmo-imap4-server-eol))
+         (goto-char (point-min))
+         (unwind-protect
+             (cond ((eq elmo-imap4-status 'initial)
+                    (setq elmo-imap4-current-response
+                          (list
+                           (list 'greeting (elmo-imap4-parse-greeting)))))
+                   ((or (eq elmo-imap4-status 'auth)
+                        (eq elmo-imap4-status 'nonauth)
+                        (eq elmo-imap4-status 'selected)
+                        (eq elmo-imap4-status 'examine))
+                    (setq elmo-imap4-current-response
+                          (cons
+                           (elmo-imap4-parse-response)
+                           elmo-imap4-current-response)))
+                   (t
+                    (message "Unknown state %s in arrival filter"
+                             elmo-imap4-status))))
+         (delete-region (point-min) (point-max)))))))
+
+;; IMAP parser.
+
+(defsubst elmo-imap4-forward ()
+  (or (eobp) (forward-char 1)))
+
+(defsubst elmo-imap4-parse-number ()
+  (when (looking-at "[0-9]+")
+    (prog1
+       (string-to-number (match-string 0))
+      (goto-char (match-end 0)))))
+
+(defsubst elmo-imap4-parse-literal ()
+  (when (looking-at "{\\([0-9]+\\)}\r\n")
+    (let ((pos (match-end 0))
+         (len (string-to-number (match-string 1))))
+      (if (< (point-max) (+ pos len))
+         nil
+       (goto-char (+ pos len))
+       (buffer-substring pos (+ pos len))))))
+       ;(list ' pos (+ pos len))))))
+
+(defsubst elmo-imap4-parse-string ()
+  (cond ((eq (char-after (point)) ?\")
+        (forward-char 1)
+        (let ((p (point)) (name ""))
+          (skip-chars-forward "^\"\\\\")
+          (setq name (buffer-substring p (point)))
+          (while (eq (char-after (point)) ?\\)
+            (setq p (1+ (point)))
+            (forward-char 2)
+            (skip-chars-forward "^\"\\\\")
+            (setq name (concat name (buffer-substring p (point)))))
+          (forward-char 1)
+          name))
+       ((eq (char-after (point)) ?{)
+        (elmo-imap4-parse-literal))))
+
+(defsubst elmo-imap4-parse-nil ()
+  (if (looking-at "NIL")
+      (goto-char (match-end 0))))
+
+(defsubst elmo-imap4-parse-nstring ()
+  (or (elmo-imap4-parse-string)
+      (and (elmo-imap4-parse-nil)
+          nil)))
+
+(defsubst elmo-imap4-parse-astring ()
+  (or (elmo-imap4-parse-string)
+      (buffer-substring (point)
+                       (if (re-search-forward "[(){ \r\n%*\"\\]" nil t)
+                           (goto-char (1- (match-end 0)))
+                         (end-of-line)
+                         (point)))))
+
+(defsubst elmo-imap4-parse-address ()
+  (let (address)
+    (when (eq (char-after (point)) ?\()
+      (elmo-imap4-forward)
+      (setq address (vector (prog1 (elmo-imap4-parse-nstring)
+                             (elmo-imap4-forward))
+                           (prog1 (elmo-imap4-parse-nstring)
+                             (elmo-imap4-forward))
+                           (prog1 (elmo-imap4-parse-nstring)
+                             (elmo-imap4-forward))
+                           (elmo-imap4-parse-nstring)))
+      (when (eq (char-after (point)) ?\))
+       (elmo-imap4-forward)
+       address))))
+
+(defsubst elmo-imap4-parse-address-list ()
+  (if (eq (char-after (point)) ?\()
+      (let (address addresses)
+       (elmo-imap4-forward)
+       (while (and (not (eq (char-after (point)) ?\)))
+                   ;; next line for MS Exchange bug
+                   (progn (and (eq (char-after (point)) ? ) (elmo-imap4-forward)) t)
+                   (setq address (elmo-imap4-parse-address)))
+         (setq addresses (cons address addresses)))
+       (when (eq (char-after (point)) ?\))
+         (elmo-imap4-forward)
+         (nreverse addresses)))
+    (assert (elmo-imap4-parse-nil))))
+
+(defsubst elmo-imap4-parse-mailbox ()
+  (let ((mailbox (elmo-imap4-parse-astring)))
+    (if (string-equal "INBOX" (upcase mailbox))
+       "INBOX"
+      mailbox)))
+
+(defun elmo-imap4-parse-greeting ()
+  "Parse a IMAP greeting."
+  (cond ((looking-at "\\* OK ")
+        (setq elmo-imap4-status 'nonauth))
+       ((looking-at "\\* PREAUTH ")
+        (setq elmo-imap4-status 'auth))
+       ((looking-at "\\* BYE ")
+        (setq elmo-imap4-status 'closed))))
+
+(defun elmo-imap4-parse-response ()
+  "Parse a IMAP command response."
+  (let (token)
+    (case (setq token (elmo-read (current-buffer)))
+      (+ (progn
+          (skip-chars-forward " ")
+          (list 'continue-req (buffer-substring (point) (point-max)))))
+      (* (case (prog1 (setq token (elmo-read (current-buffer)))
+                (elmo-imap4-forward))
+          (OK         (elmo-imap4-parse-resp-text-code))
+          (NO         (elmo-imap4-parse-resp-text-code))
+          (BAD        (elmo-imap4-parse-resp-text-code))
+          (BYE        (elmo-imap4-parse-bye))
+          (FLAGS      (list 'flags
+                            (elmo-imap4-parse-flag-list)))
+          (LIST       (list 'list (elmo-imap4-parse-data-list)))
+          (LSUB       (list 'lsub (elmo-imap4-parse-data-list)))
+          (SEARCH     (list
+                       'search
+                       (elmo-read (concat "("
+                                     (buffer-substring (point) (point-max))
+                                     ")"))))
+          (STATUS     (elmo-imap4-parse-status))
+          ;; Added
+          (NAMESPACE  (elmo-imap4-parse-namespace))
+          (CAPABILITY (list 'capability
+                            (elmo-read
+                             (concat "(" (downcase (buffer-substring
+                                                    (point) (point-max)))
+                                     ")"))))
+          (ACL        (elmo-imap4-parse-acl))
+          (t       (case (prog1 (elmo-read (current-buffer))
+                           (elmo-imap4-forward))
+                     (EXISTS  (list 'exists token))
+                     (RECENT  (list 'recent token))
+                     (EXPUNGE (list 'expunge token))
+                     (FETCH   (elmo-imap4-parse-fetch token))
+                     (t       (list 'garbage (buffer-string)))))))
+      (t (if (not (string-match elmo-imap4-seq-prefix (symbol-name token)))
+            (list 'garbage (buffer-string))
+          (case (prog1 (elmo-read (current-buffer))
+                  (elmo-imap4-forward))
+            (OK  (progn
+                   (setq elmo-imap4-parsing nil)
+                   (elmo-imap4-debug "*%s* OK arrived" token)
+                   (setq elmo-imap4-reached-tag token)
+                   (list 'ok (elmo-imap4-parse-resp-text-code))))
+            (NO  (progn
+                   (setq elmo-imap4-parsing nil)
+                   (elmo-imap4-debug "*%s* NO arrived" token)
+                   (setq elmo-imap4-reached-tag token)
+                   (let (code text)
+                     (when (eq (char-after (point)) ?\[)
+                       (setq code (buffer-substring (point)
+                                                    (search-forward "]")))
+                       (elmo-imap4-forward))
+                     (setq text (buffer-substring (point) (point-max)))
+                     (list 'no (list code text)))))
+            (BAD (progn
+                   (setq elmo-imap4-parsing nil)
+                   (elmo-imap4-debug "*%s* BAD arrived" token)
+                   (setq elmo-imap4-reached-tag token)
+                   (let (code text)
+                     (when (eq (char-after (point)) ?\[)
+                       (setq code (buffer-substring (point)
+                                                    (search-forward "]")))
+                       (elmo-imap4-forward))
+                     (setq text (buffer-substring (point) (point-max)))
+                     (list 'bad (list code text)))))
+            (t   (list 'garbage (buffer-string)))))))))
+                   
+(defun elmo-imap4-parse-bye ()
+  (let (code text)
+    (when (eq (char-after (point)) ?\[)
+      (setq code (buffer-substring (point)
+                                  (search-forward "]")))
+      (elmo-imap4-forward))
+    (setq text (buffer-substring (point) (point-max)))
+    (list 'bye (list code text))))
+
+(defun elmo-imap4-parse-text ()
+  (goto-char (point-min))
+  (when (search-forward "[" nil t)
+    (search-forward "]")
+    (elmo-imap4-forward))
+  (list 'text (buffer-substring (point) (point-max))))
+
+(defun elmo-imap4-parse-resp-text-code ()
+  (when (eq (char-after (point)) ?\[)
+    (elmo-imap4-forward)
+    (cond ((search-forward "PERMANENTFLAGS " nil t)
+          (list 'permanentflags (elmo-imap4-parse-flag-list)))
+         ((search-forward "UIDNEXT " nil t)
+          (list 'uidnext (elmo-read (current-buffer))))
+         ((search-forward "UNSEEN " nil t)
+          (list 'unseen (elmo-read (current-buffer))))
+         ((looking-at "UIDVALIDITY \\([0-9]+\\)")
+          (list 'uidvalidity (match-string 1)))
+         ((search-forward "READ-ONLY" nil t)
+          (list 'read-only t))
+         ((search-forward "READ-WRITE" nil t)
+          (list 'read-write t))
+         ((search-forward "NEWNAME " nil t)
+          (let (oldname newname)
+            (setq oldname (elmo-imap4-parse-string))
+            (elmo-imap4-forward)
+            (setq newname (elmo-imap4-parse-string))
+            (list 'newname newname oldname)))
+         ((search-forward "TRYCREATE" nil t)
+          (list 'trycreate t))
+         ((looking-at "APPENDUID \\([0-9]+\\) \\([0-9]+\\)")
+          (list 'appenduid
+                (list (match-string 1)
+                      (string-to-number (match-string 2)))))
+         ((looking-at "COPYUID \\([0-9]+\\) \\([0-9,:]+\\) \\([0-9,:]+\\)")
+          (list 'copyuid (list (match-string 1)
+                               (match-string 2)
+                               (match-string 3))))
+         ((search-forward "ALERT] " nil t)
+          (message "IMAP server information: %s"
+                   (buffer-substring (point) (point-max))))
+         (t (list 'unknown)))))
+
+(defun elmo-imap4-parse-data-list ()
+  (let (flags delimiter mailbox)
+    (setq flags (elmo-imap4-parse-flag-list))
+    (when (looking-at " NIL\\| \"\\\\?\\(.\\)\"")
+      (setq delimiter (match-string 1))
+      (goto-char (1+ (match-end 0)))
+      (when (setq mailbox (elmo-imap4-parse-mailbox))
+       (list mailbox flags delimiter)))))
+
+(defsubst elmo-imap4-parse-header-list ()
+  (when (eq (char-after (point)) ?\()
+    (let (strlist)
+      (while (not (eq (char-after (point)) ?\)))
+       (elmo-imap4-forward)
+       (push (elmo-imap4-parse-astring) strlist))
+      (elmo-imap4-forward)
+      (nreverse strlist))))
+
+(defsubst elmo-imap4-parse-fetch-body-section ()
+  (let ((section
+        (buffer-substring (point)
+                          (1-
+                           (progn (re-search-forward "[] ]" nil t)
+                                  (point))))))
+    (if (eq (char-before) ? )
+       (prog1
+           (mapconcat 'identity
+                      (cons section (elmo-imap4-parse-header-list)) " ")
+         (search-forward "]" nil t))
+      section)))
+
+(defun elmo-imap4-parse-fetch (response)
+  (when (eq (char-after (point)) ?\()
+    (let (element list)
+      (while (not (eq (char-after (point)) ?\)))
+       (elmo-imap4-forward)
+       (let ((token (elmo-imap4-fetch-read (current-buffer))))
+         (elmo-imap4-forward)
+         (setq element
+               (cond ((eq token 'UID)
+                      (list 'uid (condition-case nil
+                                     (elmo-read (current-buffer))
+                                   (error nil))))
+                     ((eq token 'FLAGS)
+                      (list 'flags (elmo-imap4-parse-flag-list)))
+                     ((eq token 'ENVELOPE)
+                      (list 'envelope (elmo-imap4-parse-envelope)))
+                     ((eq token 'INTERNALDATE)
+                      (list 'internaldate (elmo-imap4-parse-string)))
+                     ((eq token 'RFC822)
+                      (list 'rfc822 (elmo-imap4-parse-nstring)))
+                     ((eq token (intern elmo-imap4-rfc822-header))
+                      (list 'rfc822header (elmo-imap4-parse-nstring)))
+                     ((eq token (intern elmo-imap4-rfc822-text))
+                      (list 'rfc822text (elmo-imap4-parse-nstring)))
+                     ((eq token (intern elmo-imap4-rfc822-size))
+                      (list 'rfc822size (elmo-read (current-buffer))))
+                     ((eq token 'BODY)
+                      (if (eq (char-before) ?\[)
+                          (list
+                           'bodydetail
+                           (upcase (elmo-imap4-parse-fetch-body-section))
+                           (and
+                            (eq (char-after (point)) ?<)
+                            (buffer-substring (1+ (point))
+                                              (progn
+                                                (search-forward ">" nil t)
+                                                (point))))
+                           (progn (elmo-imap4-forward)
+                                  (elmo-imap4-parse-nstring)))
+                        (list 'body (elmo-imap4-parse-body))))
+                     ((eq token 'BODYSTRUCTURE)
+                      (list 'bodystructure (elmo-imap4-parse-body)))))
+         (setq list (cons element list))))
+      (and elmo-imap4-fetch-callback
+          (elmo-imap4-fetch-callback
+           list
+           elmo-imap4-fetch-callback-data))
+      (list 'fetch list))))
+
+(defun elmo-imap4-parse-status ()
+  (let ((mailbox (elmo-imap4-parse-mailbox))
+       status)
+    (when (and mailbox (search-forward "(" nil t))
+      (while (not (eq (char-after (point)) ?\)))
+       (setq status
+             (cons
+              (let ((token (elmo-read (current-buffer))))
+                (cond ((eq token 'MESSAGES)
+                       (list 'messages (elmo-read (current-buffer))))
+                      ((eq token 'RECENT)
+                       (list 'recent (elmo-read (current-buffer))))
+                      ((eq token 'UIDNEXT)
+                       (list 'uidnext (elmo-read (current-buffer))))
+                      ((eq token 'UIDVALIDITY)
+                       (and (looking-at " \\([0-9]+\\)")
+                            (prog1 (list 'uidvalidity (match-string 1))
+                              (goto-char (match-end 1)))))
+                      ((eq token 'UNSEEN)
+                       (list 'unseen (elmo-read (current-buffer))))
+                      (t
+                       (message
+                        "Unknown status data %s in mailbox %s ignored"
+                        token mailbox))))
+              status))))
+    (and elmo-imap4-status-callback
+        (funcall elmo-imap4-status-callback
+                 status
+                 elmo-imap4-status-callback-data))
+    (list 'status status)))
+
+
+(defmacro elmo-imap4-value (value)
+  (` (if (eq (, value) 'NIL) nil
+       (, value))))
+
+(defmacro elmo-imap4-nth (pos list)
+  (` (let ((value (nth (, pos) (, list))))
+       (elmo-imap4-value value))))
+
+(defun elmo-imap4-parse-namespace ()
+  (list 'namespace
+       (nconc
+        (copy-sequence elmo-imap4-extra-namespace-alist)
+        (elmo-imap4-parse-namespace-subr
+         (elmo-read (concat "(" (buffer-substring
+                                 (point) (point-max))
+                            ")"))))))
+
+(defun elmo-imap4-parse-namespace-subr (ns)
+  (let (prefix delim namespace-alist default-delim)
+    ;; 0: personal, 1: other, 2: shared
+    (dotimes (i 3)
+      (setq namespace-alist
+           (nconc namespace-alist
+                  (delq nil
+                        (mapcar
+                         (lambda (namespace)
+                           (setq prefix (elmo-imap4-nth 0 namespace)
+                                 delim (elmo-imap4-nth 1 namespace))
+                           (if (and prefix delim
+                                    (string-match
+                                     (concat (regexp-quote delim) "\\'")
+                                     prefix))
+                               (setq prefix (substring prefix 0
+                                                       (match-beginning 0))))
+                           (if (eq (length prefix) 0)
+                               (progn (setq default-delim delim) nil)
+                             (cons
+                              (concat "^"
+                                      (if (string= (downcase prefix) "inbox")
+                                          "[Ii][Nn][Bb][Oo][Xx]"
+                                        (regexp-quote prefix))
+                                      ".*$")
+                              delim)))
+                         (elmo-imap4-nth i ns))))))
+    (if default-delim
+       (setq namespace-alist
+             (nconc namespace-alist
+                    (list (cons "^.*$" default-delim)))))
+    namespace-alist))
+
+(defun elmo-imap4-parse-acl ()
+  (let ((mailbox (elmo-imap4-parse-mailbox))
+       identifier rights acl)
+    (while (eq (char-after (point)) ?\ )
+      (elmo-imap4-forward)
+      (setq identifier (elmo-imap4-parse-astring))
+      (elmo-imap4-forward)
+      (setq rights (elmo-imap4-parse-astring))
+      (setq acl (append acl (list (cons identifier rights)))))
+    (list 'acl acl mailbox)))
+
+(defun elmo-imap4-parse-flag-list ()
+  (let ((str (buffer-substring (+ (point) 1)
+                              (progn (search-forward ")" nil t)
+                                     (- (point) 1)))))
+    (unless (eq (length str) 0)
+      (split-string str))))
+
+(defun elmo-imap4-parse-envelope ()
+  (when (eq (char-after (point)) ?\()
+    (elmo-imap4-forward)
+    (vector (prog1 (elmo-imap4-parse-nstring);; date
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-nstring);; subject
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-address-list);; from
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-address-list);; sender
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-address-list);; reply-to
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-address-list);; to
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-address-list);; cc
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-address-list);; bcc
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-nstring);; in-reply-to
+             (elmo-imap4-forward))
+           (prog1 (elmo-imap4-parse-nstring);; message-id
+             (elmo-imap4-forward)))))
+
+(defsubst elmo-imap4-parse-string-list ()
+  (cond ((eq (char-after (point)) ?\();; body-fld-param
+        (let (strlist str)
+          (elmo-imap4-forward)
+          (while (setq str (elmo-imap4-parse-string))
+            (push str strlist)
+            (elmo-imap4-forward))
+          (nreverse strlist)))
+       ((elmo-imap4-parse-nil)
+        nil)))
+
+(defun elmo-imap4-parse-body-extension ()
+  (if (eq (char-after (point)) ?\()
+      (let (b-e)
+       (elmo-imap4-forward)
+       (push (elmo-imap4-parse-body-extension) b-e)
+       (while (eq (char-after (point)) ?\ )
+         (elmo-imap4-forward)
+         (push (elmo-imap4-parse-body-extension) b-e))
+       (assert (eq (char-after (point)) ?\)))
+       (elmo-imap4-forward)
+       (nreverse b-e))
+    (or (elmo-imap4-parse-number)
+       (elmo-imap4-parse-nstring))))
+
+(defsubst elmo-imap4-parse-body-ext ()
+  (let (ext)
+    (when (eq (char-after (point)) ?\ );; body-fld-dsp
+      (elmo-imap4-forward)
+      (let (dsp)
+       (if (eq (char-after (point)) ?\()
+           (progn
+             (elmo-imap4-forward)
+             (push (elmo-imap4-parse-string) dsp)
+             (elmo-imap4-forward)
+             (push (elmo-imap4-parse-string-list) dsp)
+             (elmo-imap4-forward))
+         (assert (elmo-imap4-parse-nil)))
+       (push (nreverse dsp) ext))
+      (when (eq (char-after (point)) ?\ );; body-fld-lang
+       (elmo-imap4-forward)
+       (if (eq (char-after (point)) ?\()
+           (push (elmo-imap4-parse-string-list) ext)
+         (push (elmo-imap4-parse-nstring) ext))
+       (while (eq (char-after (point)) ?\ );; body-extension
+         (elmo-imap4-forward)
+         (setq ext (append (elmo-imap4-parse-body-extension) ext)))))
+    ext))
+
+(defun elmo-imap4-parse-body ()
+  (let (body)
+    (when (eq (char-after (point)) ?\()
+      (elmo-imap4-forward)
+      (if (eq (char-after (point)) ?\()
+         (let (subbody)
+           (while (and (eq (char-after (point)) ?\()
+                       (setq subbody (elmo-imap4-parse-body)))
+             (push subbody body))
+           (elmo-imap4-forward)
+           (push (elmo-imap4-parse-string) body);; media-subtype
+           (when (eq (char-after (point)) ?\ );; body-ext-mpart:
+             (elmo-imap4-forward)
+             (if (eq (char-after (point)) ?\();; body-fld-param
+                 (push (elmo-imap4-parse-string-list) body)
+               (push (and (elmo-imap4-parse-nil) nil) body))
+             (setq body
+                   (append (elmo-imap4-parse-body-ext) body)));; body-ext-...
+           (assert (eq (char-after (point)) ?\)))
+           (elmo-imap4-forward)
+           (nreverse body))
+
+       (push (elmo-imap4-parse-string) body);; media-type
+       (elmo-imap4-forward)
+       (push (elmo-imap4-parse-string) body);; media-subtype
+       (elmo-imap4-forward)
+       ;; next line for Sun SIMS bug
+       (and (eq (char-after (point)) ? ) (elmo-imap4-forward))
+       (if (eq (char-after (point)) ?\();; body-fld-param
+           (push (elmo-imap4-parse-string-list) body)
+         (push (and (elmo-imap4-parse-nil) nil) body))
+       (elmo-imap4-forward)
+       (push (elmo-imap4-parse-nstring) body);; body-fld-id
+       (elmo-imap4-forward)
+       (push (elmo-imap4-parse-nstring) body);; body-fld-desc
+       (elmo-imap4-forward)
+       (push (elmo-imap4-parse-string) body);; body-fld-enc
+       (elmo-imap4-forward)
+       (push (elmo-imap4-parse-number) body);; body-fld-octets
+
+       ;; ok, we're done parsing the required parts, what comes now is one
+       ;; of three things:
+       ;;
+       ;; envelope       (then we're parsing body-type-msg)
+       ;; body-fld-lines (then we're parsing body-type-text)
+       ;; body-ext-1part (then we're parsing body-type-basic)
+       ;;
+       ;; the problem is that the two first are in turn optionally followed
+       ;; by the third.  So we parse the first two here (if there are any)...
+
+       (when (eq (char-after (point)) ?\ )
+         (elmo-imap4-forward)
+         (let (lines)
+           (cond ((eq (char-after (point)) ?\();; body-type-msg:
+                  (push (elmo-imap4-parse-envelope) body);; envelope
+                  (elmo-imap4-forward)
+                  (push (elmo-imap4-parse-body) body);; body
+                  (elmo-imap4-forward)
+                  (push (elmo-imap4-parse-number) body));; body-fld-lines
+                 ((setq lines (elmo-imap4-parse-number));; body-type-text:
+                  (push lines body));; body-fld-lines
+                 (t
+                  (backward-char)))));; no match...
+
+       ;; ...and then parse the third one here...
+
+       (when (eq (char-after (point)) ?\ );; body-ext-1part:
+         (elmo-imap4-forward)
+         (push (elmo-imap4-parse-nstring) body);; body-fld-md5
+         (setq body
+               (append (elmo-imap4-parse-body-ext) body)));; body-ext-1part..
+    
+       (assert (eq (char-after (point)) ?\)))
+       (elmo-imap4-forward)
+       (nreverse body)))))
+
+(require 'product)
+(product-provide (provide 'elmo-imap4) (require 'elmo-version))
 
 ;;; elmo-imap4.el ends here
index ce5b186..d504393 100644 (file)
         (arg (nth 2 spec))
         (flist (elmo-list-folder-by-location
                 spec
-                (elmo-internal-list-location directive arg))))
+                (elmo-internal-list-location directive arg)))
+        (killed (and elmo-use-killed-list
+                     (elmo-msgdb-killed-list-load
+                      (elmo-msgdb-expand-path spec))))
+        numbers)
     (if nonsort
        (cons (or (elmo-max-of-list flist) 0)
-             (length flist))
-      (sort flist '<))))
+             (if killed
+                 (- (length flist) (length killed))
+               (length flist)))
+      (setq numbers (sort flist '<))
+      (elmo-living-messages numbers killed))))
 
 (defun elmo-internal-list-folder (spec)
   (elmo-internal-list-folder-subr spec))
 
 (defun elmo-internal-list-folder-by-location (spec location &optional msgdb)
-  (let* ((path (elmo-msgdb-expand-path nil spec))
+  (let* ((path (elmo-msgdb-expand-path spec))
         (location-alist
          (if msgdb
              (elmo-msgdb-get-location msgdb)
           (arg       (nth 2 spec))
           (loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                        (elmo-msgdb-location-load (elmo-msgdb-expand-path
-                                                  nil spec))))
+                                                  spec))))
           (loc-list (elmo-internal-list-location directive arg))
           overview number-alist mark-alist entity
           i percent num location pair)
                             entity))
                           already-mark
                         new-mark))))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) num))
-       (elmo-display-progress
-        'elmo-internal-msgdb-create "Creating msgdb..."
-        percent)
+       (when (> num elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) num))
+         (elmo-display-progress
+          'elmo-internal-msgdb-create "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (message "Creating msgdb...done.")
       (list overview number-alist mark-alist loc-alist))))
 (defun elmo-internal-delete-msgs (spec msgs &optional msgdb)
   (let ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                     (elmo-msgdb-location-load (elmo-msgdb-expand-path
-                                               nil spec)))))
+                                               spec)))))
     (mapcar '(lambda (msg) (elmo-internal-delete-msg spec msg
                                                     loc-alist))
            msgs)))
   (save-excursion
     (let* ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                        (elmo-msgdb-location-load (elmo-msgdb-expand-path
-                                                  nil spec))))
+                                                  spec))))
           (file (elmo-cache-get-path (cdr (assq number loc-alist)))))
       (set-buffer outbuf)
       (erase-buffer)
                                      elmo-msgdb-dir)))))
         (loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                      (elmo-msgdb-location-load (elmo-msgdb-expand-path
-                                                nil spec))))
+                                                spec))))
+        (number-list (mapcar 'car loc-alist))
         cache-file
         ret-val
         case-fold-search msg
     (while loc-alist
       (if (and (setq cache-file (elmo-cache-exists-p (cdr (car loc-alist))))
               (elmo-file-field-condition-match cache-file
-                                               condition))
+                                               condition
+                                               (car (car loc-alist))
+                                               number-list))
          (setq ret-val (append ret-val (list (car (car loc-alist))))))
       (setq i (1+ i))
       (setq percent (/ (* i 100) num))
 (defalias 'elmo-internal-list-folder-important
   'elmo-generic-list-folder-important)
 (defalias 'elmo-internal-commit 'elmo-generic-commit)
+(defalias 'elmo-internal-folder-diff 'elmo-generic-folder-diff)
 
-(provide 'elmo-internal)
+(require 'product)
+(product-provide (provide 'elmo-internal) (require 'elmo-version))
 
 ;;; elmo-internal.el ends here
index fb16b14..89a4c43 100644 (file)
   (when numlist
     (let ((dir (elmo-localdir-get-folder-directory spec))
          overview number-alist mark-alist entity message-id
-         i percent len num seen gmark)
-      (setq len (length numlist))
-      (setq i 0)
+         num seen gmark
+         (i 0)
+         (len (length numlist)))
       (message "Creating msgdb...")
       (while numlist
        (setq entity
          (setq overview
                (elmo-msgdb-append-element
                 overview entity))
-         (setq number-alist
-               (elmo-msgdb-number-add number-alist
-                                      num
-                                      (elmo-msgdb-overview-entity-get-id
-                                       entity)))
          (setq message-id (elmo-msgdb-overview-entity-get-id entity))
+         (setq number-alist
+               (elmo-msgdb-number-add number-alist
+                                      num
+                                      message-id))
          (setq seen (member message-id seen-list))
          (if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
                              (if (elmo-cache-exists-p message-id) ; XXX
                     mark-alist
                     num
                     gmark))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) len))
-       (elmo-display-progress
-        'elmo-localdir-msgdb-create-as-numlist "Creating msgdb..."
-        percent)
+       (when (> len elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (elmo-display-progress
+          'elmo-localdir-msgdb-create-as-numlist "Creating msgdb..."
+          (/ (* i 100) len)))
        (setq numlist (cdr numlist)))
       (message "Creating msgdb...done.")
       (list overview number-alist mark-alist))))
 
 (defun elmo-localdir-list-folders-subr (folder &optional hierarchy)
   (let ((case-fold-search t)
+       (w32-get-true-file-link-count t) ; for Meadow
        folders curdir dirent relpath abspath attr
        subprefix subfolder)
     (condition-case ()
 (defsubst elmo-localdir-list-folder-subr (spec &optional nonsort)
   (let* ((dir (elmo-localdir-get-folder-directory spec))
         (flist (mapcar 'string-to-int
-                       (directory-files dir nil "^[0-9]+$" t))))
+                       (directory-files dir nil "^[0-9]+$" t)))
+        (killed (and elmo-use-killed-list
+                     (elmo-msgdb-killed-list-load
+                      (elmo-msgdb-expand-path spec))))
+        numbers)
     (if nonsort
-       (cons (or (elmo-max-of-list flist) 0) (length flist))
-      (sort flist '<))))
+       (cons (or (elmo-max-of-list flist) 0)
+             (if killed
+                 (- (length flist) (length killed))
+               (length flist)))
+      (setq numbers (sort flist '<))
+      (elmo-living-messages numbers killed))))
 
 (defun elmo-localdir-append-msg (spec string &optional msg no-see)
   (let ((dir (elmo-localdir-get-folder-directory spec))
        (tmp-buffer (get-buffer-create " *ELMO Temp buffer*"))
        (next-num (or msg
-                     (1+ (car (elmo-localdir-list-folder-subr spec t)))))
+                     (1+ (car (elmo-localdir-max-of-folder spec)))))
        filename)
     (save-excursion
       (set-buffer tmp-buffer)
        (rename-file old new)
        t))))
 
-(defsubst elmo-localdir-field-condition-match (spec number condition)
+(defsubst elmo-localdir-field-condition-match (spec condition
+                                                   number number-list)
   (elmo-file-field-condition-match
    (expand-file-name (int-to-string number)
                     (elmo-localdir-get-folder-directory spec))
-   condition))
+   condition
+   number number-list))
 
 (defun elmo-localdir-search (spec condition &optional from-msgs)
   (let* ((msgs (or from-msgs (elmo-localdir-list-folder spec)))
         (num (length msgs))
-        (i 0) case-fold-search ret-val)
+        (i 0)
+        number-list case-fold-search ret-val)
+    (setq number-list msgs)
     (while msgs
-      (if (elmo-localdir-field-condition-match spec (car msgs)
-                                              condition)
+      (if (elmo-localdir-field-condition-match spec condition
+                                              (car msgs) number-list)
          (setq ret-val (cons (car msgs) ret-val)))
-      (setq i (1+ i))
-      (elmo-display-progress
-       'elmo-localdir-search "Searching..."
-       (/ (* i 100) num))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (elmo-display-progress
+        'elmo-localdir-search "Searching..."
+        (/ (* i 100) num)))
       (setq msgs (cdr msgs)))
     (nreverse ret-val)))
 
                                         &optional loc-alist same-number)
   (let ((dst-dir
         (elmo-localdir-get-folder-directory dst-spec))
-       (next-num (1+ (car (elmo-localdir-list-folder-subr dst-spec t)))))
+       (next-num (1+ (car (elmo-localdir-max-of-folder dst-spec)))))
     (while msgs
       (elmo-copy-file
        ;; src file
                (if (and (eq (car dst-spec) 'localdir)
                         (elmo-localdir-locked-p))
                    ;; MDA is running.
-                   (1+ (car (elmo-localdir-list-folder-subr dst-spec t)))
+                   (1+ (car (elmo-localdir-max-of-folder dst-spec)))
                  (1+ next-num)))))
     t))
 
   (let ((dir (elmo-localdir-get-folder-directory spec))
        (onum-alist (elmo-msgdb-get-number-alist msgdb))
        (omark-alist (elmo-msgdb-get-mark-alist msgdb))
-       (oov (elmo-msgdb-get-overview msgdb))
        (new-number 1)                  ; first ordinal position in localdir
        flist onum mark new-mark-alist total)
     (setq flist
            (mapcar 'car onum-alist)))
     (setq total (length flist))
     (while flist
-      (elmo-display-progress
-       'elmo-localdir-pack-number "Packing..."
-       (/ (* new-number 100) total))
+      (when (> total elmo-display-progress-threshold)
+       (elmo-display-progress
+        'elmo-localdir-pack-number "Packing..."
+        (/ (* new-number 100) total)))
       (setq onum (car flist))
       (when (not (eq onum new-number))         ; why \=() is wrong..
         (elmo-bind-directory
         (rename-file (int-to-string onum) (int-to-string new-number) t))
         ;; update overview
         (elmo-msgdb-overview-entity-set-number
-        (elmo-msgdb-overview-get-entity-by-number
-         oov onum) new-number)
+        (elmo-msgdb-overview-get-entity onum msgdb)
+        new-number)
        ;; update number-alist
        (setcar (assq onum onum-alist) new-number))
       ;; update mark-alist
     (list (elmo-msgdb-get-overview msgdb)
          onum-alist
          new-mark-alist
-         (elmo-msgdb-get-location msgdb))))
+         (elmo-msgdb-get-location msgdb)
+         ;; remake hash table
+         (elmo-msgdb-make-overview-hashtb (elmo-msgdb-get-overview msgdb)))))
 
 (defun elmo-localdir-use-cache-p (spec number)
   nil)
 (defalias 'elmo-localdir-list-folder-important
   'elmo-generic-list-folder-important)
 (defalias 'elmo-localdir-commit 'elmo-generic-commit)
+(defalias 'elmo-localdir-folder-diff 'elmo-generic-folder-diff)
 
-(provide 'elmo-localdir)
+(require 'product)
+(product-provide (provide 'elmo-localdir) (require 'elmo-version))
 
 ;;; elmo-localdir.el ends here
index 24af2fa..bbb1a42 100644 (file)
 (defalias 'elmo-localnews-list-folder-important
   'elmo-generic-list-folder-important)
 (defalias 'elmo-localnews-commit 'elmo-generic-commit)
+(defalias 'elmo-localnews-folder-diff 'elmo-generic-folder-diff)
 
-(provide 'elmo-localnews)
+(require 'product)
+(product-provide (provide 'elmo-localnews) (require 'elmo-version))
 
 ;;; elmo-localnews.el ends here
index 23f0a11..9d0d3b5 100644 (file)
@@ -148,7 +148,7 @@ This variable should not be used in elsewhere.")
   (let ((dir (elmo-maildir-get-folder-directory spec))
        (locs (if msgdb
                  (elmo-msgdb-get-location msgdb)
-               (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec))))
+               (elmo-msgdb-location-load (elmo-msgdb-expand-path spec))))
        file)
     (while msgs
       (if (setq file (elmo-maildir-number-to-filename dir (car msgs) locs))
@@ -159,7 +159,7 @@ This variable should not be used in elsewhere.")
   (let ((dir (elmo-maildir-get-folder-directory spec))
        (locs (if msgdb
                  (elmo-msgdb-get-location msgdb)
-               (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec))))
+               (elmo-msgdb-location-load (elmo-msgdb-expand-path spec))))
        file)
     (while msgs
       (if (setq file (elmo-maildir-number-to-filename dir (car msgs) locs))
@@ -187,7 +187,7 @@ This variable should not be used in elsewhere.")
     (let* ((dir (elmo-maildir-get-folder-directory spec))
           (loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                        (elmo-msgdb-location-load (elmo-msgdb-expand-path
-                                                  nil spec))))
+                                                  spec))))
           (loc-seen (elmo-maildir-list-location dir))
           (loc-list  (car loc-seen))
           (seen-list (cdr loc-seen))
@@ -222,11 +222,12 @@ This variable should not be used in elsewhere.")
                        (elmo-msgdb-overview-entity-get-id
                         entity))
                       new-mark)))))
-       (setq i (1+ i))
-       (setq percent (/ (* i 100) num))
-       (elmo-display-progress
-        'elmo-maildir-msgdb-create "Creating msgdb..."
-        percent)
+       (when (> num elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (setq percent (/ (* i 100) num))
+         (elmo-display-progress
+          'elmo-maildir-msgdb-create "Creating msgdb..."
+          percent))
        (setq numlist (cdr numlist)))
       (message "Creating msgdb...done.")
       (elmo-msgdb-sort-by-date
@@ -328,7 +329,7 @@ file name for maildir directories."
   (save-excursion
     (let* ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                        (elmo-msgdb-location-load (elmo-msgdb-expand-path
-                                                  nil spec))))
+                                                  spec))))
           (dir (elmo-maildir-get-folder-directory spec))
           (file (elmo-maildir-number-to-filename dir number loc-alist)))
       (set-buffer outbuf)
@@ -340,7 +341,7 @@ file name for maildir directories."
 (defun elmo-maildir-delete-msgs (spec msgs &optional msgdb)
   (let ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                     (elmo-msgdb-location-load (elmo-msgdb-expand-path
-                                               nil spec)))))
+                                               spec)))))
     (mapcar '(lambda (msg) (elmo-maildir-delete-msg spec msg
                                                    loc-alist))
            msgs)))
@@ -350,11 +351,19 @@ file name for maildir directories."
         (flist (elmo-list-folder-by-location
                 spec
                 (car (elmo-maildir-list-location dir))))
-        (news (car (elmo-maildir-list-location dir "new"))))
+        (killed (and elmo-use-killed-list
+                     (elmo-msgdb-killed-list-load
+                      (elmo-msgdb-expand-path spec))))
+        (news (car (elmo-maildir-list-location dir "new")))
+        numbers)
     (if nonsort
        (cons (+ (or (elmo-max-of-list flist) 0) (length news))
-             (+ (length flist) (length news)))
-      (sort flist '<))))
+             (+ (length news)
+                (if killed
+                    (- (length flist) (length killed))
+                  (length flist))))
+      (setq numbers (sort flist '<))
+      (elmo-living-messages numbers killed))))
 
 (defun elmo-maildir-list-folder (spec)
   (elmo-maildir-update-current spec)
@@ -403,30 +412,31 @@ file name for maildir directories."
            (lambda (dir)
              (setq dir (expand-file-name dir basedir))
              (if (not (file-directory-p dir))
-                 (error)
+                 (error nil)
                (elmo-delete-directory dir t))))
           '("new" "cur" "tmp" "."))
          t)
-      (error))))
+      (error nil))))
 
 (defun elmo-maildir-search (spec condition &optional from-msgs msgdb)
   (save-excursion
     (let* ((msgs (or from-msgs (elmo-maildir-list-folder spec)))
           (loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                        (elmo-msgdb-location-load (elmo-msgdb-expand-path
-                                                  nil spec))))
+                                                  spec))))
           (dir (elmo-maildir-get-folder-directory spec))
           (i 0)
           case-fold-search ret-val
           percent num
           (num (length msgs))
-          msg-num)
+          number-list msg-num)
+      (setq number-list msgs)
       (while msgs
        (setq msg-num (car msgs))
        (if (elmo-file-field-condition-match
             (elmo-maildir-number-to-filename
              dir (car msgs) loc-alist)
-            condition)
+            condition (car msgs) number-list)
            (setq ret-val (append ret-val (list msg-num))))
        (setq i (1+ i))
        (setq percent (/ (* i 100) num))
@@ -464,7 +474,39 @@ file name for maildir directories."
    (elmo-maildir-get-folder-directory spec)
    number (or loc-alist (elmo-msgdb-location-load
                         (elmo-msgdb-expand-path
-                         nil spec)))))
+                         spec)))))
+
+(defun elmo-maildir-pack-number (spec msgdb arg)
+  (let ((old-number-alist (elmo-msgdb-get-number-alist msgdb))
+       (old-overview (elmo-msgdb-get-overview msgdb))
+       (old-mark-alist (elmo-msgdb-get-mark-alist msgdb))
+       (old-location (elmo-msgdb-get-location msgdb))
+       old-number overview number-alist mark-alist location
+       mark (number 1))
+    (setq overview old-overview)
+    (while old-overview
+      (setq old-number
+           (elmo-msgdb-overview-entity-get-number (car old-overview)))
+      (elmo-msgdb-overview-entity-set-number (car old-overview) number)
+      (setq number-alist
+           (cons (cons number (cdr (assq old-number old-number-alist)))
+                 number-alist))
+      (when (setq mark (cadr (assq old-number old-mark-alist)))
+       (setq mark-alist
+             (elmo-msgdb-mark-append
+              mark-alist number mark)))
+      (setq location
+           (cons (cons number (cdr (assq old-number old-location)))
+                 location))
+      (setq number (1+ number))
+      (setq old-overview (cdr old-overview)))
+    ;; XXX Should consider when folder is not persistent.
+    (elmo-msgdb-location-save (elmo-msgdb-expand-path spec) location)
+    (list overview
+         (nreverse number-alist)
+         (nreverse mark-alist)
+         (nreverse location)
+         (elmo-msgdb-make-overview-hashtb overview))))
 
 (defalias 'elmo-maildir-sync-number-alist
   'elmo-generic-sync-number-alist)
@@ -472,7 +514,10 @@ file name for maildir directories."
   'elmo-generic-list-folder-unread)
 (defalias 'elmo-maildir-list-folder-important
   'elmo-generic-list-folder-important)
+(defalias 'elmo-maildir-commit 'elmo-generic-commit)
+(defalias 'elmo-maildir-folder-diff 'elmo-generic-folder-diff)
 
-(provide 'elmo-maildir)
+(require 'product)
+(product-provide (provide 'elmo-maildir) (require 'elmo-version))
 
 ;;; elmo-maildir.el ends here
index ec3055b..5e3fbc4 100644 (file)
 (require 'std11)
 (require 'elmo-cache)
 
-(defun elmo-msgdb-expand-path (folder &optional spec)
+(defun elmo-msgdb-expand-path (folder)
+  "Expand msgdb path for FOLDER.
+FOLDER should be a sring of folder name or folder spec."
   (convert-standard-filename
-   (let* ((spec (or spec (elmo-folder-get-spec folder)))
+   (let* ((spec (if (stringp folder)
+                   (elmo-folder-get-spec folder)
+                 folder))
          (type (car spec))
          fld)
      (cond
                         (expand-file-name "folder"
                                           elmo-msgdb-dir)))
       ((eq type 'multi)
-       (expand-file-name (elmo-safe-filename folder)
+       (setq fld (concat "*" (mapconcat 'identity (cdr spec) ",")))
+       (expand-file-name (elmo-safe-filename fld)
                         (expand-file-name "multi"
                                           elmo-msgdb-dir)))
       ((eq type 'filter)
        (expand-file-name
-       (elmo-safe-filename folder)
+       (elmo-replace-msgid-as-filename folder)
        (expand-file-name "filter"
                          elmo-msgdb-dir)))
       ((eq type 'archive)
   (caddr msgdb))
 (defsubst elmo-msgdb-get-location (msgdb)
   (cadddr msgdb))
+(defsubst elmo-msgdb-get-overviewht (msgdb)
+  (nth 4 msgdb))
 
 ;;
 ;; number <-> Message-ID handling
     dir) alist))
 
 (defun elmo-list-folder-by-location (spec locations &optional msgdb)
-  (let* ((path (elmo-msgdb-expand-path nil spec))
+  (let* ((path (elmo-msgdb-expand-path spec))
         (location-alist (if msgdb
                             (elmo-msgdb-get-location msgdb)
                           (elmo-msgdb-location-load path)))
     ret-val))
 
 ;;
+;; mime decode cache
+
+(defvar elmo-msgdb-decoded-cache-hashtb nil)
+(make-variable-buffer-local 'elmo-msgdb-decoded-cache-hashtb)
+
+(defsubst elmo-msgdb-get-decoded-cache (string)
+  (if elmo-use-decoded-cache
+      (let ((hashtb (or elmo-msgdb-decoded-cache-hashtb
+                       (setq elmo-msgdb-decoded-cache-hashtb
+                             (elmo-make-hash 2048))))
+           decoded)
+       (or (elmo-get-hash-val string hashtb)
+           (progn
+             (elmo-set-hash-val
+              string
+              (setq decoded
+                    (decode-mime-charset-string string elmo-mime-charset))
+              hashtb)
+             decoded)))
+    (decode-mime-charset-string string elmo-mime-charset)))
+
+;;
 ;; overview handling
 ;;
 
@@ -382,6 +411,65 @@ header separator."
    (expand-file-name elmo-msgdb-overview-filename dir)
    overview))
 
+(defun elmo-msgdb-search-internal-primitive (condition entity number-list)
+  (let ((key (elmo-filter-key condition))
+       result)
+    (cond
+     ((string= key "last")
+      (setq result (<= (length (memq
+                               (elmo-msgdb-overview-entity-get-number entity)
+                               number-list))
+                      (string-to-int (elmo-filter-value condition)))))
+     ((string= key "first")
+      (setq result (< (- 
+                      (length number-list)
+                      (length (memq
+                               (elmo-msgdb-overview-entity-get-number entity)
+                               number-list)))
+                     (string-to-int (elmo-filter-value condition)))))
+     ((string= key "from")
+      (setq result (string-match 
+                   (elmo-filter-value condition)
+                   (elmo-msgdb-overview-entity-get-from entity))))
+     ((string= key "subject")
+      (setq result (string-match 
+                   (elmo-filter-value condition)
+                   (elmo-msgdb-overview-entity-get-subject entity))))
+     ((string= key "to")
+      (setq result (string-match
+                   (elmo-filter-value condition)
+                   (elmo-msgdb-overview-entity-get-to entity))))
+     ((string= key "cc")
+      (setq result (string-match
+                   (elmo-filter-value condition)
+                   (elmo-msgdb-overview-entity-get-cc entity))))
+     ((or (string= key "since")
+         (string= key "before"))
+      (let ((res (string< (timezone-make-date-sortable
+                          (elmo-msgdb-overview-entity-get-date entity))
+                         (elmo-date-make-sortable-string
+                          (elmo-date-get-datevec
+                           (elmo-filter-value condition))))))
+       (setq result (if (string= key "before") res (not res))))))
+    (if (eq (elmo-filter-type condition) 'unmatch)
+       (setq result (not result)))
+    result))
+
+(defun elmo-msgdb-search-internal (condition entity number-list)
+  (cond
+   ((vectorp condition)
+    (elmo-msgdb-search-internal-primitive condition entity number-list))
+   ((eq (car condition) 'and)
+    (and (elmo-msgdb-search-internal-primitive
+         (nth 1 condition) entity number-list)
+        (elmo-msgdb-search-internal-primitive
+         (nth 2 condition) entity number-list)))
+   ((eq (car condition) 'or)
+    (or (elmo-msgdb-search-internal-primitive
+        (nth 1 condition) entity number-list)
+       (elmo-msgdb-search-internal-primitive
+        (nth 2 condition) entity number-list)))))
+
 (defun elmo-msgdb-delete-msgs (folder msgs msgdb &optional reserve-cache)
   "Delete MSGS from FOLDER in MSGDB.
 content of MSGDB is changed."
@@ -394,7 +482,12 @@ content of MSGDB is changed."
                             (elmo-msgdb-number-load dir)))
           (mark-alist (or (caddr msgdb)
                           (elmo-msgdb-mark-load dir)))
-          message-id)
+          (loc-alist (or (elmo-msgdb-get-location msgdb)
+                         (elmo-msgdb-location-load dir)))
+          (hashtb (or (elmo-msgdb-get-overviewht msgdb)
+                      (elmo-msgdb-make-overview-hashtb overview)))
+          (newmsgdb (list overview number-alist mark-alist (nth 3 msgdb) hashtb))
+          ov-entity message-id)
       ;; remove from current database.
       (while msg-list
        (setq message-id (cdr (assq (car msg-list) number-alist)))
@@ -405,16 +498,22 @@ content of MSGDB is changed."
        ;(setq overview (delete (assoc message-id overview) overview))
        (setq overview
              (delq
-              (elmo-msgdb-overview-get-entity-by-number overview
-                                                        (car msg-list))
+              (setq ov-entity
+                    (elmo-msgdb-overview-get-entity (car msg-list) newmsgdb))
               overview))
+       (when (and elmo-use-overview-hashtb hashtb)
+         (elmo-msgdb-clear-overview-hashtb ov-entity hashtb))
        (setq number-alist
              (delq (assq (car msg-list) number-alist) number-alist))
        (setq mark-alist (delq (assq (car msg-list) mark-alist) mark-alist))
+       (setq loc-alist (delq (assq (car msg-list) loc-alist) loc-alist))
+       ;; XXX Should consider when folder is not persistent.
+       ;; (elmo-msgdb-location-save dir loc-alist)
        (setq msg-list (cdr msg-list)))
       (setcar msgdb overview)
       (setcar (cdr msgdb) number-alist)
-      (setcar (cddr msgdb) mark-alist))
+      (setcar (cddr msgdb) mark-alist)
+      (setcar (nthcdr 4 msgdb) hashtb))
     t)) ;return value
 
 (defsubst elmo-msgdb-set-overview (msgdb overview)
@@ -444,8 +543,7 @@ content of MSGDB is changed."
 (defsubst elmo-msgdb-overview-entity-get-from (entity)
   (and entity
        (aref (cdr entity) 2)
-       (decode-mime-charset-string (aref (cdr entity) 2)
-                                  elmo-mime-charset)))
+       (elmo-msgdb-get-decoded-cache (aref (cdr entity) 2))))
 
 (defsubst elmo-msgdb-overview-entity-set-number (entity number)
   (and entity (aset (cdr entity) 0 number))
@@ -459,8 +557,7 @@ content of MSGDB is changed."
 (defsubst elmo-msgdb-overview-entity-get-subject (entity)
   (and entity
        (aref (cdr entity) 3)
-       (decode-mime-charset-string (aref (cdr entity) 3)
-                                  elmo-mime-charset)))
+       (elmo-msgdb-get-decoded-cache (aref (cdr entity) 3))))
 
 (defsubst elmo-msgdb-overview-entity-get-subject-no-decode (entity)
   (and entity (aref (cdr entity) 3)))
@@ -481,6 +578,10 @@ content of MSGDB is changed."
 (defsubst elmo-msgdb-overview-entity-get-size (entity)
   (and entity (aref (cdr entity) 7)))
 
+(defsubst elmo-msgdb-overview-entity-set-size (entity size)
+  (and entity (aset (cdr entity) 7 size))
+  entity)
+
 (defsubst elmo-msgdb-overview-entity-get-id (entity)
   (and entity (car entity)))
 
@@ -490,16 +591,33 @@ content of MSGDB is changed."
         (cdr (assoc field-name extra)))))
 
 (defun elmo-msgdb-overview-get-entity-by-number (database number)
-  (let ((db database)
-       entity)
-    (catch 'loop
+  (when number
+    (let ((db database)
+         entity)
       (while db
        (if (eq (elmo-msgdb-overview-entity-get-number (car db)) number)
-           (progn
-             (setq entity (car db))
-             (throw 'loop nil))
-         (setq db (cdr db)))))
-    entity))
+           (setq entity (car db)
+                 db nil) ; exit loop
+         (setq db (cdr db))))
+      entity)))
+
+(defun elmo-msgdb-overview-get-entity (id msgdb)
+  (when id
+    (let ((ovht (elmo-msgdb-get-overviewht msgdb)))
+      (if ovht ;; use overview hash
+         (if (stringp id) ;; ID is message-id
+             (elmo-get-hash-val id ovht)
+           (elmo-get-hash-val (format "#%d" id) ovht))
+       (let* ((overview (elmo-msgdb-get-overview msgdb))
+              (number-alist (elmo-msgdb-get-number-alist msgdb))
+              (message-id (if (stringp id)
+                              id ;; ID is message-id
+                            (cdr (assq id number-alist))))
+              entity)
+         (if message-id
+             (assoc message-id overview)
+           ;; ID is number. message-id is nil or no exists in number-alist.
+           (elmo-msgdb-overview-get-entity-by-number overview id)))))))
 
 ;;
 ;; deleted message handling
@@ -515,80 +633,27 @@ content of MSGDB is changed."
    killed-list))
 
 (defun elmo-msgdb-killed-message-p (killed-list msg)
-  (and killed-list
-       (not (listp
-            (catch 'found
-              (mapcar
-               (function
-                (lambda (entity)
-                  (cond
-                   ((integerp entity)
-                    (if (eq entity msg)
-                        (throw 'found t)))
-                   ((consp entity)
-                    (if (and (<= (car entity) msg)
-                             (<= msg (cdr entity)))
-                        (throw 'found t)))))
-                killed-list)))))))
+  (elmo-number-set-member msg killed-list))
 
 (defun elmo-msgdb-set-as-killed (killed-list msg)
-  "if cons cell, set car-cdr messages as killed.
-if integer, set number th message as killed."
-  (let ((dlist killed-list)
-       (ret-val killed-list)
-       entity found)
-    (cond
-     ((integerp msg)
-      (while (and dlist (not found))
-       (setq entity (car dlist))
-       (if (or (and (integerp entity) (eq entity msg))
-               (and (consp entity)
-                    (<= (car entity) msg)
-                    (<= msg (cdr entity))))
-           (setq found t))
-       (setq dlist (cdr dlist))
-       )
-      (if (not found)
-         (setq ret-val (elmo-msgdb-append-element killed-list msg)))
-      )
-     ((consp msg)
-      (while (and dlist (not found))
-       (setq entity (car dlist))
-       (if (integerp entity)
-           (cond
-            ((and (<= (car msg) entity)(<= entity (cdr msg)))
-             (setcar dlist msg)
-             (setq found t)
-             )
-            ((= (1- (car msg)) entity)
-             (setcar dlist (cons entity (cdr msg)))
-             (setq found t)
-             )
-            ((= (1+ (cdr msg)) entity)
-             (setcar dlist (cons (car msg) entity))
-             (setq found t)
-             ))
-         ;; entity is consp
-         (cond  ; there are four patterns
-          ((and (<= (car msg) (car entity))
-                (<= (cdr entity) (cdr msg)))
-           (setcar dlist msg)
-           (setq found t))
-          ((and (< (car entity)(car msg))
-                (< (cdr msg) (cdr entity)))
-           (setq found t))
-          ((and (<= (car msg) (car entity))
-                (<= (cdr msg) (cdr entity)))
-           (setcar dlist (cons (car msg) (cdr entity)))
-           (setq found t))
-          ((and (<= (car entity) (car msg))
-                (<= (cdr entity) (cdr msg)))
-           (setcar dlist (cons (car entity) (cdr msg)))
-           (setq found t))))
-       (setq dlist (cdr dlist)))
-      (if (not found)
-         (setq ret-val (elmo-msgdb-append-element killed-list msg)))))
-    ret-val))
+  (elmo-number-set-append killed-list msg))
+
+(defun elmo-msgdb-append-to-killed-list (folder msgs)
+  (let ((dir (elmo-msgdb-expand-path folder)))
+    (elmo-msgdb-killed-list-save
+     dir
+     (elmo-number-set-append-list
+      (elmo-msgdb-killed-list-load dir)
+      msgs))))
+
+(defun elmo-living-messages (messages killed-list)
+  (if killed-list
+      (delq nil
+           (mapcar (lambda (number)
+                     (unless (elmo-number-set-member number killed-list)
+                       number))
+                   messages))
+    messages))
 
 (defun elmo-msgdb-finfo-load ()
   (elmo-object-load (expand-file-name
@@ -605,13 +670,13 @@ if integer, set number th message as killed."
 (defun elmo-msgdb-flist-load (folder)
   (let ((flist-file (expand-file-name
                     elmo-msgdb-flist-filename
-                    (elmo-msgdb-expand-path folder (list 'folder folder)))))
+                    (elmo-msgdb-expand-path (list 'folder folder)))))
     (elmo-object-load flist-file nil t)))
 
 (defun elmo-msgdb-flist-save (folder flist)
   (let ((flist-file (expand-file-name
                     elmo-msgdb-flist-filename
-                    (elmo-msgdb-expand-path folder (list 'folder folder)))))
+                    (elmo-msgdb-expand-path (list 'folder folder)))))
     (elmo-object-save flist-file flist)))
 
 (defun elmo-crosspost-alist-load ()
@@ -681,30 +746,61 @@ Header region is supposed to be narrowed."
   (let ((overview (elmo-msgdb-get-overview msgdb)))
     (setq overview (elmo-msgdb-overview-sort-by-date overview))
     (message "Sorting...done.")
-    (list overview (nth 1 msgdb)(nth 2 msgdb)(nth 3 msgdb))))
-
-(defsubst elmo-msgdb-search-overview-entity (number number-alist overview)
-  (let ((message-id (cdr (assq number number-alist)))
-       ovs)
-    (if message-id
-       (assoc message-id overview)
-      (elmo-msgdb-overview-get-entity-by-number overview number))))
-
-(defsubst elmo-msgdb-append (msgdb msgdb-append)
+    (list overview (nth 1 msgdb)(nth 2 msgdb)(nth 3 msgdb)(nth 4 msgdb))))
+
+(defun elmo-msgdb-clear-overview-hashtb (entity hashtb)
+  (let (number)
+    (when (and entity
+              elmo-use-overview-hashtb
+              hashtb)
+      (and (setq number (elmo-msgdb-overview-entity-get-number entity))
+          (elmo-clear-hash-val (format "#%d" number) hashtb))
+      (and (car entity) ;; message-id
+          (elmo-clear-hash-val (car entity) hashtb)))))
+
+(defun elmo-msgdb-make-overview-hashtb (overview &optional hashtb)
+  (if elmo-use-overview-hashtb
+      (let ((hashtb (or hashtb ;; append
+                       (elmo-make-hash (length overview)))))
+       (while overview
+         ;; key is message-id
+         (if (caar overview)
+             (elmo-set-hash-val (caar overview) (car overview) hashtb))
+         ;; key is number
+         (elmo-set-hash-val
+          (format "#%d" (elmo-msgdb-overview-entity-get-number (car overview)))
+          (car overview) hashtb)
+         (setq overview (cdr overview)))
+       hashtb)
+    nil))
+
+(defsubst elmo-msgdb-append (msgdb msgdb-append &optional set-hash)
   (list
    (nconc (car msgdb) (car msgdb-append))
    (nconc (cadr msgdb) (cadr msgdb-append))
    (nconc (caddr msgdb) (caddr msgdb-append))
-   (nconc (cadddr msgdb) (cadddr msgdb-append))))
+   (nconc (cadddr msgdb) (cadddr msgdb-append))
+   (and set-hash
+       (elmo-msgdb-make-overview-hashtb (car msgdb-append) (nth 4 msgdb)))))
+
+(defsubst elmo-msgdb-clear (&optional msgdb)
+  (if msgdb
+      (list
+       (setcar msgdb nil)
+       (setcar (cdr msgdb) nil)
+       (setcar (cddr msgdb) nil)
+       (setcar (cdddr msgdb) nil)
+       (setcar (nthcdr 4 msgdb) (elmo-msgdb-make-overview-hashtb nil)))
+    (list nil nil nil nil (elmo-msgdb-make-overview-hashtb nil))))
 
 (defun elmo-msgdb-delete-path (folder &optional spec)
-  (let ((path (elmo-msgdb-expand-path folder spec)))
+  (let ((path (elmo-msgdb-expand-path (or spec folder))))
     (if (file-directory-p path)
        (elmo-delete-directory path t))))
 
 (defun elmo-msgdb-rename-path (old-folder new-folder &optional old-spec new-spec)
-  (let* ((old (directory-file-name (elmo-msgdb-expand-path old-folder old-spec)))
-        (new (directory-file-name (elmo-msgdb-expand-path new-folder new-spec)))
+  (let* ((old (directory-file-name (elmo-msgdb-expand-path old-spec)))
+        (new (directory-file-name (elmo-msgdb-expand-path new-spec)))
         (new-dir (directory-file-name (file-name-directory new))))
     (if (not (file-directory-p old))
        ()
@@ -714,6 +810,7 @@ Header region is supposed to be narrowed."
            (elmo-make-directory new-dir))
        (rename-file old new)))))
 
-(provide 'elmo-msgdb)
+(require 'product)
+(product-provide (provide 'elmo-msgdb) (require 'elmo-version))
 
 ;;; elmo-msgdb.el ends here
index 918cc22..6182de0 100644 (file)
       (setq cur-number (+ 1 cur-number)))
     t))
 
-(defun elmo-multi-mark-alist-list (mark-alist)
+(defun elmo-multi-folder-diff (spec folder &optional number-list)
+  (let ((flds (cdr spec))
+       (num-alist-list
+        (elmo-multi-split-number-alist
+         (elmo-msgdb-number-load (elmo-msgdb-expand-path spec))))
+       (count 0)
+       (unsync 0)
+       (messages 0)
+       diffs)
+    (while flds
+      (setq diffs (nconc diffs (list (elmo-folder-diff
+                                     (car flds)
+                                     (mapcar 'car
+                                             (nth count num-alist-list))))))
+      (setq count (+ 1 count))
+      (setq flds (cdr flds)))
+    (while diffs
+      (and (car (car diffs))
+          (setq unsync (+ unsync (car (car diffs)))))
+      (setq messages  (+ messages (cdr (car diffs))))
+      (setq diffs (cdr diffs)))
+    (elmo-folder-set-info-hashtb folder
+                                nil messages)
+    (cons unsync messages)))
+
+(defun elmo-multi-split-mark-alist (mark-alist)
   (let ((cur-number 0)
+       (alist (sort (copy-sequence mark-alist)
+                    (lambda (pair1 pair2)
+                      (< (car pair1)(car pair2)))))
        one-alist result)
-    (while mark-alist
+    (while alist
       (setq cur-number (+ cur-number 1))
       (setq one-alist nil)
-      (while (and mark-alist
+      (while (and alist
                  (eq 0
-                     (/ (- (car (car mark-alist))
+                     (/ (- (car (car alist))
                            (* elmo-multi-divide-number cur-number))
                         elmo-multi-divide-number)))
        (setq one-alist (nconc
                         one-alist
                         (list
-                         (list (% (car (car mark-alist))
+                         (list (% (car (car alist))
                                   (* elmo-multi-divide-number cur-number))
-                               (cadr (car mark-alist))))))
-       (setq mark-alist (cdr mark-alist)))
+                               (cadr (car alist))))))
+       (setq alist (cdr alist)))
       (setq result (nconc result (list one-alist))))
     result))
 
-(defun elmo-multi-list-folder-unread (spec mark-alist unread-marks)
-  (let* ((flds (cdr spec))
-        (cur-number 0)
-        mark-alist-list
-        ret-val)
-    (setq mark-alist-list (elmo-multi-mark-alist-list mark-alist))
-    (while flds
+(defun elmo-multi-split-number-alist (number-alist)
+  (let ((alist (sort (copy-sequence number-alist)
+                    (lambda (pair1 pair2)
+                      (< (car pair1)(car pair2)))))
+       (cur-number 0)
+       one-alist split num)
+    (while alist
       (setq cur-number (+ cur-number 1))
-      (setq ret-val (append
-                    ret-val
-                    (mapcar
-                     (function
-                      (lambda (x)
-                        (+
-                         (* elmo-multi-divide-number cur-number) x)))
-                     (elmo-list-folder-unread (car flds)
-                                              (car mark-alist-list)
-                                              unread-marks))))
-      (setq mark-alist-list (cdr mark-alist-list))
-      (setq flds (cdr flds)))
-    ret-val))
-
-(defun elmo-multi-list-folder-important (spec overview)
-  (let* ((flds (cdr spec))
-        (cur-number 0)
-        ret-val)
-    (while flds
-      (setq cur-number (+ cur-number 1))
-      (setq ret-val (append
-                    ret-val
+      (setq one-alist nil)
+      (while (and alist
+                 (eq 0
+                     (/ (- (setq num (car (car alist)))
+                           (* elmo-multi-divide-number cur-number))
+                        elmo-multi-divide-number)))
+       (setq one-alist (nconc
+                        one-alist
+                        (list
+                         (cons
+                          (% num (* elmo-multi-divide-number cur-number))
+                          (cdr (car alist))))))
+       (setq alist (cdr alist)))
+      (setq split (nconc split (list one-alist))))
+    split))
+
+(defun elmo-multi-list-folder-unread (spec number-alist mark-alist
+                                          unread-marks)
+  (let ((folders (cdr spec))
+       (cur-number 0)
+       (split-mark-alist (elmo-multi-split-mark-alist mark-alist))
+       (split-number-alist (elmo-multi-split-number-alist number-alist))
+       unreads)
+    (while folders
+      (setq cur-number (+ cur-number 1)
+           unreads (append
+                    unreads
                     (mapcar
                      (function
                       (lambda (x)
                         (+
                          (* elmo-multi-divide-number cur-number) x)))
-                     (elmo-list-folder-important (car flds) overview))))
-      (setq flds (cdr flds)))
-    ret-val))
+                     (elmo-list-folder-unread (car folders)
+                                              (car split-number-alist)
+                                              (car split-mark-alist)
+                                              unread-marks)))
+           split-number-alist (cdr split-number-alist)
+           split-mark-alist (cdr split-mark-alist)
+           folders (cdr folders)))
+    unreads))
+
+(defun elmo-multi-list-folder-important (spec number-alist)
+  (let ((folders (cdr spec))
+       (cur-number 0)
+       (split-number-alist (elmo-multi-split-number-alist number-alist))
+       importants)
+    (while folders
+      (setq cur-number (+ cur-number 1)
+           importants (nconc
+                       importants
+                       (mapcar
+                        (function
+                         (lambda (x)
+                           (+ (* elmo-multi-divide-number cur-number) x)))
+                        (elmo-list-folder-important 
+                         (car folders)
+                         (car split-number-alist))))
+           folders (cdr folders)))
+    importants))
 
 (defun elmo-multi-list-folder (spec)
   (let* ((flds (cdr spec))
         (cur-number 0)
-        ret-val)
+        (killed (and elmo-use-killed-list
+                     (elmo-msgdb-killed-list-load
+                      (elmo-msgdb-expand-path spec))))
+        numbers)
     (while flds
       (setq cur-number (+ cur-number 1))
-      (setq ret-val (append
-                    ret-val
+      (setq numbers (append
+                    numbers
                     (mapcar
                      (function
                       (lambda (x)
                          (* elmo-multi-divide-number cur-number) x)))
                      (elmo-list-folder (car flds)))))
       (setq flds (cdr flds)))
-    ret-val))
+    (elmo-living-messages numbers killed)))
 
 (defun elmo-multi-folder-exists-p (spec)
   (let* ((flds (cdr spec)))
 (defun elmo-multi-sync-number-alist (spec number-alist)
   (let ((folder-list (cdr spec))
        (number-alist-list
-        (elmo-multi-get-number-alist-list number-alist))
+        (elmo-multi-split-number-alist number-alist))
        (multi-base 0)
        append-alist result-alist)
     (while folder-list
       (setq folder-list (cdr folder-list)))
     result-alist))
 
-(provide 'elmo-multi)
+(require 'product)
+(product-provide (provide 'elmo-multi) (require 'elmo-version))
 
 ;;; elmo-multi.el ends here
diff --git a/elmo/elmo-net.el b/elmo/elmo-net.el
new file mode 100644 (file)
index 0000000..5b946fa
--- /dev/null
@@ -0,0 +1,237 @@
+;;; elmo-net.el -- Network module for ELMO.
+
+;; Copyright 1998,1999,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:
+;; 
+
+(require 'luna)
+(require 'elmo-util)
+(require 'elmo-vars)
+
+(eval-and-compile
+  (luna-define-class elmo-network-session () (name
+                                             host
+                                             port
+                                             user
+                                             auth
+                                             stream-type
+                                             process
+                                             greeting))
+  (luna-define-internal-accessors 'elmo-network-session))
+
+(luna-define-generic elmo-network-initialize-session (session)
+  "Initialize SESSION (Called before authentication).")
+
+(luna-define-generic elmo-network-initialize-session-buffer (session buffer)
+  "Initialize SESSION's BUFFER.")
+
+(luna-define-generic elmo-network-authenticate-session (session)
+  "Authenticate SESSION.")
+
+(luna-define-generic elmo-network-setup-session (session)
+  "Setup SESSION. (Called after authentication).")
+
+(luna-define-generic elmo-network-close-session (session)
+  "Close SESSION.")
+
+(luna-define-method
+  elmo-network-initialize-session-buffer ((session
+                                          elmo-network-session) buffer)
+  (with-current-buffer buffer
+    (elmo-set-buffer-multibyte nil)
+    (buffer-disable-undo (current-buffer))))
+
+(luna-define-method elmo-network-close-session ((session elmo-network-session))
+  (when (elmo-network-session-process-internal session)
+;       (memq (process-status (elmo-network-session-process-internal session))
+;           '(open run))
+    (kill-buffer (process-buffer
+                 (elmo-network-session-process-internal session)))
+    (delete-process (elmo-network-session-process-internal session))))
+
+(defmacro elmo-network-stream-type-spec-string (stream-type)
+  (` (nth 0 (, stream-type))))
+
+(defmacro elmo-network-stream-type-symbol (stream-type)
+  (` (nth 1 (, stream-type))))
+
+(defmacro elmo-network-stream-type-feature (stream-type)
+  (` (nth 2 (, stream-type))))
+
+(defmacro elmo-network-stream-type-function (stream-type)
+  (` (nth 3 (, stream-type))))
+
+(defsubst elmo-network-session-password-key (session)
+  (format "%s:%s/%s@%s:%d"
+         (elmo-network-session-name-internal session)
+         (elmo-network-session-user-internal session)
+         (symbol-name (or (elmo-network-session-auth-internal session)
+                          'plain))
+         (elmo-network-session-host-internal session)
+         (elmo-network-session-port-internal session)))
+
+(defvar elmo-network-session-cache nil)
+(defvar elmo-network-session-name-prefix nil)
+
+(defsubst elmo-network-session-cache-key (name host port user auth stream-type)
+  "Returns session cache key."
+  (format "%s:%s/%s@%s:%d%s"
+         (concat elmo-network-session-name-prefix name)
+         user auth host port (or stream-type "")))
+
+(defun elmo-network-clear-session-cache ()
+  "Clear session cache."
+  (interactive)
+  (mapcar (lambda (pair)
+           (elmo-network-close-session (cdr pair)))
+         elmo-network-session-cache)
+  (setq elmo-network-session-cache nil))
+
+(defmacro elmo-network-session-buffer (session)
+  "Get buffer for SESSION."
+  (` (process-buffer (elmo-network-session-process-internal
+                     (, session)))))
+
+(defun elmo-network-get-session (class name host port user auth stream-type
+                                      &optional if-exists)
+  "Get network session from session cache or a new network session.
+CLASS is the class name of the session.
+NAME is the name of the process.
+HOST is the name of the server host.
+PORT is the port number of the service.
+USER is the user-id for the authenticate.
+AUTH is the authenticate method name (symbol).
+STREAM-TYPE is the stream type (See also `elmo-network-stream-type-alist').
+Returns a `elmo-network-session' instance.
+If optional argument IF-EXISTS is non-nil, it does not return session
+if there is no session cache.
+if making session failed, returns nil."
+  (let (pair session key)
+    (if (not (elmo-plugged-p host port))
+       (error "Unplugged"))
+    (setq pair (assoc (setq key (elmo-network-session-cache-key
+                                name host port user auth stream-type))
+                     elmo-network-session-cache))
+    (when (and pair
+              (memq (process-status
+                     (elmo-network-session-process-internal
+                      (cdr pair)))
+                    '(closed exit)))
+      (setq elmo-network-session-cache
+           (delq pair elmo-network-session-cache))
+      (elmo-network-close-session (cdr pair))
+      (setq pair nil))
+    (if pair
+       (cdr pair)                      ; connection cache exists.
+      (unless if-exists
+       (setq session
+             (elmo-network-open-session class name
+                                        host port user auth stream-type))
+       (setq elmo-network-session-cache
+             (cons (cons key session)
+                   elmo-network-session-cache))
+       session))))
+
+(defun elmo-network-open-session (class name host port user auth
+                                       stream-type)
+  "Open an authenticated network session.
+CLASS is the class name of the session.
+NAME is the name of the process.
+HOST is the name of the server host.
+PORT is the port number of the service.
+USER is the user-id for the authenticate.
+AUTH is the authenticate method name (symbol).
+STREAM-TYPE is the stream type (See also `elmo-network-stream-type-alist').
+Returns a process object. if making session failed, returns nil."
+  (let ((session
+        (luna-make-entity class
+                          :name name
+                          :host host
+                          :port port
+                          :user user
+                          :auth auth
+                          :stream-type stream-type
+                          :process nil
+                          :greeting nil))
+       (buffer (format " *%s session for %s@%s:%d%s"
+                       (concat elmo-network-session-name-prefix name)
+                       user
+                       host
+                       port
+                       (or (elmo-network-stream-type-spec-string stream-type)
+                           "")))
+       process)
+    (condition-case error
+       (progn
+         (if (get-buffer buffer) (kill-buffer buffer))
+         (setq buffer (get-buffer-create buffer))
+         (elmo-network-initialize-session-buffer session buffer)
+         (elmo-network-session-set-process-internal
+          session
+          (setq process (elmo-open-network-stream
+                         (elmo-network-session-name-internal session)
+                         buffer host port stream-type)))
+         (when process
+           (elmo-network-initialize-session session)
+           (elmo-network-authenticate-session session)
+           (elmo-network-setup-session session)))
+      (error
+       (when (eq (car error) 'elmo-authenticate-error)
+        (elmo-remove-passwd (elmo-network-session-password-key session)))
+       (elmo-network-close-session session)
+       (signal (car error)(cdr error))))
+    session))
+
+(defun elmo-open-network-stream (name buffer host service stream-type)
+  (let ((auto-plugged (and elmo-auto-change-plugged
+                          (> elmo-auto-change-plugged 0)))
+       process)
+    (if (and stream-type
+            (elmo-network-stream-type-feature stream-type))
+       (require (elmo-network-stream-type-feature stream-type)))
+    (condition-case err
+       (let (process-connection-type)
+         (as-binary-process
+          (setq process
+                (if stream-type
+                    (funcall (elmo-network-stream-type-function stream-type)
+                             name buffer host service)
+                  (open-network-stream name buffer host service)))))
+      (error
+       (when auto-plugged
+        (elmo-set-plugged nil host service (current-time))
+        (message "Auto plugged off at %s:%d" host service)
+        (sit-for 1))
+       (signal (car err) (cdr err))))
+    (when process
+      (process-kill-without-query process)
+      (when auto-plugged
+       (elmo-set-plugged t host service))
+      process)))
+
+(require 'product)
+(product-provide (provide 'elmo-net) (require 'elmo-version))
+
+;;; elmo-net.el ends here
index b38730b..4917e71 100644 (file)
   (require 'elmo-cache)
   (require 'elmo-util)
   (defun-maybe starttls-negotiate (a)))
+(require 'elmo-net)
+
+(eval-and-compile
+  (luna-define-class elmo-nntp-session (elmo-network-session)
+                    (current-group))
+  (luna-define-internal-accessors 'elmo-nntp-session))
 
 ;;
 ;; internal variables
@@ -70,6 +76,8 @@ Don't cache if nil.")
 
 (defvar elmo-nntp-default-use-list-active t)
 
+(defvar elmo-nntp-default-use-xhdr t)
+
 (defvar elmo-nntp-server-command-alist nil)
 
 
@@ -77,73 +85,75 @@ Don't cache if nil.")
                                           (listgroup . 1)
                                           (list-active . 2)))
 
-(put 'elmo-nntp-setting 'lisp-indent-function 1)
-
-(defmacro elmo-nntp-setting (spec &rest body)
-  (` (let* ((ssl (elmo-nntp-spec-ssl (, spec)))
-           (port (elmo-nntp-spec-port (, spec)))
-           (user (elmo-nntp-spec-username (, spec)))
-           (server (elmo-nntp-spec-hostname (, spec)))
-           (folder (elmo-nntp-spec-group (, spec)))
-           (connection (elmo-nntp-get-connection server user port ssl))
-           (buffer  (car connection))
-           (process (cadr connection)))
-       (,@ body))))
+(defmacro elmo-nntp-get-server-command (session)
+  (` (assoc (cons (elmo-network-session-host-internal (, session))
+                 (elmo-network-session-port-internal (, session)))
+           elmo-nntp-server-command-alist)))
 
-(defmacro elmo-nntp-get-server-command (server port)
-  (` (assoc (cons (, server) (, port)) elmo-nntp-server-command-alist)))
-
-(defmacro elmo-nntp-set-server-command (server port com value)
+(defmacro elmo-nntp-set-server-command (session com value)
   (` (let (entry)
        (unless (setq entry (cdr (elmo-nntp-get-server-command
-                                (, server) (, port))))
+                                (, session))))
         (setq elmo-nntp-server-command-alist
               (nconc elmo-nntp-server-command-alist
-                     (list (cons (cons (, server) (, port))
-                                 (setq entry
-                                       (vector
-                                        elmo-nntp-default-use-xover
-                                        elmo-nntp-default-use-listgroup
-                                        elmo-nntp-default-use-list-active))
-                                 )))))
+                     (list (cons
+                            (cons 
+                             (elmo-network-session-host-internal (, session))
+                             (elmo-network-session-port-internal (, session)))
+                            (setq entry
+                                  (vector
+                                   elmo-nntp-default-use-xover
+                                   elmo-nntp-default-use-listgroup
+                                   elmo-nntp-default-use-list-active
+                                   elmo-nntp-default-use-xhdr)))))))
        (aset entry
             (cdr (assq (, com) elmo-nntp-server-command-index))
             (, value)))))
 
-(defmacro elmo-nntp-xover-p (server port)
-  (` (let ((entry (elmo-nntp-get-server-command (, server) (, port))))
+(defmacro elmo-nntp-xover-p (session)
+  (` (let ((entry (elmo-nntp-get-server-command (, session))))
        (if entry
           (aref (cdr entry)
                 (cdr (assq 'xover elmo-nntp-server-command-index)))
         elmo-nntp-default-use-xover))))
 
-(defmacro elmo-nntp-set-xover (server port value)
-  (` (elmo-nntp-set-server-command (, server) (, port) 'xover (, value))))
+(defmacro elmo-nntp-set-xover (session value)
+  (` (elmo-nntp-set-server-command (, session) 'xover (, value))))
 
-(defmacro elmo-nntp-listgroup-p (server port)
-  (` (let ((entry (elmo-nntp-get-server-command (, server) (, port))))
+(defmacro elmo-nntp-listgroup-p (session)
+  (` (let ((entry (elmo-nntp-get-server-command (, session))))
        (if entry
           (aref (cdr entry)
                 (cdr (assq 'listgroup elmo-nntp-server-command-index)))
         elmo-nntp-default-use-listgroup))))
 
-(defmacro elmo-nntp-set-listgroup (server port value)
-  (` (elmo-nntp-set-server-command (, server) (, port) 'listgroup (, value))))
+(defmacro elmo-nntp-set-listgroup (session value)
+  (` (elmo-nntp-set-server-command (, session) 'listgroup (, value))))
 
-(defmacro elmo-nntp-list-active-p (server port)
-  (` (let ((entry (elmo-nntp-get-server-command (, server) (, port))))
+(defmacro elmo-nntp-list-active-p (session)
+  (` (let ((entry (elmo-nntp-get-server-command (, session))))
        (if entry
           (aref (cdr entry)
                 (cdr (assq 'list-active elmo-nntp-server-command-index)))
         elmo-nntp-default-use-list-active))))
 
-(defmacro elmo-nntp-set-list-active (server port value)
-  (` (elmo-nntp-set-server-command (, server) (, port) 'list-active (, value))))
+(defmacro elmo-nntp-set-list-active (session value)
+  (` (elmo-nntp-set-server-command (, session) 'list-active (, value))))
+
+(defmacro elmo-nntp-xhdr-p (session)
+  (` (let ((entry (elmo-nntp-get-server-command (, session))))
+       (if entry
+          (aref (cdr entry)
+                (cdr (assq 'xhdr elmo-nntp-server-command-index)))
+        elmo-nntp-default-use-xhdr))))
+
+(defmacro elmo-nntp-set-xhdr (session value)
+  (` (elmo-nntp-set-server-command (, session) 'xhdr (, value))))
 
 (defsubst elmo-nntp-max-number-precedes-list-active-p ()
   elmo-nntp-max-number-precedes-list-active)
 
-(defsubst elmo-nntp-folder-postfix (user server port ssl)
+(defsubst elmo-nntp-folder-postfix (user server port type)
   (concat
    (and user (concat ":" user))
    (if (and server
@@ -153,59 +163,61 @@ Don't cache if nil.")
            (null (eq port elmo-default-nntp-port)))
        (concat ":" (if (numberp port)
                       (int-to-string port) port)))
-   (unless (eq ssl elmo-default-nntp-ssl)
-     (if (eq ssl 'starttls)
-        "!!"
-       (if ssl "!")))))
-
-(defun elmo-nntp-flush-connection ()
-  (interactive)
-  (let ((cache elmo-nntp-connection-cache)
-       buffer process)
-    (while cache
-      (setq buffer (car (cdr (car cache))))
-      (if buffer (kill-buffer buffer))
-      (setq process (car (cdr (cdr (car cache)))))
-      (if process (delete-process process))
-      (setq cache (cdr cache)))
-    (setq elmo-nntp-connection-cache nil)))
-
-(defun elmo-nntp-get-connection (server user port ssl)
-  (let* ((user-at-host (format "%s@%s" user server))
-        (user-at-host-on-port (concat
-                               user-at-host ":" (int-to-string port)
-                               (if (eq ssl 'starttls) "!!" (if ssl "!"))))
-        ret-val result buffer process errmsg proc-stat)
-    (if (not (elmo-plugged-p server port))
-       (error "Unplugged"))
-    (setq ret-val (assoc user-at-host-on-port elmo-nntp-connection-cache))
-    (if (and ret-val
-            (or (eq  (setq proc-stat
-                           (process-status (cadr (cdr ret-val))))
-                     'closed)
-                (eq proc-stat 'exit)))
-       ;; connection is closed...
-       (progn
-         (kill-buffer (car (cdr ret-val)))
-         (setq elmo-nntp-connection-cache
-               (delete ret-val elmo-nntp-connection-cache))
-         (setq ret-val nil)))
-    (if ret-val
-       (cdr ret-val)
-      (setq result (elmo-nntp-open-connection server user port ssl))
-      (if (null result)
-         (progn
-           (if process (delete-process process))
-           (if buffer (kill-buffer buffer))
-           (error "Connection failed"))
-       (setq buffer (car result))
-       (setq process (cdr result))
-       (setq elmo-nntp-connection-cache
-             (nconc elmo-nntp-connection-cache
-                    (list
-                     (cons user-at-host-on-port
-                           (setq ret-val (list buffer process nil))))))
-       ret-val))))
+   (unless (eq (elmo-network-stream-type-symbol type)
+              elmo-default-nntp-stream-type)
+     (elmo-network-stream-type-spec-string type))))
+
+(defun elmo-nntp-get-session (spec &optional if-exists)
+  (elmo-network-get-session
+   'elmo-nntp-session
+   "NNTP"
+   (elmo-nntp-spec-hostname spec)
+   (elmo-nntp-spec-port spec)
+   (elmo-nntp-spec-username spec)
+   nil ; auth type
+   (elmo-nntp-spec-stream-type spec)
+   if-exists))
+
+(luna-define-method elmo-network-initialize-session ((session
+                                                     elmo-nntp-session))
+  (set-process-filter (elmo-network-session-process-internal session)
+                     'elmo-nntp-process-filter)
+  (with-current-buffer (elmo-network-session-buffer session)
+    (setq elmo-nntp-read-point (point-min))
+    (or (elmo-nntp-read-response session t)
+       (error "cannot open network"))
+    (when (eq (elmo-network-stream-type-symbol
+              (elmo-network-session-stream-type-internal session))
+             'starttls)
+      (elmo-nntp-send-command session "starttls")
+      (or (elmo-nntp-read-response session)
+         (error "cannot open starttls session"))
+      (starttls-negotiate
+       (elmo-network-session-process-internal session)))))
+
+
+(luna-define-method elmo-network-authenticate-session ((session
+                                                       elmo-nntp-session))
+  (with-current-buffer (elmo-network-session-buffer session)
+    (when (elmo-network-session-user-internal session)
+      (elmo-nntp-send-command session
+                             (format "authinfo user %s"
+                                     (elmo-network-session-user-internal
+                                      session)))
+      (or (elmo-nntp-read-response session)
+         (signal 'elmo-authenticate-error '(authinfo)))
+      (elmo-nntp-send-command
+       session
+       (format "authinfo pass %s"
+              (elmo-get-passwd (elmo-network-session-password-key session))))
+      (or (elmo-nntp-read-response session)
+         (signal 'elmo-authenticate-error '(authinfo))))))
+
+(luna-define-method elmo-network-setup-session ((session
+                                                elmo-nntp-session))
+  (if elmo-nntp-send-mode-reader
+      (elmo-nntp-send-mode-reader session))
+  (run-hooks 'elmo-nntp-opened-hook))
 
 (defun elmo-nntp-process-filter (process output)
   (save-excursion
@@ -213,20 +225,34 @@ Don't cache if nil.")
     (goto-char (point-max))
     (insert output)))
 
-(defun elmo-nntp-read-response (buffer process &optional not-command)
-  (save-excursion
-    (set-buffer buffer)
-    (let ((case-fold-search nil)
+(defun elmo-nntp-send-mode-reader (session)
+  (elmo-nntp-send-command session "mode reader")
+  (if (null (elmo-nntp-read-response session t))
+      (error "mode reader failed")))
+  
+(defun elmo-nntp-send-command (session command &optional noerase)
+  (with-current-buffer (elmo-network-session-buffer session)
+    (unless noerase
+      (erase-buffer)
+      (goto-char (point-min)))
+    (setq elmo-nntp-read-point (point))
+    (process-send-string (elmo-network-session-process-internal
+                         session) command)
+    (process-send-string (elmo-network-session-process-internal
+                         session) "\r\n")))
+
+(defun elmo-nntp-read-response (session &optional not-command)
+  (with-current-buffer (elmo-network-session-buffer session)
+    (let ((process (elmo-network-session-process-internal session))
+         (case-fold-search nil)
          (response-string nil)
          (response-continue t)
-         (return-value nil)
-         match-end)
+         response match-end)
       (while response-continue
        (goto-char elmo-nntp-read-point)
        (while (not (search-forward "\r\n" nil t))
          (accept-process-output process)
          (goto-char elmo-nntp-read-point))
-
        (setq match-end (point))
        (setq response-string
              (buffer-substring elmo-nntp-read-point (- match-end 2)))
@@ -234,79 +260,70 @@ Don't cache if nil.")
        (if (looking-at "[23][0-9]+ .*$")
            (progn (setq response-continue nil)
                   (setq elmo-nntp-read-point match-end)
-                  (setq return-value
-                        (if return-value
-                            (concat return-value "\n" response-string)
+                  (setq response 
+                        (if response 
+                            (concat response "\n" response-string)
                           response-string)))
          (if (looking-at "[^23][0-9]+ .*$")
              (progn (setq response-continue nil)
                     (setq elmo-nntp-read-point match-end)
-                    (setq return-value nil))
+                    (setq response nil))
            (setq elmo-nntp-read-point match-end)
            (if not-command
                (setq response-continue nil))
-           (setq return-value
-                 (if return-value
-                     (concat return-value "\n" response-string)
+           (setq response
+                 (if response 
+                     (concat response "\n" response-string)
                    response-string)))
          (setq elmo-nntp-read-point match-end)))
-      return-value)))
+      response)))
 
-(defun elmo-nntp-read-raw-response (buffer process)
-  (save-excursion
-    (set-buffer buffer)
-    (let ((case-fold-search nil))
-      (goto-char elmo-nntp-read-point)
-      (while (not (search-forward "\r\n" nil t))
-       (accept-process-output process)
-       (goto-char elmo-nntp-read-point))
-      (buffer-substring elmo-nntp-read-point (- (point) 2)))))
-
-(defun elmo-nntp-read-contents (buffer process)
-  (save-excursion
-    (set-buffer buffer)
-    (let ((case-fold-search nil)
-         match-end)
-      (goto-char elmo-nntp-read-point)
-      (while (not (re-search-forward "^\\.\r\n" nil t))
-       (accept-process-output process)
-       (goto-char elmo-nntp-read-point))
-      (setq match-end (point))
-      (elmo-delete-cr
-       (buffer-substring elmo-nntp-read-point
-                        (- match-end 3))))))
-
-(defun elmo-nntp-read-body (buffer process outbuf)
-  (with-current-buffer buffer
+(defun elmo-nntp-read-raw-response (session)
+  (with-current-buffer (elmo-network-session-buffer session)
+    (goto-char elmo-nntp-read-point)
+    (while (not (search-forward "\r\n" nil t))
+      (accept-process-output (elmo-network-session-process-internal
+                             session))
+      (goto-char elmo-nntp-read-point))
+    (buffer-substring elmo-nntp-read-point (- (point) 2))))
+
+(defun elmo-nntp-read-contents (session)
+  (with-current-buffer (elmo-network-session-buffer session)
+    (goto-char elmo-nntp-read-point)
+    (while (not (re-search-forward "^\\.\r\n" nil t))
+      (accept-process-output (elmo-network-session-process-internal
+                             session))
+      (goto-char elmo-nntp-read-point))
+    (elmo-delete-cr
+     (buffer-substring elmo-nntp-read-point 
+                      (- (point) 3)))))
+
+(defun elmo-nntp-read-body (session outbuf)
+  (with-current-buffer (elmo-network-session-buffer session)
+    (goto-char elmo-nntp-read-point)
+    (while (not (re-search-forward "^\\.\r\n" nil t))
+      (accept-process-output (elmo-network-session-process-internal session))
+      (goto-char elmo-nntp-read-point))
     (let ((start elmo-nntp-read-point)
-         end)
-      (goto-char start)
-      (while (not (re-search-forward "^\\.\r\n" nil t))
-       (accept-process-output process)
-       (goto-char start))
-      (setq end (point))
+         (end  (point)))
       (with-current-buffer outbuf
        (erase-buffer)
-       (insert-buffer-substring buffer start (- end 3))
+       (insert-buffer-substring (elmo-network-session-buffer session)
+                                start (- end 3))
        (elmo-delete-cr-get-content-type)))))
 
-(defun elmo-nntp-goto-folder (server folder user port ssl)
-  (let* ((connection (elmo-nntp-get-connection server user port ssl))
-        (buffer  (car connection))
-        (process (cadr connection))
-        (cwf     (caddr connection)))
-    (save-excursion
-      (condition-case ()
-         (if (not (string= cwf folder))
-             (progn
-               (elmo-nntp-send-command buffer
-                                       process
-                                       (format "group %s" folder))
-               (if (elmo-nntp-read-response buffer process)
-                   (setcar (cddr connection) folder)))
-           t)
-       (error
-        nil)))))
+(defun elmo-nntp-select-group (session group &optional force)
+  (let (response)
+    (when (or force
+             (not (string= (elmo-nntp-session-current-group-internal session)
+                           group)))
+      (unwind-protect
+         (progn
+           (elmo-nntp-send-command session (format "group %s" group))
+           (setq response (elmo-nntp-read-response session)))
+       (elmo-nntp-session-set-current-group-internal session
+                                                     (and response group))
+       response))))
 
 (defun elmo-nntp-list-folders-get-cache (folder buf)
   (when (and elmo-nntp-list-folders-use-cache
@@ -325,8 +342,9 @@ Don't cache if nil.")
          (erase-buffer)
          (insert (nth 2 elmo-nntp-list-folders-cache))
          (goto-char (point-min))
-         (and folder
-              (keep-lines (concat "^" (regexp-quote folder) "\\.")))
+         (or (string= folder "")
+             (and folder
+                  (keep-lines (concat "^" (regexp-quote folder) "\\."))))
          t
          )))))
 
@@ -343,41 +361,39 @@ Don't cache if nil.")
         (nconc number-alist (list (cons max-number nil)))))))
 
 (defun elmo-nntp-list-folders (spec &optional hierarchy)
-  (elmo-nntp-setting spec
-   (let* ((cwf     (caddr connection))
-         (tmp-buffer (get-buffer-create " *ELMO NNTP list folders TMP*"))
-         response ret-val top-ng append-serv use-list-active start)
-    (save-excursion
-      (set-buffer tmp-buffer)
-      (if (and folder
-              (elmo-nntp-goto-folder server folder user port ssl))
-         (setq ret-val (list folder))) ;; add top newsgroups
+  (let ((session (elmo-nntp-get-session spec))
+       response ret-val top-ng append-serv use-list-active start)
+    (with-temp-buffer
+      (if (and (elmo-nntp-spec-group spec)
+              (elmo-nntp-select-group session (elmo-nntp-spec-group spec)))
+         ;; add top newsgroups
+         (setq ret-val (list (elmo-nntp-spec-group spec))))
       (unless (setq response (elmo-nntp-list-folders-get-cache
-                             folder tmp-buffer))
-       (when (setq use-list-active (elmo-nntp-list-active-p server port))
-         (elmo-nntp-send-command buffer
-                                 process
-                                 (concat "list"
-                                         (if (and folder
-                                                  (null (string= folder "")))
-                                             (concat " active"
-                                                     (format " %s.*" folder) ""))))
-         (if (elmo-nntp-read-response buffer process t)
-             (if (null (setq response (elmo-nntp-read-contents
-                                       buffer process)))
+                             (elmo-nntp-spec-group spec)(current-buffer)))
+       (when (setq use-list-active (elmo-nntp-list-active-p session))
+         (elmo-nntp-send-command
+          session
+          (concat "list"
+                  (if (and (elmo-nntp-spec-group spec)
+                           (null (string= (elmo-nntp-spec-group spec) "")))
+                      (concat " active"
+                              (format " %s.*" (elmo-nntp-spec-group spec)
+                                      "")))))
+         (if (elmo-nntp-read-response session t)
+             (if (null (setq response (elmo-nntp-read-contents session)))
                  (error "NNTP List folders failed")
                (when elmo-nntp-list-folders-use-cache
                  (setq elmo-nntp-list-folders-cache
-                       (list (current-time) folder response)))
+                       (list (current-time) (elmo-nntp-spec-group spec)
+                             response)))
                (erase-buffer)
                (insert response))
-           (elmo-nntp-set-list-active server port nil)
+           (elmo-nntp-set-list-active session nil)
            (setq use-list-active nil)))
        (when (null use-list-active)
-         (elmo-nntp-send-command buffer process "list")
-         (if (null (and (elmo-nntp-read-response buffer process t)
-                        (setq response (elmo-nntp-read-contents
-                                        buffer process))))
+         (elmo-nntp-send-command session "list")
+         (if (null (and (elmo-nntp-read-response session t)
+                        (setq response (elmo-nntp-read-contents session))))
              (error "NNTP List folders failed"))
          (when elmo-nntp-list-folders-use-cache
            (setq elmo-nntp-list-folders-cache
@@ -386,7 +402,8 @@ Don't cache if nil.")
          (setq start nil)
          (while (string-match (concat "^"
                                       (regexp-quote
-                                       (or folder "")) ".*$")
+                                       (or (elmo-nntp-spec-group spec)
+                                           "")) ".*$")
                               response start)
            (insert (match-string 0 response) "\n")
            (setq start (match-end 0)))))
@@ -397,7 +414,11 @@ Don't cache if nil.")
            (progn
              (setq regexp
                    (format "^\\(%s[^. ]+\\)\\([. ]\\).*\n"
-                           (if folder (concat folder "\\.") "")))
+                           (if (and (elmo-nntp-spec-group spec)
+                                    (null (string= 
+                                           (elmo-nntp-spec-group spec) "")))
+                               (concat (elmo-nntp-spec-group spec)
+                                       "\\.") "")))
              (while (looking-at regexp)
                (setq top-ng (elmo-match-buffer 1))
                (if (string= (elmo-match-buffer 2) " ")
@@ -408,47 +429,53 @@ Don't cache if nil.")
                      (setq ret-val (delete top-ng ret-val)))
                  (if (not (assoc top-ng ret-val))
                      (setq ret-val (nconc ret-val (list (list top-ng))))))
-               (setq i (1+ i))
-               (and (zerop (% i 10))
-                    (elmo-display-progress
-                     'elmo-nntp-list-folders "Parsing active..."
-                     (/ (* i 100) len)))
-               (forward-line 1)
-               ))
+               (when (> len elmo-display-progress-threshold)
+                 (setq i (1+ i))
+                 (if (or (zerop (% i 10)) (= i len))
+                     (elmo-display-progress
+                      'elmo-nntp-list-folders "Parsing active..."
+                      (/ (* i 100) len))))
+               (forward-line 1)))
          (while (re-search-forward "\\([^ ]+\\) .*\n" nil t)
            (setq ret-val (nconc ret-val
                                 (list (elmo-match-buffer 1))))
-           (setq i (1+ i))
-           (and (zerop (% i 10))
-                (elmo-display-progress
-                 'elmo-nntp-list-folders "Parsing active..."
-                 (/ (* i 100) len))))))
-      (kill-buffer tmp-buffer)
-      (elmo-display-progress
-       'elmo-nntp-list-folders "Parsing active..."
-       100)
-      (unless (string= server elmo-default-nntp-server)
-       (setq append-serv (concat "@" server)))
-      (unless (eq port elmo-default-nntp-port)
-       (setq append-serv (concat append-serv ":" (int-to-string port))))
-      (unless (eq ssl elmo-default-nntp-ssl)
-       (if ssl
-           (setq append-serv (concat append-serv "!")))
-       (if (eq ssl 'starttls)
-           (setq append-serv (concat append-serv "!"))))
-      (mapcar '(lambda (fld)
-                (if (consp fld)
-                    (list (concat "-" (car fld)
-                                  (and user
-                                       (concat ":" user))
-                                  (and append-serv
-                                       (concat append-serv))))
-                  (concat "-" fld
-                          (and user
-                               (concat ":" user))
-                          (and append-serv
-                               (concat append-serv)))))
-             ret-val)))))
+           (when (> len elmo-display-progress-threshold)
+             (setq i (1+ i))
+             (if (or (zerop (% i 10)) (= i len))
+                 (elmo-display-progress
+                  'elmo-nntp-list-folders "Parsing active..."
+                  (/ (* i 100) len))))))
+       (when (> len elmo-display-progress-threshold)
+         (elmo-display-progress
+          'elmo-nntp-list-folders "Parsing active..." 100))))
+    (unless (string= (elmo-nntp-spec-hostname spec)
+                    elmo-default-nntp-server)
+      (setq append-serv (concat "@" (elmo-nntp-spec-hostname spec))))
+    (unless (eq (elmo-nntp-spec-port spec) elmo-default-nntp-port)
+      (setq append-serv (concat append-serv
+                               ":" (int-to-string
+                                    (elmo-nntp-spec-port spec)))))
+    (unless (eq (elmo-network-stream-type-symbol 
+                (elmo-nntp-spec-stream-type spec))
+               elmo-default-nntp-stream-type)
+      (setq append-serv
+           (concat append-serv
+                   (elmo-network-stream-type-spec-string
+                    (elmo-nntp-spec-stream-type spec)))))
+    (mapcar '(lambda (fld)
+              (if (consp fld)
+                  (list (concat "-" (car fld)
+                                (and (elmo-nntp-spec-username spec)
+                                     (concat 
+                                      ":" (elmo-nntp-spec-username spec)))
+                                (and append-serv
+                                     (concat append-serv))))
+                (concat "-" fld
+                        (and (elmo-nntp-spec-username spec)
+                             (concat ":" (elmo-nntp-spec-username spec)))
+                        (and append-serv
+                             (concat append-serv)))))
+           ret-val)))
 
 (defun elmo-nntp-make-msglist (beg-str end-str)
   (elmo-set-work-buf
@@ -465,75 +492,88 @@ Don't cache if nil.")
      (read (current-buffer)))))
 
 (defun elmo-nntp-list-folder (spec)
-  (elmo-nntp-setting spec
-   (let* ((server (format "%s" server)) ;; delete text property
-         response retval use-listgroup)
+  (let ((session (elmo-nntp-get-session spec))
+       (group   (elmo-nntp-spec-group spec))
+       (killed (and elmo-use-killed-list
+                    (elmo-msgdb-killed-list-load
+                     (elmo-msgdb-expand-path spec))))
+       response numbers use-listgroup)
     (save-excursion
-      (when (setq use-listgroup (elmo-nntp-listgroup-p server port))
-       (elmo-nntp-send-command buffer
-                               process
-                               (format "listgroup %s" folder))
-       (if (not (elmo-nntp-read-response buffer process t))
+      (when (setq use-listgroup (elmo-nntp-listgroup-p session))
+       (elmo-nntp-send-command session
+                               (format "listgroup %s" group))
+       (if (not (elmo-nntp-read-response session t))
            (progn
-             (elmo-nntp-set-listgroup server port nil)
+             (elmo-nntp-set-listgroup session nil)
              (setq use-listgroup nil))
-         (if (null (setq response (elmo-nntp-read-contents buffer process)))
+         (if (null (setq response (elmo-nntp-read-contents session)))
              (error "Fetching listgroup failed"))
-         (setq retval (elmo-string-to-list response))))
-      (if use-listgroup
-         retval
-       (elmo-nntp-send-command buffer
-                               process
-                               (format "group %s" folder))
-       (if (null (setq response (elmo-nntp-read-response buffer process)))
-           (error "Select folder failed"))
-       (setcar (cddr connection) folder)
-       (if (and
-            (string-match "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$"
-                          response)
-            (> (string-to-int (elmo-match-string 1 response)) 0))
-           (elmo-nntp-make-msglist
-            (elmo-match-string 2 response)
-            (elmo-match-string 3 response))
-         nil))))))
+         (setq numbers (elmo-string-to-list response))
+         (elmo-nntp-session-set-current-group-internal session
+                                                       group)))
+      (unless use-listgroup
+       (elmo-nntp-send-command session (format "group %s" group))
+       (if (null (setq response (elmo-nntp-read-response session)))
+           (error "Select group failed"))
+       (when (and
+              (string-match
+               "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$"
+               response)
+              (> (string-to-int (elmo-match-string 1 response)) 0))
+         (setq numbers (elmo-nntp-make-msglist
+                        (elmo-match-string 2 response)
+                        (elmo-match-string 3 response)))))
+      (elmo-living-messages numbers killed))))
 
 (defun elmo-nntp-max-of-folder (spec)
-  (let* ((port (elmo-nntp-spec-port spec))
-        (user (elmo-nntp-spec-username spec))
-        (server (elmo-nntp-spec-hostname spec))
-        (ssl (elmo-nntp-spec-ssl spec))
-        (folder (elmo-nntp-spec-group spec)))
+  (let ((killed-list (and elmo-use-killed-list
+                         (elmo-msgdb-killed-list-load 
+                          (elmo-msgdb-expand-path spec))))
+       end-num entry)
     (if elmo-nntp-groups-async
-       (let* ((fld (concat folder
-                           (elmo-nntp-folder-postfix user server port ssl)))
-              (entry (elmo-get-hash-val fld elmo-nntp-groups-hashtb)))
-         (if entry
-             (cons (nth 2 entry)
-                   (car entry))
-           (error "No such newsgroup \"%s\"" fld)))
-      (let* ((connection (elmo-nntp-get-connection server user port ssl))
-            (buffer  (car connection))
-            (process (cadr connection))
-            response e-num end-num)
-       (if (not connection)
+       (if (setq entry
+                 (elmo-get-hash-val 
+                  (concat (elmo-nntp-spec-group spec)
+                          (elmo-nntp-folder-postfix
+                           (elmo-nntp-spec-username spec)
+                           (elmo-nntp-spec-hostname spec)
+                           (elmo-nntp-spec-port spec)
+                           (elmo-nntp-spec-stream-type spec)))
+                  elmo-nntp-groups-hashtb))
+           (progn
+             (setq end-num (nth 2 entry))
+             (when (and killed-list elmo-use-killed-list
+                        (elmo-number-set-member end-num killed-list))
+               ;; Max is killed.
+               (setq end-num nil))
+             (cons end-num (car entry)))
+         (error "No such newsgroup \"%s\"" (elmo-nntp-spec-group spec)))
+      (let ((session (elmo-nntp-get-session spec))
+           response e-num)
+       (if (null session)
            (error "Connection failed"))
        (save-excursion
-         (elmo-nntp-send-command buffer
-                                 process
-                                 (format "group %s" folder))
-         (setq response (elmo-nntp-read-response buffer process))
-         (if (and response
-                  (string-match
-                   "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$"
+         (elmo-nntp-send-command session
+                                 (format "group %s"
+                                         (elmo-nntp-spec-group spec)))
+         (setq response (elmo-nntp-read-response session))
+         (if (and response 
+                  (string-match 
+                   "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$" 
                    response))
              (progn
                (setq end-num (string-to-int
                               (elmo-match-string 3 response)))
                (setq e-num (string-to-int
                             (elmo-match-string 1 response)))
+               (when (and killed-list elmo-use-killed-list
+                          (elmo-number-set-member end-num killed-list))
+                 ;; Max is killed.
+                 (setq end-num nil))
                (cons end-num e-num))
            (if (null response)
-               (error "Selecting newsgroup \"%s\" failed" folder)
+               (error "Selecting newsgroup \"%s\" failed"
+                      (elmo-nntp-spec-group spec))
              nil)))))))
 
 (defconst elmo-nntp-overview-index
@@ -635,114 +675,119 @@ Don't cache if nil.")
                                    seen-mark important-mark
                                    seen-list &optional as-num)
   (when numlist
-    (save-excursion
-     (elmo-nntp-setting spec
-      (let* ((cwf     (caddr connection))
-            (filter  (and as-num numlist))
-            beg-num end-num cur length
-            ret-val ov-str use-xover)
-       (if (and folder
-                (not (string= cwf folder))
-                (null (elmo-nntp-goto-folder server folder user port ssl)))
-           (error "group %s not found" folder))
-       (when (setq use-xover (elmo-nntp-xover-p server port))
-         (setq beg-num (car numlist)
-               cur beg-num
-               end-num (nth (1- (length numlist)) numlist)
-               length  (+ (- end-num beg-num) 1))
-         (message "Getting overview...")
-         (while (<= cur end-num)
-           (elmo-nntp-send-command buffer process
-                                   (format
-                                    "xover %s-%s"
-                                    (int-to-string cur)
-                                    (int-to-string
-                                     (+ cur
-                                        elmo-nntp-overview-fetch-chop-length))))
-           (with-current-buffer buffer
-             (if ov-str
-                 (setq ret-val
-                       (elmo-msgdb-append
-                        ret-val
-                        (elmo-nntp-create-msgdb-from-overview-string
-                         ov-str
-                         folder
-                         new-mark
-                         already-mark
-                         seen-mark
-                         important-mark
-                         seen-list
-                         filter
-                         )))))
-           (if (null (elmo-nntp-read-response buffer process t))
-               (progn
-                 (setq cur end-num);; exit while loop
-                 (elmo-nntp-set-xover server port nil)
-                 (setq use-xover nil))
-             (if (null (setq ov-str (elmo-nntp-read-contents buffer process)))
-                 (error "Fetching overview failed")))
-           (setq cur (+ elmo-nntp-overview-fetch-chop-length cur 1))
-           (elmo-display-progress
-            'elmo-nntp-msgdb-create "Getting overview..."
-            (/ (* (+ (- (min cur
-                             end-num)
-                        beg-num) 1) 100) length))))
-       (if (not use-xover)
-           (setq ret-val (elmo-nntp-msgdb-create-by-header
-                          folder buffer process numlist
-                          new-mark already-mark seen-mark seen-list))
-         (with-current-buffer buffer
+    (let ((filter  numlist)
+         (session (elmo-nntp-get-session spec))
+         beg-num end-num cur length
+         ret-val ov-str use-xover dir)
+      (elmo-nntp-select-group session (elmo-nntp-spec-group spec))
+      (when (setq use-xover (elmo-nntp-xover-p session))
+       (setq beg-num (car numlist)
+             cur beg-num
+             end-num (nth (1- (length numlist)) numlist)
+             length  (+ (- end-num beg-num) 1))
+       (message "Getting overview...")
+       (while (<= cur end-num)
+         (elmo-nntp-send-command
+          session
+          (format
+           "xover %s-%s"
+           (int-to-string cur)
+           (int-to-string
+            (+ cur
+               elmo-nntp-overview-fetch-chop-length))))
+         (with-current-buffer (elmo-network-session-buffer session)
            (if ov-str
                (setq ret-val
                      (elmo-msgdb-append
                       ret-val
                       (elmo-nntp-create-msgdb-from-overview-string
                        ov-str
-                       folder
+                       (elmo-nntp-spec-group spec)
                        new-mark
                        already-mark
                        seen-mark
                        important-mark
                        seen-list
-                       filter))))))
-       (elmo-display-progress
-        'elmo-nntp-msgdb-create "Getting overview..." 100)
-       ;; If there are canceled messages, overviews are not obtained
-       ;; to max-number(inn 2.3?).
-       (when (and (elmo-nntp-max-number-precedes-list-active-p)
-                  (elmo-nntp-list-active-p server port))
-         (elmo-nntp-send-command buffer process
-                                 (format "list active %s" folder))
-         (if (null (elmo-nntp-read-response buffer process))
+                       filter
+                       )))))
+         (if (null (elmo-nntp-read-response session t))
              (progn
-               (elmo-nntp-set-list-active server port nil)
-               (error "NNTP list command failed")))
-         (elmo-nntp-catchup-msgdb
-          ret-val
-          (nth 1 (read (concat "(" (elmo-nntp-read-contents
-                                    buffer process) ")")))))
-       ret-val)))))
+               (setq cur end-num);; exit while loop
+               (elmo-nntp-set-xover session nil)
+               (setq use-xover nil))
+           (if (null (setq ov-str (elmo-nntp-read-contents session)))
+               (error "Fetching overview failed")))
+         (setq cur (+ elmo-nntp-overview-fetch-chop-length cur 1))
+         (when (> length elmo-display-progress-threshold)
+           (elmo-display-progress
+            'elmo-nntp-msgdb-create "Getting overview..."
+            (/ (* (+ (- (min cur end-num)
+                        beg-num) 1) 100) length))))
+       (when (> length elmo-display-progress-threshold)
+         (elmo-display-progress
+          'elmo-nntp-msgdb-create "Getting overview..." 100)))
+      (if (not use-xover)
+         (setq ret-val (elmo-nntp-msgdb-create-by-header
+                        session numlist
+                        new-mark already-mark seen-mark seen-list))
+       (with-current-buffer (elmo-network-session-buffer session)
+         (if ov-str
+             (setq ret-val
+                   (elmo-msgdb-append
+                    ret-val
+                    (elmo-nntp-create-msgdb-from-overview-string
+                     ov-str
+                     (elmo-nntp-spec-group spec)
+                     new-mark
+                     already-mark
+                     seen-mark
+                     important-mark
+                     seen-list
+                     filter))))))
+      (when elmo-use-killed-list
+       (setq dir (elmo-msgdb-expand-path spec))
+       (elmo-msgdb-killed-list-save
+        dir
+        (nconc
+         (elmo-msgdb-killed-list-load dir)
+         (car (elmo-list-diff
+               numlist
+               (mapcar 'car
+                       (elmo-msgdb-get-number-alist
+                        ret-val)))))))
+      ;; If there are canceled messages, overviews are not obtained
+      ;; to max-number(inn 2.3?).
+      (when (and (elmo-nntp-max-number-precedes-list-active-p)
+                (elmo-nntp-list-active-p session))
+       (elmo-nntp-send-command session
+                               (format "list active %s"
+                                       (elmo-nntp-spec-group spec)))
+       (if (null (elmo-nntp-read-response session))
+           (progn
+             (elmo-nntp-set-list-active session nil)
+             (error "NNTP list command failed")))
+       (elmo-nntp-catchup-msgdb
+        ret-val
+        (nth 1 (read (concat "(" (elmo-nntp-read-contents
+                                  session) ")")))))
+      ret-val)))
 
 (defun elmo-nntp-sync-number-alist (spec number-alist)
   (if (elmo-nntp-max-number-precedes-list-active-p)
-      (elmo-nntp-setting spec
-       (if (elmo-nntp-list-active-p server port)
-           (let* ((cwf (caddr connection))
-                  msgdb-max max-number)
+      (let ((session (elmo-nntp-get-session spec)))
+       (if (elmo-nntp-list-active-p session)
+           (let (msgdb-max max-number)
              ;; If there are canceled messages, overviews are not obtained
              ;; to max-number(inn 2.3?).
-             (if (and folder
-                      (not (string= cwf folder))
-                      (null (elmo-nntp-goto-folder
-                             server folder user port ssl)))
-                 (error "group %s not found" folder))
-             (elmo-nntp-send-command buffer process
-                                     (format "list active %s" folder))
-             (if (null (elmo-nntp-read-response buffer process))
+             (elmo-nntp-select-group session (elmo-nntp-spec-group spec))
+             (elmo-nntp-send-command session
+                                     (format "list active %s"
+                                             (elmo-nntp-spec-group spec)))
+             (if (null (elmo-nntp-read-response session))
                  (error "NNTP list command failed"))
              (setq max-number
                    (nth 1 (read (concat "(" (elmo-nntp-read-contents
-                                             buffer process) ")"))))
+                                             session) ")"))))
              (setq msgdb-max
                    (car (nth (max (- (length number-alist) 1) 0)
                              number-alist)))
@@ -754,19 +799,26 @@ Don't cache if nil.")
                number-alist))
          number-alist))))
 
-(defun elmo-nntp-msgdb-create-by-header (folder buffer process numlist
-                                               new-mark already-mark
-                                               seen-mark seen-list)
-  (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*"))
-       ret-val)
-    (elmo-nntp-retrieve-headers
-     buffer tmp-buffer process numlist)
-    (setq ret-val
-         (elmo-nntp-msgdb-create-message
-          tmp-buffer (length numlist) folder new-mark already-mark
-          seen-mark seen-list))
-    (kill-buffer tmp-buffer)
-    ret-val))
+(defun elmo-nntp-msgdb-create-by-header (session numlist
+                                                new-mark already-mark
+                                                seen-mark seen-list)
+  (with-temp-buffer
+    (elmo-nntp-retrieve-headers session (current-buffer) numlist)
+    (elmo-nntp-msgdb-create-message
+     (length numlist) new-mark already-mark seen-mark seen-list)))
+
+(defun elmo-nntp-parse-xhdr-response (string)
+  (let (response)
+    (with-temp-buffer
+      (insert string)
+      (goto-char (point-min))
+      (while (not (eobp))
+       (if (looking-at "^\\([0-9]+\\) \\(.*\\)$")
+           (setq response (cons (cons (string-to-int (elmo-match-buffer 1))
+                                      (elmo-match-buffer 2))
+                                response)))
+       (forward-line 1)))
+    (nreverse response)))
 
 (defun elmo-nntp-parse-overview-string (string)
   (save-excursion
@@ -791,174 +843,34 @@ Don't cache if nil.")
 ;      (kill-buffer tmp-buffer)
       ret-val)))
 
-(defun elmo-nntp-get-overview (server beg end folder user port ssl)
-  (save-excursion
-    (let* ((connection (elmo-nntp-get-connection server user port ssl))
-          (buffer  (car connection))
-          (process (cadr connection))
-;         (cwf     (caddr connection))
-          response errmsg ov-str)
-      (catch 'done
-       (if folder
-           (if (null (elmo-nntp-goto-folder server folder user port ssl))
-               (progn
-                 (setq errmsg (format "group %s not found." folder))
-                 (throw 'done nil))))
-       (elmo-nntp-send-command buffer process
-                               (format "xover %s-%s" beg end))
-       (if (null (setq response (elmo-nntp-read-response
-                                 buffer process t)))
-           (progn
-             (setq errmsg "Getting overview failed.")
-             (throw 'done nil)))
-       (if (null (setq response (elmo-nntp-read-contents
-                                 buffer process)))
-           (progn
-             ;(setq errmsg "Fetching header failed")
-             (throw 'done nil)))
-       (setq ov-str response)
-       )
-      (if errmsg
-         (progn
-           (message errmsg)
-           nil)
-       ov-str))))
-
-
-(defun elmo-nntp-get-message (server user number folder outbuf port ssl)
-  "Get nntp message on FOLDER at SERVER.
-Returns message string."
-  (save-excursion
-    (let* ((connection (elmo-nntp-get-connection server user port ssl))
-          (buffer  (car connection))
-          (process (cadr connection))
-          (cwf     (caddr connection))
-          response errmsg)
-      (catch 'done
-       (if (and folder
-                (not (string= cwf folder)))
-           (if (null (elmo-nntp-goto-folder server folder user port ssl))
-               (progn
-                 (setq errmsg (format "group %s not found." folder))
-                 (throw 'done nil))))
-       (elmo-nntp-send-command buffer process
-                               (format "article %s" number))
-       (if (null (setq response (elmo-nntp-read-response
-                                 buffer process t)))
-           (progn
-             (setq errmsg "Fetching message failed")
-             (set-buffer outbuf)
-             (erase-buffer)
-             (insert "\n\n")
-             (throw 'done nil)))
-       (setq response (elmo-nntp-read-body buffer process outbuf))
-       (set-buffer outbuf)
-       (goto-char (point-min))
-       (while (re-search-forward "^\\." nil t)
-         (replace-match "")
-         (forward-line))
-       )
-      (if errmsg
-         (progn
-           (message errmsg)
-           nil))
-      response)))
-
-(defun elmo-nntp-get-newsgroup-by-msgid (msgid server user port ssl)
+(defun elmo-nntp-get-newsgroup-by-msgid (msgid server user port type)
   "Get nntp header string."
   (save-excursion
-    (let* ((connection (elmo-nntp-get-connection server user port ssl))
-          (buffer  (car connection))
-          (process (cadr connection)))
-      (elmo-nntp-send-command buffer process
+    (let ((session (elmo-nntp-get-session
+                   (list 'nntp nil user server port type))))
+      (elmo-nntp-send-command session
                              (format "head %s" msgid))
-      (if (elmo-nntp-read-response buffer process)
-         (elmo-nntp-read-contents buffer process))
-      (set-buffer buffer)
-      (std11-field-body "Newsgroups"))))
-
-(defun elmo-nntp-open-connection (server user portnum ssl)
-  "Open NNTP connection and returns
-the list of (process session-buffer current-working-folder).
-Return nil if connection failed."
-  (let ((process nil)
-       (host server)
-       (port (or portnum
-                 elmo-default-nntp-port))
-       (user-at-host (format "%s@%s" user server))
-       process-buffer)
-    (as-binary-process
-     (catch 'done
-       (setq process-buffer
-            (get-buffer-create (format " *NNTP session to %s:%d" host port)))
-       (save-excursion
-        (set-buffer process-buffer)
-        (elmo-set-buffer-multibyte nil)
-        (erase-buffer))
-       (setq process
-            (elmo-open-network-stream "NNTP" process-buffer host port ssl))
-       (and (null process) (throw 'done nil))
-       (set-process-filter process 'elmo-nntp-process-filter)
-       ;; flush connections when exiting...?
-       ;; (add-hook 'kill-emacs-hook 'elmo-nntp-flush-connection)
-       (save-excursion
-        (set-buffer process-buffer)
-        (elmo-set-buffer-multibyte nil)
-        (make-local-variable 'elmo-nntp-read-point)
-        (setq elmo-nntp-read-point (point-min))
-        (if (null (elmo-nntp-read-response process-buffer process t))
-            (throw 'done nil))
-        (if elmo-nntp-send-mode-reader
-            (elmo-nntp-send-mode-reader process-buffer process))
-        ;; starttls
-        (if (eq ssl 'starttls)
-            (if (progn
-                  (elmo-nntp-send-command process-buffer process "starttls")
-                  (elmo-nntp-read-response process-buffer process))
-                (starttls-negotiate process)
-              (error "STARTTLS aborted")))
-        (if user
-            (progn
-              (elmo-nntp-send-command process-buffer process
-                                      (format "authinfo user %s" user))
-              (if (null (elmo-nntp-read-response process-buffer process))
-                  (error "Authinfo failed"))
-              (elmo-nntp-send-command process-buffer process
-                                      (format "authinfo pass %s"
-                                              (elmo-get-passwd user-at-host)))
-              (if (null (elmo-nntp-read-response process-buffer process))
-                  (progn
-                    (elmo-remove-passwd user-at-host)
-                    (error "Authinfo failed")))))
-        (run-hooks 'elmo-nntp-opened-hook)) ; XXX
-       (cons process-buffer process)))))
-
-(defun elmo-nntp-send-mode-reader (buffer process)
-  (elmo-nntp-send-command buffer
-                         process
-                         "mode reader")
-  (if (null (elmo-nntp-read-response buffer process t))
-      (error "mode reader failed")))
-  
-(defun elmo-nntp-send-command (buffer process command &optional noerase)
-  "Send COMMAND string to server with sequence number."
-  (save-excursion
-    (set-buffer buffer)
-    (when (not noerase)
-      (erase-buffer)
-      (goto-char (point-min)))
-    (setq elmo-nntp-read-point (point))
-    (process-send-string process command)
-    (process-send-string process "\r\n")))
-
-(defun elmo-nntp-read-msg (spec msg outbuf)
-  (elmo-nntp-get-message (elmo-nntp-spec-hostname spec)
-                        (elmo-nntp-spec-username spec)
-                        msg
-                        (elmo-nntp-spec-group spec)
-                        outbuf
-                        (elmo-nntp-spec-port spec)
-                        (elmo-nntp-spec-ssl spec)))
+      (if (elmo-nntp-read-response session)
+         (elmo-nntp-read-contents session))
+      (with-current-buffer (elmo-network-session-buffer session)
+       (std11-field-body "Newsgroups")))))
+
+(defun elmo-nntp-read-msg (spec number outbuf)
+  (let ((session (elmo-nntp-get-session spec)))
+    (with-current-buffer (elmo-network-session-buffer session)
+      (elmo-nntp-select-group session (elmo-nntp-spec-group spec))
+      (elmo-nntp-send-command session (format "article %s" number))
+      (if (null (elmo-nntp-read-response session t))
+         (progn
+           (with-current-buffer outbuf (erase-buffer))
+           (message "Fetching message failed")
+           nil)
+       (prog1 (elmo-nntp-read-body session outbuf)
+         (with-current-buffer outbuf
+           (goto-char (point-min))
+           (while (re-search-forward "^\\." nil t)
+             (replace-match "")
+             (forward-line))))))))
 
 ;(defun elmo-msgdb-nntp-overview-create-range (spec beg end mark)
 ;    (elmo-nntp-overview-create-range hostname beg end mark folder)))
@@ -969,26 +881,20 @@ Return nil if connection failed."
 (defun elmo-nntp-append-msg (spec string &optional msg no-see))
 
 (defun elmo-nntp-post (hostname content-buf)
-  (let* (;(folder (nth 1 spec))
-        (connection
-         (elmo-nntp-get-connection
-          hostname
-          elmo-default-nntp-user
-          elmo-default-nntp-port elmo-default-nntp-ssl))
-        (buffer (car connection))
-        (process (cadr connection))
-        response has-message-id
-        )
+  (let ((session (elmo-nntp-get-session
+                 (list 'nntp nil elmo-default-nntp-user
+                       hostname elmo-default-nntp-port
+                       elmo-default-nntp-stream-type)))
+       response has-message-id)
     (save-excursion
       (set-buffer content-buf)
       (goto-char (point-min))
       (if (search-forward mail-header-separator nil t)
          (delete-region (match-beginning 0)(match-end 0)))
       (setq has-message-id (std11-field-body "message-id"))
-      (elmo-nntp-send-command buffer process "post")
+      (elmo-nntp-send-command session "post")
       (if (string-match "^340" (setq response
-                                    (elmo-nntp-read-raw-response
-                                     buffer process)))
+                                    (elmo-nntp-read-raw-response session)))
          (if (string-match "recommended ID \\(<[^@]+@[^>]+>\\)" response)
              (unless has-message-id
                (goto-char (point-min))
@@ -996,62 +902,51 @@ Return nil if connection failed."
                                (elmo-match-string 1 response)
                                "\n"))))
        (error "POST failed"))
-      (current-buffer)
       (run-hooks 'elmo-nntp-post-pre-hook)
-      (set-buffer buffer)
-      (elmo-nntp-send-data process content-buf)
-      (elmo-nntp-send-command buffer process ".")
-      ;(elmo-nntp-read-response buffer process t)
+      (elmo-nntp-send-buffer session content-buf)
+      (elmo-nntp-send-command session ".")
+      ;;(elmo-nntp-read-response buffer process t)
       (if (not (string-match
                "^2" (setq response (elmo-nntp-read-raw-response
-                                    buffer process))))
+                                    session))))
          (error (concat "NNTP error: " response))))))
 
-(defun elmo-nntp-send-data-line (process data)
-  (goto-char (point-max))
-
+(defsubst elmo-nntp-send-data-line (session line)
+  "Send LINE to SESSION."
   ;; Escape "." at start of a line
-  (if (eq (string-to-char data) ?.)
-      (process-send-string process "."))
-  (process-send-string process data)
-  (process-send-string process "\r\n"))
-
-(defun elmo-nntp-send-data (process buffer)
-  (let
-      ((data-continue t)
-       (sending-data nil)
-       this-line
-       this-line-end)
-    (save-excursion
-      (set-buffer buffer)
-      (goto-char (point-min)))
-
-    (while data-continue
-      (save-excursion
-       (set-buffer buffer)
+  (if (eq (string-to-char line) ?.)
+      (process-send-string (elmo-network-session-process-internal
+                           session) "."))
+  (process-send-string (elmo-network-session-process-internal
+                       session) line)
+  (process-send-string (elmo-network-session-process-internal
+                       session) "\r\n"))
+
+(defun elmo-nntp-send-buffer (session databuf)
+  "Send data content of DATABUF to SESSION."
+  (let ((data-continue t)
+       line bol)
+    (with-current-buffer databuf
+      (goto-char (point-min))
+      (while data-continue
        (beginning-of-line)
-       (setq this-line (point))
+       (setq bol (point))
        (end-of-line)
-       (setq this-line-end (point))
-       (setq sending-data nil)
-       (setq sending-data (buffer-substring this-line this-line-end))
-       (if (/= (forward-line 1) 0)
-           (setq data-continue nil)))
-
-      (elmo-nntp-send-data-line process sending-data))))
-
+       (setq line (buffer-substring bol (point)))
+       (unless (eq (forward-line 1) 0) (setq data-continue nil))
+       (elmo-nntp-send-data-line session line)))))
 
 (defun elmo-nntp-delete-msgs (spec msgs)
   "MSGS on FOLDER at SERVER pretended as Deleted. Returns nil if failed."
-  (let* ((dir (elmo-msgdb-expand-path nil spec))
-;       (msgs (mapcar 'string-to-int msgs))
-        (killed-list (elmo-msgdb-killed-list-load dir)))
-    (mapcar '(lambda (msg)
-              (setq killed-list
-                    (elmo-msgdb-set-as-killed killed-list msg)))
-           msgs)
-    (elmo-msgdb-killed-list-save dir killed-list)
-    t))
+  (if elmo-use-killed-list
+      (let* ((dir (elmo-msgdb-expand-path spec))
+            (killed-list (elmo-msgdb-killed-list-load dir)))
+       (mapcar '(lambda (msg)
+                  (setq killed-list
+                        (elmo-msgdb-set-as-killed killed-list msg)))
+               msgs)
+       (elmo-msgdb-killed-list-save dir killed-list)))
+  t)
 
 (defun elmo-nntp-check-validity (spec validity-file)
   t)
@@ -1059,13 +954,14 @@ Return nil if connection failed."
   t)
 
 (defun elmo-nntp-folder-exists-p (spec)
-  (if (elmo-nntp-plugged-p spec)
-      (elmo-nntp-setting spec
-       (elmo-nntp-send-command buffer
-                               process
-                               (format "group %s" folder))
-       (elmo-nntp-read-response buffer process))
-    t))
+  (let ((session (elmo-nntp-get-session spec)))
+    (if (elmo-nntp-plugged-p spec)
+       (progn
+         (elmo-nntp-send-command session
+                                 (format "group %s"
+                                         (elmo-nntp-spec-group spec)))
+         (elmo-nntp-read-response session))
+      t)))
 
 (defun elmo-nntp-folder-creatable-p (spec)
   nil)
@@ -1073,58 +969,165 @@ Return nil if connection failed."
 (defun elmo-nntp-create-folder (spec)
   nil) ; noop
 
-(defun elmo-nntp-search (spec condition &optional from-msgs)
-  (error "Search by %s for %s is not implemented yet." condition (car spec))
-  nil)
+(defun elmo-nntp-retrieve-field (spec field from-msgs)
+  "Retrieve FIELD values from FROM-MSGS.
+Returns a list of cons cells like (NUMBER . VALUE)"
+  (let ((session (elmo-nntp-get-session spec)))
+    (if (elmo-nntp-xhdr-p session)
+       (progn
+         (elmo-nntp-select-group session (elmo-nntp-spec-group spec))
+         (elmo-nntp-send-command session
+                                 (format "xhdr %s %s"
+                                         field
+                                         (if from-msgs
+                                             (format
+                                              "%d-%d"
+                                              (car from-msgs)
+                                              (nth
+                                               (max
+                                                (- (length from-msgs) 1) 0)
+                                               from-msgs))
+                                           "0-")))
+         (if (elmo-nntp-read-response session t)
+             (elmo-nntp-parse-xhdr-response
+              (elmo-nntp-read-contents session))
+           (elmo-nntp-set-xhdr session nil)
+           (error "NNTP XHDR command failed"))))))
+
+(defun elmo-nntp-search-primitive (spec condition &optional from-msgs)
+  (let ((search-key (elmo-filter-key condition)))
+    (cond
+     ((string= "last" search-key)
+      (let ((numbers (or from-msgs (elmo-nntp-list-folder spec))))
+       (nthcdr (max (- (length numbers)
+                       (string-to-int (elmo-filter-value condition)))
+                    0)
+               numbers)))
+     ((string= "first" search-key)
+      (let* ((numbers (or from-msgs (elmo-nntp-list-folder spec)))
+            (rest (nthcdr (string-to-int (elmo-filter-value condition) )
+                          numbers)))
+       (mapcar '(lambda (x) (delete x numbers)) rest)
+       numbers))
+     ((or (string= "since" search-key)
+         (string= "before" search-key))
+      (let* ((key-date (elmo-date-get-datevec (elmo-filter-value condition)))
+            (key-datestr (elmo-date-make-sortable-string key-date))
+            (since (string= "since" search-key))
+            result)
+       (if (eq (elmo-filter-type condition) 'unmatch)
+           (setq since (not since)))
+       (setq result
+             (delq nil
+                   (mapcar
+                    (lambda (pair)
+                      (if (if since
+                              (string< key-datestr
+                                       (elmo-date-make-sortable-string
+                                        (timezone-fix-time
+                                         (cdr pair)
+                                         (current-time-zone) nil)))
+                            (not (string< key-datestr
+                                          (elmo-date-make-sortable-string
+                                           (timezone-fix-time
+                                            (cdr pair)
+                                            (current-time-zone) nil)))))
+                          (car pair)))
+                    (elmo-nntp-retrieve-field spec "date" from-msgs))))
+       (if from-msgs
+           (elmo-list-filter from-msgs result)
+         result)))
+     (t 
+      (let ((val (elmo-filter-value condition))
+           (negative (eq (elmo-filter-type condition) 'unmatch))
+           (case-fold-search t)
+           result)
+       (setq result
+             (delq nil
+                   (mapcar
+                    (lambda (pair)
+                      (if (string-match val
+                                        (eword-decode-string
+                                         (decode-mime-charset-string
+                                          (cdr pair) elmo-mime-charset)))
+                          (unless negative (car pair))
+                        (if negative (car pair))))
+                    (elmo-nntp-retrieve-field spec search-key
+                                              from-msgs))))
+       (if from-msgs
+           (elmo-list-filter from-msgs result)
+         result))))))
 
-(defun elmo-nntp-get-folders-info-prepare (spec connection-keys)
+(defun elmo-nntp-search (spec condition &optional from-msgs)
+  (let (result)
+    (cond
+     ((vectorp condition)
+      (setq result (elmo-nntp-search-primitive
+                   spec condition from-msgs)))
+     ((eq (car condition) 'and)
+      (setq result (elmo-nntp-search spec (nth 1 condition) from-msgs)
+           result (elmo-list-filter result
+                                    (elmo-nntp-search
+                                     spec (nth 2 condition)
+                                     from-msgs))))
+     ((eq (car condition) 'or)
+      (setq result (elmo-nntp-search spec (nth 1 condition) from-msgs)
+           result (elmo-uniq-list
+                   (nconc result
+                          (elmo-nntp-search spec (nth 2 condition)
+                                            from-msgs)))
+           result (sort result '<))))))
+
+(defun elmo-nntp-get-folders-info-prepare (spec session-keys)
   (condition-case ()
-      (elmo-nntp-setting spec
-       (let (key count)
-         (save-excursion
-           (set-buffer buffer)
-           (unless (setq key (assoc (cons buffer process) connection-keys))
-             (erase-buffer)
-             (setq key (cons (cons buffer process)
-                             (vector 0 server user port ssl)))
-             (setq connection-keys (nconc connection-keys (list key))))
-           (elmo-nntp-send-command buffer
-                                   process
-                                   (format "group %s" folder)
-                                   t ;; don't erase-buffer
-                                   )
-           (if elmo-nntp-get-folders-securely
-               (accept-process-output process 1))
-           (setq count (aref (cdr key) 0))
-           (aset (cdr key) 0 (1+ count)))))
+      (let ((session (elmo-nntp-get-session spec))
+           key count)
+       (with-current-buffer (elmo-network-session-buffer session)
+         (unless (setq key (assoc session session-keys))
+           (erase-buffer)
+           (setq key (cons session
+                           (vector 0
+                                   (elmo-nntp-spec-hostname spec)
+                                   (elmo-nntp-spec-username spec)
+                                   (elmo-nntp-spec-port spec)
+                                   (elmo-nntp-spec-stream-type spec))))
+           (setq session-keys (nconc session-keys (list key))))
+         (elmo-nntp-send-command session
+                                 (format "group %s"
+                                         (elmo-nntp-spec-group spec))
+                                 'noerase)
+         (if elmo-nntp-get-folders-securely
+             (accept-process-output
+              (elmo-network-session-process-internal session)
+              1))
+         (setq count (aref (cdr key) 0))
+         (aset (cdr key) 0 (1+ count))))
     (error
      (when elmo-auto-change-plugged
        (sit-for 1))
      nil))
-  connection-keys)
+  session-keys)
 
-(defun elmo-nntp-get-folders-info (connection-keys)
-  (let ((connections connection-keys)
+(defun elmo-nntp-get-folders-info (session-keys)
+  (let ((sessions session-keys)
        (cur (get-buffer-create " *ELMO NNTP Temp*")))
-    (while connections
-      (let* ((connect (caar connections))
-            (key     (cdar connections))
-            (buffer  (car connect))
-            (process (cdr connect))
+    (while sessions
+      (let* ((session (caar sessions))
+            (key     (cdar sessions))
             (count   (aref key 0))
             (server  (aref key 1))
             (user    (aref key 2))
             (port    (aref key 3))
-            (ssl     (aref key 4))
+            (type    (aref key 4))
             (hashtb (or elmo-nntp-groups-hashtb
                         (setq elmo-nntp-groups-hashtb
                               (elmo-make-hash count)))))
        (save-excursion
-         (elmo-nntp-groups-read-response buffer cur process count)
+         (elmo-nntp-groups-read-response session cur count)
          (set-buffer cur)
          (goto-char (point-min))
          (let ((case-replace nil)
-               (postfix (elmo-nntp-folder-postfix user server port ssl)))
+               (postfix (elmo-nntp-folder-postfix user server port type)))
            (if (not (string= postfix ""))
                (save-excursion
                  (replace-regexp "^\\(211 [0-9]+ [0-9]+ [0-9]+ [^ \n]+\\).*$"
@@ -1141,16 +1144,16 @@ Return nil if connection failed."
                         (list len min max)))
                (error (and group (symbolp group) (set group nil))))
              (forward-line 1))))
-       (setq connections (cdr connections))))
+       (setq sessions (cdr sessions))))
     (kill-buffer cur)))
 
 ;; original is 'nntp-retrieve-groups [Gnus]
-(defun elmo-nntp-groups-read-response (buffer tobuffer process count)
+(defun elmo-nntp-groups-read-response (session outbuf count)
   (let* ((received 0)
         (last-point (point-min)))
-    (save-excursion
-      (set-buffer buffer)
-      (accept-process-output process 1)
+    (with-current-buffer (elmo-network-session-buffer session)
+      (accept-process-output 
+       (elmo-network-session-process-internal session) 1)
       (discard-input)
       ;; Wait for all replies.
       (message "Getting folders info...")
@@ -1162,16 +1165,17 @@ Return nil if connection failed."
                       (1+ received)))
               (setq last-point (point))
               (< received count))
-       (accept-process-output process 1)
+       (accept-process-output (elmo-network-session-process-internal session)
+                              1)
        (discard-input)
-       (and (zerop (% received 10))
-            (elmo-display-progress
-             'elmo-nntp-groups-read-response "Getting folders info..."
-             (/ (* received 100) count)))
-       )
-      (elmo-display-progress
-       'elmo-nntp-groups-read-response "Getting folders info..."
-       100)
+       (when (> count elmo-display-progress-threshold)
+         (if (or (zerop (% received 10)) (= received count))
+             (elmo-display-progress
+              'elmo-nntp-groups-read-response "Getting folders info..."
+              (/ (* received 100) count)))))
+      (when (> count elmo-display-progress-threshold)
+       (elmo-display-progress
+        'elmo-nntp-groups-read-response "Getting folders info..." 100))
       ;; Wait for the reply from the final command.
       (goto-char (point-max))
       (re-search-backward "^[0-9]" nil t)
@@ -1179,13 +1183,14 @@ Return nil if connection failed."
        (while (progn
                 (goto-char (point-max))
                 (not (re-search-backward "\r?\n" (- (point) 3) t)))
-         (accept-process-output process 1)
+         (accept-process-output
+          (elmo-network-session-process-internal session) 1)
          (discard-input)))
       ;; Now all replies are received.  We remove CRs.
       (goto-char (point-min))
       (while (search-forward "\r" nil t)
        (replace-match "" t t))
-      (copy-to-buffer tobuffer (point-min) (point-max)))))
+      (copy-to-buffer outbuf (point-min) (point-max)))))
 
 (defun elmo-nntp-make-groups-hashtb (folders &optional size)
   (let ((hashtb (or elmo-nntp-groups-hashtb
@@ -1213,10 +1218,9 @@ Return nil if connection failed."
    (t
     nil)))
 
-(defun elmo-nntp-retrieve-headers (buffer tobuffer process articles)
+(defun elmo-nntp-retrieve-headers (session outbuf articles)
   "Retrieve the headers of ARTICLES."
-  (save-excursion
-    (set-buffer buffer)
+  (with-current-buffer (elmo-network-session-buffer session)
     (erase-buffer)
     (let ((number (length articles))
          (count 0)
@@ -1225,52 +1229,49 @@ Return nil if connection failed."
          article)
       ;; Send HEAD commands.
       (while (setq article (pop articles))
-       (elmo-nntp-send-command
-        buffer
-        process
-        (format "head %s" article)
-        t ;; not erase-buffer
-        )
+       (elmo-nntp-send-command session
+                               (format "head %s" article)
+                               'noerase)
        (setq count (1+ count))
        ;; Every 200 requests we have to read the stream in
        ;; order to avoid deadlocks.
        (when (or (null articles)       ;All requests have been sent.
                  (zerop (% count elmo-nntp-header-fetch-chop-length)))
-         (accept-process-output process 1)
+         (accept-process-output 
+          (elmo-network-session-process-internal session) 1)
          (discard-input)
          (while (progn
-                  (set-buffer buffer)
                   (goto-char last-point)
                   ;; Count replies.
                   (while (elmo-nntp-next-result-arrived-p)
                     (setq last-point (point))
                     (setq received (1+ received)))
                   (< received count))
-           (and (zerop (% received 20))
-                (elmo-display-progress
-                 'elmo-nntp-retrieve-headers "Getting headers..."
-                 (/ (* received 100) number)))
-           (accept-process-output process 1)
-           (discard-input)
-           )))
-      (elmo-display-progress
-       'elmo-nntp-retrieve-headers "Getting headers..." 100)
+           (when (> number elmo-display-progress-threshold)
+             (if (or (zerop (% received 20)) (= received number))
+                 (elmo-display-progress
+                  'elmo-nntp-retrieve-headers "Getting headers..."
+                  (/ (* received 100) number))))
+           (accept-process-output
+            (elmo-network-session-process-internal session) 1)
+           (discard-input))))
+      (when (> number elmo-display-progress-threshold)
+       (elmo-display-progress
+        'elmo-nntp-retrieve-headers "Getting headers..." 100))
       (message "Getting headers...done")
       ;; Remove all "\r"'s.
       (goto-char (point-min))
       (while (search-forward "\r\n" nil t)
        (replace-match "\n"))
-      (copy-to-buffer tobuffer (point-min) (point-max)))))
+      (copy-to-buffer outbuf (point-min) (point-max)))))
 
 ;; end of from Gnus
 
-(defun elmo-nntp-msgdb-create-message (buffer len folder new-mark
-                                             already-mark seen-mark seen-list)
+(defun elmo-nntp-msgdb-create-message (len new-mark
+                                          already-mark seen-mark seen-list)
   (save-excursion
-    (let (beg
-         overview number-alist mark-alist
-         entity i num gmark seen message-id)
-      (set-buffer buffer)
+    (let (beg overview number-alist mark-alist
+             entity i num gmark seen message-id)
       (elmo-set-buffer-multibyte nil)
       (goto-char (point-min))
       (setq i 0)
@@ -1294,9 +1295,10 @@ Return nil if connection failed."
                      (elmo-msgdb-append-element
                       overview entity))
                (setq number-alist
-                     (elmo-msgdb-number-add number-alist
-                                            (elmo-msgdb-overview-entity-get-number entity)
-                                            (car entity)))
+                     (elmo-msgdb-number-add
+                      number-alist
+                      (elmo-msgdb-overview-entity-get-number entity)
+                      (car entity)))
                (setq message-id (car entity))
                (setq seen (member message-id seen-list))
                (if (setq gmark
@@ -1306,20 +1308,23 @@ Return nil if connection failed."
                                      nil
                                    already-mark)
                                (if seen
-                                   seen-mark
+                                   (if elmo-nntp-use-cache
+                                       seen-mark)
                                  new-mark))))
                    (setq mark-alist
                          (elmo-msgdb-mark-append
                           mark-alist
                           num gmark)))
                ))))
-       (setq i (1+ i))
-       (and (zerop (% i 20))
-            (elmo-display-progress
-             'elmo-nntp-msgdb-create-message "Creating msgdb..."
-             (/ (* i 100) len))))
-      (elmo-display-progress
-       'elmo-nntp-msgdb-create-message "Creating msgdb..." 100)
+       (when (> len elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (if (or (zerop (% i 20)) (= i len))
+             (elmo-display-progress
+              'elmo-nntp-msgdb-create-message "Creating msgdb..."
+              (/ (* i 100) len)))))
+      (when (> len elmo-display-progress-threshold)
+       (elmo-display-progress
+        'elmo-nntp-msgdb-create-message "Creating msgdb..." 100))
       (list overview number-alist mark-alist))))
 
 (defun elmo-nntp-use-cache-p (spec number)
@@ -1330,7 +1335,10 @@ Return nil if connection failed."
 
 (defun elmo-nntp-port-label (spec)
   (concat "nntp"
-         (if (elmo-nntp-spec-ssl spec) "!ssl" "")))
+         (if (elmo-nntp-spec-stream-type spec)
+             (concat "!" (symbol-name
+                          (elmo-network-stream-type-symbol
+                           (elmo-nntp-spec-stream-type spec)))))))
 
 (defsubst elmo-nntp-portinfo (spec)
   (list (elmo-nntp-spec-hostname spec)
@@ -1351,7 +1359,9 @@ Return nil if connection failed."
 (defalias 'elmo-nntp-list-folder-important
   'elmo-generic-list-folder-important)
 (defalias 'elmo-nntp-commit 'elmo-generic-commit)
+(defalias 'elmo-nntp-folder-diff 'elmo-generic-folder-diff)
 
-(provide 'elmo-nntp)
+(require 'product)
+(product-provide (provide 'elmo-nntp) (require 'elmo-version))
 
 ;;; elmo-nntp.el ends here
index 04a0688..8989966 100644 (file)
   (let ((msgdb (elmo-msgdb-load src))
        elmo-nntp-use-cache
        elmo-imap4-use-cache
-       elmo-pop3-use-cache) ; Inhibit caching while moving messages.
+       elmo-pop3-use-cache ; Inhibit caching while moving messages.
+       elmo-pop3-use-uidl) ; No need to use UIDL
     (message "Checking %s..." src)
     (elmo-move-msgs src (elmo-list-folder src) dst msgdb)
     (elmo-msgdb-save src msgdb)
+    (elmo-commit src)
     (run-hooks 'elmo-pipe-drained-hook)))
 
 (defun elmo-pipe-list-folder (spec)
   (elmo-pipe-drain (elmo-pipe-spec-src spec)
                   (elmo-pipe-spec-dst spec))
-  (elmo-list-folder (elmo-pipe-spec-dst spec)))
-
-(defun elmo-pipe-list-folder-unread (spec mark-alist unread-marks)
-  (elmo-list-folder-unread (elmo-pipe-spec-dst spec) mark-alist unread-marks))
+  (let ((killed (and elmo-use-killed-list
+                    (elmo-msgdb-killed-list-load
+                     (elmo-msgdb-expand-path spec))))
+       numbers)
+    (setq numbers (elmo-list-folder (elmo-pipe-spec-dst spec)))
+    (elmo-living-messages numbers killed)))
+
+(defun elmo-pipe-list-folder-unread (spec number-alist mark-alist unread-marks)
+  (elmo-list-folder-unread (elmo-pipe-spec-dst spec)
+                          number-alist mark-alist unread-marks))
   
-(defun elmo-pipe-list-folder-important (spec overview)
-  (elmo-list-folder-important (elmo-pipe-spec-dst spec) overview))
+(defun elmo-pipe-list-folder-important (spec number-alist)
+  (elmo-list-folder-important (elmo-pipe-spec-dst spec) number-alist))
 
 (defun elmo-pipe-max-of-folder (spec)
-  (let ((src-length (length (elmo-list-folder (elmo-pipe-spec-src spec))))
-       (dst-list (elmo-list-folder (elmo-pipe-spec-dst spec))))
+  (let* (elmo-pop3-use-uidl
+        (src-length (length (elmo-list-folder (elmo-pipe-spec-src spec))))
+        (dst-list (elmo-list-folder (elmo-pipe-spec-dst spec))))
     (cons (+ src-length (elmo-max-of-list dst-list))
          (+ src-length (length dst-list)))))
 
 (defun elmo-pipe-server-diff (spec)
   nil)
 
-(provide 'elmo-pipe)
+(defalias 'elmo-pipe-folder-diff 'elmo-generic-folder-diff)
+
+(require 'product)
+(product-provide (provide 'elmo-pipe) (require 'elmo-version))
 
 ;;; elmo-pipe.el ends here
index 494784a..65338c5 100644 (file)
@@ -30,6 +30,7 @@
 ;; 
 
 (require 'elmo-msgdb)
+(require 'elmo-net)
 (eval-when-compile
   (require 'elmo-util)
   (condition-case nil
@@ -46,6 +47,7 @@
     (server-msg-1 client-msg-1 salted-pass))
   (defun-maybe sasl-scram-md5-make-salted-pass
     (server-msg-1 passphrase))
+  (defun-maybe sasl-cram-md5 (username passphrase challenge))
   (defun-maybe sasl-scram-md5-authenticate-server
     (server-msg-1 server-msg-2 client-msg-1 salted-pass))
   (defun-maybe starttls-negotiate (a)))
       (require 'sasl))
   (error))
 
+(defvar elmo-pop3-use-uidl t
+  "*If non-nil, use UIDL.")
+
 (defvar elmo-pop3-exists-exactly t)
-(defvar elmo-pop3-read-point nil)
-(defvar elmo-pop3-connection-cache nil
-  "Cache of pop3 connection.")
 
-(defun elmo-pop3-close-connection (connection &optional process buffer)
-  (save-excursion
-    (let* ((buffer  (or buffer (nth 0 connection)))
-          (process (or process (nth 1 connection))))
-      (elmo-pop3-send-command buffer process "quit")
-      (when (null (elmo-pop3-read-response buffer process t))
-       (error "POP error: QUIT failed")))))
-
-(defun elmo-pop3-flush-connection ()
-  (interactive)
-  (let ((cache elmo-pop3-connection-cache)
-       buffer process proc-stat)
-    (while cache
-      (setq buffer (car (cdr (car cache))))
-      (setq process (car (cdr (cdr (car cache)))))
-      (if (and process
-              (not (or (eq (setq proc-stat
-                                 (process-status process))
-                           'closed)
-                       (eq proc-stat 'exit))))
-         (condition-case ()
-             (elmo-pop3-close-connection nil process buffer)
-           (error)))
-      (if buffer (kill-buffer buffer))
-      ;;(setq process (car (cdr (cdr (car cache)))))
-      (if process (delete-process process))
-      (setq cache (cdr cache)))
-    (setq elmo-pop3-connection-cache nil)))
-
-(defun elmo-pop3-get-connection (spec)
-  (let* ((user   (elmo-pop3-spec-username spec))
-        (server (elmo-pop3-spec-hostname spec))
-        (port   (elmo-pop3-spec-port spec))
-        (auth   (elmo-pop3-spec-auth spec))
-        (ssl    (elmo-pop3-spec-ssl spec))
-        (user-at-host (format "%s@%s" user server))
-        ret-val result buffer process errmsg proc-stat
-        user-at-host-on-port)
-    (if (not (elmo-plugged-p server port))
-       (error "Unplugged"))
-    (setq user-at-host-on-port
-         (concat user-at-host ":" (int-to-string port)
-                 (if (eq ssl 'starttls) "!!" (if ssl "!"))))
-    (setq ret-val (assoc user-at-host-on-port elmo-pop3-connection-cache))
-    (if (and ret-val
-            (or (eq (setq proc-stat
-                          (process-status (cadr (cdr ret-val))))
-                    'closed)
-                (eq proc-stat 'exit)))
-       ;; connection is closed...
-       (progn
-         (kill-buffer (car (cdr ret-val)))
-         (setq elmo-pop3-connection-cache
-               (delete ret-val elmo-pop3-connection-cache))
-         (setq ret-val nil)
-         ))
-    (if ret-val
-       (cdr ret-val)
-      (setq result
-           (elmo-pop3-open-connection
-            server user port auth
-            (elmo-get-passwd user-at-host) ssl))
-      (if (null result)
-         (error "Connection failed"))
-      (setq buffer (car result))
-      (setq process (cdr result))
-      (when (and process (null buffer))
-       (elmo-remove-passwd user-at-host)
-       (delete-process process)
-       (error "Login failed")
-       )
-      (setq elmo-pop3-connection-cache
-           (append elmo-pop3-connection-cache
-                   (list
-                    (cons user-at-host-on-port
-                          (setq ret-val (list buffer process))))))
-      ret-val)))
-
-(defun elmo-pop3-send-command (buffer process command)
-  (save-excursion
-    (set-buffer buffer)
-    (erase-buffer)
-    (goto-char (point-min))
-    (setq elmo-pop3-read-point (point))
-    (process-send-string process command)
-    (process-send-string process "\r\n")))
+(defvar elmo-pop3-authenticator-alist
+  '((user        elmo-pop3-auth-user)
+    (apop        elmo-pop3-auth-apop)
+    (cram-md5    elmo-pop3-auth-cram-md5)
+    (scram-md5   elmo-pop3-auth-scram-md5)
+    (digest-md5  elmo-pop3-auth-digest-md5))
+  "Definition of authenticators.")
 
-(defun elmo-pop3-send-command-no-erase (buffer process command)
-  (save-excursion
-    (set-buffer buffer)
-    ;(erase-buffer)
+(eval-and-compile
+  (luna-define-class elmo-pop3-session (elmo-network-session) ()))
+
+;; buffer-local
+(defvar elmo-pop3-read-point nil)
+(defvar elmo-pop3-number-uidl-hash nil) ; number -> uidl
+(defvar elmo-pop3-uidl-number-hash nil) ; uidl -> number
+(defvar elmo-pop3-size-hash nil) ; number -> size
+(defvar elmo-pop3-uidl-done nil)
+(defvar elmo-pop3-list-done nil)
+
+(defvar elmo-pop3-local-variables '(elmo-pop3-read-point
+                                   elmo-pop3-uidl-number-hash
+                                   elmo-pop3-number-uidl-hash
+                                   elmo-pop3-uidl-done
+                                   elmo-pop3-size-hash
+                                   elmo-pop3-list-done))
+
+(luna-define-method elmo-network-close-session ((session elmo-pop3-session))
+  (unless (memq (process-status
+                (elmo-network-session-process-internal session))
+               '(closed exit))
+    (elmo-pop3-send-command (elmo-network-session-process-internal session)
+                           "quit")
+    (or (elmo-pop3-read-response
+        (elmo-network-session-process-internal session) t)
+       (error "POP error: QUIT failed")))
+  (kill-buffer (process-buffer
+               (elmo-network-session-process-internal session)))
+  (delete-process (elmo-network-session-process-internal session)))
+
+(defun elmo-pop3-get-session (spec &optional if-exists)
+  (elmo-network-get-session
+   'elmo-pop3-session
+   "POP3"
+   (elmo-pop3-spec-hostname spec)
+   (elmo-pop3-spec-port spec)
+   (elmo-pop3-spec-username spec)
+   (elmo-pop3-spec-auth spec)
+   (elmo-pop3-spec-stream-type spec)
+   if-exists))
+
+(defun elmo-pop3-send-command (process command &optional no-erase)
+  (with-current-buffer (process-buffer process)
+    (unless no-erase
+      (erase-buffer))
     (goto-char (point-min))
     (setq elmo-pop3-read-point (point))
     (process-send-string process command)
     (process-send-string process "\r\n")))
 
-(defun elmo-pop3-read-response (buffer process &optional not-command)
-  (save-excursion
-    (set-buffer buffer)
+(defun elmo-pop3-read-response (process &optional not-command)
+  (with-current-buffer (process-buffer process)
     (let ((case-fold-search nil)
          (response-string nil)
          (response-continue t)
              (setq return-value
                    (if return-value
                        (concat return-value "\n" response-string)
-                     response-string
-                     )))
+                     response-string)))
          (if (looking-at "\\-.*$")
              (progn
                (setq response-continue nil)
     (goto-char (point-max))
     (insert output)))
 
-(defun elmo-pop3-open-connection (server user port auth passphrase ssl)
-  (let ((process nil)
-       (host server)
-       process-buffer ret-val response capability)
-    (catch 'done
-      (as-binary-process
-       (setq process-buffer
-            (get-buffer-create (format " *POP session to %s:%d" host port)))
-       (save-excursion
-        (set-buffer process-buffer)
-        (elmo-set-buffer-multibyte nil)
-        (erase-buffer))
-       (setq process
-            (elmo-open-network-stream "POP" process-buffer host port ssl))
-       (and (null process) (throw 'done nil))
-       (set-process-filter process 'elmo-pop3-process-filter)
-       ;; flush connections when exiting...
-       (save-excursion
-        (set-buffer process-buffer)
-        (make-local-variable 'elmo-pop3-read-point)
-        (setq elmo-pop3-read-point (point-min))
-        (when (null (setq response
-                          (elmo-pop3-read-response process-buffer process t)))
-          (setq ret-val (cons nil process))
-          (throw 'done nil))
-        (when (eq ssl 'starttls)
-          (elmo-pop3-send-command process-buffer process "stls")
-          (string-match "^\+OK"
-                        (elmo-pop3-read-response
-                         process-buffer process))
-          (starttls-negotiate process))
-        (cond ((string= auth "apop")
-               ;; try only APOP
-               (if (string-match "^\+OK .*\\(<[^\>]+>\\)" response)
-                   ;; good, APOP ready server
-                   (progn
-                     (require 'md5)
-                     (elmo-pop3-send-command
-                      process-buffer process
-                      (format "apop %s %s"
-                              user
-                              (md5
-                               (concat (match-string 1 response)
-                                           passphrase)))))
-                 ;; otherwise, fail (only APOP authentication)
-                 (setq ret-val (cons nil process))
-                 (throw 'done nil)))
-              ((string= auth "cram-md5")
-               (elmo-pop3-send-command
-                process-buffer process "auth cram-md5")
-               (when (null (setq response
-                                 (elmo-pop3-read-response
-                                  process-buffer process t)))
-                 (setq ret-val (cons nil process))
-                 (throw 'done nil))
-               (elmo-pop3-send-command
-                process-buffer process
-                (elmo-base64-encode-string
-                 (sasl-cram-md5 user passphrase
-                                (elmo-base64-decode-string
-                                 (cadr (split-string response " ")))))))
-              ((string= auth "digest-md5")
-               (elmo-pop3-send-command
-                process-buffer process "auth digest-md5")
-               (when (null (setq response
-                                 (elmo-pop3-read-response
-                                  process-buffer process t)))
-                 (setq ret-val (cons nil process))
-                 (throw 'done nil))
-               (elmo-pop3-send-command
-                process-buffer process
-                (elmo-base64-encode-string
-                 (sasl-digest-md5-digest-response
-                  (elmo-base64-decode-string
-                   (cadr (split-string response " ")))
-                  user passphrase "pop" host)
-                 'no-line-break))
-               (when (null (setq response
-                                 (elmo-pop3-read-response
-                                  process-buffer process t)))
-                 (setq ret-val (cons nil process))
-                 (throw 'done nil))
-               (elmo-pop3-send-command process-buffer process ""))
-              ((string= auth "scram-md5")
-               (let (server-msg-1 server-msg-2 client-msg-1 client-msg-2
-                                  salted-pass)
-                 (elmo-pop3-send-command
-                  process-buffer process
-                  (format "auth scram-md5 %s"
-                          (elmo-base64-encode-string
-                           (setq client-msg-1
-                                 (sasl-scram-md5-client-msg-1 user)))))
-                 (when (null (setq response
-                                   (elmo-pop3-read-response
-                                    process-buffer process t)))
-                   (setq ret-val (cons nil process))
-                   (throw 'done nil))
-                 (setq server-msg-1
-                       (elmo-base64-decode-string
-                        (cadr (split-string response " "))))
-                 (elmo-pop3-send-command
-                  process-buffer process
-                  (elmo-base64-encode-string
-                   (sasl-scram-md5-client-msg-2
-                    server-msg-1
-                    client-msg-1
-                    (setq salted-pass
-                          (sasl-scram-md5-make-salted-pass
-                           server-msg-1 passphrase)))))
-                 (when (null (setq response
-                                   (elmo-pop3-read-response
-                                    process-buffer process t)))
-                   (setq ret-val (cons nil process))
-                   (throw 'done nil))
-                 (setq server-msg-2
-                       (elmo-base64-decode-string
-                        (cadr (split-string response " "))))
-                 (if (null (sasl-scram-md5-authenticate-server
-                            server-msg-1
-                            server-msg-2
-                            client-msg-1
-                            salted-pass))
-                     (throw 'done nil))
-                 (elmo-pop3-send-command
-                  process-buffer process "") ))
-              (t
-               ;; try USER/PASS
-               (elmo-pop3-send-command  process-buffer process
-                                        (format "user %s" user))
-               (when (null (elmo-pop3-read-response process-buffer process t))
-                 (setq ret-val (cons nil process))
-                 (throw 'done nil))
-               (elmo-pop3-send-command  process-buffer process
-                                        (format "pass %s" passphrase))))
-        ;; read PASS or APOP response
-        (when (null (elmo-pop3-read-response process-buffer process t))
-          (setq ret-val (cons nil process))
-          (throw 'done nil))
-        (setq ret-val (cons process-buffer process)))))
-    ret-val))
+(defun elmo-pop3-auth-user (session)
+  (let ((process (elmo-network-session-process-internal session)))
+    ;; try USER/PASS
+    (elmo-pop3-send-command
+     process
+     (format "user %s" (elmo-network-session-user-internal session)))
+    (or (elmo-pop3-read-response process t)
+       (signal 'elmo-authenticate-error
+               '(elmo-pop-auth-user)))
+    (elmo-pop3-send-command  process
+                            (format
+                             "pass %s"
+                             (elmo-get-passwd
+                              (elmo-network-session-password-key session))))
+    (or (elmo-pop3-read-response process t)
+       (signal 'elmo-authenticate-error
+               '(elmo-pop-auth-user)))))
+
+(defun elmo-pop3-auth-apop (session)
+  (if (string-match "^\+OK .*\\(<[^\>]+>\\)"
+                   (elmo-network-session-greeting-internal session))
+      ;; good, APOP ready server
+      (progn
+       (require 'md5)
+       (elmo-pop3-send-command
+        (elmo-network-session-process-internal session)
+        (format "apop %s %s"
+                (elmo-network-session-user-internal session)
+                (md5
+                 (concat (match-string
+                          1
+                          (elmo-network-session-greeting-internal session))
+                         (elmo-get-passwd
+                          (elmo-network-session-password-key session))))))
+       (or (elmo-pop3-read-response
+            (elmo-network-session-process-internal session)
+            t)
+           (signal 'elmo-authenticate-error
+                   '(elmo-pop3-auth-apop))))
+    (signal 'elmo-open-error '(elmo-pop-auth-user))))
+    
+(defun elmo-pop3-auth-cram-md5 (session)
+  (let ((process (elmo-network-session-process-internal session))
+       response)
+    (elmo-pop3-send-command  process "auth cram-md5")
+    (or (setq response
+             (elmo-pop3-read-response process t))
+       (signal 'elmo-open-error '(elmo-pop-auth-cram-md5)))
+    (elmo-pop3-send-command
+     process
+     (elmo-base64-encode-string
+      (sasl-cram-md5 (elmo-network-session-user-internal session)
+                    (elmo-get-passwd
+                     (elmo-network-session-password-key session))
+                    (elmo-base64-decode-string
+                     (cadr (split-string response " "))))))
+    (or (elmo-pop3-read-response process t)
+       (signal 'elmo-authenticate-error
+               '(elmo-pop-auth-cram-md5)))))
+
+(defun elmo-pop3-auth-scram-md5 (session)
+  (let ((process (elmo-network-session-process-internal session))
+       server-msg-1 server-msg-2 client-msg-1 client-msg-2
+       salted-pass response)
+    (elmo-pop3-send-command
+     process
+     (format "auth scram-md5 %s"
+            (elmo-base64-encode-string
+             (setq client-msg-1
+                   (sasl-scram-md5-client-msg-1
+                    (elmo-network-session-user-internal session))))))
+    (or (elmo-pop3-read-response process t)
+       (signal 'elmo-open-error '(elmo-pop-auth-scram-md5)))
+    (setq server-msg-1
+         (elmo-base64-decode-string (cadr (split-string response " "))))
+    (elmo-pop3-send-command
+     process
+     (elmo-base64-encode-string
+      (sasl-scram-md5-client-msg-2
+       server-msg-1
+       client-msg-1
+       (setq salted-pass
+            (sasl-scram-md5-make-salted-pass
+             server-msg-1
+             (elmo-get-passwd
+              (elmo-network-session-password-key session)))))))
+    (or (setq response (elmo-pop3-read-response process t))
+       (signal 'elmo-authenticate-error
+               '(elmo-pop-auth-scram-md5)))
+    (setq server-msg-2 (elmo-base64-decode-string
+                       (cadr (split-string response " "))))
+    (or (sasl-scram-md5-authenticate-server server-msg-1
+                                           server-msg-2
+                                           client-msg-1
+                                           salted-pass)
+       (signal 'elmo-authenticate-error
+               '(elmo-pop-auth-scram-md5)))
+    (elmo-pop3-send-command process "")
+    (or (setq response (elmo-pop3-read-response process t))
+       (signal 'elmo-authenticate-error
+               '(elmo-pop-auth-scram-md5)))))
+
+(defun elmo-pop3-auth-digest-md5 (session)
+  (let ((process (elmo-network-session-process-internal session))
+       response)
+    (elmo-pop3-send-command process "auth digest-md5")
+    (or (setq response
+             (elmo-pop3-read-response process t))
+       (signal 'elmo-open-error
+               '(elmo-pop-auth-digest-md5)))
+    (elmo-pop3-send-command
+     process
+     (elmo-base64-encode-string
+      (sasl-digest-md5-digest-response
+       (elmo-base64-decode-string
+       (cadr (split-string response " ")))
+       (elmo-network-session-user-internal session)
+       (elmo-get-passwd
+       (elmo-network-session-password-key session))
+       "pop"
+       (elmo-network-session-host-internal session))
+      'no-line-break))
+    (or (elmo-pop3-read-response process t)
+       (signal 'elmo-authenticate-error
+               '(elmo-pop-auth-digest-md5)))
+    (elmo-pop3-send-command process "")
+    (or (elmo-pop3-read-response process t)
+       (signal 'elmo-open-error
+               '(elmo-pop-auth-digest-md5)))))
+
+(luna-define-method elmo-network-initialize-session-buffer :after
+  ((session elmo-pop3-session) buffer)
+  (with-current-buffer buffer
+    (mapcar 'make-variable-buffer-local elmo-pop3-local-variables)))
+
+(luna-define-method elmo-network-initialize-session ((session
+                                                     elmo-pop3-session))
+  (let ((process (elmo-network-session-process-internal session))
+       response capability mechanism)
+    (with-current-buffer (process-buffer process)
+      (set-process-filter process 'elmo-pop3-process-filter)
+      (setq elmo-pop3-read-point (point-min))
+      (or (elmo-network-session-set-greeting-internal
+          session
+          (elmo-pop3-read-response process t))
+         (signal 'elmo-open-error
+                 '(elmo-network-intialize-session)))
+      (when (eq (elmo-network-stream-type-symbol
+                (elmo-network-session-stream-type-internal session))
+               'starttls)
+       (elmo-pop3-send-command process "stls")
+       (if (string-match "^\+OK"
+                         (elmo-pop3-read-response process))
+           (starttls-negotiate process)
+         (signal 'elmo-open-error
+                 '(elmo-network-intialize-session)))))))
+
+(luna-define-method elmo-network-authenticate-session ((session
+                                                       elmo-pop3-session))
+  (let (authenticator)
+    ;; defaults to 'user.
+    (unless (elmo-network-session-auth-internal session)
+      (elmo-network-session-set-auth-internal session 'user))
+    (setq authenticator
+         (nth 1 (assq (elmo-network-session-auth-internal session)
+                      elmo-pop3-authenticator-alist)))
+    (unless authenticator (error "There's no authenticator for %s"
+                                (elmo-network-session-auth-internal session)))
+    (funcall authenticator session)))
+
+(luna-define-method elmo-network-setup-session ((session
+                                                elmo-pop3-session))
+  (let ((process (elmo-network-session-process-internal session))
+       response)
+    (with-current-buffer (process-buffer process)
+      (setq elmo-pop3-size-hash (make-vector 31 0))
+      ;; To get obarray of uidl and size
+      (elmo-pop3-send-command process "list")
+      (if (null (elmo-pop3-read-response process))
+         (error "POP List folder failed"))
+      (if (null (setq response
+                     (elmo-pop3-read-contents
+                      (current-buffer) process)))
+         (error "POP List folder failed"))
+      ;; POP server always returns a sequence of serial numbers.
+      (elmo-pop3-parse-list-response response)
+      ;; UIDL
+      (when elmo-pop3-use-uidl
+       (setq elmo-pop3-uidl-number-hash (make-vector 31 0))
+       (setq elmo-pop3-number-uidl-hash (make-vector 31 0))
+       ;; UIDL
+       (elmo-pop3-send-command process "uidl")
+       (unless (elmo-pop3-read-response process)
+         (error "UIDL failed."))
+       (unless (setq response (elmo-pop3-read-contents
+                               (current-buffer) process))
+         (error "UIDL failed."))
+       (elmo-pop3-parse-uidl-response response)))))
 
 (defun elmo-pop3-read-contents (buffer process)
   (save-excursion
   (if (and elmo-pop3-exists-exactly
           (elmo-pop3-plugged-p spec))
       (save-excursion
-       (let (elmo-auto-change-plugged) ;;don't change plug status.
+       (let (elmo-auto-change-plugged ; don't change plug status.
+             session)
          (condition-case nil
              (prog1
-                 (elmo-pop3-get-connection spec)
-               (elmo-pop3-flush-connection))
+                 (setq session (elmo-pop3-get-session spec))
+               (if session
+                   (elmo-network-close-session session)))
            (error nil))))
     t))
 
-(defun elmo-pop3-parse-list-response (string)
-  (save-excursion
-    (let ((tmp-buffer (get-buffer-create " *ELMO PARSE TMP*"))
-         ret-val)
-      (set-buffer tmp-buffer)
-      (let ((case-fold-search t))
-       (erase-buffer)
+(defun elmo-pop3-parse-uidl-response (string)
+  (let ((buffer (current-buffer))
+       number list size)
+    (with-temp-buffer
+      (let (number uid list)
        (insert string)
        (goto-char (point-min))
-       (while (re-search-forward "^\\([0-9]*\\)[\t ].*$" nil t)
-         (setq ret-val
-               (cons
-                (string-to-int
-                 (elmo-match-buffer 1))
-                ret-val)))
-       (kill-buffer tmp-buffer)
-       (nreverse ret-val)))))
+       (while (re-search-forward "^\\([0-9]+\\)[\t ]\\([^ \n]+\\)$" nil t)
+         (setq number  (elmo-match-buffer 1))
+         (setq uid (elmo-match-buffer 2))
+         (with-current-buffer buffer
+           (elmo-set-hash-val uid number elmo-pop3-uidl-number-hash)
+           (elmo-set-hash-val (concat "#" number) uid
+                              elmo-pop3-number-uidl-hash))
+         (setq list (cons uid list)))
+       (with-current-buffer buffer (setq elmo-pop3-uidl-done t))
+       (nreverse list)))))
+
+(defun elmo-pop3-parse-list-response (string)
+  (let ((buffer (current-buffer))
+       number list size)
+    (with-temp-buffer
+      (insert string)
+      (goto-char (point-min))
+      (while (re-search-forward "^\\([0-9]+\\)[\t ]\\([0-9]+\\)$" nil t)
+       (setq list
+             (cons
+              (string-to-int (setq number (elmo-match-buffer 1)))
+              list))
+       (setq size (elmo-match-buffer 2))
+       (with-current-buffer buffer
+         (elmo-set-hash-val (concat "#" number)
+                            size
+                            elmo-pop3-size-hash)))
+      (with-current-buffer buffer (setq elmo-pop3-list-done t))
+      (nreverse list))))
+
+(defun elmo-pop3-list-location (spec)
+  (with-current-buffer (process-buffer
+                       (elmo-network-session-process-internal
+                        (elmo-pop3-get-session spec)))
+    (let (list)
+      (if elmo-pop3-uidl-done
+         (progn
+           (mapatoms
+            (lambda (atom)
+              (setq list (cons (symbol-name atom) list)))
+            elmo-pop3-uidl-number-hash)
+           (nreverse list))
+       (error "POP3: Error in UIDL")))))
+
+(defun elmo-pop3-list-by-uidl-subr (spec &optional nonsort)
+  (let ((flist (elmo-list-folder-by-location
+               spec
+               (elmo-pop3-list-location spec))))
+    (if nonsort
+       (cons (elmo-max-of-list flist) (length flist))
+      (sort flist '<))))
+
+(defun elmo-pop3-list-by-list (spec)
+  (with-current-buffer (process-buffer
+                       (elmo-network-session-process-internal
+                        (elmo-pop3-get-session spec)))
+    (let (list)
+      (if elmo-pop3-list-done
+         (progn
+           (mapatoms (lambda (atom)
+                       (setq list (cons (string-to-int
+                                         (substring (symbol-name atom) 1))
+                                        list)))
+                     elmo-pop3-size-hash)
+           (sort list '<))
+       (error "POP3: Error in list")))))
 
 (defun elmo-pop3-list-folder (spec)
-  (save-excursion
-    (elmo-pop3-flush-connection)
-    (let* ((connection (elmo-pop3-get-connection spec))
-          (buffer  (nth 0 connection))
-          (process (nth 1 connection))
-          response errmsg ret-val)
-      (elmo-pop3-send-command buffer process "list")
-      (if (null (elmo-pop3-read-response buffer process))
-         (error "POP List folder failed"))
-      (if (null (setq response (elmo-pop3-read-contents buffer process)))
-         (error "POP List folder failed"))
-      ;; POP server always returns a sequence of serial numbers.
-      (elmo-pop3-parse-list-response response))))
+  (let ((killed (and elmo-use-killed-list
+                    (elmo-msgdb-killed-list-load
+                     (elmo-msgdb-expand-path spec))))
+       numbers)
+    (elmo-pop3-commit spec)
+    (setq numbers (if elmo-pop3-use-uidl
+                     (progn
+                       (elmo-pop3-list-by-uidl-subr spec))
+                   (elmo-pop3-list-by-list spec)))
+    (elmo-living-messages numbers killed)))
 
 (defun elmo-pop3-max-of-folder (spec)
-  (save-excursion
-    (elmo-pop3-flush-connection)
-    (let* ((connection (elmo-pop3-get-connection spec))
-          (buffer  (nth 0 connection))
-          (process (nth 1 connection))
+  (elmo-pop3-commit spec)
+  (if elmo-pop3-use-uidl
+      (elmo-pop3-list-by-uidl-subr spec 'nonsort)
+    (let* ((process
+           (elmo-network-session-process-internal
+            (elmo-pop3-get-session spec)))
           (total 0)
           response)
-      (elmo-pop3-send-command buffer process "STAT")
-      (setq response (elmo-pop3-read-response buffer process))
-      ;; response: "^\+OK 2 7570$"
-      (if (not (string-match "^\+OK[ \t]*\\([0-9]*\\)" response))
-         (error "POP STAT command failed")
-       (setq total
-             (string-to-int
-              (substring response (match-beginning 1)(match-end 1 ))))
-       (cons total total)))))
+      (with-current-buffer (process-buffer process)
+       (elmo-pop3-send-command process "STAT")
+       (setq response (elmo-pop3-read-response process))
+       ;; response: "^\+OK 2 7570$"
+       (if (not (string-match "^\+OK[ \t]*\\([0-9]*\\)" response))
+           (error "POP STAT command failed")
+         (setq total
+               (string-to-int
+                (substring response (match-beginning 1)(match-end 1 ))))
+         (cons total total))))))
 
 (defvar elmo-pop3-header-fetch-chop-length 200)
 
          (last-point (point-min)))
       ;; Send HEAD commands.
       (while articles
-       (elmo-pop3-send-command-no-erase
-        buffer
-        process
-        (format "top %s 0" (car articles))
-        )
-       ; (accept-process-output process 1)
+       (elmo-pop3-send-command process (format
+                                        "top %s 0" (car articles))
+                               'no-erase)
+       ;; (accept-process-output process 1)
        (setq articles (cdr articles))
        (setq count (1+ count))
        ;; Every 200 requests we have to read the stream in
                     (setq last-point (point))
                     (setq received (1+ received)))
                   (< received count))
-           (and (zerop (% received 20))
-                (elmo-display-progress
-                 'elmo-pop3-retrieve-headers "Getting headers..."
-                 (/ (* received 100) number)))
+           (when (> number elmo-display-progress-threshold)
+             (if (or (zerop (% received 5)) (= received number))
+                 (elmo-display-progress
+                  'elmo-pop3-retrieve-headers "Getting headers..."
+                  (/ (* received 100) number))))
            (accept-process-output process 1)
            ;(accept-process-output process)
-           (discard-input)
-           )))
-      (elmo-display-progress
-       'elmo-pop3-retrieve-headers "Getting headers..." 100)
+           (discard-input))))
       ;; Remove all "\r"'s.
       (goto-char (point-min))
       (while (search-forward "\r\n" nil t)
        (replace-match "\n"))
-      (copy-to-buffer tobuffer (point-min) (point-max))
-      ;(elmo-pop3-close-connection nil process buffer) ; close connection
-      )))
+      (copy-to-buffer tobuffer (point-min) (point-max)))))
 
 (defalias 'elmo-pop3-msgdb-create 'elmo-pop3-msgdb-create-as-numlist)
+
 (defun elmo-pop3-msgdb-create-as-numlist (spec numlist new-mark
                                               already-mark seen-mark
-                                              important-mark seen-list)
+                                              important-mark seen-list
+                                              &optional msgdb)
   (when numlist
-    (let* ((connection (elmo-pop3-get-connection spec))
-          (buffer (nth 0 connection))
-          (process (nth 1 connection))
-          response errmsg ret-val)
-      (elmo-pop3-msgdb-create-by-header buffer process numlist
+    (let ((process (elmo-network-session-process-internal
+                   (elmo-pop3-get-session spec)))
+         loc-alist)
+      (if elmo-pop3-use-uidl
+         (setq loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
+                           (elmo-msgdb-location-load
+                            (elmo-msgdb-expand-path spec)))))
+      (elmo-pop3-msgdb-create-by-header process numlist
                                        new-mark already-mark
-                                       seen-mark seen-list))))
-
-(defun elmo-pop3-msgdb-create-by-header (buffer process numlist
-                                               new-mark already-mark
-                                               seen-mark
-                                               seen-list)
-  (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*"))
-       ret-val)
-    (elmo-pop3-retrieve-headers
-     buffer tmp-buffer process numlist)
-    (setq ret-val
+                                       seen-mark seen-list
+                                       loc-alist))))
+
+(defun elmo-pop3-uidl-to-number (uidl)
+  (string-to-number (elmo-get-hash-val uidl
+                                      elmo-pop3-uidl-number-hash)))
+
+(defun elmo-pop3-number-to-uidl (number)
+  (elmo-get-hash-val (format "#%d" number)
+                    elmo-pop3-number-uidl-hash))
+
+(defun elmo-pop3-number-to-size (number)
+  (elmo-get-hash-val (format "#%d" number)
+                    elmo-pop3-size-hash))
+
+(defun elmo-pop3-msgdb-create-by-header (process numlist
+                                                new-mark already-mark
+                                                seen-mark
+                                                seen-list
+                                                loc-alist)
+  (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*")))
+    (with-current-buffer (process-buffer process)
+      (if loc-alist ; use uidl.
+         (setq numlist
+               (delq
+                nil
+                (mapcar
+                 (lambda (number)
+                   (elmo-pop3-uidl-to-number (cdr (assq number loc-alist))))
+                 numlist))))
+      (elmo-pop3-retrieve-headers (process-buffer process)
+                                 tmp-buffer process numlist)
+      (prog1
          (elmo-pop3-msgdb-create-message
           tmp-buffer
+          process
           (length numlist)
           numlist
-          new-mark already-mark seen-mark seen-list))
-    (kill-buffer tmp-buffer)
-    ret-val))
+          new-mark already-mark seen-mark seen-list loc-alist)
+       (kill-buffer tmp-buffer)))))
 
 (defun elmo-pop3-msgdb-create-message (buffer
-                                      num numlist new-mark already-mark
+                                      process
+                                      num
+                                      numlist new-mark already-mark
                                       seen-mark
-                                      seen-list)
+                                      seen-list
+                                      loc-alist)
   (save-excursion
-    (let (beg
-         overview number-alist mark-alist
-         entity i number message-id gmark seen)
+    (let (beg overview number-alist mark-alist
+             entity i number message-id gmark seen size)
       (set-buffer buffer)
       (elmo-set-buffer-multibyte default-enable-multibyte-characters)
       (goto-char (point-min))
              (setq overview
                    (elmo-msgdb-append-element
                     overview entity))
+             (with-current-buffer (process-buffer process)
+               (elmo-msgdb-overview-entity-set-size
+                entity
+                (string-to-number
+                 (elmo-pop3-number-to-size
+                  (elmo-msgdb-overview-entity-get-number entity))))
+               (if (setq number
+                         (car
+                          (rassoc
+                           (elmo-pop3-number-to-uidl
+                            (elmo-msgdb-overview-entity-get-number entity))
+                           loc-alist)))
+                   (elmo-msgdb-overview-entity-set-number entity number)))
              (setq number-alist
-                   (elmo-msgdb-number-add number-alist
-                                          (elmo-msgdb-overview-entity-get-number entity)
-                                          (car entity)))
+                   (elmo-msgdb-number-add
+                    number-alist
+                    (elmo-msgdb-overview-entity-get-number entity)
+                    (car entity)))
              (setq message-id (car entity))
              (setq seen (member message-id seen-list))
              (if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
                        (elmo-msgdb-mark-append
                         mark-alist
                         (elmo-msgdb-overview-entity-get-number entity)
-                        gmark)))
-             )))
-       (setq i (1+ i))
-       (and (zerop (% i 20))
-            (elmo-display-progress
-             'elmo-pop3-msgdb-create-message "Creating msgdb..."
-             (/ (* i 100) num)))
-       )
-      (elmo-display-progress
-       'elmo-pop3-msgdb-create-message "Creating msgdb..." 100)
-      (list overview number-alist mark-alist))))
-
-(defun elmo-pop3-read-body (buffer process outbuf)
-  (with-current-buffer buffer
+                        gmark))))))
+       (when (> num elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (if (or (zerop (% i 5)) (= i num))
+             (elmo-display-progress
+              'elmo-pop3-msgdb-create-message "Creating msgdb..."
+              (/ (* i 100) num)))))
+      (list overview number-alist mark-alist loc-alist))))
+
+(defun elmo-pop3-read-body (process outbuf)
+  (with-current-buffer (process-buffer process)
     (let ((start elmo-pop3-read-point)
          end)
       (goto-char start)
       (setq end (point))
       (with-current-buffer outbuf
        (erase-buffer)
-       (insert-buffer-substring buffer start (- end 3))
+       (insert-buffer-substring (process-buffer process) start (- end 3))
        (elmo-delete-cr-get-content-type)))))
 
-(defun elmo-pop3-read-msg (spec number outbuf)
-  (save-excursion
-    (let* ((connection (elmo-pop3-get-connection spec))
-          (buffer  (car connection))
-          (process (cadr connection))
-          (cwf     (caddr connection))
-          response errmsg msg)
-      (elmo-pop3-send-command buffer process
-                             (format "retr %s" number))
-      (when (null (setq response (elmo-pop3-read-response
-                                 buffer process t)))
-       (error "Fetching message failed"))
-      (setq response (elmo-pop3-read-body buffer process outbuf))
-      (set-buffer outbuf)
-      (goto-char (point-min))
-      (while (re-search-forward "^\\." nil t)
-       (replace-match "")
-       (forward-line))
-      response)))
-
-(defun elmo-pop3-delete-msg (buffer process number)
-  (let (response errmsg msg)
-    (elmo-pop3-send-command buffer process
-                           (format "dele %s" number))
-    (when (null (setq response (elmo-pop3-read-response
-                               buffer process t)))
-      (error "Deleting message failed"))))
-
-(defun elmo-pop3-delete-msgs (spec msgs)
-  (save-excursion
-    (let* ((connection (elmo-pop3-get-connection spec))
-          (buffer  (car connection))
-          (process (cadr connection)))
-      (mapcar '(lambda (msg) (elmo-pop3-delete-msg
-                             buffer process msg))
-             msgs))))
+(defun elmo-pop3-read-msg (spec number outbuf &optional msgdb)
+  (let* ((loc-alist (if elmo-pop3-use-uidl
+                       (if msgdb
+                           (elmo-msgdb-get-location msgdb)
+                         (elmo-msgdb-location-load
+                          (elmo-msgdb-expand-path spec)))))
+        (process (elmo-network-session-process-internal
+                  (elmo-pop3-get-session spec)))
+        response errmsg msg)
+    (with-current-buffer (process-buffer process)
+      (if loc-alist
+         (setq number (elmo-pop3-uidl-to-number
+                       (cdr (assq number loc-alist)))))
+      (when number
+       (elmo-pop3-send-command process
+                               (format "retr %s" number))
+       (when (null (setq response (elmo-pop3-read-response
+                                   process t)))
+         (error "Fetching message failed"))
+       (setq response (elmo-pop3-read-body process outbuf))
+       (set-buffer outbuf)
+       (goto-char (point-min))
+       (while (re-search-forward "^\\." nil t)
+         (replace-match "")
+         (forward-line))
+       response))))
+
+(defun elmo-pop3-delete-msg (process number loc-alist)
+  (with-current-buffer (process-buffer process)
+    (let (response errmsg msg)
+      (if loc-alist
+         (setq number (elmo-pop3-uidl-to-number
+                       (cdr (assq number loc-alist)))))
+      (if number
+         (progn
+           (elmo-pop3-send-command process
+                                   (format "dele %s" number))
+           (when (null (setq response (elmo-pop3-read-response
+                                       process t)))
+             (error "Deleting message failed")))
+       (error "Deleting message failed")))))
+
+(defun elmo-pop3-delete-msgs (spec msgs &optional msgdb)
+  (let ((loc-alist (if elmo-pop3-use-uidl
+                      (if msgdb
+                          (elmo-msgdb-get-location msgdb)
+                        (elmo-msgdb-location-load
+                         (elmo-msgdb-expand-path spec)))))
+       (process (elmo-network-session-process-internal
+                 (elmo-pop3-get-session spec))))
+    (mapcar '(lambda (msg) (elmo-pop3-delete-msg
+                           process msg loc-alist))
+           msgs)))
 
 (defun elmo-pop3-search (spec condition &optional numlist)
   (error "Searching in pop3 folder is not implemented yet"))
 
 (defun elmo-pop3-port-label (spec)
   (concat "pop3"
-         (if (elmo-pop3-spec-ssl spec) "!ssl" "")))
+         (if (elmo-pop3-spec-stream-type spec)
+             (concat "!" (symbol-name
+                          (elmo-network-stream-type-symbol
+                           (elmo-pop3-spec-stream-type spec)))))))
 
 (defsubst elmo-pop3-portinfo (spec)
   (list (elmo-pop3-spec-hostname spec)
   'elmo-generic-list-folder-unread)
 (defalias 'elmo-pop3-list-folder-important
   'elmo-generic-list-folder-important)
-(defalias 'elmo-pop3-commit 'elmo-generic-commit)
+(defalias 'elmo-pop3-folder-diff 'elmo-generic-folder-diff)
+
+(defun elmo-pop3-commit (spec)
+  (if (elmo-pop3-plugged-p spec)
+      (let ((session (elmo-pop3-get-session spec 'if-exists)))
+       (and session
+            (elmo-network-close-session session)))))
+       
 
-(provide 'elmo-pop3)
+(require 'product)
+(product-provide (provide 'elmo-pop3) (require 'elmo-version))
 
 ;;; elmo-pop3.el ends here
index 6388fed..99e1b97 100644 (file)
 (require 'eword-decode)
 (require 'utf7)
 
-(eval-when-compile
-  (condition-case nil
-      (progn
-       (require 'ssl)
-       (require 'starttls))
-    (error))
-  (defun-maybe starttls-negotiate (a))
-  (defun-maybe starttls-open-stream (a b c d))
-  (defun-maybe open-ssl-stream (a b c d)))
-
 (defmacro elmo-set-buffer-multibyte (flag)
   "Set the multibyte flag of the current buffer to FLAG."
   (cond ((boundp 'MULE)
     (filename newname &optional ok-if-already-exists)
     (copy-file filename newname ok-if-already-exists t)))
 
-(require 'broken)
-(broken-facility timezone-y2k
-  "timezone.el does not clear Y2K."
-  (or (not (featurep 'timezone))
-      (string= (aref (timezone-parse-date "Sat, 1 Jan 00 07:00:00 JST") 0)
-              "2000")))
-
-(when-broken timezone-y2k
-  (defun timezone-parse-date (date)
-    "Parse DATE and return a vector [YEAR MONTH DAY TIME TIMEZONE].
-19 is prepended to year if necessary.  Timezone may be nil if nothing.
-Understands the following styles:
- (1) 14 Apr 89 03:20[:12] [GMT]
- (2) Fri, 17 Mar 89 4:01[:33] [GMT]
- (3) Mon Jan 16 16:12[:37] [GMT] 1989
- (4) 6 May 1992 1641-JST (Wednesday)
- (5) 22-AUG-1993 10:59:12.82
- (6) Thu, 11 Apr 16:17:12 91 [MET]
- (7) Mon, 6  Jul 16:47:20 T 1992 [MET]"
-    (condition-case nil
-       (progn
-         ;; Get rid of any text properties.
-         (and (stringp date)
-              (or (text-properties-at 0 date)
-                  (next-property-change 0 date))
-              (setq date (copy-sequence date))
-              (set-text-properties 0 (length date) nil date))
-         (let ((date (or date ""))
-               (year nil)
-               (month nil)
-               (day nil)
-               (time nil)
-               (zone nil))                     ;This may be nil.
-           (cond ((string-match
-                   "\\([^ \t,]+\\),[ \t]+\\([0-9]+\\)[ \t]+\\([^ \t,]+\\)[ \t]+\\([0-9]+:[0-9:]+\\)[ \t]+\\(T[ \t]+\\|\\)\\([0-9]+\\)[ \t]*\\'" date)
-                  ;; Styles: (6) and (7) without timezone
-                  (setq year 6 month 3 day 2 time 4 zone nil))
-                 ((string-match
-                   "\\([^ \t,]+\\),[ \t]+\\([0-9]+\\)[ \t]+\\([^ \t,]+\\)[ \t]+\\([0-9]+:[0-9:]+\\)[ \t]+\\(T[ \t]+\\|\\)\\([0-9]+\\)[ \t]*\\([-+a-zA-Z0-9]+\\)" date)
-                  ;; Styles: (6) and (7) with timezone and buggy timezone
-                  (setq year 6 month 3 day 2 time 4 zone 7))
-                 ((string-match
-                   "\\([0-9]+\\)[ \t]+\\([^ \t,]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9:]+\\)[ \t]*\\'" date)
-                  ;; Styles: (1) and (2) without timezone
-                  (setq year 3 month 2 day 1 time 4 zone nil))
-                 ((string-match
-                   "\\([0-9]+\\)[ \t]+\\([^ \t,]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9:]+\\)[ \t]*\\([-+a-zA-Z0-9]+\\)" date)
-                  ;; Styles: (1) and (2) with timezone and buggy timezone
-                  (setq year 3 month 2 day 1 time 4 zone 5))
-                 ((string-match
-                   "\\([^ \t,]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9:]+\\)[ \t]+\\([0-9]+\\)" date)
-                  ;; Styles: (3) without timezone
-                  (setq year 4 month 1 day 2 time 3 zone nil))
-                 ((string-match
-                   "\\([^ \t,]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9:]+\\)[ \t]+\\([-+a-zA-Z0-9]+\\)[ \t]+\\([0-9]+\\)" date)
-                  ;; Styles: (3) with timezone
-                  (setq year 5 month 1 day 2 time 3 zone 4))
-                 ((string-match
-                   "\\([0-9]+\\)[ \t]+\\([^ \t,]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)[ \t]*\\([-+a-zA-Z0-9]+\\)" date)
-                  ;; Styles: (4) with timezone
-                  (setq year 3 month 2 day 1 time 4 zone 5))
-                 ((string-match
-                   "\\([0-9]+\\)-\\([A-Za-z]+\\)-\\([0-9]+\\)[ \t]+\\([0-9]+:[0-9]+:[0-9]+\\)\\.[0-9]+" date)
-                  ;; Styles: (5) without timezone.
-                  (setq year 3 month 2 day 1 time 4 zone nil))
-                 )
-           (if year
-               (progn
-                 (setq year
-                       (substring date (match-beginning year)
-                                  (match-end year)))
-                 (if (< (length year) 4)
-                     (let ((yr (string-to-int year)))
-                       (when (>= yr 100)
-                         (setq yr (- yr 100)))
-                       (setq year (format "%d%02d"
-                                          (if (< yr 70)
-                                              20
-                                            19)
-                                          yr))))
-                 (let ((string (substring date
-                                          (match-beginning month)
-                                          (+ (match-beginning month) 3))))
-                   (setq month
-                         (int-to-string
-                          (cdr (assoc (upcase string)
-                                      timezone-months-assoc)))))
-                 (setq day
-                       (substring date (match-beginning day) (match-end day)))
-                 (setq time
-                       (substring date (match-beginning time)
-                                  (match-end time)))))
-           (if zone
-               (setq zone
-                     (substring date (match-beginning zone)
-                                (match-end zone))))
-           (if year
-               (vector year month day time zone)
-             (vector "0" "0" "0" "0" nil))
-           )
-         )
-      (t (signal 'invalid-date (list date))))))
-
 (defsubst elmo-call-func (folder func-name &rest args)
   (let* ((spec (if (stringp folder)
                   (elmo-folder-get-spec folder)
@@ -198,6 +85,14 @@ Understands the following styles:
           spec
           args)))
 
+;; Nemacs's `read' is different.
+(static-if (fboundp 'nemacs-version)
+    (defun elmo-read (obj)
+      (prog1 (read obj)
+       (if (bufferp obj)
+           (or (bobp) (forward-char -1)))))
+  (defalias 'elmo-read 'read))
+
 (defmacro elmo-set-work-buf (&rest body)
   "Execute BODY on work buffer. Work buffer remains."
   (` (save-excursion
@@ -287,42 +182,45 @@ File content is encoded with MIME-CHARSET."
       (utf7-encode-string string 'imap)
     string))
 
-(defun elmo-network-get-spec (folder default-server default-port default-tls)
-  (let (server port tls)
-    (if (string-match "\\(@[^@:/!]+\\)?\\(:[0-9]+\\)?\\(!*\\)$" folder)
-       (progn
-         (if (match-beginning 1)
-             (setq server (elmo-match-substring 1 folder 1))
-           (setq server default-server))
-         (if (match-beginning 2)
-             (setq port
-                   (string-to-int (elmo-match-substring 2 folder 1)))
-           (setq port default-port))
-         (setq tls (elmo-match-string 3 folder))
-         (if (and (match-beginning 3)
-                  (> (length tls) 0))
-             (setq tls (if (= 2 (length tls)) 'starttls
-                         (string= tls "!")))
-           (setq tls default-tls))
-         (setq folder (substring folder 0 (match-beginning 0))))
-      (setq server default-server
-           port   default-port
-           tls    default-tls))
-    (cons folder (list server port tls))))
+(defun elmo-get-network-stream-type (stream-type stream-type-alist)
+  (catch 'found
+    (while stream-type-alist
+      (if (eq (nth 1 (car stream-type-alist)) stream-type)
+         (throw 'found (car stream-type-alist)))
+      (setq stream-type-alist (cdr stream-type-alist)))))
+
+(defun elmo-network-get-spec (folder server port stream-type stream-type-alist)
+  (setq stream-type (elmo-get-network-stream-type
+                    stream-type stream-type-alist))
+  (when (string-match "\\(@[^@:/!]+\\)?\\(:[0-9]+\\)?\\(!.*\\)?$" folder)
+    (if (match-beginning 1)
+       (setq server (elmo-match-substring 1 folder 1)))
+    (if (match-beginning 2)
+       (setq port (string-to-int (elmo-match-substring 2 folder 1))))
+    (if (match-beginning 3)
+       (setq stream-type (assoc (elmo-match-string 3 folder)
+                                stream-type-alist)))
+    (setq folder (substring folder 0 (match-beginning 0))))
+  (cons folder (list server port stream-type)))
 
 (defun elmo-imap4-get-spec (folder)
-  (let ((default-user    elmo-default-imap4-user)
-       (default-server  elmo-default-imap4-server)
-       (default-port    elmo-default-imap4-port)
-       (default-tls     elmo-default-imap4-ssl)
+  (let ((default-user        elmo-default-imap4-user)
+       (default-server      elmo-default-imap4-server)
+       (default-port        elmo-default-imap4-port)
+       (default-stream-type elmo-default-imap4-stream-type)
+       (stream-type-alist elmo-network-stream-type-alist)
        spec mailbox user auth)
     (when (string-match "\\(.*\\)@\\(.*\\)" default-server)
       ;; case: default-imap4-server is specified like
       ;; "hoge%imap.server@gateway".
       (setq default-user (elmo-match-string 1 default-server))
       (setq default-server (elmo-match-string 2 default-server)))
+    (if elmo-imap4-stream-type-alist
+       (setq stream-type-alist
+             (append elmo-imap4-stream-type-alist stream-type-alist)))
     (setq spec (elmo-network-get-spec
-               folder default-server default-port default-tls))
+               folder default-server default-port default-stream-type
+               stream-type-alist))
     (setq folder (car spec))
     (when (string-match
           "^\\(%\\)\\([^:@!]*\\)\\(:[^/!]+\\)?\\(/[^/:@!]+\\)?"
@@ -335,7 +233,7 @@ File content is encoded with MIME-CHARSET."
                       (elmo-match-substring 3 folder 1)
                     default-user))
        (setq auth (if (match-beginning 4)
-                      (elmo-match-substring 4 folder 1)
+                      (intern (elmo-match-substring 4 folder 1))
                     elmo-default-imap4-authenticate-type))
        (append (list 'imap4
                      (elmo-imap4-encode-folder-string mailbox)
@@ -357,11 +255,11 @@ File content is encoded with MIME-CHARSET."
 (defsubst elmo-imap4-spec-port (spec)
   (nth 5 spec))
 
-(defsubst elmo-imap4-spec-ssl (spec)
+(defsubst elmo-imap4-spec-stream-type (spec)
   (nth 6 spec))
 
-(defsubst elmo-imap4-spec-folder (spec) ;; obsolete
-  (nth 1 spec))
+(defalias 'elmo-imap4-spec-folder 'elmo-imap4-spec-mailbox)
+(make-obsolete 'elmo-imap4-spec-folder 'elmo-imap4-spec-mailbox)
 
 (defsubst elmo-imap4-connection-get-process (conn)
   (nth 1 conn))
@@ -373,11 +271,16 @@ File content is encoded with MIME-CHARSET."
   (nth 2 conn))
 
 (defun elmo-nntp-get-spec (folder)
-  (let (spec group user)
+  (let ((stream-type-alist elmo-network-stream-type-alist)
+       spec group user)
+    (if elmo-nntp-stream-type-alist
+       (setq stream-type-alist
+             (append elmo-nntp-stream-type-alist stream-type-alist)))
     (setq spec (elmo-network-get-spec folder
                                      elmo-default-nntp-server
                                      elmo-default-nntp-port
-                                     elmo-default-nntp-ssl))
+                                     elmo-default-nntp-stream-type
+                                     stream-type-alist))
     (setq folder (car spec))
     (when (string-match
           "^\\(-\\)\\([^:@!]*\\)\\(:[^/!]+\\)?\\(/[^/:@!]+\\)?"
@@ -407,7 +310,7 @@ File content is encoded with MIME-CHARSET."
 (defsubst elmo-nntp-spec-port (spec)
   (nth 4 spec))
 
-(defsubst elmo-nntp-spec-ssl (spec)
+(defsubst elmo-nntp-spec-stream-type (spec)
   (nth 5 spec))
 
 (defun elmo-localdir-get-spec (folder)
@@ -494,11 +397,16 @@ File content is encoded with MIME-CHARSET."
       (list 'archive fld-name (intern-soft type) prefix))))
 
 (defun elmo-pop3-get-spec (folder)
-  (let (spec user auth)
+  (let ((stream-type-alist elmo-network-stream-type-alist)
+       spec user auth)
+    (if elmo-pop3-stream-type-alist
+       (setq stream-type-alist
+             (append elmo-pop3-stream-type-alist stream-type-alist)))
     (setq spec (elmo-network-get-spec folder
                                      elmo-default-pop3-server
                                      elmo-default-pop3-port
-                                     elmo-default-pop3-ssl))
+                                     elmo-default-pop3-stream-type
+                                     stream-type-alist))
     (setq folder (car spec))
     (when (string-match
           "^\\(&\\)\\([^:/!]*\\)\\(/[^/:@!]+\\)?"
@@ -508,7 +416,7 @@ File content is encoded with MIME-CHARSET."
       (if (eq (length user) 0)
          (setq user elmo-default-pop3-user))
       (setq auth (if (match-beginning 3)
-                    (elmo-match-substring 3 folder 1)
+                    (intern (elmo-match-substring 3 folder 1))
                   elmo-default-pop3-authenticate-type))
       (append (list 'pop3 user auth)
              (cdr spec)))))
@@ -525,7 +433,7 @@ File content is encoded with MIME-CHARSET."
 (defsubst elmo-pop3-spec-port (spec)
   (nth 4 spec))
 
-(defsubst elmo-pop3-spec-ssl (spec)
+(defsubst elmo-pop3-spec-stream-type (spec)
   (nth 5 spec))
 
 (defun elmo-internal-get-spec (folder)
@@ -550,23 +458,13 @@ File content is encoded with MIME-CHARSET."
               ",")))))
 
 (defun elmo-filter-get-spec (folder)
-  (save-match-data
-    (when (string-match
-          "^\\(/\\)\\(.*\\)$"
-          folder)
-      (let ((spec (elmo-match-string 2 folder))
-           filter)
-       (when (string-match "\\([^/]+\\)/" spec)
-         (setq filter (elmo-match-string 1 spec))
-         (setq spec (substring spec (match-end 0))))
-       (cond
-        ((string-match "^\\(last\\|first\\):\\(.*\\)$" filter) ; partial
-         (setq filter (vector 'partial
-                              (elmo-match-string 1 filter)
-                              (elmo-match-string 2 filter))))
-        (t
-         (setq filter (elmo-parse-search-condition filter))))
-       (list 'filter filter spec)))))
+  (when (string-match "^\\(/\\)\\(.*\\)$" folder)
+    (let ((folder (elmo-match-string 2 folder))
+         pair)
+      (setq pair (elmo-parse-search-condition folder))
+      (if (string-match "^ */\\(.*\\)$" (cdr pair))
+         (list 'filter (car pair) (elmo-match-string 1 (cdr pair)))
+       (error "Folder syntax error `%s'" folder)))))
 
 (defun elmo-pipe-get-spec (folder)
   (when (string-match "^\\(|\\)\\([^|]*\\)|\\(.*\\)$" folder)
@@ -578,50 +476,150 @@ File content is encoded with MIME-CHARSET."
   "return spec of folder"
   (let ((type (elmo-folder-get-type folder)))
     (if type
-       (funcall (intern (concat "elmo-" (symbol-name type) "-get-spec"))
-                folder)
+       (save-match-data
+         (funcall (intern (concat "elmo-" (symbol-name type) "-get-spec"))
+                  folder))
       (error "%s is not supported folder type" folder))))
 
+;;; Search Condition
+(defun elmo-read-search-condition (default)
+  "Read search condition string interactively"
+  (elmo-read-search-condition-internal "Search by" default))
+
+(defun elmo-read-search-condition-internal (prompt default)
+  (let* ((completion-ignore-case t)
+        (field (completing-read
+                (format "%s (%s): " prompt default)
+                (mapcar 'list
+                        (append '("AND" "OR"
+                                  "Last" "First"
+                                  "From" "Subject" "To" "Cc" "Body"
+                                  "Since" "Before" "ToCc"
+                                  "!From" "!Subject" "!To" "!Cc" "!Body"
+                                  "!Since" "!Before" "!ToCc")
+                                elmo-msgdb-extra-fields)))))
+    (setq field (if (string= field "")
+                   (setq field default)
+                 field))
+    (cond
+     ((or (string= field "AND") (string= field "OR"))
+      (concat "("
+             (elmo-read-search-condition-internal
+              (concat field "(1) Search by") default)
+             (if (string= field "AND") "&" "|")
+             (elmo-read-search-condition-internal
+              (concat field "(2) Search by") default)
+             ")"))
+     ((string-match "Since\\|Before" field)
+      (concat
+       (downcase field) ":"
+       (completing-read (format "Value for '%s': " field)
+                       (mapcar (function
+                                (lambda (x)
+                                  (list (format "%s" (car x)))))
+                               elmo-date-descriptions))))
+     (t
+      (concat
+       (downcase field) ":"
+       (prin1-to-string
+       (read-from-minibuffer
+        (format "Value for '%s': " field))))))))
+
+(defsubst elmo-condition-parse-error ()
+  (error "Syntax error in '%s'" (buffer-string)))
+
 (defun elmo-parse-search-condition (condition)
-  (let ((terms (split-string condition "|")) ; split by OR
-       term ret-val)
-    (while terms
-      (setq term (car terms))
-      (cond
-       ((string-match "^\\([a-zA-Z\\-]+\\)=\\(.*\\)$" term)
-       (if (save-match-data
-             (string-match "tocc" (elmo-match-string 1 term))) ;; syntax sugar
-           (setq ret-val (nconc
-                          ret-val
-                          (list (vector 'match "to"
-                                        (elmo-match-string 2 term))
-                                (vector 'match "cc"
-                                        (elmo-match-string 2 term)))))
-         (setq ret-val (cons (vector 'match
-                                     (elmo-match-string 1 term)
-                                     (elmo-match-string 2 term))
-                             ret-val))))
-       ((string-match "^\\([a-zA-Z\\-]+\\)!=\\(.*\\)$" term)
-       (if (save-match-data
-             (string-match "tocc" (elmo-match-string 1 term))) ;; syntax sugar
-           (setq ret-val (nconc
-                          ret-val
-                          (list (vector 'unmatch "to"
-                                        (elmo-match-string 2 term))
-                                (vector 'unmatch "cc"
-                                        (elmo-match-string 2 term)))))
-         (setq ret-val (cons (vector 'unmatch
-                                     (elmo-match-string 1 term)
-                                     (elmo-match-string 2 term))
-                             ret-val))))
-       ((string-match "^\\(since\\|before\\):\\(.*\\)$" term)
-       (setq ret-val (cons (vector 'date
-                                   (elmo-match-string 1 term)
-                                   (elmo-match-string 2 term))
-                           ret-val))))
-      (setq terms (cdr terms)))
-    ret-val))
+  "Parse CONDITION.
+Return value is a cons cell of (STRUCTURE . REST)"
+  (with-temp-buffer
+    (insert condition)
+    (goto-char (point-min))
+    (cons (elmo-condition-parse) (buffer-substring (point) (point-max)))))
+
+;; condition    ::= or-expr
+(defun elmo-condition-parse ()
+  (or (elmo-condition-parse-or-expr)
+      (elmo-condition-parse-error)))
+
+;; or-expr      ::= and-expr /
+;;                 and-expr "|" or-expr
+(defun elmo-condition-parse-or-expr ()
+  (let ((left (elmo-condition-parse-and-expr)))
+    (if (looking-at "| *")
+       (progn
+         (goto-char (match-end 0))
+         (list 'or left (elmo-condition-parse-or-expr)))
+      left)))
+
+;; and-expr     ::= primitive /
+;;                  primitive "&" and-expr
+(defun elmo-condition-parse-and-expr ()
+  (let ((left (elmo-condition-parse-primitive)))
+    (if (looking-at "& *")
+       (progn
+         (goto-char (match-end 0))
+         (list 'and left (elmo-condition-parse-and-expr)))
+      left)))
+
+;; primitive    ::= "(" expr ")" /
+;;                  ["!"] search-key SPACE* ":" SPACE* search-value
+(defun elmo-condition-parse-primitive ()
+  (cond 
+   ((looking-at "( *")
+    (goto-char (match-end 0))
+    (prog1 (elmo-condition-parse)
+      (unless (looking-at ") *")
+       (elmo-condition-parse-error))
+      (goto-char (match-end 0))))
+;; search-key   ::= [A-Za-z-]+
+;;                 ;; "since" / "before" / "last" / "first" /
+;;                 ;; "body" / field-name
+   ((looking-at "\\(!\\)? *\\([A-Za-z-]+\\) *: *")
+    (goto-char (match-end 0))
+    (let ((search-key (vector
+                      (if (match-beginning 1) 'unmatch 'match)
+                      (elmo-match-buffer 2)
+                      (elmo-condition-parse-search-value))))
+      ;; syntax sugar.
+      (if (string= (aref search-key 1) "tocc")
+         (if (eq (aref search-key 0) 'match)
+             (list 'or
+                   (vector 'match "to" (aref search-key 2))
+                   (vector 'match "cc" (aref search-key 2)))
+           (list 'and
+                 (vector 'unmatch "to" (aref search-key 2))
+                 (vector 'unmatch "cc" (aref search-key 2))))
+       search-key)))))
+
+;; search-value ::= quoted / time / number / atom
+;; quoted       ::= <elisp string expression>
+;; time         ::= "yesterday" / "lastweek" / "lastmonth" / "lastyear" /
+;;                   number SPACE* "daysago" /
+;;                   number "-" month "-" number  ; ex. 10-May-2000
+;; number       ::= [0-9]+
+;; month        ::= "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
+;;                  "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
+;; atom         ::= ATOM_CHARS*
+;; SPACE        ::= <ascii space character, 0x20>
+;; ATOM_CHARS   ::= <any character except specials>
+;; specials     ::= SPACE / <"> / </> / <)> / <|> / <&>
+;;                  ;; These characters should be quoted.
+(defun elmo-condition-parse-search-value ()
+  (cond
+   ((looking-at "\"")
+    (elmo-read (current-buffer)))
+   ((or (looking-at "yesterday") (looking-at "lastweek")
+       (looking-at "lastmonth") (looking-at "lastyear")
+       (looking-at "[0-9]+ *daysago")
+       (looking-at "[0-9]+-[A-Za-z]+-[0-9]+")
+       (looking-at "[0-9]+")
+       (looking-at "[^/ \")|&]*") ; atom* (except quoted specials).
+       )
+    (prog1 (elmo-match-buffer 0)
+      (goto-char (match-end 0))))
+   (t (error "Syntax error '%s'" (buffer-string)))))
 
+;;;
 (defun elmo-multi-get-real-folder-number (folder number)
   (let* ((spec (elmo-folder-get-spec folder))
         (flds (cdr spec))
@@ -733,6 +731,11 @@ File content is encoded with MIME-CHARSET."
       (kill-buffer tmp-buffer)
       ret-val)))
 
+(defun elmo-passwd-alist-clear ()
+  "Clear password cache."
+  (interactive)
+  (setq elmo-passwd-alist nil))
+  
 (defun elmo-passwd-alist-save ()
   "Save password into file."
   (interactive)
@@ -755,28 +758,34 @@ File content is encoded with MIME-CHARSET."
         (message (format "%s is not writable." filename)))
       (kill-buffer tmp-buffer))))
 
-(defun elmo-get-passwd (user-at-host)
+(defun elmo-get-passwd (key)
   "Get password from password pool."
-  (let (data pass)
+  (let (pair pass)
     (if (not elmo-passwd-alist)
        (setq elmo-passwd-alist (elmo-passwd-alist-load)))
-    (setq data (assoc user-at-host elmo-passwd-alist))
-    (if data
-       (elmo-base64-decode-string (cdr data))
+    (setq pair (assoc key elmo-passwd-alist))
+    (if pair
+       (elmo-base64-decode-string (cdr pair))
       (setq pass (elmo-read-passwd (format "Password for %s: "
-                                          user-at-host) t))
+                                          key) t))
       (setq elmo-passwd-alist
            (append elmo-passwd-alist
-                   (list (cons user-at-host
+                   (list (cons key
                                (elmo-base64-encode-string pass)))))
+      (if elmo-passwd-life-time
+         (run-with-timer elmo-passwd-life-time nil
+                         (` (lambda () (elmo-remove-passwd (, key))))))
       pass)))
 
-(defun elmo-remove-passwd (user-at-host)
+(defun elmo-remove-passwd (key)
   "Remove password from password pool (for failure)."
-  (setq elmo-passwd-alist
-       (delete (assoc user-at-host elmo-passwd-alist)
-               elmo-passwd-alist
-               )))
+  (let (pass-cons)
+    (if (setq pass-cons (assoc key elmo-passwd-alist))
+       (progn
+         (unwind-protect
+             (fillarray (cdr pass-cons) 0))
+         (setq elmo-passwd-alist
+               (delete pass-cons elmo-passwd-alist))))))
 
 (defmacro elmo-read-char-exclusive ()
   (cond ((featurep 'xemacs)
@@ -992,7 +1001,7 @@ Otherwise treat \\ in NEWTEXT string as special:
          (t
           ;; delete plugged one port of server
           (setq alist
-                (delete (assoc (cons server port) alist)) alist)))
+                (delete (assoc (cons server port) alist) alist))))
     alist))
 
 (defun elmo-disk-usage (path)
@@ -1013,7 +1022,7 @@ Otherwise treat \\ in NEWTEXT string as special:
          (float (nth 7 file-attr))))))
 
 (defun elmo-get-last-accessed-time (path &optional dir)
-  "Returns last accessed time."
+  "Return the last accessed time of PATH."
   (let ((last-accessed (nth 4 (file-attributes (or (and dir
                                                        (expand-file-name
                                                         path dir))
@@ -1024,7 +1033,7 @@ Otherwise treat \\ in NEWTEXT string as special:
       0)))
 
 (defun elmo-get-last-modification-time (path &optional dir)
-  "Returns last accessed time."
+  "Return the last accessed time of PATH."
   (let ((last-modified (nth 5 (file-attributes (or (and dir
                                                        (expand-file-name
                                                         path dir))
@@ -1033,7 +1042,7 @@ Otherwise treat \\ in NEWTEXT string as special:
                              (float 65536)) (nth 1 last-modified)))))
 
 (defun elmo-make-directory (path)
-  "create directory recursively."
+  "Create directory recursively."
   (let ((parent (directory-file-name (file-name-directory path))))
     (if (null (file-directory-p parent))
        (elmo-make-directory parent))
@@ -1043,7 +1052,7 @@ Otherwise treat \\ in NEWTEXT string as special:
       )))
 
 (defun elmo-delete-directory (path &optional no-hierarchy)
-  "delete directory recursively."
+  "Delete directory recursively."
   (let ((dirent (directory-files path))
        relpath abspath hierarchy)
     (while dirent
@@ -1180,12 +1189,12 @@ Otherwise treat \\ in NEWTEXT string as special:
   (cond ((eq (elmo-folder-get-type folder1) 'imap4)
         (let ((spec1 (elmo-folder-get-spec folder1))
               (spec2 (elmo-folder-get-spec folder2)))
-          (and (elmo-imap4-identical-name-space-p
-                (nth 1 spec1) (nth 1 spec2))
-               (string= (elmo-imap4-spec-hostname spec1)
-                        (elmo-imap4-spec-hostname spec2))    ; hostname
-               (string= (elmo-imap4-spec-username spec1)
-                        (elmo-imap4-spec-username spec2))))) ; username
+          (and ;(elmo-imap4-identical-name-space-p ;; No use.
+               ; (nth 1 spec1) (nth 1 spec2))
+           (string= (elmo-imap4-spec-hostname spec1)
+                    (elmo-imap4-spec-hostname spec2))    ; hostname
+           (string= (elmo-imap4-spec-username spec1)
+                    (elmo-imap4-spec-username spec2))))) ; username
        (t
         (elmo-folder-direct-copy-p folder1 folder2))))
 
@@ -1213,85 +1222,94 @@ Otherwise treat \\ in NEWTEXT string as special:
 (defmacro elmo-filter-value (filter)
   (` (aref (, filter) 2)))
 
-(defsubst elmo-buffer-field-condition-match (condition)
-  (let (term)
-    (catch 'done
-      (while condition
-       (goto-char (point-min))
-       (setq term (car condition))
-       (cond
-        ((and (eq (elmo-filter-type term) 'date)
-              (string= (elmo-filter-key term) "since"))
-         (let ((date (elmo-date-get-datevec (elmo-filter-value term))))
-           (if (string<
-                (timezone-make-sortable-date (aref date 0)
-                                             (aref date 1)
-                                             (aref date 2)
-                                             (timezone-make-time-string
-                                              (aref date 3)
-                                              (aref date 4)
-                                              (aref date 5)))
-                (timezone-make-date-sortable (std11-field-body "date")))
-               (throw 'done t))))
-        ((and (eq (elmo-filter-type term) 'date)
-              (string= (elmo-filter-key term) "before"))
-         (let ((date (elmo-date-get-datevec (elmo-filter-value term))))
-           (if (string<
-                (timezone-make-date-sortable (std11-field-body "date"))
-                (timezone-make-sortable-date (aref date 0)
-                                             (aref date 1)
-                                             (aref date 2)
-                                             (timezone-make-time-string
-                                              (aref date 3)
-                                              (aref date 4)
-                                              (aref date 5))))
-               (throw 'done t))))
-        ((eq (elmo-filter-type term) 'match)
-         (if (string= "body" (elmo-filter-key term))
-             (progn
-               (re-search-forward "^$" nil t)     ; goto body
-               (if (search-forward (elmo-filter-value term) nil t)
-                   (throw 'done t)))
-           (let ((fval (eword-decode-string
-                        (or (std11-field-body (elmo-filter-key term)) ""))))
-             (if (and fval (string-match (elmo-filter-value term)
-                                         fval))
-                 (throw 'done t)))))
-        ((eq (elmo-filter-type term) 'unmatch)
-         (if (string= "body" (elmo-filter-key term))
-             (progn
-               (re-search-forward "^$" nil t)     ; goto body
-               (if (not (search-forward (elmo-filter-value term) nil t))
-                   (throw 'done t)))
-           (let ((fval (eword-decode-string
-                        (or (std11-field-body (elmo-filter-key term)) ""))))
-             (if fval
-                 (if (not (string-match (elmo-filter-value term)
-                                        fval))
-                     (throw 'done t))
-               (throw 'done t)))))) ; OK?
-       (setq condition (cdr condition)))
-      (throw 'done nil))))
-
-(defsubst elmo-file-field-condition-match (file condition)
+(defsubst elmo-buffer-field-primitive-condition-match (condition
+                                                      number
+                                                      number-list)
+  (let (result)
+    (goto-char (point-min))
+    (cond
+     ((string= (elmo-filter-key condition) "last")
+      (setq result (<= (length (memq number number-list))
+                      (string-to-int (elmo-filter-value condition)))))
+     ((string= (elmo-filter-key condition) "first")
+      (setq result (< (- (length number-list)
+                        (length (memq number number-list)))
+                     (string-to-int (elmo-filter-value condition)))))
+     ((string= (elmo-filter-key condition) "since")
+      (let ((date (elmo-date-get-datevec (elmo-filter-value condition))))
+       (setq result
+             (string<
+              (timezone-make-sortable-date (aref date 0)
+                                           (aref date 1)
+                                           (aref date 2)
+                                           (timezone-make-time-string
+                                            (aref date 3)
+                                            (aref date 4)
+                                            (aref date 5)))
+              (timezone-make-date-sortable (std11-field-body "date"))))))
+     ((string= (elmo-filter-key condition) "before")
+      (let ((date (elmo-date-get-datevec (elmo-filter-value condition))))
+       (setq result
+             (string<
+              (timezone-make-date-sortable (std11-field-body "date"))
+              (timezone-make-sortable-date (aref date 0)
+                                           (aref date 1)
+                                           (aref date 2)
+                                           (timezone-make-time-string
+                                            (aref date 3)
+                                            (aref date 4)
+                                            (aref date 5)))))))
+     ((string= (elmo-filter-key condition) "body")
+      (and (re-search-forward "^$" nil t)         ; goto body
+          (setq result (search-forward (elmo-filter-value condition)
+                                       nil t))))
+     (t
+      (let ((fval (std11-field-body (elmo-filter-key condition))))
+       (if (eq (length fval) 0) (setq fval nil))
+       (if fval (setq fval (eword-decode-string fval)))
+       (setq result (and fval (string-match
+                               (elmo-filter-value condition) fval))))))
+    (if (eq (elmo-filter-type condition) 'unmatch)
+       (setq result (not result)))
+    result))
+
+(defun elmo-condition-find-key-internal (condition key)
+  (cond
+   ((vectorp condition)
+    (if (string= (elmo-filter-key condition) key)
+       (throw 'found t)))
+   ((or (eq (car condition) 'and)
+       (eq (car condition) 'or))
+    (elmo-condition-find-key-internal (nth 1 condition) key)
+    (elmo-condition-find-key-internal (nth 2 condition) key))))
+
+(defun elmo-condition-find-key (condition key)
+  (catch 'found
+    (elmo-condition-find-key-internal condition key)))
+
+(defun elmo-buffer-field-condition-match (condition number number-list)
+  (cond
+   ((vectorp condition)
+    (elmo-buffer-field-primitive-condition-match
+     condition number number-list))
+   ((eq (car condition) 'and)
+    (and (elmo-buffer-field-condition-match
+         (nth 1 condition) number number-list)
+        (elmo-buffer-field-condition-match
+         (nth 2 condition) number number-list)))
+   ((eq (car condition) 'or)
+    (or (elmo-buffer-field-condition-match
+        (nth 1 condition) number number-list)
+       (elmo-buffer-field-condition-match
+        (nth 2 condition) number number-list)))))
+
+(defsubst elmo-file-field-condition-match (file condition number number-list)
   (elmo-set-work-buf
-   (as-binary-input-file
-    (insert-file-contents file))
+   (as-binary-input-file (insert-file-contents file))
    (elmo-set-buffer-multibyte default-enable-multibyte-characters)
+   ;; Should consider charset?
    (decode-mime-charset-region (point-min)(point-max) elmo-mime-charset)
-   (elmo-buffer-field-condition-match condition)))
-
-(defun elmo-cross-device-link-error-p (err)
-  (let ((errobj err)
-       cur)
-    (catch 'done
-      (while errobj
-       (if (and (stringp (setq cur (car errobj)))
-                (or (string-match "cross-device" cur)
-                    (string-match "operation not supported" cur)))
-           (throw 'done t))
-       (setq errobj (cdr errobj)))
-      nil)))
+   (elmo-buffer-field-condition-match condition number number-list)))
 
 (defmacro elmo-get-hash-val (string hashtable)
   (let ((sym (list 'intern-soft string hashtable)))
@@ -1301,9 +1319,16 @@ Otherwise treat \\ in NEWTEXT string as special:
 (defmacro elmo-set-hash-val (string value hashtable)
   (list 'set (list 'intern string hashtable) value))
 
+(defmacro elmo-clear-hash-val (string hashtable)
+  (static-if (fboundp 'unintern)
+      (list 'unintern string hashtable)
+    (list 'makunbound (list 'intern string hashtable))))
+
 ;; Make a hash table (default and minimum size is 1024).
 (defun elmo-make-hash (&optional hashsize)
-  (make-vector (if hashsize (max (elmo-create-hash-size hashsize) 1024) 1024) 0))
+  (make-vector
+   (if hashsize (max (min (elmo-create-hash-size hashsize)
+                         elmo-hash-maximum-size) 1024) 1024) 0))
 
 (defsubst elmo-mime-string (string)
   "Normalize MIME encoded string."
@@ -1406,21 +1431,20 @@ Otherwise treat \\ in NEWTEXT string as special:
 (defsubst elmo-copy-file (src dst)
   (condition-case err
       (elmo-add-name-to-file src dst t)
-    (error (if (elmo-cross-device-link-error-p err)
-              (copy-file src dst t)
-            (error "copy file failed")))))
+    (error (copy-file src dst t)
+          (error "copy file failed"))))
 
-(defmacro elmo-buffer-exists-p (buffer)
-  (` (when (, buffer)
-       (funcall (if (stringp (, buffer)) 'get-buffer 'buffer-name)
-               (, buffer)))))
+(defsubst elmo-buffer-exists-p (buffer)
+  (if (bufferp buffer)
+      (buffer-live-p buffer)
+    (get-buffer buffer)))
 
-(defmacro elmo-kill-buffer (buffer)
-  (` (when (elmo-buffer-exists-p (, buffer))
-       (kill-buffer (, buffer)))))
+(defsubst elmo-kill-buffer (buffer)
+  (when (elmo-buffer-exists-p buffer)
+    (kill-buffer buffer)))
 
 (defun elmo-delete-if (pred lst)
-  "Returns new list contains items which don't satisfy PRED in LST."
+  "Return new list contains items which don't satisfy PRED in LST."
   (let (result)
     (while lst
       (unless (funcall pred (car lst))
@@ -1439,7 +1463,7 @@ the value of `foo'."
   list2)
 
 (defun elmo-list-member (list1 list2)
-  "If any element of list1 is member of list2, returns t."
+  "If any element of list1 is member of list2, return t."
   (catch 'done
     (while list1
       (if (member (car list1) list2)
@@ -1473,14 +1497,29 @@ the value of `foo'."
        (setq first nil))
       (princ err-mes stream))))
 
-(if (fboundp 'lprogress-display)
-    (defalias 'elmo-display-progress 'lprogress-display)
-  (defun elmo-display-progress (label format &optional value &rest args)
-    "Print a progress message."
-    (if (and (null format) (null args))
-       (message nil)
-      (apply (function message) (concat format " %d%%")
-            (nconc args (list value))))))
+(if (fboundp 'define-error)
+    (defalias 'elmo-define-error 'define-error)
+  (defun elmo-define-error (error doc &optional parents)
+    (or parents
+       (setq parents 'error))
+    (let ((conds (get parents 'error-conditions)))
+      (or conds
+         (error "Not an error symbol: %s" error))
+      (setplist error
+               (list 'error-message doc
+                     'error-conditions (cons error conds))))))
+
+(cond ((fboundp 'lprogress-display)
+       (defalias 'elmo-display-progress 'lprogress-display))
+      ((fboundp 'progress-feedback-with-label)
+       (defalias 'elmo-display-progress 'progress-feedback-with-label))
+      (t
+       (defun elmo-display-progress (label format &optional value &rest args)
+        "Print a progress message."
+        (if (and (null format) (null args))
+            (message nil)
+          (apply (function message) (concat format " %d%%")
+                 (nconc args (list value)))))))
 
 (defun elmo-time-expire (before-time diff-time)
   (let* ((current (current-time))
@@ -1493,33 +1532,6 @@ the value of `foo'."
     (and (eq (car diff) 0)
         (< diff-time (nth 1 diff)))))
 
-(defun elmo-open-network-stream (name buffer host service ssl)
-  (let ((auto-plugged (and elmo-auto-change-plugged
-                          (> elmo-auto-change-plugged 0)))
-       process)
-    (if (eq ssl 'starttls)
-       (require 'starttls)
-      (if ssl (require 'ssl)))
-    (condition-case err
-       (let (process-connection-type)
-         (setq process
-               (if (eq ssl 'starttls)
-                   (starttls-open-stream name buffer host service)
-                 (if ssl
-                     (open-ssl-stream name buffer host service)
-                   (open-network-stream name buffer host service)))))
-      (error
-       (when auto-plugged
-        (elmo-set-plugged nil host service (current-time))
-        (message "Auto plugged off at %s:%d" host service)
-        (sit-for 1))
-       (signal (car err) (cdr err))))
-    (when process
-      (process-kill-without-query process)
-      (when auto-plugged
-       (elmo-set-plugged t host service))
-      process)))
-
 (if (fboundp 'std11-fetch-field)
     (defalias 'elmo-field-body 'std11-fetch-field) ;;no narrow-to-region
   (defalias 'elmo-field-body 'std11-field-body))
@@ -1538,7 +1550,7 @@ But if optional argument AUTO is non-nil, DEFAULT is returned."
     (y-or-n-p prompt)))
 
 (defun elmo-string-member (string slist)
-  "Returns t if STRING is a member of the SLIST."
+  "Return t if STRING is a member of the SLIST."
   (catch 'found
     (while slist
       (if (and (stringp (car slist))
@@ -1607,6 +1619,64 @@ But if optional argument AUTO is non-nil, DEFAULT is returned."
            (throw 'loop a))
        (setq alist (cdr alist))))))
 
-(provide 'elmo-util)
+;;; Number set defined by OKAZAKI Tetsurou <okazaki@be.to>
+;; 
+;; number          ::= [0-9]+
+;; beg             ::= number
+;; end             ::= number
+;; number-range    ::= "(" beg " . " end ")"      ;; cons cell
+;; number-set-elem ::= number / number-range
+;; number-set      ::= "(" *number-set-elem ")"   ;; list
+
+(defun elmo-number-set-member (number number-set)
+  "Return non-nil if NUMBER is an element of NUMBER-SET.
+The value is actuall the tail of SET-LIST whose car contains NUMBER."
+  (or (memq number number-set)
+      (let (found)
+       (while (and number-set (not found))
+         (if (and (consp (car number-set))
+                  (and (<= (car (car number-set)) number)
+                       (<= number (cdr (car number-set)))))
+             (setq found t)
+           (setq number-set (cdr number-set))))
+       number-set)))
+
+(defun elmo-number-set-append-list (number-set list)
+  "Append LIST of numbers to the NUMBER-SET.
+NUMBER-SET is altered."
+  (let ((appended number-set))
+    (while list
+      (setq appended (elmo-number-set-append appended (car list)))
+      (setq list (cdr list)))
+    appended))
+
+(defun elmo-number-set-append (number-set number)
+  "Append NUMBER to the NUMBER-SET.
+NUMBER-SET is altered."
+  (let ((number-set-1 number-set)
+       found elem)
+    (while (and number-set (not found))
+      (setq elem (car number-set))
+      (cond
+       ((and (consp elem)
+            (eq (+ 1 (cdr elem)) number))
+       (setcdr elem number)
+       (setq found t))
+       ((and (integerp elem)
+            (eq (+ 1 elem) number))
+       (setcar number-set (cons elem number))
+       (setq found t))
+       ((or (and (integerp elem) (eq elem number))
+           (and (consp elem)
+                (<= (car elem) number)
+                (<= number (cdr elem))))
+       (setq found t)))
+      (setq number-set (cdr number-set)))
+    (if (not found)
+       (setq number-set-1 (nconc number-set-1 (list number))))
+    number-set-1))
+
+(require 'product)
+(product-provide (provide 'elmo-util) (require 'elmo-version))
 
 ;;; elmo-util.el ends here
index b2f6faf..bc40fec 100644 (file)
   (defun-maybe dynamic-link (a))
   (defun-maybe dynamic-call (a b)))
 
-;; Version info.
-(defconst elmo-version "1.1.2")
-(defconst elmo-appname "ELMO")
-
-(defun elmo-version ()
-  (format "%s/%s" elmo-appname elmo-version))
-
 ;; IMAP4
 (defvar elmo-default-imap4-mailbox "inbox"
   "*Default IMAP4 mailbox.")
 (defvar elmo-default-imap4-server "localhost"
   "*Default IMAP4 server.")
-(defvar elmo-default-imap4-authenticate-type "auth"
-  "*Default Authentication type for IMAP4.") ; "auth" or "login"
+(defvar elmo-default-imap4-authenticate-type 'login
+  "*Default Authentication type for IMAP4.")
 (defvar elmo-default-imap4-user (or (getenv "USER")
                                    (getenv "LOGNAME")
                                    (user-login-name))
-  "*Default username for IMAP4")
+  "*Default username for IMAP4.")
 (defvar elmo-default-imap4-port 143
   "*Default Port number of IMAP.")
-(defvar elmo-default-imap4-ssl nil
-  "*Non-nil forces using SSL by default.")
+(defvar elmo-default-imap4-stream-type nil
+  "*Default stream type for IMAP4.
+Any symbol value of `elmo-network-stream-type-alist'.")
+(defvar elmo-imap4-stream-type-alist nil
+  "*Stream bindings for IMAP4.
+This is taken precedence over `elmo-network-stream-type-alist'.")
 
 ;; POP3
 (defvar elmo-default-pop3-user (or (getenv "USER")
                                   (getenv "LOGNAME")
                                   (user-login-name))
-  "*Default username for POP3")
+  "*Default username for POP3.")
 (defvar elmo-default-pop3-server  "localhost"
   "*Default POP3 server.")
-(defvar elmo-default-pop3-authenticate-type "user"
-  "*Default Authentication type for POP3") ; "apop" or "user"
+(defvar elmo-default-pop3-authenticate-type 'user
+  "*Default Authentication type for POP3.")
 (defvar elmo-default-pop3-port 110
   "*Default POP3 port.")
-(defvar elmo-default-pop3-ssl nil
-  "*Non-nil forces using SSL by default.")
+(defvar elmo-default-pop3-stream-type nil
+  "*Default stream type for POP3.
+Any symbol value of `elmo-network-stream-type-alist'.")
+(defvar elmo-pop3-stream-type-alist nil
+  "*Stream bindings for POP3.
+This is taken precedence over `elmo-network-stream-type-alist'.")
 
 ;; NNTP
 (defvar elmo-default-nntp-server  "localhost"
   "*Default NNTP server.")
 (defvar elmo-default-nntp-user nil
-  "*Default User of NNTP. nil means no user authentication.")
+  "*Default User of NNTP.  nil means no user authentication.")
 (defvar elmo-default-nntp-port 119
-  "*Default Port number of NNTP")
-(defvar elmo-default-nntp-ssl nil
-  "*Non-nil forces using SSL by default.")
-
+  "*Default Port number of NNTP.")
+(defvar elmo-default-nntp-stream-type nil
+  "*Default stream type for NNTP.
+Any symbol value of `elmo-network-stream-type-alist'.")
+(defvar elmo-nntp-stream-type-alist nil
+  "*Stream bindings for NNTP.
+This is taken precedence over `elmo-network-stream-type-alist'.")
+
+;; Local
 (defvar elmo-localdir-folder-path "~/Mail"
   "*Local mail folder path.")
 (defvar elmo-localnews-folder-path "~/News"
 (defvar elmo-maildir-list '("\\+~/Maildir")
   "*All Folders that match this list will be treated as Maildir.
 Each elements are regexp of folder name (This is obsolete).")
+
 (defvar elmo-msgdb-dir "~/.elmo"
   "*ELMO Message Database path.")
 (defvar elmo-passwd-alist-file-name "passwd"
   "*ELMO Password filename.")
+(defvar elmo-passwd-life-time nil
+  "*Duration of ELMO Password in seconds.  nil means infinity.")
 (defvar elmo-warning-threshold 30000
   "*Display warning when the bytes of message exceeds this value.")
 (defvar elmo-msg-appended-hook nil
   "A hook called when message is appended to database.")
 (defvar elmo-msg-deleted-hook nil
-  "A hook called when message is deleted from database")
+  "A hook called when message is deleted from database.")
 (defvar elmo-nntp-post-pre-hook nil
   "A hook called just before the nntp posting.")
 (defvar elmo-lang "ja"
   "Language for displayed messages.")
 
 (defvar elmo-mime-charset 'iso-2022-jp)
-(defvar elmo-search-mime-charset 'iso-2022-jp)
 
 (defvar elmo-msgdb-mark-filename "mark"
   "Mark database.")
@@ -129,12 +137,12 @@ Each elements are regexp of folder name (This is obsolete).")
   "Appended messages...Structure is same as number-alist.
 For disconnected operations.")
 (defvar elmo-msgdb-resume-list-filename "resume"
-  "Resumed messages. For disconnected operations.")
+  "Resumed messages.  For disconnected operations.")
 (defvar elmo-msgdb-lock-list-filename "lock"
   "Locked messages...list of message-id.
 For disconnected operations.")
 (defvar elmo-msgdb-global-mark-filename "global-mark"
-  "Alist of global mark .")
+  "Alist of global mark.")
 (defvar elmo-lost+found-folder "+lost+found"
   "Lost and found.")
 (defvar elmo-crosspost-alist-filename "crosspost-alist"
@@ -144,8 +152,8 @@ For disconnected operations.")
   "Non-nil forces to get unread message information on server.")
 
 (defvar elmo-imap4-disuse-server-flag-mailbox-regexp "^#mh" ; UW imapd
-  "If mailbox name matches this value, flags on server are not used except
- \Delete flag.")
+  "Regexp to match IMAP4 mailbox names whose message flags on server should be ignored.
+(Except `\\Deleted' flag).")
 
 (defvar elmo-msgdb-extra-fields nil
   "Extra fields for msgdb.")
@@ -171,12 +179,12 @@ For disconnected operations.")
   "*Use mofidied UTF-7 (rfc2060) encoding for IMAP4 folder name.")
 
 (defvar elmo-auto-change-plugged 600
-  "*Time to expire change plugged state automatically,
-as the number of seconds. Don't change plugged state automatically if nil.")
+  "*Time to expire change plugged state automatically, as the number of seconds.
+Don't change plugged state automatically if nil.")
 
 (defvar elmo-plugged-condition 'one
   "*The condition for `elmo-plugged' becomes on.
-If `all', when all port is on. If `one', when even one port is on.
+If `all', when all ports are on.  If `one', when even one port is on.
 If `independent', independent port plugged.
 If function, return value of function.")
 
@@ -207,7 +215,7 @@ If function, return value of function.")
 
 ;;; User variables for elmo-archive.
 (defvar elmo-archive-default-type 'zip
-  "*Default archiver type. The value must be a symbol.")
+  "*Default archiver type.  The value must be a symbol.")
 
 ;; database dynamic linking
 (defvar elmo-database-dl-module
@@ -233,7 +241,7 @@ If function, return value of function.")
                              (fboundp 'open-database)))
 
 (defvar elmo-date-match (not (boundp 'nemacs-version))
-  "Date match is available or not")
+  "Date match is available or not.")
 
 (defconst elmo-spec-alist
   '((?%  . imap4)
@@ -248,6 +256,18 @@ If function, return value of function.")
     (?|  . pipe)
     (?.  . maildir)))
 
+(defvar elmo-network-stream-type-alist
+  '(("!"      ssl       ssl      open-ssl-stream)
+    ("!!"     starttls  starttls starttls-open-stream)
+    ("!socks" socks     socks    socks-open-network-stream))
+  "An alist of (SPEC-STRING SYMBOL FEATURE OPEN-STREAM-FUNCTION).
+SPEC-STRING is a string for stream-type spec (it must start with '!').
+SYMBOL is a symbol which indicates the name of the stream type.
+SYMBOL should be identical in this alist.
+FEATURE is a symbol of the feature for OPEN-STREAM-FUNCTION.
+OPEN-STREAM-FUNCTION is a function to open network stream.
+Arguments for this function are NAME, BUFFER, HOST and SERVICE.")
+
 (defvar elmo-debug nil)
 (defconst mmelmo-entity-buffer-name "*MMELMO-BUFFER*")
 
@@ -261,7 +281,7 @@ If function, return value of function.")
   "Default expiration method.")
 
 (defvar elmo-cache-expire-default-size 30000
-  "Cache expiration disk size (Kilo bytes). This must be float value.")
+  "Cache expiration disk size (Kilo bytes).  This must be float value.")
 
 (defvar elmo-cache-expire-default-age 50
   "Cache expiration age (days).")
@@ -316,14 +336,31 @@ If function, return value of function.")
 (defvar elmo-localdir-lockfile-list nil)
 
 (defvar elmo-nntp-max-number-precedes-list-active nil
-  "If non-nil, max number of the msgdb is set as the max number of
-'list active' (needed for inn 2.3 or later?). ")
+  "Non-nil means max number of msgdb is set as the max number of `list active'.
+(Needed for inn 2.3 or later?).")
+
+(defvar elmo-use-killed-list t
+  "If non-nil, deleted messages are saved as `killed'
+and do not appear again.")
 
 (defvar elmo-pop3-send-command-synchronously nil
   "If non-nil, commands are send synchronously.
 If server doesn't accept asynchronous commands, this variable should be
 set as non-nil.")
 
-(provide 'elmo-vars)
+(defvar elmo-hash-maximum-size 4096
+  "Maximum size of hash table.")
+
+(defvar elmo-use-decoded-cache (featurep 'xemacs)
+  "Use cache of decoded mime charset string.")
+
+(defvar elmo-use-overview-hashtb t
+  "Use hash table of overview.")
+
+(defvar elmo-display-progress-threshold 20
+  "*Displaying progress gauge if number of messages are more than this value.")
+
+(require 'product)
+(product-provide (provide 'elmo-vars) (require 'elmo-version))
 
 ;;; elmo-vars.el ends here
diff --git a/elmo/elmo-version.el b/elmo/elmo-version.el
new file mode 100644 (file)
index 0000000..ad0967e
--- /dev/null
@@ -0,0 +1,58 @@
+;;; elmo-version.el -- Version information for ELMO.
+
+;; Copyright 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 'product)
+(provide 'elmo-version)
+
+(product-provide 'elmo-version
+  (product-define "ELMO" nil '(2 3 90)))
+
+;; set version-string
+(if (fboundp 'product-version-as-string)
+    (product-version-as-string 'elmo-version)
+  (product-string-1 'elmo-version))
+
+(defun elmo-version ()
+  "Return ELMO version."
+  (product-string-1 'elmo-version))
+
+
+;; for backward compatibility
+(defconst elmo-appname (product-name (product-find 'elmo-version)))
+(make-obsolete-variable
+ 'elmo-appname
+ "use (product-name (product-find 'elmo-version)) insteaed.")
+
+(defconst elmo-version (product-version-string (product-find 'elmo-version)))
+(make-obsolete-variable
+ 'elmo-version
+ "use (product-version-string (product-find 'elmo-version)) instead.")
+
+;;; elmo-version.el ends here
index 62545bc..31a82ee 100644 (file)
@@ -34,7 +34,8 @@
 (require 'elmo-cache)
 (require 'elmo-util)
 (require 'elmo-dop)
-(provide 'elmo2)
+(require 'product)
+(product-provide (provide 'elmo2) (require 'elmo-version))
 
 (eval-when-compile
   (require 'elmo-localdir)
        (featurep 'berkeley-db))
     (require 'elmo-database))
 
+(elmo-define-error 'elmo-error "Error" 'error)
+(elmo-define-error 'elmo-open-error "Cannot open" 'elmo-error)
+(elmo-define-error 'elmo-authenticate-error "Login failed" 'elmo-open-error)
+(elmo-define-error 'elmo-imap4-bye-error "IMAP4 BYE response" 'elmo-open-error)
+
 (defun elmo-quit ()
   (interactive)
-  (if (featurep 'elmo-imap4)
-      (elmo-imap4-flush-connection))
-  (if (featurep 'elmo-nntp)
-      (elmo-nntp-flush-connection))
-  (if (featurep 'elmo-pop3)
-      (elmo-pop3-flush-connection))
+  (if (featurep 'elmo-net)
+      (elmo-network-clear-session-cache))
   (if (get-buffer elmo-work-buf-name)
-      (kill-buffer elmo-work-buf-name))
-  )
+      (kill-buffer elmo-work-buf-name)))
 
 (defun elmo-cleanup-variables ()
   (setq elmo-folder-info-hashtb nil
@@ -85,7 +86,6 @@
     (elmo-dop-list-folder folder)))
 
 ;;  list elmo-list-folders (folder)
-
 (defun elmo-list-folders (folder &optional hierarchy)
   (elmo-call-func folder "list-folders" hierarchy))
 
@@ -208,9 +208,11 @@ without cacheing."
 (defun elmo-read-msg (folder msg outbuf msgdb &optional force-reload)
   "Read message into outbuf."
   (let ((inhibit-read-only t))
-    (if (not (elmo-use-cache-p folder msg))
-       (elmo-read-msg-no-cache folder msg outbuf)
-      (elmo-read-msg-with-cache folder msg outbuf msgdb force-reload))))
+    ;;Only use elmo-read-msg-with-cache, because if folder is network and
+    ;;elmo-use-cache-p is nil, cannot read important msg. (by muse)
+    ;;(if (not (elmo-use-cache-p folder msg))
+    ;;  (elmo-read-msg-no-cache folder msg outbuf)
+    (elmo-read-msg-with-cache folder msg outbuf msgdb force-reload)))
 
 (defun elmo-read-msg-with-cache (folder msg outbuf msgdb
                                        &optional force-reload)
@@ -234,7 +236,9 @@ without cacheing."
       (if (setq ret-val (elmo-call-func (car real-fld-num)
                                        "read-msg"
                                        (cdr real-fld-num) outbuf))
-         (if (not (elmo-local-file-p folder msg))
+         (if (and message-id
+                  (not (elmo-local-file-p folder msg))
+                  (elmo-use-cache-p folder msg))
              (elmo-cache-save message-id
                               (elmo-string-partial-p ret-val)
                               folder msg)))
@@ -245,7 +249,7 @@ without cacheing."
         (loc-alist (if msgdb
                        (elmo-msgdb-get-location msgdb)
                      (elmo-msgdb-location-load
-                      (elmo-msgdb-expand-path nil src-spec)))))
+                      (elmo-msgdb-expand-path src-spec)))))
     (if (eq (car src-spec) 'archive)
        (elmo-archive-copy-msgs-froms
         (elmo-folder-get-spec dst-folder)
@@ -267,10 +271,13 @@ without cacheing."
           (len (length msgs))
           (all-msg-num (or all len))
           (done-msg-num (or done 0))
+          (progress-message (if no-delete
+                                "Copying messages..."
+                              "Moving messages..."))
           (tmp-buf (get-buffer-create " *elmo-move-msg*"))
           ;elmo-no-cache-flag
-          ret-val real-fld-num done-copy dir
-          mes-string message-id src-cache i percent unseen seen-list)
+          ret-val real-fld-num done-copy dir pair
+          mes-string message-id src-cache i unseen seen-list)
       (setq i done-msg-num)
       (set-buffer tmp-buf)
       (when (and (not (eq dst-folder 'null))
@@ -287,13 +294,14 @@ without cacheing."
       (while messages
        (setq real-fld-num (elmo-get-real-folder-number src-folder
                                                        (car messages)))
-       (setq message-id (cdr (assq (car messages) number-alist)))
+       (setq message-id (cdr (setq pair (assq (car messages) number-alist))))
        ;; seen-list.
        (if (and (not (eq dst-folder 'null))
                 (not (and unread-marks
-                          (member
-                           (cadr (assq (car messages) mark-alist))
-                           unread-marks))))
+                          (setq unseen
+                                (member
+                                 (cadr (assq (car messages) mark-alist))
+                                 unread-marks)))))
            (setq seen-list (cons message-id seen-list)))
        (unless (or (eq dst-folder 'null) done-copy)
          (if (and (elmo-folder-plugged-p src-folder)
@@ -309,25 +317,34 @@ without cacheing."
                                  same-number)
                (error "Copy message to %s failed" dst-folder))
            ;; use cache if exists.
-           (elmo-read-msg src-folder (car messages) tmp-buf msgdb)
-           (unless (elmo-append-msg dst-folder (buffer-string) message-id
-                                    (if same-number (car messages))
-                                    ;; null means all unread.
-                                    (or (null unread-marks)
-                                        unseen))
-             (error "move: append message to %s failed" dst-folder))))
+           ;; if there's other message with same message-id,
+           ;; don't use cache.
+           (elmo-read-msg src-folder (car messages)
+                          tmp-buf msgdb
+                          (and (elmo-folder-plugged-p src-folder)
+                               (and pair
+                                    (or
+                                     (rassoc
+                                      message-id
+                                      (cdr (memq pair number-alist)))
+                                     (not (eq pair
+                                              (rassoc message-id
+                                                      number-alist)))))))
+           (unless (eq (buffer-size) 0)
+             (unless (elmo-append-msg dst-folder (buffer-string) message-id
+                                      (if same-number (car messages))
+                                      ;; null means all unread.
+                                      (or (null unread-marks)
+                                          unseen))
+               (error "move: append message to %s failed" dst-folder)))))
        ;; delete src cache if it is partial.
        (elmo-cache-delete-partial message-id src-folder (car messages))
-       (setq ret-val (append ret-val (list (car messages))))
-       (setq i (+ i 1))
-       (setq percent (/ (* i 100) all-msg-num))
-       (if no-delete
-           (elmo-display-progress
-            'elmo-move-msgs "Copying messages..."
-            percent)
+       (setq ret-val (nconc ret-val (list (car messages))))
+       (when (> all-msg-num elmo-display-progress-threshold)
+         (setq i (+ i 1))
          (elmo-display-progress
-          'elmo-move-msgs "Moving messages..."
-          percent))
+          'elmo-move-msgs progress-message
+          (/ (* i 100) all-msg-num)))
        (setq messages (cdr messages)))
       ;; Save seen-list.
       (unless (eq dst-folder 'null)
@@ -367,14 +384,34 @@ without cacheing."
       (elmo-call-func folder "delete-msgs" msgs)
     (elmo-dop-delete-msgs folder msgs msgdb)))
 
-;;
-;; Server side search.
-;;
 (defun elmo-search (folder condition &optional from-msgs)
-  (let ((type (elmo-folder-get-type folder)))
-    (if (elmo-folder-plugged-p folder)
-       (elmo-call-func folder "search" condition from-msgs)
-      (elmo-cache-search-all folder condition from-msgs))))
+  (if (elmo-folder-plugged-p folder)
+      (elmo-call-func folder "search" condition from-msgs)
+    (elmo-cache-search-all folder condition from-msgs)))
+
+(defun elmo-msgdb-search (folder condition msgdb)
+  "Search messages which satisfy CONDITION from FOLDER with MSGDB."
+  (let* ((condition (car (elmo-parse-search-condition condition)))
+        (overview (elmo-msgdb-get-overview msgdb))
+        (number-alist (elmo-msgdb-get-number-alist msgdb))
+        (number-list (mapcar 'car number-alist))
+        (length (length overview))
+        (i 0)
+        result)
+    (if (elmo-condition-find-key condition "body")
+       (elmo-search folder condition number-list)
+      (while overview
+       (if (elmo-msgdb-search-internal condition (car overview)
+                                       number-list)
+           (setq result
+                 (cons
+                  (elmo-msgdb-overview-entity-get-number (car overview))
+                  result)))
+       (setq i (1+ i))
+       (elmo-display-progress
+        'elmo-msgdb-search "Searching..." (/ (* i 100) length))
+       (setq overview (cdr overview)))
+      (nreverse result))))
 
 (defun elmo-msgdb-create (folder numlist new-mark already-mark
                                 seen-mark important-mark seen-list)
@@ -398,9 +435,10 @@ without cacheing."
     ret-val))
 
 (defun elmo-call-func-on-markable-msgs (folder func-name msgs msgdb)
+  "Returns t if marked."
   (save-match-data
     (let ((folder-numbers (elmo-make-folder-numbers-list folder msgs))
-         type)
+         type error)
       (while folder-numbers
        (if (or (eq
                 (setq type (car
@@ -417,8 +455,9 @@ without cacheing."
                   func-name
                   (cdr (car folder-numbers)) ; real number
                   msgdb)
-               (error "Unplugged"))))
-       (setq folder-numbers (cdr folder-numbers))))))
+               (setq error t))))
+       (setq folder-numbers (cdr folder-numbers)))
+      (not error))))
 
 (defun elmo-unmark-important (folder msgs msgdb)
   (elmo-call-func-on-markable-msgs folder "unmark-important" msgs msgdb))
@@ -442,14 +481,17 @@ without cacheing."
      seen-mark important-mark seen-list)))
 
 ;;   msgdb elmo-msgdb-load        (folder)
-(defun elmo-msgdb-load (folder &optional spec)
+(defun elmo-msgdb-load (folder)
   (message "Loading msgdb for %s..." folder)
-  (let* ((path (elmo-msgdb-expand-path folder spec))
+  (let* ((path (elmo-msgdb-expand-path folder))
+        (overview (elmo-msgdb-overview-load path))
         (ret-val
-         (list (elmo-msgdb-overview-load path)
+         (list overview
                (elmo-msgdb-number-load path)
                (elmo-msgdb-mark-load path)
-               (elmo-msgdb-location-load path))))
+               (elmo-msgdb-location-load path)
+               (elmo-msgdb-make-overview-hashtb overview)
+               )))
     (message "Loading msgdb for %s...done." folder)
     (elmo-folder-set-info-max-by-numdb folder (nth 1 ret-val))
     ret-val))
@@ -519,9 +561,10 @@ without cacheing."
                   (elmo-msgdb-expand-path folder))))
 
 (defun elmo-pack-number (folder msgdb arg)
-  (if (string-match "^[\\+=].*" folder)
-      (elmo-call-func folder "pack-number" msgdb arg)
-    (error "pack-number not supported")))
+  (let ((type (elmo-folder-get-type folder)))
+    (if (memq type '(localdir localnews maildir))
+       (elmo-call-func folder "pack-number" msgdb arg)
+      (error "pack-number not supported"))))
 
 (defun elmo-sync-validity (folder)
   (elmo-call-func folder "sync-validity"
@@ -555,16 +598,16 @@ without cacheing."
   "Just return number-alist."
   number-alist)
 
-(defun elmo-generic-list-folder-unread (spec mark-alist unread-marks)
-  (elmo-delete-if
-   'null
-   (mapcar
-    (function (lambda (x)
-               (if (member (cadr (assq (car x) mark-alist)) unread-marks)
-                   (car x))))
-    mark-alist)))
+(defun elmo-generic-list-folder-unread (spec number-alist mark-alist
+                                            unread-marks)
+  (delq nil
+       (mapcar
+        (function (lambda (x)
+                    (if (member (cadr (assq (car x) mark-alist)) unread-marks)
+                        (car x))))
+        mark-alist)))
 
-(defun elmo-generic-list-folder-important (spec overview)
+(defun elmo-generic-list-folder-important (spec number-alist)
   nil)
 
 (defun elmo-update-number (folder msgdb)
@@ -609,29 +652,26 @@ without cacheing."
                0)))
          (length in-folder))))
 
-(defun elmo-list-folder-unread (folder mark-alist unread-marks)
-  (elmo-call-func folder "list-folder-unread" mark-alist unread-marks))
+(defun elmo-list-folder-unread (folder number-alist mark-alist unread-marks)
+  (elmo-call-func folder "list-folder-unread"
+                 number-alist mark-alist unread-marks))
 
-(defun elmo-list-folder-important (folder overview)
+(defun elmo-list-folder-important (folder number-alist)
   (let (importants)
-    ;; server side importants...(append only.)
+    ;; Server side importants...(append only.)
     (if (elmo-folder-plugged-p folder)
        (setq importants (elmo-call-func folder "list-folder-important"
-                                        overview)))
+                                        number-alist)))
     (or elmo-msgdb-global-mark-alist
        (setq elmo-msgdb-global-mark-alist
              (elmo-object-load (expand-file-name
                                 elmo-msgdb-global-mark-filename
                                 elmo-msgdb-dir))))
-    (while overview
-      (car overview)
-      (if (assoc (elmo-msgdb-overview-entity-get-id (car overview))
+    (while number-alist
+      (if (assoc (cdr (car number-alist))
                 elmo-msgdb-global-mark-alist)
-         (setq importants (cons
-                           (elmo-msgdb-overview-entity-get-number
-                            (car overview))
-                           importants)))
-      (setq overview (cdr overview)))
+         (setq importants (cons (car (car number-alist)) importants)))
+      (setq number-alist (cdr number-alist)))
     importants))
 
 (defun elmo-generic-commit (folder)
@@ -640,61 +680,68 @@ without cacheing."
 (defun elmo-commit (folder)
   (elmo-call-func folder "commit"))
 
-;; returns cons cell of (unsync . number-of-messages-in-folder)
-(defun elmo-folder-diff (fld &optional number-alist)
-  (interactive)
-  (let ((type (elmo-folder-get-type fld)))
-    (cond ((eq type 'multi)
-          (elmo-multi-folder-diff fld))
-         ((and (eq type 'filter)
-               (or (elmo-multi-p fld)
-                   (not
-                    (vectorp (nth 1 (elmo-folder-get-spec fld)))))
-               ;; not partial...unsync number is unknown.
-               (cons nil
-                     (cdr (elmo-folder-diff
-                           (nth 2 (elmo-folder-get-spec fld)))))))
-         ((and (eq type 'imap4)
-               elmo-use-server-diff)
-          (elmo-call-func fld "server-diff")) ;; imap4 server side diff.
-         (t
-          (let ((cached-in-db-max (elmo-folder-get-info-max fld))
-                (in-folder (elmo-max-of-folder fld))
-                (in-db t)
-                unsync nomif
-                in-db-max)
-            (if (or number-alist
-                    (not cached-in-db-max))
-                (let* ((dir (elmo-msgdb-expand-path fld))
-                       (nalist (or number-alist
-                                   (elmo-msgdb-number-load dir))))
-                  ;; No info-cache.
-                  (setq in-db (sort (mapcar 'car nalist) '<))
-                  (setq in-db-max (or (nth (max 0 (1- (length in-db))) in-db)
-                                      0))
-                  (if (not number-alist)
-                      ;; Number-alist is not used.
-                      (elmo-folder-set-info-hashtb fld in-db-max
-                                                   nil))
-;;                                                (or
-;;                                                 (and in-db (length in-db))
-;;                                                 0)))
-                  )
-              ;; info-cache exists.
-              (setq in-db-max cached-in-db-max))
-            (setq unsync (if (and in-db
-                                  (car in-folder))
-                             (- (car in-folder) in-db-max)
-                           (if (and in-folder
-                                    (null in-db))
-                               (cdr in-folder)
-                             (if (null (car in-folder))
-                                 nil))))
-            (setq nomif (cdr in-folder))
-            (if (and unsync nomif (> unsync nomif))
-                (setq unsync nomif))
-            (cons (or unsync 0) (or nomif 0)))))))
-    
+(defun elmo-clear-killed (folder)
+  (elmo-msgdb-killed-list-save (elmo-msgdb-expand-path folder) nil))
+
+(defvar elmo-folder-diff-async-callback nil)
+(defvar elmo-folder-diff-async-callback-data nil)
+
+(defun elmo-folder-diff-async (folder)
+  "Get diff of FOLDER asynchronously.
+`elmo-folder-diff-async-callback' is called with arguments of
+FOLDER and DIFF (cons cell of UNSEEN and MESSAGES).
+Currently works on IMAP4 folder only."
+  (if (eq (elmo-folder-get-type folder) 'imap4)
+      ;; Only works on imap4 with server diff.
+      (progn
+       (setq elmo-imap4-server-diff-async-callback
+             elmo-folder-diff-async-callback)
+       (setq elmo-imap4-server-diff-async-callback-data
+             elmo-folder-diff-async-callback-data)
+       (elmo-imap4-server-diff-async (elmo-folder-get-spec folder)))
+    (and elmo-folder-diff-async-callback
+        (funcall elmo-folder-diff-async-callback
+                 folder
+                 (elmo-folder-diff folder)))))
+
+(defun elmo-folder-diff (folder &optional number-list)
+  "Get diff of FOLDER.
+Return value is a cons cell of NEW and MESSAGES.
+If optional argumnet NUMBER-LIST is set, it is used as a 
+message list in msgdb. Otherwise, number-list is load from msgdb."
+  (elmo-call-func folder "folder-diff" folder number-list))
+
+(defun elmo-generic-folder-diff (spec folder &optional number-list)
+  (let ((cached-in-db-max (elmo-folder-get-info-max folder))
+       (in-folder (elmo-max-of-folder folder))
+       (in-db t)
+       unsync messages
+       in-db-max)
+    (if (or number-list (not cached-in-db-max))
+       (let ((number-list (or number-list
+                              (mapcar 'car
+                                      (elmo-msgdb-number-load
+                                       (elmo-msgdb-expand-path spec))))))
+         ;; No info-cache.
+         (setq in-db (sort number-list '<))
+         (setq in-db-max (or (nth (max 0 (1- (length in-db))) in-db)
+                             0))
+         (if (not number-list)
+             (elmo-folder-set-info-hashtb folder in-db-max nil)))
+      (setq in-db-max cached-in-db-max))
+    (setq unsync (if (and in-db
+                         (car in-folder))
+                    (- (car in-folder) in-db-max)
+                  (if (and in-folder
+                           (null in-db))
+                      (cdr in-folder)
+                    (if (null (car in-folder))
+                        nil))))
+    (setq messages (cdr in-folder))
+    (if (and unsync messages (> unsync messages))
+       (setq unsync messages))
+    (cons (or unsync 0) (or messages 0))))
+
 (defsubst elmo-folder-get-info (folder &optional hashtb)
   (elmo-get-hash-val folder
                     (or hashtb elmo-folder-info-hashtb)))
@@ -710,50 +757,6 @@ without cacheing."
                       (list new unread numbers max)
                       elmo-folder-info-hashtb)))
 
-(defun elmo-multi-get-number-alist-list (number-alist)
-  (let ((alist (sort number-alist (function (lambda (x y) (< (car x)
-                                                            (car y))))))
-       (cur-number 0)
-       one-alist ret-val num)
-    (while alist
-      (setq cur-number (+ cur-number 1))
-      (setq one-alist nil)
-      (while (and alist
-                 (eq 0
-                     (/ (- (setq num (car (car alist)))
-                           (* elmo-multi-divide-number cur-number))
-                        elmo-multi-divide-number)))
-       (setq one-alist (nconc
-                        one-alist
-                        (list
-                         (cons
-                          (% num (* elmo-multi-divide-number cur-number))
-                          (cdr (car alist))))))
-       (setq alist (cdr alist)))
-      (setq ret-val (nconc ret-val (list one-alist))))
-    ret-val))
-
-(defun elmo-multi-folder-diff (fld)
-  (let ((flds (cdr (elmo-folder-get-spec fld)))
-       (num-alist-list
-        (elmo-multi-get-number-alist-list
-         (elmo-msgdb-number-load (elmo-msgdb-expand-path fld))))
-       (count 0)
-       diffs (unsync 0) (nomif 0))
-    (while flds
-      (setq diffs (nconc diffs (list (elmo-folder-diff (car flds)
-                                                      (nth count
-                                                           num-alist-list)
-                                                      ))))
-      (setq count (+ 1 count))
-      (setq flds (cdr flds)))
-    (while diffs
-      (setq unsync (+ unsync (car (car diffs))))
-      (setq nomif  (+ nomif (cdr (car diffs))))
-      (setq diffs (cdr diffs)))
-    (elmo-folder-set-info-hashtb fld nil nomif)
-    (cons unsync nomif)))
-
 (defun elmo-folder-set-info-max-by-numdb (folder msgdb-number)
   (let ((num-db (sort (mapcar 'car msgdb-number) '<)))
     (elmo-folder-set-info-hashtb
@@ -1001,12 +1004,10 @@ without cacheing."
     (elmo-folder-number-get-spec fld number)))
 
 ;; autoloads
-(autoload 'elmo-imap4-get-connection "elmo-imap4")
 (autoload 'elmo-nntp-make-groups-hashtb "elmo-nntp")
 (autoload 'elmo-nntp-post "elmo-nntp")
 (autoload 'elmo-localdir-max-of-folder "elmo-localdir")
 (autoload 'elmo-localdir-msgdb-create-overview-entity-from-file "elmo-localdir")
-(autoload 'elmo-multi-folder-diff "elmo-multi")
 (autoload 'elmo-archive-copy-msgs-froms "elmo-archive")
 
 ;;; elmo2.el ends here
index 27b8fe0..8400e0c 100644 (file)
                                'CRLF))
   (run-hooks 'mmelmo-entity-content-inserted-hook))
 
-(provide 'mmelmo-1)
+(require 'product)
+(product-provide (provide 'mmelmo-1) (require 'elmo-version))
 
 ;;; mmelmo-1.el ends here
index 887ca16..8a3d2af 100644 (file)
@@ -119,7 +119,7 @@ size:   size of the entity."
                                        &optional invisible-fields
                                        visible-fields)
   (mmelmo-insert-sorted-header-from-buffer
-   (mime-entity-buffer entity)
+   (mime-buffer-entity-buffer-internal entity)
    (mime-buffer-entity-header-start-internal entity)
    (mime-buffer-entity-header-end-internal entity)
    invisible-fields visible-fields mmelmo-sort-field-list))
@@ -136,6 +136,7 @@ size:   size of the entity."
 ;                     (mime-buffer-entity-body-end-internal entity)))
 ;   (mime-entity-encoding entity)))
 
-(provide 'mmelmo-2)
+(require 'product)
+(product-provide (provide 'mmelmo-2) (require 'elmo-version))
 
 ;;; mmelmo-2.el ends here
index 8ccdccf..0c90987 100644 (file)
           (process (elmo-imap4-connection-get-process connection))
           (read-it t)
           response errmsg ret-val bytes)
-      (when (elmo-imap4-spec-folder spec)
+      (when (elmo-imap4-spec-mailbox spec)
        (save-excursion
          (when (not (string= (elmo-imap4-connection-get-cwf connection)
-                             (elmo-imap4-spec-folder spec)))
+                             (elmo-imap4-spec-mailbox spec)))
            (if (null (setq response
                            (elmo-imap4-select-folder
-                            (elmo-imap4-spec-folder spec) connection)))
+                            (elmo-imap4-spec-mailbox spec) connection)))
                (error "Select folder failed")))
          (elmo-imap4-send-command (process-buffer process)
                                   process
                (std11-fetch-field field-name))
            nil))))))
 
-(provide 'mmelmo-imap4-1)
+(require 'product)
+(product-provide (provide 'mmelmo-imap4-1) (require 'elmo-version))
 
 ;;; mmelmo-imap4-1.el ends here
index a9c9636..6b31535 100644 (file)
                                               (elmo-imap4-nth 5 object))))
       ret-val))))
 
-(defun mmelmo-imap4-parse-bodystructure-string (folder number msgdb string)
-  (with-temp-buffer
-    (insert string)
-    (goto-char (point-min))
-    (when (search-forward "FETCH" nil t)
-      (narrow-to-region (match-end 0) (point-max))
-      (while (re-search-forward "{\\([0-9]+\\)}\r\n" nil t)
-       (let (str)
-         (goto-char (+ (point)
-                       (string-to-int (elmo-match-buffer 1))))
-         (setq str (buffer-substring (match-end 0) (point)))
-         (delete-region (match-beginning 0) (point))
-         (insert (prin1-to-string str))))
-      (goto-char (point-min))
-      (mmelmo-imap4-parse-bodystructure-object
-       folder ; folder
-       number ; number
-       msgdb  ; msgdb
-       nil    ; node-id
-       (nth 1 (memq 'BODYSTRUCTURE (read (current-buffer)))) ; bodystructure-object
-       nil    ; parent
-       ))))
-
 (defun mmelmo-imap4-multipart-p (entity)
   (eq (cdr (assq 'type (mime-entity-content-type entity))) 'multipart))
 
 (defun mmelmo-imap4-textpart-p (entity)
   (eq (cdr (assq 'type (mime-entity-content-type entity))) 'text))
       
-(defun mmelmo-imap4-get-mime-entity (fld number msgdb)
-  (save-excursion
-    (let* ((spec (elmo-folder-get-spec fld))
-          (connection (elmo-imap4-get-connection spec))
-          (folder (elmo-imap4-spec-folder spec))
-          response)
-      (when folder
-       (save-excursion
-         (when (not (string= (elmo-imap4-connection-get-cwf connection)
-                             folder))
-           (if (null (elmo-imap4-select-folder folder connection))
-               (error "Select folder failed")))
-         (elmo-imap4-send-command (elmo-imap4-connection-get-buffer
-                                   connection)
-                                  (elmo-imap4-connection-get-process
-                                   connection)
-                                  (format
-                                   (if elmo-imap4-use-uid
-                                       "uid fetch %s bodystructure"
-                                     "fetch %s bodystructure")
-                                   number))
-         (if (null (setq response (elmo-imap4-read-contents
-                                   (elmo-imap4-connection-get-buffer
-                                    connection)
-                                   (elmo-imap4-connection-get-process
-                                    connection))))
-             (error "Fetching body structure failed")))
-       (mmelmo-imap4-parse-bodystructure-string fld number msgdb
-                                                response)))))
+(defun mmelmo-imap4-get-mime-entity (folder number msgdb)
+  (let* ((spec (elmo-folder-get-spec folder))
+        (session (elmo-imap4-get-session spec)))
+    (elmo-imap4-session-select-mailbox session (elmo-imap4-spec-mailbox spec))
+    (with-current-buffer (elmo-network-session-buffer session)
+      (setq elmo-imap4-fetch-callback nil)
+      (setq elmo-imap4-fetch-callback-data nil))    
+    (mmelmo-imap4-parse-bodystructure-object
+     folder
+     number
+     msgdb
+     nil ; node-id
+     (elmo-imap4-response-value
+      (elmo-imap4-response-value
+       (elmo-imap4-send-command-wait
+       session
+       (format
+        (if elmo-imap4-use-uid
+            "uid fetch %s bodystructure"
+          "fetch %s bodystructure")
+        number)) 'fetch) 'bodystructure)
+     nil ; parent
+     )))
 
 (defun mmelmo-imap4-read-part (entity)
   (if (or (not mmelmo-imap4-threshold)
@@ -247,7 +218,7 @@ These value must be specified as argument for `luna-make-entity'."
               'initialize-instance))
         entity init-args))
 
-(luna-define-method mime-entity-buffer ((entity mime-elmo-imap4-entity))
+(defun mmelmo-imap4-mime-entity-buffer (entity)
   (if (mime-buffer-entity-buffer-internal entity)
       (save-excursion
        (set-buffer (mime-buffer-entity-buffer-internal entity))
@@ -258,10 +229,11 @@ These value must be specified as argument for `luna-make-entity'."
                   (mime-elmo-entity-size-internal entity)))
              (mime-buffer-entity-set-buffer-internal entity nil)
              (message "Fetching skipped part...")
-             (luna-send entity 'mime-entity-buffer entity)
+             (mmelmo-imap4-mime-entity-buffer entity)
              (message "Fetching skipped part...done."))
            (setq mmelmo-imap4-fetched t)))
        (mime-buffer-entity-buffer-internal entity))
+    ;; No buffer exist.
     (save-excursion
       (set-buffer (get-buffer-create
                   (concat mmelmo-entity-buffer-name
@@ -280,8 +252,7 @@ These value must be specified as argument for `luna-make-entity'."
              (setq mmelmo-imap4-skipped-parts nil)
              ;; insert header
              (insert (elmo-imap4-read-part
-                      (mime-elmo-entity-folder-internal
-                       entity)
+                      (mime-elmo-entity-folder-internal entity)
                       (mime-elmo-entity-number-internal entity)
                       "header"))
              (mime-buffer-entity-set-header-start-internal
@@ -301,42 +272,23 @@ These value must be specified as argument for `luna-make-entity'."
          (mmelmo-imap4-read-part entity)))
       (current-buffer))))
 
-(luna-define-method mime-goto-header-start-point ((entity mime-elmo-imap4-entity))
-  (set-buffer (mime-entity-buffer entity))
-  (point-min))
-
-(luna-define-method mime-goto-body-end-point ((entity mime-elmo-imap4-entity))
-  (set-buffer (mime-entity-buffer entity))
-  (point-max))
-
-(luna-define-method mime-entity-point-min ((entity mime-elmo-imap4-entity))
-  (set-buffer (mime-buffer-entity-buffer-internal entity))
-  (point-min))
-
-(luna-define-method mime-entity-point-max ((entity mime-elmo-imap4-entity))
-  (set-buffer (mime-buffer-entity-buffer-internal entity))
-  (point-max))
-
-(luna-define-method mime-entity-children ((entity mime-elmo-imap4-entity))
-  (let* ((content-type (mime-entity-content-type entity))
-         (primary-type (mime-content-type-primary-type content-type)))
-    (cond ((eq primary-type 'multipart)
-           (mime-parse-multipart entity))
-          ((and (eq primary-type 'message)
-                (memq (mime-content-type-subtype content-type)
-                      '(rfc822 news external-body)
-                      ))
-          (save-excursion
-            (set-buffer (luna-send entity 'mime-entity-buffer entity))
-            (mime-buffer-entity-set-body-start-internal entity (point-min))
-            (mime-buffer-entity-set-body-end-internal entity (point-max)))
-           (mime-parse-encapsulated entity)))))
+; mime-entity-children
+(luna-define-method mime-entity-children ((entity
+                                          mime-elmo-imap4-entity))
+  (mime-entity-children-internal entity))
 
 ;; override generic function for dynamic body fetching.
+(luna-define-method mime-entity-body ((entity
+                                      mime-elmo-imap4-entity))
+  (save-excursion
+    (set-buffer (mmelmo-imap4-mime-entity-buffer entity))
+    (buffer-substring (mime-buffer-entity-body-start-internal entity)
+                     (mime-buffer-entity-body-end-internal entity))))
+
 (luna-define-method mime-entity-content ((entity
                                          mime-elmo-imap4-entity))
   (save-excursion
-    (set-buffer (mime-entity-buffer entity))
+    (set-buffer (mmelmo-imap4-mime-entity-buffer entity))
     (mime-decode-string
      (buffer-substring (mime-buffer-entity-body-start-internal entity)
                       (mime-buffer-entity-body-end-internal entity))
@@ -361,33 +313,44 @@ These value must be specified as argument for `luna-make-entity'."
                                        &optional invisible-fields
                                        visible-fields)
   (mmelmo-insert-sorted-header-from-buffer
-   (mime-entity-buffer entity)
+   (mmelmo-imap4-mime-entity-buffer entity)
    (mime-buffer-entity-header-start-internal entity)
    (mime-buffer-entity-header-end-internal entity)
    invisible-fields visible-fields))
 
 (luna-define-method mime-entity-header-buffer ((entity mime-elmo-imap4-entity))
-  (mime-entity-buffer entity))
+  (mime-buffer-entity-buffer-internal entity))
 
 (luna-define-method mime-entity-body-buffer ((entity mime-elmo-imap4-entity))
-  (mime-entity-buffer entity))
+  (mime-buffer-entity-buffer-internal entity))
 
 (luna-define-method mime-write-entity-content ((entity mime-elmo-imap4-entity)
                                               filename)
-  (save-excursion
-    (set-buffer (mime-entity-buffer entity))
-    (unless mmelmo-imap4-fetched
-      (setq mmelmo-imap4-skipped-parts nil) ; No need?
-      (let ((mmelmo-imap4-threshold (mime-elmo-entity-size-internal entity)))
-       (mime-buffer-entity-set-buffer-internal entity nil) ; To re-fetch.
-       (message "Fetching skipped part...")
-       (luna-send entity 'mime-entity-buffer entity)
-       (message "Fetching skipped part...done.")))
-    (mime-write-decoded-region (mime-buffer-entity-body-start-internal entity)
-                              (mime-buffer-entity-body-end-internal entity)
-                              filename
-                              (or (mime-entity-encoding entity) "7bit"))))
+  (let ((mmelmo-imap4-threshold (mime-elmo-entity-size-internal entity)))
+    (if (mime-buffer-entity-buffer-internal entity)
+       (save-excursion
+         (set-buffer (mime-buffer-entity-buffer-internal entity))
+         (unless mmelmo-imap4-fetched
+           (setq mmelmo-imap4-skipped-parts nil) ; No need?
+           (mime-buffer-entity-set-buffer-internal entity nil) ; To re-fetch.
+           ))
+      (unless mmelmo-imap4-fetched
+       (setq mmelmo-imap4-skipped-parts nil) ; No need?
+       (let ((mmelmo-imap4-threshold (mime-elmo-entity-size-internal entity)))
+         (mime-buffer-entity-set-buffer-internal entity nil) ; To re-fetch.
+         (message "Fetching skipped part...")
+         (mime-buffer-entity-set-buffer-internal
+          entity
+          (mmelmo-imap4-mime-entity-buffer entity))
+         (message "Fetching skipped part...done.")))
+      (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+       (mime-write-decoded-region
+        (mime-buffer-entity-body-start-internal entity)
+        (mime-buffer-entity-body-end-internal entity)
+        filename
+        (or (mime-entity-encoding entity) "7bit"))))))
 
-(provide 'mmelmo-imap4-2)
+(require 'product)
+(product-provide (provide 'mmelmo-imap4-2) (require 'elmo-version))
 
 ;;; mmelmo-imap4-2.el ends here
index 4bd5c45..f3142f4 100644 (file)
@@ -35,6 +35,7 @@
   ;; FLIM 1.12
   (require 'mmelmo-imap4-1))
 
-(provide 'mmelmo-imap4)
+(require 'product)
+(product-provide (provide 'mmelmo-imap4) (require 'elmo-version))
 
 ;;; mmelmo-imap4.el ends here
index ebd64e4..c64b16e 100644 (file)
@@ -145,12 +145,14 @@ If function is specified, its return value is used.")
          (setq attrlist (cdr (cdr attrlist))))
        ret-val)))
 
-(provide 'mmelmo) ; for circular dependency.
+;;;(provide 'mmelmo) ; for circular dependency.
+(require 'product)
+(product-provide (provide 'mmelmo) (require 'elmo-version))
+
 (static-if (fboundp 'luna-define-method)
     ;; FLIM 1.13 or later
     (require 'mmelmo-2)
   ;; FLIM 1.12
   (require 'mmelmo-1))
 
-
 ;;; mmelmo.el ends here
diff --git a/elmo/pldap.el b/elmo/pldap.el
new file mode 100644 (file)
index 0000000..265629c
--- /dev/null
@@ -0,0 +1,1053 @@
+;;; pldap.el -- A portable LDAP support for Emacs.
+
+;; Copyright (C) 1998 Free Software Foundation, Inc.
+;; Copyright (C) 2000 Yuuichi Teranishi <teranisi@gohome.org>
+
+;; Original was ldap.el:
+;; Author: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
+;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
+
+;; pldap.el:
+;; Author: Yuuichi Teranishi <teranisi@gohome.org>
+;; Maintainer: Yuuichi Teranishi <teranisi@gohome.org>
+;; Keywords: emulating, LDAP, comm
+;; Created: 15 June 2000
+
+;; This file is not part of GNU Emacs
+
+;; 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:
+;; 
+
+(eval-when-compile (require 'cl))
+
+(defmacro ldap-static-if (cond then &rest else)
+  (if (eval cond)
+      then
+    (` (progn  (,@ else)))))
+
+(ldap-static-if (and (not (featurep 'pldap))
+                    (fboundp 'ldap-open))
+    ;; You have built-in ldap feature (XEmacs).
+    (require 'ldap)
+
+;; You don't have built-in ldap feature.
+;; Use external program.
+
+;;; For LDIF encoding.
+;; SAFE-CHAR                = %x01-09 / %x0B-0C / %x0E-7F
+(defconst ldap-ldif-safe-char-regexp
+  "[\000-\011\013\014\016-\177]"
+  "A Regexp for safe-char")
+;; SAFE-INIT-CHAR           = %x01-09 / %x0B-0C / %x0E-1F /
+;;                            %x21-39 / %x3B / %x3D-7F
+(defconst ldap-ldif-safe-init-char-regexp
+  "[\001-\011\013\014\016-\037\038-\071\073\075-\177]"
+  "A Regexp for safe-init-char.")
+;; SAFE-STRING              = [SAFE-INIT-CHAR *SAFE-CHAR]
+(defconst ldap-ldif-safe-string-regexp
+  (concat ldap-ldif-safe-init-char-regexp ldap-ldif-safe-char-regexp "*")
+  "A Regexp for safe-string.")
+
+(defconst ldap-ldif-field-name-regexp "[a-zA-Z][a-zA-Z0-9-]*"
+  "A Regexp for field name.")
+
+(defconst ldap-ldif-field-head-regexp
+  (concat "^" ldap-ldif-field-name-regexp ":")
+  "A Regexp for field head.")
+
+(defconst ldap-ldif-next-field-head-regexp
+  (concat "\n" ldap-ldif-field-name-regexp ":")
+  "A Regexp for next field head.")
+
+(defmacro ldap/ldif-safe-string-p (string)
+  "Return t if STRING is a safe-string for LDIF."
+  ;; Need better implentation.
+  (` (string-match ldap-ldif-safe-string-regexp (, string))))
+
+(defgroup ldap nil
+  "Lightweight Directory Access Protocol"
+  :group 'comm)
+
+(defvar ldap-search-program "ldapsearch"
+  "LDAP search program.")
+
+(defvar ldap-add-program "ldapadd"
+  "LDAP add program.")
+
+(defvar ldap-delete-program "ldapdelete"
+  "LDAP delete program.")
+
+(defvar ldap-modify-program "ldapmodify"
+  "LDAP modify program.")
+
+(defcustom ldap-search-program-arguments '("-L" "-B")
+  "*A list of additional arguments to pass to `ldapsearch'.
+It is recommended to use the `-T' switch with Nescape's
+implementation to avoid line wrapping.
+`-L' is needed to get LDIF outout.
+The `-B' switch should be used to enable the retrieval of
+binary values."
+  :type '(repeat :tag "`ldapsearch' Arguments"
+                (string :tag "Argument"))
+  :group 'ldap)
+
+(defcustom ldap-default-host nil
+  "*Default LDAP server hostname.
+A TCP port number can be appended to that name using a colon as
+a separator."
+  :type '(choice (string :tag "Host name")
+                (const :tag "Use library default" nil))
+  :group 'ldap)
+
+(defcustom ldap-default-port nil
+  "*Default TCP port for LDAP connections.
+Initialized from the LDAP library at build time.  Default value is 389."
+  :type '(choice (const :tag "Use library default" nil)
+                (integer :tag "Port number"))
+  :group 'ldap)
+
+(defcustom ldap-default-base nil
+  "*Default base for LDAP searches.
+This is a string using the syntax of RFC 1779.
+For instance, \"o=ACME, c=US\" limits the search to the
+Acme organization in the United States."
+  :type '(choice (const :tag "Use library default" nil)
+                (string :tag "Search base"))
+  :group 'ldap)
+
+(defcustom ldap-host-parameters-alist nil
+  "*Alist of host-specific options for LDAP transactions.
+The format of each list element is:
+\(HOST PROP1 VAL1 PROP2 VAL2 ...)
+HOST is the hostname of an LDAP server (with an optional TCP port number
+appended to it  using a colon as a separator).
+PROPn and VALn are property/value pairs describing parameters for the server.
+Valid properties include:
+  `binddn' is the distinguished name of the user to bind as
+    (in RFC 1779 syntax).
+  `passwd' is the password to use for simple authentication.
+  `auth' is the authentication method to use.
+    Possible values are: `simple', `krbv41' and `krbv42'.
+  `base' is the base for the search as described in RFC 1779.
+  `scope' is one of the three symbols `subtree', `base' or `onelevel'.
+  `deref' is one of the symbols `never', `always', `search' or `find'.
+  `timelimit' is the timeout limit for the connection in seconds.
+  `sizelimit' is the maximum number of matches to return."
+  :type '(repeat :menu-tag "Host parameters"
+                :tag "Host parameters"
+                (list :menu-tag "Host parameters"
+                      :tag "Host parameters"
+                      :value nil
+                      (string :tag "Host name")
+                      (checklist :inline t
+                                 :greedy t
+                                 (list
+                                  :tag "Search Base"
+                                  :inline t
+                                  (const :tag "Search Base" base)
+                                  string)
+                                 (list
+                                  :tag "Binding DN"
+                                  :inline t
+                                  (const :tag "Binding DN" binddn)
+                                  string)
+                                 (list
+                                  :tag "Password"
+                                  :inline t
+                                  (const :tag "Password" passwd)
+                                  string)
+                                 (list
+                                  :tag "Authentication Method"
+                                  :inline t
+                                  (const :tag "Authentication Method" auth)
+                                  (choice
+                                   (const :menu-tag "None" :tag "None" nil)
+                                   (const :menu-tag "Simple" :tag "Simple" simple)
+                                   (const :menu-tag "Kerberos 4.1" :tag "Kerberos 4.1" krbv41)
+                                   (const :menu-tag "Kerberos 4.2" :tag "Kerberos 4.2" krbv42)))
+                                 (list
+                                  :tag "Search Scope"
+                                  :inline t
+                                  (const :tag "Search Scope" scope)
+                                  (choice
+                                   (const :menu-tag "Default" :tag "Default" nil)
+                                   (const :menu-tag "Subtree" :tag "Subtree" subtree)
+                                   (const :menu-tag "Base" :tag "Base" base)
+                                   (const :menu-tag "One Level" :tag "One Level" onelevel)))
+                                 (list
+                                  :tag "Dereferencing"
+                                  :inline t
+                                  (const :tag "Dereferencing" deref)
+                                  (choice
+                                   (const :menu-tag "Default" :tag "Default" nil)
+                                   (const :menu-tag "Never" :tag "Never" never)
+                                   (const :menu-tag "Always" :tag "Always" always)
+                                   (const :menu-tag "When searching" :tag "When searching" search)
+                                   (const :menu-tag "When locating base" :tag "When locating base" find)))
+                                 (list
+                                  :tag "Time Limit"
+                                  :inline t
+                                  (const :tag "Time Limit" timelimit)
+                                  (integer :tag "(in seconds)"))
+                                 (list
+                                  :tag "Size Limit"
+                                  :inline t
+                                  (const :tag "Size Limit" sizelimit)
+                                  (integer :tag "(number of records)")))))
+:group 'ldap)
+
+(defcustom ldap-verbose nil
+  "*If non-nil, LDAP operations echo progress messages."
+  :type 'boolean
+  :group 'ldap)
+
+(defcustom ldap-ignore-attribute-codings nil
+  "*If non-nil, do not perform any encoding/decoding on LDAP attribute values."
+  :type 'boolean
+  :group 'ldap)
+
+(defcustom ldap-default-attribute-encoder nil
+  "*Encoder function to use for attributes whose syntax is unknown."
+  :type 'symbol
+  :group 'ldap)
+
+(defcustom ldap-default-attribute-decoder nil
+  "*Decoder function to use for attributes whose syntax is unknown."
+  :type 'symbol
+  :group 'ldap)
+
+(defcustom ldap-coding-system (if (boundp 'NEMACS) 0
+                               nil)
+  "*Coding system of LDAP string values.
+LDAP v3 specifies the coding system of strings to be UTF-8.
+Mule support is needed for this."
+  :type 'symbol
+  :group 'ldap)
+
+(defvar ldap-attribute-syntax-encoders
+  [nil                                 ; 1  ACI Item                        N
+   nil                                 ; 2  Access Point                    Y
+   nil                                 ; 3  Attribute Type Description      Y
+   nil                                 ; 4  Audio                           N
+   nil                                 ; 5  Binary                          N
+   nil                                 ; 6  Bit String                      Y
+   ldap-encode-boolean                 ; 7  Boolean                         Y
+   nil                                 ; 8  Certificate                     N
+   nil                                 ; 9  Certificate List                N
+   nil                                 ; 10 Certificate Pair                N
+   ldap-encode-country-string          ; 11 Country String                  Y
+   ldap-encode-string                  ; 12 DN                              Y
+   nil                                 ; 13 Data Quality Syntax             Y
+   nil                                 ; 14 Delivery Method                 Y
+   ldap-encode-string                  ; 15 Directory String                Y
+   nil                                 ; 16 DIT Content Rule Description    Y
+   nil                                 ; 17 DIT Structure Rule Description  Y
+   nil                                 ; 18 DL Submit Permission            Y
+   nil                                 ; 19 DSA Quality Syntax              Y
+   nil                                 ; 20 DSE Type                        Y
+   nil                                 ; 21 Enhanced Guide                  Y
+   nil                                 ; 22 Facsimile Telephone Number      Y
+   nil                                 ; 23 Fax                             N
+   nil                                 ; 24 Generalized Time                Y
+   nil                                 ; 25 Guide                           Y
+   nil                                 ; 26 IA5 String                      Y
+   number-to-string                    ; 27 INTEGER                         Y
+   nil                                 ; 28 JPEG                            N
+   nil                                 ; 29 Master And Shadow Access Points Y
+   nil                                 ; 30 Matching Rule Description       Y
+   nil                                 ; 31 Matching Rule Use Description   Y
+   nil                                 ; 32 Mail Preference                 Y
+   nil                                 ; 33 MHS OR Address                  Y
+   nil                                 ; 34 Name And Optional UID           Y
+   nil                                 ; 35 Name Form Description           Y
+   nil                                 ; 36 Numeric String                  Y
+   nil                                 ; 37 Object Class Description        Y
+   nil                                 ; 38 OID                             Y
+   nil                                 ; 39 Other Mailbox                   Y
+   nil                                 ; 40 Octet String                    Y
+   ldap-encode-address                 ; 41 Postal Address                  Y
+   nil                                 ; 42 Protocol Information            Y
+   nil                                 ; 43 Presentation Address            Y
+   ldap-encode-string                  ; 44 Printable String                Y
+   nil                                 ; 45 Subtree Specification           Y
+   nil                                 ; 46 Supplier Information            Y
+   nil                                 ; 47 Supplier Or Consumer            Y
+   nil                                 ; 48 Supplier And Consumer           Y
+   nil                                 ; 49 Supported Algorithm             N
+   nil                                 ; 50 Telephone Number                Y
+   nil                                 ; 51 Teletex Terminal Identifier     Y
+   nil                                 ; 52 Telex Number                    Y
+   nil                                 ; 53 UTC Time                        Y
+   nil                                 ; 54 LDAP Syntax Description         Y
+   nil                                 ; 55 Modify Rights                   Y
+   nil                                 ; 56 LDAP Schema Definition          Y
+   nil                                 ; 57 LDAP Schema Description         Y
+   nil                                 ; 58 Substring Assertion             Y
+   ]
+  "A vector of functions used to encode LDAP attribute values.
+The sequence of functions corresponds to the sequence of LDAP attribute syntax
+object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in
+RFC2252 section 4.3.2")
+
+(defvar ldap-attribute-syntax-decoders
+  [nil                                 ; 1  ACI Item                        N
+   nil                                 ; 2  Access Point                    Y
+   nil                                 ; 3  Attribute Type Description      Y
+   nil                                 ; 4  Audio                           N
+   nil                                 ; 5  Binary                          N
+   nil                                 ; 6  Bit String                      Y
+   ldap-decode-boolean                 ; 7  Boolean                         Y
+   nil                                 ; 8  Certificate                     N
+   nil                                 ; 9  Certificate List                N
+   nil                                 ; 10 Certificate Pair                N
+   ldap-decode-string                  ; 11 Country String                  Y
+   ldap-decode-string                  ; 12 DN                              Y
+   nil                                 ; 13 Data Quality Syntax             Y
+   nil                                 ; 14 Delivery Method                 Y
+   ldap-decode-string                  ; 15 Directory String                Y
+   nil                                 ; 16 DIT Content Rule Description    Y
+   nil                                 ; 17 DIT Structure Rule Description  Y
+   nil                                 ; 18 DL Submit Permission            Y
+   nil                                 ; 19 DSA Quality Syntax              Y
+   nil                                 ; 20 DSE Type                        Y
+   nil                                 ; 21 Enhanced Guide                  Y
+   nil                                 ; 22 Facsimile Telephone Number      Y
+   nil                                 ; 23 Fax                             N
+   nil                                 ; 24 Generalized Time                Y
+   nil                                 ; 25 Guide                           Y
+   nil                                 ; 26 IA5 String                      Y
+   string-to-number                    ; 27 INTEGER                         Y
+   nil                                 ; 28 JPEG                            N
+   nil                                 ; 29 Master And Shadow Access Points Y
+   nil                                 ; 30 Matching Rule Description       Y
+   nil                                 ; 31 Matching Rule Use Description   Y
+   nil                                 ; 32 Mail Preference                 Y
+   nil                                 ; 33 MHS OR Address                  Y
+   nil                                 ; 34 Name And Optional UID           Y
+   nil                                 ; 35 Name Form Description           Y
+   nil                                 ; 36 Numeric String                  Y
+   nil                                 ; 37 Object Class Description        Y
+   nil                                 ; 38 OID                             Y
+   nil                                 ; 39 Other Mailbox                   Y
+   nil                                 ; 40 Octet String                    Y
+   ldap-decode-address                 ; 41 Postal Address                  Y
+   nil                                 ; 42 Protocol Information            Y
+   nil                                 ; 43 Presentation Address            Y
+   ldap-decode-string                  ; 44 Printable String                Y
+   nil                                 ; 45 Subtree Specification           Y
+   nil                                 ; 46 Supplier Information            Y
+   nil                                 ; 47 Supplier Or Consumer            Y
+   nil                                 ; 48 Supplier And Consumer           Y
+   nil                                 ; 49 Supported Algorithm             N
+   nil                                 ; 50 Telephone Number                Y
+   nil                                 ; 51 Teletex Terminal Identifier     Y
+   nil                                 ; 52 Telex Number                    Y
+   nil                                 ; 53 UTC Time                        Y
+   nil                                 ; 54 LDAP Syntax Description         Y
+   nil                                 ; 55 Modify Rights                   Y
+   nil                                 ; 56 LDAP Schema Definition          Y
+   nil                                 ; 57 LDAP Schema Description         Y
+   nil                                 ; 58 Substring Assertion             Y
+   ]
+  "A vector of functions used to decode LDAP attribute values.
+The sequence of functions corresponds to the sequence of LDAP attribute syntax
+object identifiers of the form 1.3.6.1.4.1.1466.1115.121.1.* as defined in
+RFC2252 section 4.3.2")
+
+(defvar ldap-attribute-syntaxes-alist
+  '((createtimestamp . 24)
+    (modifytimestamp . 24)
+    (creatorsname . 12)
+    (modifiersname . 12)
+    (subschemasubentry . 12)
+    (attributetypes . 3)
+    (objectclasses . 37)
+    (matchingrules . 30)
+    (matchingruleuse . 31)
+    (namingcontexts . 12)
+    (altserver . 26)
+    (supportedextension . 38)
+    (supportedcontrol . 38)
+    (supportedsaslmechanisms . 15)
+    (supportedldapversion . 27)
+    (ldapsyntaxes . 16)
+    (ditstructurerules . 17)
+    (nameforms . 35)
+    (ditcontentrules . 16)
+    (objectclass . 38)
+    (aliasedobjectname . 12)
+    (cn . 15)
+    (sn . 15)
+    (serialnumber . 44)
+    (c . 15)
+    (l . 15)
+    (st . 15)
+    (street . 15)
+    (o . 15)
+    (ou . 15)
+    (title . 15)
+    (description . 15)
+    (searchguide . 25)
+    (businesscategory . 15)
+    (postaladdress . 41)
+    (postalcode . 15)
+    (postofficebox . 15)
+    (physicaldeliveryofficename . 15)
+    (telephonenumber . 50)
+    (telexnumber . 52)
+    (telexterminalidentifier . 51)
+    (facsimiletelephonenumber . 22)
+    (x121address . 36)
+    (internationalisdnnumber . 36)
+    (registeredaddress . 41)
+    (destinationindicator . 44)
+    (preferreddeliverymethod . 14)
+    (presentationaddress . 43)
+    (supportedapplicationcontext . 38)
+    (member . 12)
+    (owner . 12)
+    (roleoccupant . 12)
+    (seealso . 12)
+    (userpassword . 40)
+    (usercertificate . 8)
+    (cacertificate . 8)
+    (authorityrevocationlist . 9)
+    (certificaterevocationlist . 9)
+    (crosscertificatepair . 10)
+    (name . 15)
+    (givenname . 15)
+    (initials . 15)
+    (generationqualifier . 15)
+    (x500uniqueidentifier . 6)
+    (dnqualifier . 44)
+    (enhancedsearchguide . 21)
+    (protocolinformation . 42)
+    (distinguishedname . 12)
+    (uniquemember . 34)
+    (houseidentifier . 15)
+    (supportedalgorithms . 49)
+    (deltarevocationlist . 9)
+    (dmdname . 15))
+  "A map of LDAP attribute names to their type object id minor number.
+This table is built from RFC2252 Section 5 and RFC2256 Section 5")
+
+;;; LDAP primitive functions.
+;;
+;; LDAP object is
+;; (__ldap-object HOSTNAME PLIST)
+
+(defun ldapp (object)
+  "Return t if OBJECT is a LDAP connection."
+  (and (listp object)
+       (eq (car object) '__ldap-object)))
+
+(defun ldap-open (host &optional plist)
+  "Open a LDAP connection to HOST.
+PLIST is a plist containing additional parameters for the connection.
+Valid keys in that list are:
+  `port' the TCP port to use for the connection if different from
+`ldap-default-port'.
+  `auth' is the authentication method to use, possible values depend on
+the LDAP library: `simple', `krbv41' and `krbv42'.
+  `binddn' is the distinguished name of the user to bind as
+ (in RFC 1779 syntax).
+  `passwd' is the password to use for simple authentication.
+  `deref' is one of the symbols `never', `always', `search' or `find'.
+  `timelimit' is the timeout limit for the connection in seconds.
+  `sizelimit' is the maximum number of matches to return."
+  (list '__ldap-object host plist))
+
+(defun ldap-host (ldap)
+  "Return the server host of the connection LDAP, as a string."
+  (nth 1 ldap))
+
+(defun ldap-close (ldap)
+  "Close an LDAP connection."
+  t)
+
+(defun ldap-delete (ldap dn)
+  "Delete an entry to an LDAP directory.
+LDAP is an LDAP connection object created with `ldap-open'.
+DN is the distinguished name of the entry to delete."
+  (let* ((plist (or (nth 2 ldap)
+                   (cdr (assoc (ldap-host ldap)
+                               ldap-host-parameters-alist))))
+        (port   (plist-get plist 'port))
+        (binddn (plist-get plist 'binddn))
+        (passwd (plist-get plist 'passwd))
+        arglist ret)
+    (setq arglist (list (format "-h%s" (ldap-host ldap))))
+    (if (and port (not (equal 389 port)))
+       (setq arglist (nconc arglist (list (format "-p%d" port)))))
+    (if (and binddn
+            (not (equal "" binddn)))
+       (setq arglist (nconc arglist (list (format "-D%s" binddn)))))
+    (if (and passwd
+            (not (equal "" passwd)))
+       (setq arglist (nconc arglist (list (format "-w%s" passwd)))))
+    (with-temp-buffer
+      (setq ret (apply 'call-process
+                      ldap-delete-program
+                      nil (current-buffer) t
+                      (append arglist
+                              (list dn))))
+      (if (integerp ret)
+         (if (not (zerop ret))
+             (error (car (split-string (buffer-string) "\n"))))
+       (if (and (setq ret (buffer-string)); Nemacs
+                (string-match "ldap_delete:" ret))
+           (error (car (split-string ret "\n"))))))))
+
+(defmacro ldap/ldif-insert-field (attr value)
+  (` (if (not (ldap/ldif-safe-string-p (, value)))
+        (insert (, attr) ":: " (base64-encode-string (, value)) "\n")
+       (insert (, attr) ": " (, value) "\n"))))
+
+(defun ldap-modify (ldap dn mods)
+  "Add an entry to an LDAP directory.
+LDAP is an LDAP connection object created with `ldap-open'.
+DN is the distinguished name of the entry to modify.
+MODS is a list of modifications to apply.
+A modification is a list of the form (MOD-OP ATTR VALUE1 VALUE2 ...)
+MOD-OP and ATTR are mandatory, VALUEs are optional depending on MOD-OP.
+MOD-OP is the type of modification, one of the symbols `add', `delete'
+or `replace'.  ATTR is the LDAP attribute type to modify."
+  (let* ((plist (or (nth 2 ldap)
+                   (cdr (assoc (ldap-host ldap)
+                               ldap-host-parameters-alist))))
+        (port   (plist-get plist 'port))
+        (binddn (plist-get plist 'binddn))
+        (passwd (plist-get plist 'passwd))
+        arglist ret)
+    (setq arglist (list (format "-h%s" (ldap-host ldap))))
+    (if (and port (not (equal 389 port)))
+       (setq arglist (nconc arglist (list (format "-p%d" port)))))
+    (if (and binddn
+            (not (equal "" binddn)))
+       (setq arglist (nconc arglist (list (format "-D%s" binddn)))))
+    (if (and passwd
+            (not (equal "" passwd)))
+       (setq arglist (nconc arglist (list (format "-w%s" passwd)))))
+    (with-temp-buffer
+      (ldap/ldif-insert-field "dn" dn)
+      (insert "changetype: modify\n")
+      (while mods
+       (cond
+        ((eq (nth 0 (car mods)) 'add)
+         (insert "add: " (nth 1 (car mods)) "\n")
+         (ldap/ldif-insert-field (nth 1 (car mods)) (nth 2 (car mods)))
+         (insert "-\n"))
+        ((eq (nth 0 (car mods)) 'delete)
+         (insert "delete: " (nth 1 (car mods)) "\n-\n"))
+        ((eq (nth 0 (car mods)) 'replace)
+         (insert "replace: " (nth 1 (car mods)) "\n")
+         (ldap/ldif-insert-field (nth 1 (car mods)) (nth 2 (car mods)))
+         (insert "-\n")))
+       (setq mods (cdr mods)))
+      (setq ret (apply 'call-process-region
+                      (point-min) (point-max)
+                      ldap-modify-program
+                      t t nil
+                      arglist))
+      (if (integerp ret)
+         (if (not (zerop ret))
+             (error (car (split-string (buffer-string) "\n"))))
+       (if (and (setq ret (buffer-string)); Nemacs
+                (string-match "ldap_modify:" ret))
+           (error (car (split-string ret "\n"))))))))
+
+(defun ldap-add (ldap dn entry)
+  "Add an entry to an LDAP directory.
+LDAP is an LDAP connection object created with `ldap-open'.
+DN is the distinguished name of the entry to add.
+ENTRY is an entry specification, i.e., a list of cons cells
+containing attribute/value string pairs."
+  (let* ((plist (or (nth 2 ldap)
+                   (cdr (assoc (ldap-host ldap)
+                               ldap-host-parameters-alist))))
+        (port   (plist-get plist 'port))
+        (binddn (plist-get plist 'binddn))
+        (passwd (plist-get plist 'passwd))
+        arglist ret)
+    (setq arglist (list (format "-h%s" (ldap-host ldap))))
+    (if (and port (not (equal 389 port)))
+       (setq arglist (nconc arglist (list (format "-p%d" port)))))
+    (if (and binddn
+            (not (equal "" binddn)))
+       (setq arglist (nconc arglist (list (format "-D%s" binddn)))))
+    (if (and passwd
+            (not (equal "" passwd)))
+       (setq arglist (nconc arglist (list (format "-w%s" passwd)))))
+    (with-temp-buffer
+      (set-buffer-multibyte nil)
+      (ldap/ldif-insert-field "dn" dn)
+      (while entry
+       (ldap/ldif-insert-field (car (car entry)) (cdr (car entry)))
+       (setq entry (cdr entry)))
+      (setq ret (apply 'call-process-region
+                      (point-min) (point-max)
+                      ldap-add-program
+                      t t nil
+                      arglist))
+      (if (integerp ret)
+         (if (not (zerop ret))
+             (error (car (split-string (buffer-string) "\n"))))
+       (if (and (setq ret (buffer-string)) ; Nemacs
+                (string-match "ldap_add:" ret))
+           (error (car (split-string ret "\n"))))))))
+
+(defun ldap-search-basic (ldap filter base scope
+                              &optional attrs attrsonly withdn verbose)
+  "Perform a search on a LDAP server.  (Use external program `ldapsearch')
+FILTER is a filter string for the search as described in RFC 1558.
+BASE is the distinguished name at which to start the search.
+SCOPE is one of the symbols `base', `onelevel' or `subtree' indicating
+the scope of the search.
+ATTRS is a list of strings indicating which attributes to retrieve
+ for each matching entry.  If nil return all available attributes.
+If ATTRSONLY is non-nil then only the attributes are retrieved, not
+the associated values.
+If WITHDN is non-nil each entry in the result will be prepended with
+its distinguished name DN.
+If VERBOSE is non-nil progress messages will be echoed.
+The function returns a list of matching entries.  Each entry is itself
+an alist of attribute/value pairs optionally preceded by the DN of the
+entry according to the value of WITHDN."
+  (let* ((plist (or (nth 2 ldap)
+                   (cdr (assoc (ldap-host ldap)
+                               ldap-host-parameters-alist))))
+        (port   (plist-get plist 'port))
+        (base (or base (plist-get plist 'base) ldap-default-base))
+        (scope (or scope (plist-get plist 'scope)))
+        (binddn (plist-get plist 'binddn))
+        (passwd (plist-get plist 'passwd))
+        (deref (plist-get plist 'deref))
+        (timelimit (plist-get plist 'timelimit))
+        (sizelimit (plist-get plist 'sizelimit))
+        start value attrs-result
+        (i 0)
+        result arglist ret)
+    (setq arglist (list (format "-h%s" (ldap-host ldap))))
+    (if (and port (not (equal 389 port)))
+       (setq arglist (nconc arglist (list (format "-p%d" port)))))
+    (if (and base
+            (not (equal "" base)))
+       (setq arglist (nconc arglist (list (format "-b%s" base)))))
+    (if (and scope
+            (not (equal "" scope)))
+       (setq
+        arglist
+        (nconc
+         arglist
+         (list (format "-s%s"
+                       (cond ((eq scope 'onelevel) "one")
+                             ((eq scope 'base) "base")
+                             ((eq scope 'subtree) "sub")
+                             ((null scope) "sub")
+                             (t (error "Invalid scope: %s" scope))))))))
+    (if (and binddn
+            (not (equal "" binddn)))
+       (setq arglist (nconc arglist (list (format "-D%s" binddn)))))
+    (if (and passwd
+            (not (equal "" passwd)))
+       (setq arglist (nconc arglist (list (format "-w%s" passwd)))))
+    (if (and deref
+            (not (equal "" deref)))
+       (setq arglist (nconc arglist (list (format "-a%s" deref)))))
+    (if (and timelimit
+            (not (equal "" timelimit)))
+       (setq arglist (nconc arglist (list (format "-l%s" timelimit)))))
+    (if (and sizelimit
+            (not (equal "" sizelimit)))
+       (setq arglist (nconc arglist (list (format "-z%s" sizelimit)))))
+    (with-temp-buffer
+      (set-buffer-multibyte nil)
+      (setq ret (apply 'call-process
+                      ldap-search-program
+                      nil (current-buffer) t
+                      (append arglist
+                              ldap-search-program-arguments
+                              (list filter)
+                              attrs)))
+      (if (and (integerp ret)
+              (not (zerop ret)))
+         (error "LDAP error: \"No such object\""))
+      (goto-char (point-min))
+      (setq start (point))
+      (while (and (not (eobp))
+                 (re-search-forward "^$" nil t)) ; empty line is a delimiter.
+       (if verbose
+           (message "Parsing ldap results...%d" (setq i (+ i 1))))
+       (save-excursion
+         (save-restriction
+           (narrow-to-region start (point))
+           (if attrs
+               (setq attrs-result (delq
+                                   nil
+                                   (mapcar
+                                    (lambda (attr)
+                                      ;; dn is not an attribute.
+                                      (unless (string= attr "dn")
+                                        (if (setq value
+                                                  (ldap/field-body attr))
+                                            (if attrsonly
+                                                (list attr)
+                                              (nconc (list attr) value)))))
+                                    attrs)))
+             (setq attrs-result (ldap/collect-field "dn"))
+             (if attrsonly
+                 (setq attrs-result (mapcar (lambda (x) (list (car x)))
+                                            attrs-result))))
+           (setq result
+                 (cons
+                  (if withdn
+                      (if attrs-result
+                          (nconc (ldap/field-body "dn") attrs-result)
+                        (ldap/field-body "dn"))
+                    attrs-result)
+                  result))))
+       (if (not (eobp)) (forward-char 1))
+       (setq start (point)))
+      (if verbose
+         (message "Parsing ldap results...done."))
+      (delq nil (nreverse result)))))
+
+(defun ldap/field-end ()
+  "Move to end of field and return this point."
+  (if (re-search-forward ldap-ldif-next-field-head-regexp nil t)
+      (goto-char (match-beginning 0))
+    (if (re-search-forward "^$" nil t)
+       (goto-char (1- (match-beginning 0)))
+      (end-of-line)))
+  (point))
+
+(defun ldap/field-body (name)
+  "Return field body list of NAME."
+  (save-excursion
+    (goto-char (point-min))
+    (let ((case-fold-search t)
+         (field-body nil)
+         body)
+      (while (re-search-forward (concat "^" name ":[ \t]*") nil t)
+       ;; Base64
+       (if (string-match "^:[ \t]*" (setq body
+                                          (buffer-substring-no-properties
+                                           (match-end 0)
+                                           (ldap/field-end))))
+           (setq body (base64-decode-string (substring body (match-end 0)))))
+       (setq field-body (nconc field-body (list body))))
+      field-body)))
+
+(defun ldap/collect-field (without)
+  "Collect fields without WITHOUT."
+  (goto-char (point-min))
+  (let ((regexp (concat "\\(" ldap-ldif-field-head-regexp "\\)[ \t]*"))
+       dest name body entry)
+    (while (re-search-forward regexp nil t)
+      (setq name (downcase (buffer-substring-no-properties
+                           (match-beginning 1)(1- (match-end 1)))))
+      (setq body (buffer-substring-no-properties
+                 (match-end 0) (ldap/field-end)))
+      (if (string-match "^:[ \t]*" body)
+         (setq body (base64-decode-string (substring body (match-end 0)))))
+      (unless (string= name without)
+       (if (setq entry (assoc name dest))
+           (nconc entry (list body))
+         (setq dest (cons (list name body) dest)))))
+    (nreverse dest)))
+
+;;; Coding/decoding functions
+;;
+(defun ldap-encode-boolean (bool)
+  "Encode BOOL to LDAP type."
+  (if bool
+      "TRUE"
+    "FALSE"))
+
+(defun ldap-decode-boolean (str)
+  "Decode STR to elisp type."
+  (cond
+   ((string-equal str "TRUE")
+    t)
+   ((string-equal str "FALSE")
+    nil)
+   (t
+    (error "Wrong LDAP boolean string: %s" str))))
+    
+(defun ldap-encode-country-string (str)
+  "Encode STR to LDAP country string."
+  ;; We should do something useful here...
+  (if (not (= 2 (length str)))
+      (error "Invalid country string: %s" str)))
+
+(defun ldap-decode-string (str)
+  "Decode LDAP STR."
+  (if (fboundp 'decode-coding-string)
+      (decode-coding-string str ldap-coding-system)))
+
+(defun ldap-encode-string (str)
+  "Encode LDAP STR."
+  (if (fboundp 'encode-coding-string)
+      (encode-coding-string str ldap-coding-system)))
+
+(defun ldap-decode-address (str)
+  "Decode LDAP address STR."
+  (mapconcat 'ldap-decode-string
+            (split-string str "\\$")
+            "\n"))
+
+(defun ldap-encode-address (str)
+  "Encode address STR to LDAP type."
+  (mapconcat 'ldap-encode-string
+            (split-string str "\n")
+            "$"))
+
+;;; LDAP protocol functions
+;;    
+(defun ldap-get-host-parameter (host parameter)
+  "Get HOST's PARAMETER in `ldap-host-parameters-alist'."
+  (plist-get (cdr (assoc host ldap-host-parameters-alist))
+            parameter))
+
+(defun ldap-encode-attribute (attr)
+  "Encode the attribute/value pair ATTR according to LDAP rules.
+The attribute name is looked up in `ldap-attribute-syntaxes-alist'
+and the corresponding decoder is then retrieved from
+`ldap-attribute-syntax-encoders' and applied on the value(s)."
+  (let* ((name (car attr))
+        (values (cdr attr))
+        (syntax-id (cdr (assq (intern (downcase name))
+                              ldap-attribute-syntaxes-alist)))
+        encoder)
+    (if syntax-id
+       (setq encoder (aref ldap-attribute-syntax-encoders
+                           (1- syntax-id)))
+      (setq encoder ldap-default-attribute-encoder))
+    (if encoder
+       (cons name (mapcar encoder values))
+      attr)))
+       
+(defun ldap-decode-attribute (attr)
+  "Decode the attribute/value pair ATTR according to LDAP rules.
+The attribute name is looked up in `ldap-attribute-syntaxes-alist'
+and the corresponding decoder is then retrieved from
+`ldap-attribute-syntax-decoders' and applied on the value(s)."
+  (if (consp attr)
+      (let* ((name (car attr))
+            (values (cdr attr))
+            (syntax-id (cdr (assq (intern (downcase name))
+                                  ldap-attribute-syntaxes-alist)))
+            decoder)
+       (if syntax-id
+           (setq decoder (aref ldap-attribute-syntax-decoders
+                               (1- syntax-id)))
+         (setq decoder ldap-default-attribute-decoder))
+       (if decoder
+           (cons name (mapcar decoder values))
+         attr))
+    attr))
+    
+(defun ldap-search (arg1 &rest args)
+  "Perform an LDAP search.if ARG1 is LDAP object, invoke `ldap-search-basic'.
+Otherwise, invoke `ldap-search-entries'.  ARGS are passed to each function."
+      (apply (if (ldapp arg1)
+                'ldap-search-basic
+              'ldap-search-entries) arg1 args))
+
+(make-obsolete 'ldap-search
+              "Use `ldap-search-entries' instead or
+`ldap-search-basic' for the low-level search API.")
+
+(defun ldap-search-entries (filter &optional host attributes attrsonly withdn)
+  "Perform an LDAP search.
+FILTER is the search filter in RFC1558 syntax, i.e., something that
+looks like \"(cn=John Smith)\".
+HOST is the LDAP host on which to perform the search.
+ATTRIBUTES is a list of attributes to retrieve; nil means retrieve all.
+If ATTRSONLY is non nil, the attributes will be retrieved without
+the associated values.
+If WITHDN is non-nil each entry in the result will be prepennded with
+its distinguished name DN.
+Additional search parameters can be specified through
+`ldap-host-parameters-alist' which see.
+The function returns a list of matching entries.  Each entry is itself
+an alist of attribute/value pairs optionally preceded by the DN of the
+entry according to the value of WITHDN."
+  (interactive "sFilter:")
+  (or host
+      (setq host ldap-default-host)
+      (error "No LDAP host specified"))
+  (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
+       ldap
+       result)
+    (if ldap-verbose
+       (message "Opening LDAP connection to %s..." host))
+    (setq ldap (ldap-open host host-plist))
+    (if ldap-verbose
+       (message "Searching with LDAP on %s..." host))
+    (setq result (ldap-search ldap filter
+                             (plist-get host-plist 'base)
+                             (plist-get host-plist 'scope)
+                             attributes attrsonly withdn
+                             ldap-verbose))
+    (ldap-close ldap)
+    (with-temp-buffer
+      (set-buffer-multibyte nil)
+      (if ldap-ignore-attribute-codings
+         result
+       (mapcar (function
+                (lambda (record)
+                  (mapcar 'ldap-decode-attribute record)))
+               result)))))
+
+(defun ldap-add-entries (entries &optional host binddn passwd)
+  "Add entries to an LDAP directory.
+ENTRIES is a list of entry specifications of
+the form (DN (ATTR . VALUE) (ATTR . VALUE) ...) where
+DN is the distinguished name of an entry to add, the following
+are cons cells containing attribute/value string pairs.
+HOST is the LDAP host, defaulting to `ldap-default-host'
+BINDDN is the DN to bind as to the server
+PASSWD is the corresponding password"
+  (or host
+      (setq host ldap-default-host)
+      (error "No LDAP host specified"))
+  (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
+       ldap
+       (i 1))
+    (if (or binddn passwd)
+       (setq host-plist (copy-seq host-plist)))
+    (if binddn
+       (setq host-plist (plist-put host-plist 'binddn binddn)))
+    (if passwd
+       (setq host-plist (plist-put host-plist 'passwd passwd)))
+    (if ldap-verbose
+       (message "Opening LDAP connection to %s..." host))
+    (setq ldap (ldap-open host host-plist))
+    (if ldap-verbose
+       (message "Adding LDAP entries..."))
+    (mapcar (lambda (thisentry)
+             (setcdr thisentry
+                     (mapcar
+                      (lambda (add-spec)
+                        (setq add-spec (ldap-encode-attribute
+                                        (list (car add-spec)
+                                              (cdr add-spec))))
+                        (cons (nth 0 add-spec)
+                              (nth 1 add-spec)))
+                      (cdr thisentry)))
+             (setq thisentry (ldap-encode-attribute thisentry))
+             (ldap-add ldap (car thisentry) (cdr thisentry))
+             (if ldap-verbose
+                 (message "%d added" i))
+             (setq i (1+ i)))
+           entries)
+    (ldap-close ldap)))
+
+(defun ldap-modify-entries (entry-mods &optional host binddn passwd)
+  "Modify entries of an LDAP directory.
+ENTRY-MODS is a list of entry modifications of the form
+  \(DN MOD-SPEC1 MOD-SPEC2 ...\) where DN is the distinguished name of
+the entry to modify, the following are modification specifications.
+A modification specification is itself a list of the form
+\(MOD-OP ATTR VALUE1 VALUE2 ...\) MOD-OP and ATTR are mandatory,
+VALUEs are optional depending on MOD-OP.
+MOD-OP is the type of modification, one of the symbols `add', `delete'
+or `replace'.  ATTR is the LDAP attribute type to modify.
+HOST is the LDAP host, defaulting to `ldap-default-host'
+BINDDN is the DN to bind as to the server
+PASSWD is the corresponding password"
+  (or host
+      (setq host ldap-default-host)
+      (error "No LDAP host specified"))
+  (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
+       ldap
+       (i 1))
+    (if (or binddn passwd)
+       (setq host-plist (copy-seq host-plist)))
+    (if binddn
+       (setq host-plist (plist-put host-plist 'binddn binddn)))
+    (if passwd
+       (setq host-plist (plist-put host-plist 'passwd passwd)))
+    (if ldap-verbose
+       (message "Opening LDAP connection to %s..." host))
+    (setq ldap (ldap-open host host-plist))
+    (if ldap-verbose
+       (message "Modifying LDAP entries..."))
+    (mapcar (lambda (thisentry)
+             (setcdr thisentry
+                     (mapcar
+                      (lambda (mod-spec)
+                        (if (or (eq (car mod-spec) 'add)
+                                (eq (car mod-spec) 'replace))
+                            (append (list (nth 0 mod-spec))
+                                    (ldap-encode-attribute
+                                     (cdr mod-spec)))))
+                      (cdr thisentry)))
+             (ldap-modify ldap (car thisentry) (cdr thisentry))
+             (if ldap-verbose
+                 (message "%d modified" i))
+             (setq i (1+ i)))
+           entry-mods)
+    (ldap-close ldap)))
+
+(defun ldap-delete-entries (dn &optional host binddn passwd)
+  "Delete an entry from an LDAP directory.
+DN is the distinguished name of an entry to delete or
+a list of those.
+HOST is the LDAP host, defaulting to `ldap-default-host'
+BINDDN is the DN to bind as to the server
+PASSWD is the corresponding password."
+  (or host
+      (setq host ldap-default-host)
+      (error "No LDAP host specified"))
+  (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
+       ldap)
+    (if (or binddn passwd)
+       (setq host-plist (copy-seq host-plist)))
+    (if binddn
+       (setq host-plist (plist-put host-plist 'binddn binddn)))
+    (if passwd
+       (setq host-plist (plist-put host-plist 'passwd passwd)))
+    (if ldap-verbose
+       (message "Opening LDAP connection to %s..." host))
+    (setq ldap (ldap-open host host-plist))
+    (if (consp dn)
+       (let ((i 1))
+         (if ldap-verbose
+             (message "Deleting LDAP entries..."))
+         (mapcar (function
+                  (lambda (thisdn)
+                    (ldap-delete ldap thisdn)
+                    (if ldap-verbose
+                        (message "%d deleted" i))
+                    (setq i (1+ i))))
+                 dn))
+      (if ldap-verbose
+         (message "Deleting LDAP entry..."))
+      (ldap-delete ldap dn))
+    (ldap-close ldap)))
+;; end of ldap-static-if
+)
+
+(provide 'pldap)
+
+;;; pldap.el ends here
diff --git a/etc/icons/letter.xpm b/etc/icons/letter.xpm
new file mode 100644 (file)
index 0000000..ee6b5fc
--- /dev/null
@@ -0,0 +1,20 @@
+/* XPM */
+static char * jmail_xpm[] = {
+"18 13 4 1",
+"      s None c None",
+".     c gray85",
+"X     c yellow",
+"o     c black",
+"                  ",
+"                  ",
+"   .XXXXXXXXXXX.  ",
+"   XoXXXXXXXXXoXoo",
+"   XXoXXXXXXXoXXoo",
+"   XXXoXXXXXoXXXoo",
+"   XXX.oXXXo.XXXoo",
+"   XXXo.oXo.oXXXoo",
+"   XXoXXXoXXXoXXoo",
+"   XoXXXXXXXXXoXoo",
+"   .XXXXXXXXXXX.oo",
+"     ooooooooooooo",
+"     ooooooooooooo"};
diff --git a/etc/icons/no-letter.xpm b/etc/icons/no-letter.xpm
new file mode 100644 (file)
index 0000000..72e8880
--- /dev/null
@@ -0,0 +1,20 @@
+/* XPM */
+static char * jmail_xpm[] = {
+"18 13 4 1",
+"      s None  c None",
+".     c gray55",
+"o     c black",
+"x     c gray95",
+"                  ",
+"                  ",
+"   ooooooooooooox ",
+"   o.xxxxxxxxx.ox ",
+"   oxox      oxox ",
+"   ox ox    ox ox ",
+"   ox  ox  ox  ox ",
+"   ox oxoxoxox ox ",
+"   oxox  ox  oxox ",
+"   o.x        .ox ",
+"   ooooooooooooox ",
+"   xxxxxxxxxxxxxx ",
+"                  "};
index d0d3218..ff26c4d 100644 (file)
 #define wl-logo_height 160
 static char wl-logo_bits[] = {
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x16,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x80,0x02,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x0a,
+ 0x50,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xa2,0xa8,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x2a,0x42,0xa9,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x14,0x04,0x2a,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xaa,0x54,0x02,0x2a,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x7a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x28,0xa1,0xa2,0x80,0x02,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xa0,0x6a,0xa2,0xa8,0x84,0x02,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x80,0x77,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x24,0x85,0x08,0x10,0x2a,0x28,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xaa,0x4a,0x55,0x55,0x05,0x21,0x28,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x80,0x7a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x49,0x28,0xa5,0x8a,0x80,0x82,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x6d,
+ 0xc0,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xaa,0x22,0x55,0xc9,0x50,0x94,0x82,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x40,0x24,0x45,0x48,0x40,0x2a,0x24,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x6b,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
+ 0x52,0x4d,0xaa,0xa2,0x0a,0x41,0x28,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x76,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x92,
- 0x10,0x85,0x2a,0x80,0x08,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb8,0x7d,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x8a,0x2a,
+ 0x49,0x4d,0x51,0x14,0x82,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb4,0x6b,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x48,0x24,0xa5,0x28,
- 0x80,0x2a,0x42,0x44,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x6b,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x52,0x94,0x94,0x54,
+ 0x85,0x42,0x49,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x22,0x49,0x12,0x82,0x2a,0x80,
- 0x28,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xda,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xa5,0x2a,0x55,0xaa,0x22,0x10,
+ 0x22,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x80,0xb7,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x55,0x92,0xa4,0x54,0x00,0x25,0x02,0x54,
+ 0x00,0x00,0x00,0x00,0x80,0x6d,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x14,0xa0,0x12,0xa9,0x28,0x55,0x95,0x8a,0x88,0x42,
  0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x40,0x6d,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x94,0x08,0x09,0x11,0x82,0xaa,0x88,0x90,0x00,0x10,0x00,
+ 0x00,0x00,0x80,0xb6,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x80,0x2a,0x54,0xa9,0x54,0xaa,0x50,0x45,0x20,0x22,0x88,0x10,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xa0,0xbb,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x51,0x52,0x52,0xa4,0x28,0x00,0x22,0x44,0x24,0x21,0x00,0x00,0x00,
+ 0xe0,0x7b,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x20,0x15,0x52,0x45,0x52,0x25,0x5a,0x15,0x95,0x08,0x11,0x22,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x6d,
- 0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x8a,0x8a,0x24,0x09,0x85,0xaa,0x08,0x11,0x02,0x84,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0xd6,
+ 0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x45,
+ 0xa9,0x29,0x51,0x50,0xa1,0x8a,0x20,0x42,0x42,0x84,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb8,0xb7,0x6b,0x00,
- 0x00,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x29,0x29,
- 0x89,0xa4,0x28,0x01,0xa2,0x84,0xa8,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdc,0xbb,0x76,0x00,
+ 0x00,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x50,0x25,0x95,0x94,
+ 0xaa,0xaa,0x54,0x55,0x8a,0x28,0x08,0x48,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6f,0x6d,0x7d,0x00,0x00,0x00,
- 0x00,0x00,0xa0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xa4,0xa4,0x50,0x12,
- 0x12,0xaa,0x08,0x50,0x00,0x82,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6b,0xdd,0x7b,0x00,0x00,0x00,
+ 0x00,0x00,0xa0,0x0a,0x00,0x00,0x00,0x00,0x00,0x28,0x94,0x48,0x43,0xa4,0x62,
+ 0x82,0x0a,0x21,0x82,0x42,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xb5,0xdb,0x76,0x00,0x00,0x00,0x00,0x00,
- 0x58,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x12,0x49,0x0a,0x49,0xa1,0x00,
- 0x42,0x05,0x92,0x20,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xbd,0xb7,0x76,0x00,0x00,0x00,0x00,0x00,
+ 0x58,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x25,0xa9,0xa2,0x94,0xa9,0x4a,
+ 0x88,0x28,0x10,0x48,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xc0,0xdf,0xb6,0x3b,0x00,0x00,0x00,0x00,0x00,0x6a,0x35,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0xaa,0x92,0xa2,0x20,0x0a,0xaa,0x28,0xa0,
- 0x04,0x88,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xe0,0xd6,0xda,0x3b,0x00,0x00,0x00,0x00,0x00,0xac,0x36,
+ 0x00,0x00,0x00,0x00,0x14,0x00,0xaa,0xaa,0x15,0xa9,0xa2,0x16,0x24,0x25,0x82,
+ 0x8a,0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x78,0xb5,0x6d,0x3d,0x00,0x00,0x00,0x00,0x00,0xad,0x6a,0x00,0x00,
- 0x00,0x00,0x00,0x40,0x25,0x49,0x48,0x14,0x95,0x50,0x01,0x82,0x0a,0xa0,0x02,
- 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xb8,0x7b,0x6f,0x3d,0x00,0x00,0x00,0x00,0x00,0xd6,0x6a,0x00,0x00,
+ 0x00,0x80,0x2a,0x80,0x4a,0x48,0xa6,0xd4,0x54,0x49,0x89,0x80,0x28,0x20,0xa8,
+ 0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xd6,0x6e,0xdb,0x36,0x00,0x00,0x00,0x00,0x00,0x55,0x6b,0x00,0x00,0x00,0x00,
- 0x00,0x80,0xa8,0x24,0x95,0xa2,0x68,0x0f,0xa8,0x28,0xa0,0x0a,0x28,0x11,0x00,
+ 0xd6,0xde,0xda,0x36,0x00,0x00,0x00,0x00,0x80,0xab,0x6a,0x00,0x00,0x00,0x50,
+ 0x15,0x40,0xad,0x26,0x29,0x45,0x59,0x2d,0x22,0x54,0x82,0x0a,0x01,0x10,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x7a,0xdb,
- 0xbd,0x3b,0x00,0x00,0x00,0x00,0xc0,0x6a,0xd5,0x00,0x00,0x00,0x00,0x00,0x50,
- 0x95,0x92,0x42,0xfc,0x1f,0xc0,0x0f,0x82,0x0a,0x20,0x01,0x24,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7b,0x6b,
+ 0xb7,0x3d,0x00,0x00,0x00,0x00,0x40,0xda,0xd6,0x00,0x00,0x00,0x28,0x54,0xa0,
+ 0x2a,0xa9,0x86,0xbc,0xbf,0xc2,0x9f,0x02,0x28,0x40,0x88,0x24,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xd7,0x76,0x6b,0x1d,
- 0x00,0x00,0x00,0x00,0x40,0xab,0xea,0x00,0x00,0x00,0x00,0x00,0x24,0x49,0x4a,
- 0xe9,0x0f,0x00,0x00,0xe0,0x28,0x90,0x04,0x90,0x60,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xd6,0xbd,0xed,0x1e,
+ 0x00,0x00,0x00,0x00,0x40,0xab,0xea,0x00,0x00,0x00,0x20,0x20,0x28,0xa9,0x24,
+ 0xf9,0x6f,0x00,0x00,0xe0,0xa8,0x02,0x29,0x22,0x60,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xbd,0xdb,0xb6,0x1f,0x00,0x00,
- 0x00,0x00,0x50,0x55,0xd5,0x00,0x00,0x00,0x00,0x00,0x90,0x24,0x29,0x7e,0x00,
- 0x00,0x00,0x00,0x86,0x42,0x50,0x05,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd8,0x7d,0xd7,0xbb,0x1d,0x00,0x00,
+ 0x00,0x00,0xb0,0xaa,0xea,0x00,0x00,0x00,0x10,0x50,0xaa,0xaa,0x92,0x76,0x20,
+ 0x00,0x00,0x00,0x06,0x50,0x82,0x08,0x49,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0xd7,0xd7,0xb6,0x6d,0x1d,0x00,0x00,0x00,0x00,
- 0xa0,0xda,0xf6,0x00,0x00,0x00,0x00,0x00,0xaa,0xaa,0xd4,0x07,0x00,0x00,0x00,
- 0x00,0x30,0x10,0x02,0xa0,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x77,0xd7,0x7a,0x6d,0x1f,0x00,0x00,0x00,0x00,
+ 0xa0,0xb5,0xed,0x00,0x00,0x00,0x08,0x20,0x94,0x54,0xd5,0xaf,0x50,0x00,0x00,
+ 0x00,0xb0,0x0a,0x20,0x20,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0xe0,0xba,0x7a,0x6f,0xb7,0x0f,0x00,0x00,0x00,0x00,0x70,0xab,
- 0x6a,0x00,0x00,0x00,0x00,0x80,0x4a,0x92,0xfa,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x45,0x11,0x09,0x82,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xe0,0xba,0x7b,0xaf,0xdb,0x0e,0x00,0x00,0x00,0x00,0xd8,0x56,
+ 0x75,0x00,0x00,0x00,0x14,0x80,0x4a,0xaa,0xf8,0x50,0x15,0x00,0x00,0x00,0x80,
+ 0xa0,0x0a,0x45,0xa8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
- 0x01,0x5e,0xdf,0xd7,0xba,0xdb,0x0e,0x00,0x00,0x00,0x00,0x58,0x55,0x75,0x00,
- 0x00,0x00,0x00,0x40,0x29,0x49,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x44,
- 0x20,0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xfe,0xf5,
- 0x6b,0xbd,0x6d,0x6d,0x07,0x00,0x00,0x00,0x00,0x56,0xad,0x75,0x00,0x00,0x00,
- 0x00,0x50,0x4a,0xd5,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x10,0x04,0x09,
+ 0x01,0xbe,0xdf,0xd6,0xf5,0x76,0x0f,0x00,0x00,0x00,0x00,0xa8,0xaa,0x6a,0x00,
+ 0x50,0x01,0x08,0xa0,0x52,0xa9,0x1f,0xa0,0x0a,0x00,0x00,0x00,0x00,0x0a,0xa0,
+ 0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xfe,0xd5,
+ 0xea,0xbd,0x5e,0xaf,0x07,0x00,0x00,0x00,0x00,0x56,0x75,0x75,0x00,0x54,0x05,
+ 0x10,0x40,0x4a,0x55,0x07,0x80,0x0a,0x00,0x00,0x00,0x00,0xa0,0x0a,0x2a,0x44,
  0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xab,0x5e,0xbd,0x6b,
- 0xb7,0xbb,0x07,0x00,0x00,0x00,0x00,0xaa,0x55,0x75,0x00,0x00,0x00,0x00,0x48,
- 0xa5,0xf4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x42,0x41,0x80,0x02,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xeb,0x6e,0xdd,0xdb,0xed,
- 0x03,0x00,0x00,0x00,0x00,0xb5,0xb6,0x3a,0x00,0x00,0x00,0x00,0xa0,0x54,0x3e,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x08,0x14,0x25,0x06,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xab,0xbe,0xf5,0x77,0xbd,0xda,0x01,0x00,
- 0x00,0x00,0x80,0x56,0xd5,0x3a,0x00,0x00,0x00,0x00,0x54,0x92,0x0f,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x82,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x80,0xfe,0xeb,0xaf,0xda,0xd6,0xf7,0x00,0x00,0x00,0x00,
- 0x80,0x6a,0x55,0x1d,0x00,0x00,0x00,0x00,0x95,0xca,0x03,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x28,0x92,0x28,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0xab,0xbe,0xda,0x6f,0x7b,0x7d,0x00,0x00,0x00,0x00,0xa0,0xad,
- 0xaa,0x1e,0x00,0x00,0x00,0x00,0x55,0xf5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x02,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0xfe,0xd7,0xbf,0xba,0xad,0x3b,0x00,0x00,0x00,0x00,0x60,0xd5,0xb6,0x0e,
- 0x00,0x00,0x00,0x80,0x92,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x50,0x49,0x88,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xab,
- 0xfa,0x6a,0xd7,0xd7,0x1e,0x00,0x00,0x00,0x00,0xa0,0x5a,0x55,0x0f,0x00,0x00,
- 0x00,0xa0,0x54,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
- 0x20,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x5f,0xff,
- 0xbb,0x7a,0x0f,0x00,0x00,0x00,0x00,0x58,0xab,0xaa,0x07,0x00,0x00,0x00,0x90,
- 0x92,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x84,0x82,0x08,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xac,0xea,0x55,0xed,0xde,
- 0x07,0x00,0x00,0x00,0x00,0xa8,0xd5,0xb6,0x03,0x00,0x00,0x00,0x48,0xd5,0x01,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x08,0x18,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf4,0x7f,0xbb,0xb7,0xeb,0x01,0x00,
- 0x00,0x00,0x00,0x68,0x6d,0xd5,0x01,0x00,0x00,0x00,0xa4,0xf4,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x85,0x40,0x1a,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0xd5,0x6e,0x6d,0xfd,0x00,0x00,0x00,0x00,
- 0x00,0xac,0xaa,0xea,0x00,0x00,0x00,0x00,0xa8,0x7a,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x12,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xf0,0xbf,0xdb,0xbb,0x3f,0x00,0x00,0x00,0x00,0x00,0xd6,
- 0x56,0x7b,0x00,0x00,0x00,0x00,0x2a,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x41,0x00,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0xb0,0xea,0xbd,0x6e,0x0f,0x00,0x00,0x00,0x00,0x00,0x5a,0xb5,0x3a,
- 0x00,0x00,0x00,0x00,0x55,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x08,0x49,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xc0,0x7f,0xeb,0xf5,0x03,0x00,0x00,0x00,0x00,0x00,0x6b,0xab,0x1d,0x00,0x00,
- 0x00,0x40,0xa5,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x22,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xaa,
- 0x5f,0xef,0x01,0x00,0x00,0x00,0x00,0x80,0x55,0xb5,0x0e,0x00,0x00,0x00,0x40,
- 0xd5,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x24,
- 0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xf5,0x7a,
- 0x00,0x00,0x00,0x00,0x00,0x80,0xb6,0xad,0x07,0x00,0x00,0x00,0x50,0xe9,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x00,0x36,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x57,0xff,0x5f,0xd7,
+ 0xeb,0xfa,0x07,0x00,0x00,0x00,0x00,0xea,0x56,0x7b,0x00,0x52,0x05,0x20,0x70,
+ 0x55,0x72,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x10,0x03,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfa,0x55,0xf5,0x7b,0xbd,0xad,
+ 0x03,0x00,0x00,0x00,0x00,0x5b,0x55,0x35,0x80,0x0a,0x0a,0x50,0x95,0x4a,0x3d,
+ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x12,0x12,0x02,0x06,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x5f,0xff,0x5f,0xad,0x6b,0xf7,0x01,0x00,
+ 0x00,0x00,0x00,0x55,0x5b,0x3d,0x80,0x02,0x08,0xa0,0xaa,0xaa,0x8f,0x35,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x40,0x48,0x06,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x80,0xf6,0xab,0xea,0xff,0xdd,0xed,0x00,0x00,0x00,0x00,
+ 0x80,0x6d,0xd5,0x1a,0xc2,0x02,0x10,0x40,0x6b,0xd5,0x83,0x4a,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x21,0x0a,0x01,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xbd,0xfe,0xbf,0xaa,0x6e,0x7b,0x00,0x00,0x00,0x00,0x60,0xb5,
+ 0xaa,0x5e,0x01,0x02,0x08,0x80,0x54,0xf5,0xa0,0x2a,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x88,0x20,0x24,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0xd7,0x57,0xd5,0x7d,0xb7,0x3d,0x00,0x00,0x00,0x00,0xa0,0xd6,0xb6,0x5e,
+ 0x05,0x05,0x14,0x00,0x95,0x3a,0xa0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x10,0x82,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,
+ 0xfa,0x7f,0xd7,0x7a,0x1f,0x00,0x00,0x00,0x00,0x50,0x5b,0x55,0xa7,0x02,0x04,
+ 0x08,0xa0,0x52,0x1f,0xa8,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,
+ 0xa8,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5a,0x5f,0xd5,
+ 0xfa,0xd7,0x0f,0x00,0x00,0x00,0x00,0xe8,0xaa,0xad,0x51,0x05,0x08,0x15,0xa0,
+ 0xaa,0x03,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x85,0x02,0x08,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf6,0xeb,0xbf,0xaf,0xba,
+ 0x07,0x00,0x00,0x00,0x00,0x28,0x6b,0xb5,0x0c,0x04,0xa8,0x0a,0x90,0xca,0x0b,
+ 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x19,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0xbd,0x6a,0xb5,0xef,0x01,0x00,
+ 0x00,0x00,0x00,0xd4,0xb5,0xaa,0x02,0x0a,0xa8,0x0a,0x54,0xf5,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x42,0x18,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xf4,0xef,0xff,0xef,0xfa,0x00,0x00,0x00,0x00,
+ 0x00,0x6a,0xd6,0x56,0x01,0x00,0xa8,0x0a,0xaa,0x7a,0x07,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x80,0xa0,0x08,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xb8,0xba,0xaa,0x7a,0x3f,0x00,0x00,0x00,0x00,0x00,0x5a,
+ 0xab,0x7a,0x81,0x00,0x50,0x15,0xa9,0x9a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x04,0x40,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xe0,0xef,0xff,0xaf,0x0f,0x00,0x00,0x00,0x00,0x00,0xad,0xad,0x3a,
+ 0x01,0x01,0x50,0xa8,0x54,0xab,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x91,0x12,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x60,0x7b,0x55,0xf5,0x03,0x00,0x00,0x00,0x00,0x80,0x6a,0x55,0x1d,0x42,0x01,
+ 0x40,0xa0,0xaa,0xaa,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xae,
+ 0xff,0xee,0x01,0x00,0x00,0x00,0x00,0x80,0xb6,0xb5,0x0f,0xaa,0x02,0x20,0x50,
+ 0xd5,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x49,
+ 0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfb,0xaa,0x7b,
+ 0x00,0x00,0x00,0x00,0x00,0x80,0xaa,0x56,0x07,0xaa,0x00,0x40,0xa0,0xea,0x0a,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x3a,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd4,0xaf,0x3f,0x00,0x00,
- 0x00,0x00,0x00,0xc0,0x5a,0xd5,0x03,0x00,0x00,0x00,0xa0,0x7a,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x49,0x39,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xff,0x1e,0x00,0x00,0x00,0x00,
- 0x00,0x40,0xd5,0xea,0x01,0x00,0x00,0x00,0x28,0x3d,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0x00,0x35,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xd4,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x07,0x00,0x00,0x00,0x00,0x00,0x70,
- 0x57,0xfd,0x00,0x00,0x00,0x00,0x54,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x10,0xa4,0x2a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x88,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0xfa,0x07,0x00,0x00,0x00,0x00,0x00,0xa0,0x6a,0x3b,
- 0x00,0x00,0x00,0x00,0x54,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x40,0x41,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xa2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0xdc,0x01,0x00,0x00,0x00,0x00,0x00,0xb0,0xb5,0x1e,0x00,0x00,
- 0x00,0x00,0xaa,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x08,0xa4,0x6a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x94,0x01,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0xeb,0x01,0x00,0x00,0x00,0x00,0x00,0xd8,0xae,0x0f,0x00,0x00,0x00,0x00,
- 0xa5,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,
- 0x50,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x54,0xd5,0x03,0x00,0x00,0x00,0x80,0xea,0x01,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x42,0x75,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x94,0x01,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x7b,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xa8,0xf5,0x01,0x00,0x00,0x00,0x40,0xf5,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x58,0x35,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xc8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3e,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x6e,0xed,0x00,0x00,0x00,0x00,0x40,0x75,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x35,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x80,0xd2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xb4,0x76,0x00,0x00,0x00,0x00,0xa0,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x14,0xa8,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x20,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0xd0,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0xab,0x75,
- 0x00,0x00,0x00,0x00,0x50,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x40,0x56,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x80,0xd2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,
- 0x00,0x00,0x00,0xf8,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x3a,0x00,0x00,
- 0x00,0x00,0xa8,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0xa9,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xc8,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x1c,0x00,0x00,
- 0x00,0xa8,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x6a,0x3d,0x00,0x00,0x00,0x00,
- 0x50,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x28,0xaa,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xe5,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x0c,0x00,0x00,0x00,0xf4,
- 0x03,0x00,0x00,0x00,0x00,0x00,0x80,0x56,0x1b,0x00,0x00,0x00,0x00,0xac,0x03,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,
- 0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x70,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0xdc,0x01,0x00,
- 0x00,0x00,0x00,0x00,0x40,0xb5,0x1d,0x00,0x00,0x00,0x00,0xa4,0x03,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x55,0x1d,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x75,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0xf6,0x00,0x00,0x00,0x00,
- 0x00,0x00,0xa0,0xad,0x0e,0x00,0x00,0x00,0x00,0xda,0x01,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0xaa,0x0e,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x48,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x92,0x07,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xd0,0xd6,0x0e,0x00,0x00,0x00,0x00,0xea,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xaa,0x0e,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x15,0x39,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x80,0x03,0x00,0x00,0x80,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x6b,
- 0x0f,0x00,0x00,0x00,0x80,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x48,0x55,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x40,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc4,
- 0x01,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x6a,0x5d,0x07,0x00,
- 0x00,0x00,0x40,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x50,0x55,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x95,
- 0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xe0,0x00,0x00,
- 0x00,0xc0,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0xbd,0xaa,0x07,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,0xff,0x3e,0x00,0x00,
+ 0x00,0x00,0x00,0xc0,0x55,0xb5,0x03,0xaa,0x02,0x40,0xa8,0x75,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x28,0x35,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x57,0x1f,0x00,0x00,0x00,0x00,
+ 0x00,0xa0,0xaa,0x6d,0x01,0x54,0x01,0x80,0xa8,0x3a,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x35,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xc4,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x07,0x00,0x00,0x00,0x00,0x00,0x50,
+ 0xd5,0xf6,0x00,0x94,0x82,0xa0,0x54,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x20,0xc8,0x2a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x92,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0xaa,0x07,0x00,0x00,0x00,0x00,0x00,0x60,0x57,0x3d,
+ 0x01,0x04,0x40,0x40,0x55,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x08,0x41,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xfc,0x01,0x00,0x00,0x00,0x00,0x00,0xb0,0xb5,0xde,0x00,0x10,
+ 0x40,0xa1,0xaa,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x22,0xa4,0x6a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa5,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0xd7,0x01,0x00,0x00,0x00,0x00,0x00,0x58,0xad,0x0f,0x01,0x08,0x80,0x80,
+ 0xaa,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,
+ 0x50,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x90,0x01,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xd4,0x56,0xc3,0x00,0x28,0x00,0xc1,0xea,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x75,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa5,0x01,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x7b,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xa8,0x7a,0x01,0x01,0x10,0x40,0x01,0xf5,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x50,0x35,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3f,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x76,0xeb,0x82,0x00,0x20,0xb4,0x62,0x75,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xaa,0x3a,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x40,0xd2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xac,0x75,0x81,0x02,0x50,0xa9,0x90,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x54,0x35,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x20,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0xf0,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0xb6,0x7a,
+ 0x8a,0x00,0xa0,0xaa,0xd0,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x08,0xaa,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x90,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x18,
+ 0x00,0x00,0x00,0x58,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x37,0xaa,0x02,
+ 0xa8,0x0a,0xa0,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x40,0xb4,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xe9,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00,
+ 0x00,0xf0,0x03,0x00,0x00,0x00,0x34,0x00,0x00,0xbb,0x3d,0x54,0x01,0x50,0x05,
+ 0x58,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x10,0x4b,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0xe4,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x0c,0x00,0x00,0x00,0xdc,
+ 0x03,0x00,0x00,0x00,0x15,0x00,0x80,0xd6,0x1a,0xa8,0x00,0x40,0x00,0xa8,0x03,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xb5,
+ 0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x69,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0e,0x00,0x00,0x00,0xf6,0x01,0x00,
+ 0x00,0x00,0xd5,0x00,0x80,0xab,0x1e,0xa0,0x02,0x00,0x00,0xaa,0x03,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xaa,0x1e,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x72,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x08,0x06,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00,
+ 0x54,0x01,0xe0,0xdc,0x0e,0x40,0x01,0x00,0x00,0xd5,0x01,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0xaa,0x0e,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x88,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x20,0x07,0x00,0x00,0x00,0x77,0x00,0x00,0x00,0x00,0x50,0x01,
+ 0x50,0x6b,0x0f,0x40,0x01,0x00,0x00,0xea,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xaa,0x0e,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x52,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x82,0x03,0x00,0x00,0x80,0x3d,0x00,0x00,0xc0,0x02,0xa8,0x02,0xa8,0xad,
+ 0x0e,0x40,0x01,0x00,0x00,0x75,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x50,0x55,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x09,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
+ 0x01,0x00,0x00,0x40,0x3f,0x00,0x00,0x54,0x01,0xa8,0x02,0x76,0x75,0x07,0x00,
+ 0x01,0x00,0xc0,0x7a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xa4,0x56,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,
+ 0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xe4,0x00,0x00,
+ 0x00,0xc0,0x1d,0x00,0x00,0x55,0x05,0x10,0x0a,0xad,0xab,0x07,0x00,0x00,0x00,
  0x80,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0xa0,0x2a,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x48,0x06,0x00,
+ 0x00,0x50,0x55,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x89,0x06,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x60,
- 0x0f,0x00,0x00,0x00,0x00,0x00,0x40,0xd5,0x6d,0x03,0x00,0x00,0x00,0x40,0x1d,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,
- 0x95,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x92,0x07,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x32,0x00,0x00,0x00,0xb0,0x0f,0x00,
- 0x00,0x00,0x00,0x00,0xa0,0xaf,0xb6,0x03,0x00,0x00,0x00,0x40,0x1d,0x00,0x00,
+ 0x0f,0x00,0x40,0x15,0x02,0x20,0x88,0x6d,0x5d,0x03,0x00,0x00,0x00,0x40,0x1d,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,
+ 0x95,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x54,0x07,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x30,0x00,0x00,0x00,0xd0,0x0f,0x00,
+ 0x50,0x15,0x04,0x10,0xe8,0xb6,0xea,0x03,0x00,0x00,0x00,0xa0,0x1e,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x95,0x01,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xc9,0x03,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x80,0x01,0x00,0x00,0x38,0x00,0x00,0x00,0xd8,0x07,0x00,0x00,0x00,
- 0x00,0x00,0xd8,0x76,0xd5,0x03,0x00,0x00,0x00,0xb0,0x0e,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0xc5,0x01,0x00,0x00,
- 0x00,0x00,0xa0,0x00,0x00,0x00,0xd2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xd0,0x01,0x00,0x00,0x1d,0x00,0x00,0x00,0xe8,0x03,0x00,0x00,0x00,0x00,0x00,
- 0xe8,0xab,0xdb,0x01,0x00,0x00,0x00,0x40,0x07,0x00,0x00,0x38,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0xc5,0x01,0x00,0x50,0x01,0x00,
- 0xa8,0x01,0x00,0x40,0xe9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc4,0x00,
- 0x00,0x20,0x0e,0x00,0x00,0x00,0xb8,0x03,0x00,0x00,0x00,0x00,0x00,0xde,0x5f,
- 0xd5,0x01,0x00,0x00,0x00,0xb0,0x07,0x00,0x00,0x56,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x54,0xd1,0x00,0x00,0x8a,0x0a,0x00,0xe2,0x01,
- 0x00,0x50,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x08,
- 0x07,0x00,0x00,0x00,0xee,0x01,0x00,0x00,0x00,0x00,0x00,0xf5,0xea,0xee,0x01,
- 0x00,0x00,0x00,0x94,0x03,0x00,0x00,0xfa,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
- 0x00,0x00,0x40,0x15,0x55,0xe1,0x00,0x00,0x69,0x1a,0x00,0xe8,0x00,0x00,0x80,
- 0x3a,0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x80,0x44,0x00,0x10,0x81,0x03,0x00,
- 0x00,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc0,0x7b,0x55,0xd5,0x00,0x00,0x00,
- 0x00,0xd4,0x03,0x00,0x00,0xd6,0x01,0x00,0x00,0x6a,0x00,0x00,0x00,0x00,0x00,
- 0xe8,0x0f,0xaa,0x70,0x00,0xa0,0x94,0x1a,0x00,0x6b,0x00,0x00,0x50,0x1c,0x00,
- 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x04,0x00,0x00,0x00,0x00,
- 0xef,0x00,0x00,0x00,0x00,0x00,0xa0,0x1e,0xdd,0xb6,0x00,0x00,0x00,0x00,0xd4,
- 0x01,0x00,0xff,0xed,0x01,0x00,0x80,0xf6,0x00,0x00,0x00,0x00,0x00,0xfd,0x00,
- 0x55,0x74,0x00,0xa0,0x57,0x1a,0x80,0x48,0x00,0x00,0x28,0x0f,0x00,0x40,0xd5,
- 0x00,0x00,0x00,0x00,0x40,0x42,0x01,0x44,0x20,0x00,0x0f,0x00,0x80,0x7a,0x00,
- 0x00,0x00,0x00,0x00,0x68,0x8f,0x6a,0xdb,0x01,0x00,0x00,0x00,0xea,0x00,0xf0,
- 0x7a,0xf7,0x01,0x00,0x80,0x6d,0x00,0x2c,0x00,0x00,0xc0,0x1e,0x00,0x15,0x31,
- 0x00,0xc8,0xa1,0x1a,0x40,0x25,0x01,0x00,0x80,0x07,0x00,0x00,0xe0,0x00,0x00,
- 0x15,0x00,0x10,0x00,0x02,0x00,0x01,0xf2,0x03,0x00,0xc0,0x7f,0x00,0x00,0x00,
- 0x00,0x00,0xb4,0x07,0x5b,0xd5,0x01,0x00,0x00,0x00,0xea,0x00,0xd4,0xc7,0xed,
- 0x00,0x00,0x60,0x7b,0x00,0xd7,0x00,0x00,0xb0,0x07,0x00,0x15,0x38,0x00,0x64,
- 0x50,0x1d,0x20,0x95,0x02,0x00,0xd4,0x03,0x00,0x40,0x75,0x00,0x40,0x30,0x00,
- 0x00,0x29,0x06,0x70,0xf0,0x7f,0x00,0x00,0xa0,0x3a,0x00,0x00,0x00,0x00,0x00,
- 0xdb,0x83,0xd6,0xb6,0x01,0x00,0x00,0x00,0x75,0x00,0xff,0x40,0x7b,0x00,0x00,
- 0xb0,0x7d,0xc0,0xf5,0x00,0x00,0xd4,0x03,0x80,0x4a,0x1d,0x00,0x1d,0x90,0x0e,
- 0xa0,0x52,0x18,0x00,0xe0,0x01,0x00,0x20,0x70,0x00,0x00,0x3a,0x00,0x40,0x80,
- 0x04,0x00,0x34,0x00,0x00,0x00,0xe0,0x3f,0x00,0x00,0x00,0x00,0x80,0xf6,0x80,
- 0x6d,0x5b,0x03,0x00,0x00,0x00,0x75,0xc0,0x7a,0x80,0x5d,0x00,0x00,0xd0,0x3a,
- 0x40,0xad,0x01,0x00,0xea,0x01,0x00,0x05,0x0c,0x80,0x0e,0x50,0x07,0x20,0x49,
- 0x35,0x00,0x74,0x00,0x00,0x48,0x3d,0x00,0xa0,0x18,0x00,0xc0,0x04,0x0c,0x80,
- 0x38,0x00,0x00,0x00,0x50,0x1d,0x00,0x00,0x00,0x00,0x80,0x7d,0xc0,0xb6,0xaa,
- 0x03,0x00,0x00,0x00,0x35,0x60,0x1f,0x00,0xeb,0x01,0x00,0x6c,0x1f,0xb0,0xd6,
- 0x01,0x00,0xed,0x00,0xc0,0x22,0x0e,0x40,0x0e,0xa0,0x03,0x90,0x2a,0x35,0x00,
- 0x3a,0x00,0x00,0x10,0x1e,0x00,0x10,0x1e,0x00,0x20,0x40,0x08,0x00,0x18,0x00,
- 0x00,0x00,0xf8,0x1f,0x00,0x00,0x00,0x00,0xf0,0x3e,0x40,0x5b,0xdb,0x06,0x00,
- 0x00,0x00,0x3d,0xd8,0x1d,0x80,0x5e,0x03,0x00,0xb8,0x1d,0x68,0xdb,0x01,0x00,
- 0x75,0x00,0x40,0x09,0x07,0x40,0x07,0xd4,0x01,0xc0,0xa5,0x38,0x00,0x39,0x00,
- 0x00,0xa2,0x07,0x00,0x88,0x0e,0x00,0x08,0x12,0x19,0x00,0x1d,0x00,0x00,0x00,
- 0x6c,0x1d,0x00,0x00,0x00,0x00,0x50,0x0f,0x40,0xed,0xad,0x06,0x00,0x00,0xc0,
- 0x1a,0x74,0x0f,0x00,0xb5,0x07,0x00,0xd6,0x0e,0xb4,0xad,0x01,0x80,0x75,0x00,
- 0x40,0x81,0x03,0x40,0x03,0xf5,0x00,0x04,0x94,0x1e,0x00,0x1c,0x00,0x00,0xc8,
- 0x03,0x00,0xa2,0x07,0x00,0x00,0x00,0x18,0x20,0x0c,0x00,0x00,0x00,0xd8,0x0f,
- 0x00,0x00,0x00,0x00,0xde,0x07,0x80,0xab,0xea,0x0e,0x00,0x00,0x40,0x1d,0xde,
- 0x07,0x80,0xed,0x06,0x00,0x6d,0x0f,0x72,0xf5,0x01,0xc0,0x3a,0x00,0xa0,0xa4,
- 0x03,0xa0,0x43,0x3c,0x00,0x00,0x50,0x0e,0x80,0x0e,0x00,0x00,0xe2,0x00,0x00,
- 0xc4,0x01,0x00,0x00,0x90,0x1c,0x00,0x0e,0x00,0x00,0x00,0xfe,0x0e,0x00,0x00,
- 0x00,0x00,0xea,0x03,0x40,0xb5,0x36,0x0b,0x00,0x00,0x80,0x0e,0x74,0x07,0x40,
- 0x5c,0x0f,0x00,0xdb,0x06,0xc8,0x96,0x01,0xa0,0x36,0x00,0x50,0x81,0x01,0x90,
- 0xaa,0x0f,0x00,0x00,0x80,0x07,0x00,0x0d,0x00,0x00,0x74,0x00,0x00,0xe0,0x00,
- 0x00,0x00,0x00,0x1c,0x00,0x06,0x00,0x00,0x00,0x55,0x0f,0x00,0x00,0x00,0xc0,
- 0xfb,0x01,0x80,0x5d,0xdb,0x1d,0x00,0x00,0xe0,0x0e,0xdf,0x07,0x40,0xf0,0x0d,
- 0x80,0xb6,0x07,0x00,0xeb,0x01,0xa0,0x3a,0x00,0xa8,0xe8,0x00,0x50,0xff,0x00,
- 0x00,0x00,0xb0,0x03,0x00,0x0c,0x00,0x00,0x71,0x00,0x00,0x75,0x00,0x00,0x00,
- 0x40,0x0c,0x40,0x06,0x00,0x00,0x00,0xff,0x0d,0x00,0x00,0x00,0xa0,0x76,0x00,
- 0xc0,0xea,0x55,0x15,0x00,0x00,0x00,0x8f,0x75,0x07,0x20,0xa8,0x0e,0x80,0x6d,
- 0x07,0x80,0xb5,0x01,0xb0,0x35,0x00,0xa6,0xe2,0x00,0xc8,0x03,0x00,0x00,0x00,
- 0xc0,0x01,0x80,0x0a,0x00,0x00,0x34,0x00,0x80,0x30,0x00,0x00,0x00,0x00,0x0e,
- 0x10,0x06,0x00,0x00,0x80,0xb6,0x0f,0x00,0x00,0x00,0x68,0x3f,0x00,0x40,0xaf,
- 0xb6,0x3a,0x00,0x00,0xe0,0x86,0xbe,0x07,0x10,0xdc,0x0f,0x80,0xb6,0x03,0x80,
- 0x5e,0x01,0x50,0x6d,0x00,0xd1,0x72,0x00,0xa8,0x01,0x00,0x00,0x00,0xe8,0x00,
- 0x40,0x12,0x00,0x80,0x32,0x00,0x20,0x34,0x00,0x00,0x00,0x40,0x0e,0x00,0x04,
- 0x00,0x00,0xc0,0xef,0x0e,0x00,0x00,0x00,0xdc,0x0e,0x00,0x00,0xb5,0xda,0x6d,
- 0x00,0x00,0x30,0x87,0xd7,0x06,0x0c,0xb4,0x0e,0xd0,0xdb,0x03,0x00,0xd5,0x03,
- 0xd4,0x6a,0x80,0xaa,0x3a,0x00,0x50,0x03,0x00,0x40,0x00,0x68,0x00,0x08,0x29,
- 0x00,0x40,0x60,0x00,0x00,0x31,0x00,0x00,0x00,0x00,0x07,0x80,0x0c,0x00,0x00,
- 0x80,0xba,0x1d,0x00,0x00,0x00,0xeb,0x07,0x00,0x80,0x55,0xab,0x6a,0x00,0x00,
- 0xc8,0xc3,0xfa,0x0f,0x15,0x7a,0x0f,0x44,0x6d,0x07,0x80,0x6b,0x03,0x52,0xab,
- 0x69,0xa9,0x1a,0x00,0xa8,0x06,0x00,0x00,0x00,0x6a,0x00,0xa0,0x04,0x00,0x80,
- 0x8a,0x00,0xa8,0x24,0x00,0x08,0x09,0x00,0x03,0x20,0x10,0x00,0x00,0xe0,0xef,
- 0x1f,0x00,0x00,0x40,0xdd,0x03,0x00,0x00,0xde,0xb5,0xd6,0x00,0x00,0x50,0xc3,
- 0x5f,0xf5,0x0b,0xd6,0x06,0x73,0xb7,0x15,0x00,0x5d,0x43,0x59,0xad,0xaa,0xa8,
- 0x2a,0x00,0x91,0x0a,0x00,0xa8,0x00,0x68,0x80,0x5a,0xaa,0x04,0x20,0x51,0x00,
- 0x00,0x10,0x80,0x44,0x18,0xa0,0x03,0x08,0x01,0x00,0x08,0x60,0xbb,0x3a,0x00,
- 0x00,0xa0,0xf7,0x00,0x00,0x00,0xb3,0xae,0xb5,0x01,0x00,0xd0,0xa3,0xea,0x5f,
- 0x07,0xba,0xcf,0x8c,0xda,0x0e,0x80,0xaa,0xad,0x6f,0xb5,0x6a,0x51,0xab,0xaa,
- 0x56,0x29,0x00,0x42,0x40,0x65,0x20,0x0e,0x21,0x49,0x24,0x04,0x85,0x4e,0x45,
- 0x90,0x01,0x12,0xc0,0x01,0x00,0x10,0x00,0x07,0xd0,0xee,0x3f,0x00,0x00,0x70,
- 0x7d,0x00,0x00,0x00,0xdc,0x6a,0xad,0x01,0x00,0xac,0xe1,0xbf,0xea,0x83,0xef,
- 0xba,0xe7,0xaf,0x07,0x80,0x6d,0xf5,0xab,0x55,0x75,0x54,0x55,0xd5,0x53,0xa5,
- 0xaa,0x3c,0x80,0xaa,0x84,0x87,0x4a,0x22,0x5d,0xa9,0x20,0x2f,0x10,0xe5,0x90,
- 0x30,0xc0,0x00,0x44,0x84,0x80,0x03,0xf0,0xbf,0x6a,0x00,0x00,0xbe,0x1f,0x00,
- 0x00,0x00,0x54,0xb5,0x55,0x03,0x00,0xd4,0x41,0xd5,0xff,0x81,0x5a,0xef,0x41,
- 0xf5,0x03,0x00,0x56,0xeb,0xa8,0x6a,0xbb,0x68,0x55,0xd5,0x59,0x55,0x49,0x1e,
- 0x20,0x49,0xd5,0x43,0x28,0x49,0x0e,0x04,0x94,0x03,0x45,0x70,0x00,0x28,0x68,
- 0x00,0x10,0x00,0xe8,0x01,0xa8,0xea,0xff,0x00,0x80,0x6a,0x0f,0x00,0x00,0x00,
- 0xe8,0xae,0xb6,0x06,0x00,0xe8,0xe1,0x7f,0xf5,0x80,0xed,0xfa,0x60,0xdb,0x01,
- 0x00,0xeb,0x7a,0xd0,0x56,0x1d,0x50,0x55,0xf5,0x40,0x55,0x55,0x0f,0x80,0x24,
- 0xe9,0x01,0x45,0x92,0x47,0xa9,0xc2,0xa1,0x10,0x3d,0xa0,0x42,0x30,0x00,0x00,
- 0x11,0x71,0x00,0xf8,0x7f,0x55,0x03,0xd0,0xdf,0x03,0x00,0x00,0x00,0xb0,0xd5,
- 0xaa,0x0d,0x00,0xd4,0x40,0xd5,0x3f,0x40,0x77,0x3f,0xa0,0xed,0x00,0x00,0x5d,
- 0x3d,0x50,0x5b,0x0f,0xa5,0xaa,0x7a,0x50,0x95,0xaa,0x07,0x50,0x95,0x74,0x80,
- 0x12,0xc9,0x03,0x22,0xf0,0x00,0x44,0x0e,0x00,0x10,0x1d,0x00,0x40,0x00,0x3c,
- 0x00,0xb0,0xd5,0xff,0x1d,0x7e,0xf5,0x01,0x00,0x00,0x00,0x50,0x6d,0x6d,0x0d,
- 0x00,0xea,0xc0,0xff,0x1e,0xc0,0xad,0x1f,0xc0,0x76,0x00,0x00,0xaa,0x1f,0xb0,
- 0xaa,0x57,0x50,0x55,0x3d,0xa0,0x54,0xd2,0x01,0x50,0x52,0x3a,0x00,0xa8,0xe4,
- 0x80,0x88,0x7a,0x40,0x81,0x07,0x20,0x42,0x0e,0x00,0x00,0x49,0x0e,0x00,0x7c,
- 0x7f,0x55,0xef,0xd5,0x7e,0x00,0x00,0x00,0x00,0xc0,0xb6,0xb6,0x1a,0x00,0xf4,
- 0x80,0xaa,0x07,0x80,0xf6,0x07,0x80,0x3d,0x00,0x00,0xb6,0x07,0x40,0xed,0x83,
- 0x7c,0xab,0x0e,0x40,0x53,0xf5,0x00,0x20,0xa9,0x1e,0x00,0x04,0x7a,0x00,0x44,
- 0x1e,0x00,0xd4,0x03,0x80,0x88,0x07,0x00,0x00,0x80,0x07,0x00,0xd4,0xdb,0xff,
- 0x5b,0xbb,0x3d,0x00,0x00,0x00,0x00,0x60,0xd5,0xd5,0x36,0x00,0x6b,0x00,0xfe,
- 0x01,0x80,0xfb,0x01,0xc0,0x1e,0x00,0x00,0xec,0x03,0x80,0xf5,0x14,0x1c,0xd5,
- 0x07,0x80,0x54,0x3d,0x00,0x40,0x45,0x0f,0x00,0x54,0x1f,0x00,0x92,0x0f,0x80,
- 0xf2,0x00,0x00,0xf0,0x01,0x00,0x40,0xf0,0x01,0x00,0xfc,0x76,0xab,0xf6,0xee,
- 0x0f,0x00,0x00,0x00,0x00,0x40,0x5b,0x56,0x2b,0x00,0x75,0x00,0x00,0x00,0x00,
- 0x3e,0x00,0x80,0x0f,0x00,0x00,0xf8,0x00,0x00,0x3f,0x40,0x0f,0xfe,0x01,0x00,
- 0xaa,0x0f,0x00,0x00,0xd5,0x03,0x00,0xe0,0x03,0x00,0xf8,0x01,0x00,0x3e,0x00,
- 0x00,0x7e,0x00,0x00,0x00,0x7f,0x00,0x00,0xb4,0xdf,0xfe,0xbd,0xb7,0x07,0x00,
- 0x00,0x00,0x00,0x80,0xad,0x5b,0x75,0x00,0x6a,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x07,0x00,0x00,0x00,0xf0,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xa2,0x03,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x90,0x01,0x00,0x00,0x3c,0x00,0x00,0x00,0xb8,0x07,0x00,0xa8,0x04,
+ 0x04,0x58,0xac,0xdf,0xad,0x03,0x00,0x00,0x00,0xd0,0x0e,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xaa,0xca,0x01,0x00,0x00,
+ 0x00,0x00,0xa0,0x00,0x00,0x80,0xd4,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xc0,0x01,0x00,0x20,0x1d,0x00,0x00,0x00,0xe8,0x03,0x10,0x10,0x10,0x00,0x40,
+ 0xa5,0xab,0xd6,0x01,0x00,0x00,0x00,0x20,0x07,0x00,0x00,0x38,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0xc5,0x01,0x00,0x50,0x01,0x00,
+ 0xa8,0x01,0x00,0x20,0xe9,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,
+ 0x00,0x00,0x0e,0x00,0x00,0x00,0xdc,0x03,0x54,0x28,0x08,0x00,0xb0,0xaa,0x77,
+ 0xeb,0x01,0x00,0x00,0x00,0xa8,0x07,0x00,0x00,0x56,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x54,0xd1,0x00,0x00,0x24,0x0d,0x00,0xe4,0x01,
+ 0x00,0x80,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe2,0x00,0x00,0x10,
+ 0x07,0x00,0x00,0x00,0xf6,0x81,0x52,0x10,0x10,0x00,0x48,0x55,0xaa,0xdd,0x01,
+ 0x00,0x00,0x00,0xb4,0x03,0x00,0x00,0xfa,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
+ 0x00,0x00,0x40,0x15,0x5a,0xe1,0x00,0x00,0x55,0x19,0x00,0xea,0x00,0x00,0x50,
+ 0x3a,0x00,0x00,0x24,0x00,0x00,0x00,0x00,0x80,0x40,0x00,0x88,0x84,0x03,0x00,
+ 0x00,0x00,0xfb,0x40,0xaa,0x20,0x10,0x00,0xa0,0x7e,0xdd,0xea,0x00,0x00,0x00,
+ 0x00,0xc8,0x03,0x00,0x00,0xd6,0x01,0x00,0x00,0x6a,0x00,0x00,0x00,0x00,0x00,
+ 0xec,0x0f,0x55,0x72,0x00,0xa0,0xaa,0x1a,0x00,0x69,0x00,0x00,0x28,0x1d,0x00,
+ 0x00,0x48,0x00,0x00,0x00,0x00,0x00,0x94,0x00,0x20,0x00,0x00,0x00,0x00,0x00,
+ 0xee,0x50,0x4b,0x20,0x20,0x00,0xb0,0x5d,0x65,0xad,0x00,0x00,0x00,0x00,0xd4,
+ 0x01,0x00,0xff,0xfd,0x01,0x00,0x80,0xf6,0x00,0x00,0x00,0x00,0x80,0xfa,0x00,
+ 0x54,0x70,0x00,0xa0,0x97,0x1a,0x40,0x55,0x00,0x00,0x40,0x0f,0x00,0x80,0xe2,
+ 0x00,0x00,0x00,0x00,0x80,0x40,0x01,0x00,0x24,0x00,0x0f,0x00,0x80,0x7b,0xaa,
+ 0x40,0x41,0x20,0x00,0x48,0x4f,0xb5,0xeb,0x01,0x00,0x00,0x00,0xea,0x00,0xf0,
+ 0x7a,0xd7,0x01,0x00,0x80,0x7b,0x00,0x2c,0x00,0x00,0xa0,0x1e,0x00,0x2b,0x39,
+ 0x00,0xc8,0xa9,0x1c,0x80,0x24,0x01,0x00,0x28,0x07,0x00,0x40,0xe8,0x00,0x00,
+ 0x15,0x00,0x20,0x04,0x02,0x10,0x81,0xf4,0x03,0x00,0x40,0x7f,0x54,0x80,0x20,
+ 0x40,0x00,0xd8,0x87,0x5a,0xb5,0x01,0x00,0x00,0x00,0xed,0x00,0xdc,0xc7,0xfb,
+ 0x00,0x00,0x60,0x6d,0x00,0xd7,0x00,0x00,0xa0,0x07,0x00,0x15,0x38,0x00,0x6a,
+ 0x50,0x1d,0x50,0x92,0x02,0x00,0xc8,0x03,0x00,0x80,0x62,0x00,0x80,0x30,0x00,
+ 0x80,0x48,0x06,0xf0,0xb0,0x7f,0x00,0x00,0xe0,0x3b,0x54,0x00,0x40,0x20,0x00,
+ 0xd7,0x03,0xd5,0xdd,0x01,0x00,0x00,0x00,0x75,0x00,0xf6,0x80,0x6e,0x00,0x00,
+ 0xb0,0x7b,0xc0,0xfa,0x00,0x00,0xd8,0x03,0x80,0x4a,0x1d,0x00,0x1a,0xa0,0x0e,
+ 0x40,0x55,0x19,0x00,0xe4,0x01,0x00,0x20,0x78,0x00,0x20,0x3a,0x00,0x08,0x00,
+ 0x04,0x00,0x34,0x00,0x00,0x00,0x40,0x3d,0x20,0x00,0x00,0x80,0x00,0xdd,0xc0,
+ 0xba,0x56,0x03,0x00,0x00,0x00,0x75,0xc0,0x7b,0x40,0x7b,0x00,0x00,0xd0,0x3d,
+ 0x40,0xab,0x01,0x00,0xee,0x01,0x40,0x05,0x0c,0x00,0x0d,0x50,0x07,0xa0,0x92,
+ 0x34,0x00,0x72,0x00,0x00,0x90,0x3a,0x00,0x88,0x18,0x00,0xc0,0x92,0x0c,0x00,
+ 0x38,0x00,0x00,0x00,0xf0,0x1a,0x20,0x00,0x00,0x40,0xc0,0xb7,0x80,0xd7,0xaa,
+ 0x03,0x00,0x00,0x00,0x35,0x60,0x1f,0x80,0xad,0x01,0x00,0xbc,0x1e,0xf0,0xd6,
+ 0x01,0x00,0xe9,0x00,0x80,0x42,0x0e,0x40,0x0f,0x88,0x03,0x50,0x4a,0x35,0x00,
+ 0x38,0x00,0x00,0x48,0x1e,0x00,0x20,0x1e,0x00,0x20,0x00,0x08,0x00,0x19,0x00,
+ 0x00,0x00,0xa8,0x0a,0x20,0x28,0x00,0x40,0x51,0x4d,0xc1,0x6c,0xdb,0x06,0x00,
+ 0x00,0x00,0x3d,0xd8,0x1e,0x00,0xf7,0x03,0x00,0xd4,0x1d,0x50,0xdb,0x01,0x80,
+ 0x76,0x00,0xc0,0x12,0x07,0x40,0x07,0xe4,0x01,0xc0,0x55,0x3a,0x00,0x3d,0x00,
+ 0x00,0x92,0x07,0x00,0x08,0x0f,0x00,0x08,0x4a,0x19,0x00,0x1c,0x00,0x00,0x00,
+ 0xaa,0x16,0x40,0x29,0x00,0x80,0xb8,0x5f,0x41,0xb7,0x6d,0x07,0x00,0x00,0xc0,
+ 0x1a,0xf4,0x0f,0x00,0xad,0x06,0x00,0xba,0x0e,0xbc,0xb5,0x01,0x80,0x7a,0x00,
+ 0x40,0x09,0x03,0x40,0x03,0xf8,0x00,0x04,0x28,0x1d,0x00,0x1c,0x00,0x00,0xc4,
+ 0x03,0x00,0xa0,0x07,0x00,0x00,0x00,0x18,0x80,0x0c,0x00,0x00,0x80,0xea,0x2d,
+ 0x40,0x55,0x00,0x00,0xd6,0xa7,0x80,0xda,0x56,0x0d,0x00,0x00,0x80,0x1e,0x5e,
+ 0x07,0x80,0xf9,0x07,0x00,0xd6,0x0f,0x70,0xdd,0x01,0xc0,0x35,0x00,0x50,0xc1,
+ 0x03,0xa0,0x43,0x3d,0x00,0x00,0xa0,0x0e,0x00,0x0d,0x00,0x00,0xf0,0x00,0x00,
+ 0xca,0x01,0x00,0x00,0x90,0x1c,0x20,0x0e,0x00,0x00,0x00,0xb5,0x17,0x40,0x55,
+ 0x00,0x00,0xfb,0x03,0xc0,0x55,0xb5,0x0d,0x00,0x00,0x40,0x0d,0xf4,0x07,0x80,
+ 0xac,0x0e,0x00,0xbb,0x06,0x89,0xab,0x01,0x20,0x3d,0x00,0xa0,0xa4,0x01,0x50,
+ 0xd5,0x0f,0x00,0x00,0x50,0x07,0x80,0x0e,0x00,0x00,0x6a,0x00,0x80,0xe0,0x00,
+ 0x00,0x00,0x00,0x1c,0x00,0x06,0x00,0x00,0x80,0xea,0x5e,0x80,0xaa,0x00,0x40,
+ 0xc9,0x01,0x40,0xb7,0xdb,0x1a,0x00,0x00,0xa0,0x0e,0x5f,0x07,0x40,0x70,0x0f,
+ 0x80,0xdd,0x07,0x00,0xdd,0x01,0xd0,0x35,0x00,0xac,0xc8,0x00,0xa0,0xff,0x00,
+ 0x00,0x00,0x80,0x03,0x00,0x0c,0x00,0x00,0x71,0x00,0x00,0x74,0x00,0x00,0x00,
+ 0x90,0x0c,0x00,0x06,0x00,0x00,0x00,0xb5,0x1f,0x00,0x05,0x00,0x60,0x75,0x00,
+ 0x80,0x6d,0x6d,0x1d,0x00,0x00,0x40,0x8f,0xf6,0x07,0x20,0xd8,0x0d,0x00,0x6b,
+ 0x07,0x80,0xaa,0x01,0xa0,0x36,0x00,0xa2,0xe1,0x00,0xa8,0x03,0x00,0x00,0x00,
+ 0xf0,0x01,0x80,0x0a,0x00,0x80,0x34,0x00,0x80,0x32,0x00,0x00,0x00,0x00,0x0e,
+ 0x48,0x06,0x00,0x00,0x80,0xf7,0x2d,0x00,0x01,0x00,0x58,0x35,0x00,0xc0,0xb6,
+ 0xaa,0x36,0x00,0x00,0x60,0x87,0xbd,0x06,0x18,0x6c,0x0f,0xc0,0xb6,0x03,0x80,
+ 0xf7,0x01,0x60,0x75,0x00,0x55,0x75,0x00,0xa8,0x01,0x00,0x00,0x00,0xc8,0x00,
+ 0x40,0x12,0x00,0x00,0x32,0x00,0x20,0x30,0x00,0x00,0x00,0x40,0x0e,0x00,0x04,
+ 0x00,0x00,0x40,0x55,0x2f,0x80,0x02,0x30,0x68,0x0b,0x00,0x00,0xdb,0x77,0x6b,
+ 0x00,0x00,0x50,0xc7,0xef,0x07,0x04,0xd8,0x0e,0x90,0xdd,0x03,0x80,0x2c,0x03,
+ 0xb8,0x56,0x40,0xb1,0x3a,0x00,0x50,0x03,0x00,0x40,0x00,0x70,0x00,0x08,0x29,
+ 0x00,0x80,0x64,0x00,0x40,0x35,0x00,0x00,0x00,0x00,0x07,0x90,0x0c,0x00,0x00,
+ 0xc0,0xeb,0x52,0x00,0x01,0x10,0xff,0x07,0x00,0x80,0x6d,0xaa,0x6d,0x00,0x00,
+ 0xa8,0x83,0xba,0x0e,0x16,0xbe,0x0f,0x48,0x6b,0x07,0x00,0xd7,0x03,0xab,0xb5,
+ 0x51,0xd5,0x1a,0x00,0xaa,0x06,0x00,0x00,0x00,0x6a,0x00,0xa0,0x0a,0x00,0x20,
+ 0x91,0x00,0x08,0x20,0x00,0x48,0x0a,0x00,0x03,0x00,0x10,0x00,0x00,0x60,0x5f,
+ 0x55,0x01,0x02,0xa0,0xd5,0x03,0x00,0x00,0xaa,0x5b,0xd5,0x00,0x00,0xa8,0xc3,
+ 0xef,0xf7,0x0b,0xea,0x06,0xf3,0xbd,0x15,0x80,0x6a,0x83,0x50,0xad,0xda,0x28,
+ 0x2b,0x80,0xa8,0x0a,0x00,0xa8,0x00,0x74,0x80,0x5a,0xa4,0x04,0x80,0x88,0x00,
+ 0x50,0x15,0x80,0x04,0x18,0xa0,0x03,0x40,0x04,0x00,0x08,0xc0,0xab,0x5a,0x01,
+ 0x02,0xa8,0xfe,0x00,0x00,0x00,0x77,0xd5,0xb6,0x01,0x00,0xd0,0xa3,0x75,0x5d,
+ 0x07,0x76,0x6f,0x4d,0xd7,0x0e,0x80,0x5d,0xed,0xbf,0xd5,0x6a,0x50,0x55,0x55,
+ 0xa6,0x2a,0x00,0x44,0x40,0x65,0x20,0x8e,0x92,0x92,0x68,0x52,0x84,0x0e,0x80,
+ 0x90,0x21,0x11,0xc0,0x01,0x10,0x10,0x00,0x07,0xf0,0xae,0x3a,0x05,0x88,0xd6,
+ 0x7b,0x00,0x00,0x00,0xac,0x6e,0xab,0x01,0x00,0xac,0x61,0xbf,0xf7,0x83,0xaf,
+ 0xdb,0xc7,0xba,0x07,0x80,0xb6,0xb5,0x53,0x6d,0x75,0xd5,0xaa,0xaa,0x5b,0xa9,
+ 0xaa,0x3a,0x80,0x52,0x89,0x07,0x49,0x24,0x1d,0x09,0x29,0x5f,0x55,0xe4,0x80,
+ 0x30,0xc0,0x00,0x04,0x81,0xa0,0x03,0xb0,0x5b,0x6f,0x02,0xa8,0xaa,0x1e,0x00,
+ 0x00,0x00,0x74,0x5b,0x6d,0x03,0x00,0xd0,0xe1,0xd5,0xfd,0x81,0x7a,0xed,0x61,
+ 0xd7,0x03,0x00,0x6b,0xeb,0xd8,0x56,0x3b,0x50,0xb5,0xea,0x51,0x55,0x55,0x1d,
+ 0x40,0x2a,0xd5,0x83,0x2a,0x49,0x4e,0x44,0x82,0x03,0x00,0x72,0x00,0x2a,0x68,
+ 0x00,0x20,0x04,0xc4,0x01,0xe8,0xaf,0xfa,0x05,0x54,0xf5,0x0f,0x00,0x00,0x00,
+ 0xa8,0xaa,0xb5,0x06,0x00,0xec,0xa1,0xff,0xf6,0x80,0xdd,0xfb,0xa0,0xfb,0x01,
+ 0x00,0x5d,0x7d,0xa8,0x5a,0x1d,0x55,0x55,0xf5,0xa8,0xaa,0x24,0x0f,0xa0,0x92,
+ 0xe4,0x81,0x90,0x92,0x07,0xa9,0xd4,0xa1,0xaa,0x3c,0x50,0x40,0x30,0x00,0x80,
+ 0x40,0x78,0x00,0xb8,0xba,0xb7,0x05,0xaa,0xba,0x03,0x00,0x00,0x00,0xb0,0xdb,
+ 0xd6,0x0e,0x00,0xd4,0xc0,0x56,0x3f,0x40,0xb7,0x3e,0x60,0xed,0x00,0x00,0xd5,
+ 0x3d,0x60,0x6b,0x8f,0xa0,0xd6,0x7a,0x50,0x55,0xd5,0x07,0x20,0xa9,0x72,0x00,
+ 0x4a,0xc8,0x83,0x04,0xe8,0x00,0x00,0x0e,0x00,0x12,0x1d,0x00,0x08,0x10,0x39,
+ 0x00,0xe8,0xaf,0xee,0x15,0x54,0xef,0x01,0x00,0x00,0x00,0x50,0xad,0x5a,0x0b,
+ 0x00,0xea,0xc0,0xfd,0x1f,0xc0,0xed,0x1f,0xc0,0x76,0x00,0x00,0xb6,0x1e,0x50,
+ 0xad,0x57,0x74,0x55,0x3d,0xa0,0x52,0xd5,0x01,0xa0,0x4a,0x3d,0x00,0x52,0xe5,
+ 0x00,0xa9,0x7a,0xa0,0xaa,0x07,0x80,0x40,0x0e,0x00,0x20,0x02,0x0e,0x00,0xbc,
+ 0x7d,0x7b,0xfb,0xf7,0x7b,0x00,0x00,0x00,0x00,0xe0,0x75,0x6b,0x1d,0x00,0xec,
+ 0x00,0xaf,0x07,0x40,0xbb,0x07,0x80,0x3d,0x00,0x00,0xda,0x07,0xc0,0xea,0x07,
+ 0xb9,0x55,0x0f,0x80,0xaa,0xf4,0x00,0x40,0x29,0x1e,0x00,0x88,0x7c,0x00,0x20,
+ 0x1c,0x00,0xc1,0x03,0x00,0x8a,0x07,0x00,0x80,0x90,0x07,0x00,0xf4,0xaf,0xae,
+ 0xad,0xba,0x3e,0x00,0x00,0x00,0x00,0x20,0xad,0xad,0x35,0x00,0x75,0x00,0xfc,
+ 0x01,0x80,0xf7,0x01,0x40,0x1f,0x00,0x00,0xec,0x03,0x40,0xfb,0x50,0x9e,0xaa,
+ 0x07,0x00,0x95,0x3e,0x00,0x00,0xa5,0x0f,0x00,0x28,0x1f,0x00,0x8a,0x0f,0x00,
+ 0xfa,0x00,0x80,0xf0,0x01,0x00,0x00,0xe2,0x01,0x00,0xbc,0xfa,0xfa,0xfa,0xdf,
+ 0x0f,0x00,0x00,0x00,0x00,0xc0,0x56,0xb5,0x2a,0x00,0x6a,0x00,0x00,0x00,0x00,
+ 0x3e,0x00,0x80,0x0f,0x00,0x00,0xf8,0x00,0x00,0x3f,0x02,0x0e,0xff,0x01,0x00,
+ 0xd6,0x0f,0x00,0x00,0xd5,0x03,0x00,0xe0,0x03,0x00,0xf8,0x01,0x00,0x3e,0x00,
+ 0x00,0x7e,0x00,0x00,0x00,0x7f,0x00,0x00,0xe8,0xdf,0x2e,0xad,0xea,0x07,0x00,
+ 0x00,0x00,0x00,0x00,0xdb,0xd6,0x76,0x00,0x75,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x07,0x00,0x00,0x00,0xf0,0x01,
  0x00,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0xec,0xfa,0x57,0xd7,0xfa,0x01,0x00,0x00,0x00,
- 0x00,0x00,0xb5,0x6a,0xd5,0x00,0x7a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x80,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xf6,0xaa,0xfe,0xff,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0xaa,0x5a,0xd5,0x00,0x76,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xc1,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xbc,0x5f,0xfd,0xbd,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x54,0x55,0xab,0x81,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xea,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xac,0xbb,0xaa,0x57,0x75,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x6c,0xab,0xad,0x81,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x40,0xe4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0xf4,0xea,0x57,0xef,0x3d,0x00,0x0c,0x03,0x00,0x00,0x00,0xab,0x55,
- 0x55,0x03,0x3a,0x00,0x00,0x00,0x00,0x18,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x40,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,
+ 0x00,0x00,0xf8,0xde,0xea,0xfa,0x3f,0x00,0x0c,0x03,0x00,0x00,0x00,0xab,0x55,
+ 0x55,0x03,0x35,0x00,0x00,0x00,0x00,0x18,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,
  0x00,0xc0,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xdc,0x7f,0xfd,0x75,0x0f,0x00,0x08,0xe1,0xef,0x1f,0x80,0x57,0xdb,0xed,0xf3,
- 0x77,0x10,0xfe,0xf8,0x00,0x38,0x1c,0xfe,0x70,0xe0,0xc0,0x00,0x03,0x7f,0x20,
- 0x7a,0x90,0x7f,0xfe,0xf8,0xc0,0x0f,0x03,0x0e,0x7f,0x00,0xc6,0x30,0x04,0x40,
- 0x00,0x82,0xc0,0x80,0x83,0x83,0x3f,0x86,0x00,0x00,0x00,0x00,0x00,0xf4,0xd6,
- 0x6f,0xef,0x03,0x00,0x98,0xa1,0x44,0x0b,0x80,0x51,0x67,0x3a,0x86,0x70,0x10,
- 0x4a,0x28,0x01,0x28,0x06,0x4a,0xac,0x58,0xc1,0xc1,0x0d,0x4b,0x12,0xdb,0x10,
- 0x2d,0x96,0x28,0x63,0x80,0x83,0x13,0x49,0x00,0x83,0x31,0x04,0x40,0x00,0xc2,
- 0xe0,0xe0,0x46,0x8d,0x25,0x86,0x00,0x00,0x00,0x00,0x00,0xbc,0x7d,0xb5,0xfd,
- 0x00,0x00,0x70,0x20,0x00,0x03,0x80,0xa4,0x55,0x0c,0x8a,0x74,0x10,0x02,0x08,
- 0x01,0x28,0x1a,0x02,0x04,0x08,0x40,0x21,0x00,0x01,0x08,0x43,0x11,0x04,0x02,
- 0x08,0x22,0x80,0xc2,0x00,0x01,0x00,0x01,0x51,0x04,0xc0,0x07,0xc6,0xa0,0x30,
- 0x40,0x80,0x00,0x8a,0x00,0x00,0x00,0x00,0x00,0xd0,0xdb,0xff,0x3f,0x00,0x00,
- 0x40,0xe0,0x03,0x01,0x40,0x8c,0x4a,0x4d,0x9b,0xd9,0x1f,0x3e,0xf8,0x01,0x58,
- 0x0b,0x3e,0x78,0xf0,0x20,0x21,0x00,0x1f,0xc1,0x43,0x13,0x0c,0x3e,0xf8,0xe1,
- 0x83,0x44,0x00,0x1f,0x00,0x01,0x91,0x04,0x40,0x05,0x24,0x21,0x11,0xc0,0x83,
- 0x0f,0x92,0x00,0x00,0x00,0x00,0x00,0x70,0xf7,0xaa,0x0f,0x00,0x00,0x20,0x20,
- 0x01,0x03,0xc0,0x0b,0x5b,0xaa,0xf6,0x58,0x00,0x12,0x88,0x40,0x48,0x19,0x02,
- 0xa0,0x41,0xa3,0x22,0x0e,0x03,0xe8,0x43,0x14,0x0c,0x12,0x98,0x20,0xc0,0x44,
- 0x00,0x0b,0x00,0x81,0x11,0x05,0x40,0x00,0xaa,0x30,0x11,0x00,0x8c,0x04,0xa2,
- 0x00,0x00,0x00,0x00,0x00,0xe0,0xbd,0xff,0x01,0x00,0x00,0x20,0x20,0x00,0x03,
- 0x60,0x10,0x69,0x4c,0xa2,0x59,0x10,0x02,0x88,0xa0,0x9a,0x18,0x02,0x00,0x01,
- 0xb2,0x26,0x08,0x11,0x75,0x42,0x14,0x0c,0x06,0x88,0x61,0x40,0xcd,0x10,0x01,
- 0x00,0x83,0x10,0x06,0x40,0x00,0x98,0x50,0x33,0x04,0x88,0x01,0xc2,0x00,0x00,
- 0x00,0x00,0x00,0x80,0x6f,0x3f,0x00,0x00,0x00,0x20,0xe0,0x0f,0x03,0x20,0x10,
- 0xd2,0xb2,0x93,0x5c,0x10,0xfe,0x08,0x29,0x99,0x08,0xfe,0xdc,0xb8,0x11,0xc4,
- 0x0d,0x6f,0x3c,0x42,0x18,0x0c,0xfe,0x08,0x21,0x20,0x88,0x1f,0x7f,0x00,0xfc,
- 0x10,0x06,0x40,0x1f,0x92,0x09,0xe2,0xc7,0x8d,0x3f,0x82,0x00,0x00,0x00,0x00,
- 0x00,0x00,0xfe,0x03,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x2a,0x4a,
- 0xd0,0x18,0x10,0x40,0x00,0x95,0x0a,0x10,0x50,0x40,0x80,0x00,0x00,0x00,0x41,
- 0x0e,0x02,0x00,0x00,0x90,0x00,0x00,0x00,0x00,0x04,0x48,0x00,0x00,0x20,0x00,
- 0x40,0x09,0x00,0x00,0x00,0x00,0x01,0x24,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xaa,0x54,0x1c,
- 0x00,0x00,0x00,0xa0,0x44,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x07,0x00,
+ 0xbc,0x77,0xbd,0x5f,0x0f,0x00,0x08,0xe1,0xef,0x1f,0x80,0x57,0xef,0xf5,0xf3,
+ 0x7f,0x10,0xfe,0xf8,0x00,0x38,0x1c,0xfe,0x70,0xe0,0xc0,0x00,0x03,0x7f,0x50,
+ 0x7b,0x90,0x7f,0xfe,0xf8,0xc0,0x0f,0x03,0x0e,0x7f,0x00,0xc6,0x30,0x04,0x40,
+ 0x00,0x82,0xc0,0x80,0x83,0x83,0x3f,0x86,0x00,0x00,0x00,0x00,0x00,0xec,0xdd,
+ 0xee,0xf5,0x03,0x00,0x98,0xa1,0x44,0x0b,0x80,0xa4,0x56,0x3a,0x86,0x70,0x10,
+ 0x4a,0x48,0x01,0x28,0x0e,0x4a,0xac,0x58,0xc1,0xc1,0x0d,0x4b,0x00,0xda,0x10,
+ 0x2d,0x92,0x28,0x63,0x80,0x83,0x1b,0x49,0x00,0x83,0x31,0x04,0x40,0x00,0xc2,
+ 0xe0,0xe0,0x46,0x8d,0x29,0x86,0x00,0x00,0x00,0x00,0x00,0x74,0xf7,0xb7,0xfe,
+ 0x00,0x00,0x70,0x20,0x00,0x03,0x80,0xa4,0xcd,0x8c,0x8a,0x70,0x10,0x02,0x08,
+ 0x01,0x38,0x12,0x02,0x04,0x08,0x40,0x21,0x00,0x01,0x54,0x43,0x11,0x0c,0x02,
+ 0x08,0x21,0x80,0xc2,0x00,0x01,0x00,0x01,0x51,0x04,0xc0,0x07,0xc6,0xa1,0x30,
+ 0x40,0x80,0x00,0x8a,0x00,0x00,0x00,0x00,0x00,0xd8,0x5f,0xfd,0x3f,0x00,0x00,
+ 0x60,0xe0,0x03,0x01,0xc0,0x4c,0x59,0x8c,0x9a,0xdd,0x1f,0x3e,0xf8,0x01,0x48,
+ 0x1b,0x3e,0x78,0xf0,0x20,0x21,0x00,0x1f,0x82,0x43,0x11,0x04,0x3e,0xf8,0xe1,
+ 0x83,0x44,0x00,0x1f,0x00,0x01,0x91,0x04,0x40,0x06,0x24,0x20,0x11,0xc0,0x83,
+ 0x0f,0x92,0x00,0x00,0x00,0x00,0x00,0xf0,0xfa,0xaf,0x0f,0x00,0x00,0x20,0x20,
+ 0x01,0x03,0xc0,0x0b,0x53,0xad,0xf6,0x58,0x00,0x12,0x98,0x40,0x98,0x09,0x12,
+ 0xa0,0x41,0xa3,0x22,0x0e,0x13,0xe9,0x43,0x16,0x0c,0x16,0x88,0x20,0xc0,0x44,
+ 0x00,0x0b,0x00,0x81,0x11,0x05,0x40,0x00,0xaa,0x30,0x11,0x00,0x8c,0x05,0xa2,
+ 0x00,0x00,0x00,0x00,0x00,0xa0,0xdf,0xfa,0x01,0x00,0x00,0x20,0x20,0x00,0x03,
+ 0x20,0x08,0x69,0x8a,0xa2,0x58,0x10,0x02,0x88,0xa8,0x9a,0x18,0x02,0x00,0x01,
+ 0xb2,0x26,0x08,0x41,0x74,0x42,0x14,0x0c,0x02,0x88,0x61,0x40,0xcd,0x10,0x01,
+ 0x00,0x83,0x10,0x07,0x40,0x00,0x9a,0x51,0x33,0x04,0x88,0x00,0xe2,0x00,0x00,
+ 0x00,0x00,0x00,0x80,0xea,0x3f,0x00,0x00,0x00,0x20,0xe0,0x0f,0x03,0x20,0x10,
+ 0xd4,0xf8,0xa3,0x5d,0x10,0xfe,0x08,0x21,0x99,0x18,0xfe,0xdc,0xb8,0x11,0xc4,
+ 0x0d,0x77,0x3c,0x42,0x08,0x0c,0xfe,0x08,0x21,0x20,0x88,0x1f,0x7f,0x00,0xfc,
+ 0x10,0x04,0xc0,0x1f,0x90,0x08,0xe2,0xc7,0x8d,0x3f,0x82,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xfe,0x03,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x2a,0x06,
+ 0xa8,0x18,0x10,0x40,0x00,0xaa,0x0a,0x00,0x90,0x40,0x80,0x00,0x00,0x01,0x09,
+ 0x0f,0x02,0x10,0x00,0xa4,0x10,0x00,0x00,0x00,0x04,0x48,0x00,0x10,0x00,0x00,
+ 0x40,0x12,0x00,0x00,0x00,0x01,0x02,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x58,0xaa,0x1c,
+ 0x00,0x00,0x00,0x51,0x45,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x07,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x95,0xaa,0x0e,0x00,0x00,
- 0x00,0xad,0x2a,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0xe1,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x56,0xab,0x0e,0x00,0x00,
+ 0x00,0x2c,0xa9,0x0a,0x00,0x00,0x00,0x00,0x00,0x40,0xe2,0x01,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x6a,0x55,0x0d,0x00,0x00,0x80,0x52,
- 0x92,0x14,0x00,0x00,0x00,0x00,0x00,0xa0,0x78,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x55,0x55,0x0d,0x00,0x00,0x00,0xa3,
+ 0x4a,0x14,0x00,0x00,0x00,0x00,0x00,0x10,0x79,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x40,0xad,0x5a,0x0d,0x00,0x00,0x00,0x4a,0xa9,0x2a,
- 0x00,0x00,0x00,0x00,0x00,0x14,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x80,0x6b,0x6d,0x0d,0x00,0x00,0x80,0x54,0xaa,0x2a,
+ 0x00,0x00,0x00,0x00,0x00,0x84,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x55,0xab,0x0e,0x00,0x00,0x80,0x2a,0x95,0x64,0x00,0x00,
- 0x00,0x00,0x80,0x42,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xb5,0xaa,0x0e,0x00,0x00,0x80,0xaa,0x52,0x69,0x00,0x00,
+ 0x00,0x00,0x00,0x51,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x6a,0x55,0x0d,0x00,0x00,0x00,0x55,0xa5,0x52,0x00,0x00,0x00,0x00,
- 0x00,0xd0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xac,0x55,0x0d,0x00,0x00,0x00,0x95,0x2a,0x55,0x00,0x00,0x00,0x00,
+ 0x40,0xc8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xac,0xb5,0x0d,0x00,0x00,0x00,0xa4,0x54,0xaa,0x00,0x00,0x00,0x00,0xa0,0xfa,
+ 0xb4,0xae,0x0d,0x00,0x00,0x00,0xaa,0x94,0xa4,0x00,0x00,0x00,0x00,0x88,0xfa,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0xaa,
- 0x1a,0x00,0x00,0x00,0x95,0x4a,0x49,0x01,0x00,0x00,0x00,0x14,0x3d,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0xb2,
+ 0x1a,0x00,0x00,0x00,0xa5,0x52,0x55,0x01,0x00,0x00,0x00,0x20,0x3d,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xad,0x1a,0x00,
- 0x00,0x00,0x54,0x29,0xa5,0x02,0x00,0x00,0x80,0xc2,0x0f,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xdb,0x1a,0x00,
+ 0x00,0x00,0xaa,0x4a,0xa5,0x02,0x00,0x00,0x40,0x95,0x0f,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x55,0x35,0x00,0x00,0x00,
- 0x50,0xa5,0x54,0x0a,0x00,0x00,0x52,0xf4,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x55,0x35,0x00,0x00,0x00,
+ 0x54,0xaa,0x54,0x0a,0x00,0x00,0x24,0xf2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xda,0x6a,0x00,0x00,0x00,0x90,0x94,
- 0x92,0x12,0x00,0x40,0x08,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x56,0x6b,0x00,0x00,0x00,0x48,0x29,
+ 0x25,0x15,0x00,0x40,0x12,0x7d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x6b,0x00,0x00,0x00,0x40,0x55,0x4a,0x49,
- 0x92,0x94,0xd2,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x5a,0x75,0x00,0x00,0x00,0x40,0xa5,0xaa,0xa2,
+ 0x52,0x2a,0xc9,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x56,0xd5,0x00,0x00,0x00,0x80,0x52,0xa9,0x54,0x49,0x22,
- 0xf9,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xaa,0xd5,0x00,0x00,0x00,0x80,0x55,0x52,0x2a,0x29,0x49,
+ 0xfa,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0xa8,0xda,0x00,0x00,0x00,0x00,0xae,0x4a,0x92,0x2a,0x55,0x1f,0x00,
+ 0x00,0x00,0xb4,0xd6,0x00,0x00,0x00,0x00,0xae,0x4a,0x95,0x8a,0xa4,0x1f,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xd8,0xaa,0x01,0x00,0x00,0x00,0x60,0xa5,0x4a,0xa4,0xf8,0x03,0x00,0x00,0x00,
+ 0xd0,0xaa,0x01,0x00,0x00,0x00,0xe0,0x29,0x51,0xa4,0xfa,0x03,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xd5,
- 0x01,0x00,0x00,0x00,0x00,0xbc,0xa9,0xfa,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0xda,
+ 0x01,0x00,0x00,0x00,0x00,0xfc,0xab,0xfa,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x56,0x03,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x55,0x03,0x00,
  0x00,0x00,0x00,0x00,0xf8,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0xaa,0x03,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0xaa,0x03,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0xaa,0x02,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x56,0x03,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x58,0x55,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0xb8,0xaa,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x50,0xad,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xa0,0x5a,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0xa8,0xb5,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x58,0xab,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,
  0x55,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0xaa,0x0e,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xb5,0x0e,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x55,0x0d,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa8,0x56,0x0d,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xab,0x0a,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0xaa,0x0a,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x5a,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xb5,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x50,0xd5,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xa0,0xaa,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x60,0x55,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xd0,0x56,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0xa0,0xaa,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x56,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x6a,
  0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xaa,0x3a,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xad,0x3a,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -566,7 +566,7 @@ static char wl-logo_bits[] = {
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xda,0x3a,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x6a,0x3b,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -574,26 +574,26 @@ static char wl-logo_bits[] = {
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x80,0xaa,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xc0,0xaa,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x40,0x55,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x5b,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xab,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
+ 0xd5,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x5a,0x35,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x35,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xaa,0x3a,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x3b,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6b,0x35,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5a,0x35,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -601,15 +601,15 @@ static char wl-logo_bits[] = {
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0xaa,0x3a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x54,0x3d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x54,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xd8,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x68,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x50,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,
index e46eaac..b873642 100644 (file)
 /* XPM */
-static char *wl-logo26[] = {
+static char *wl-beta-logo26[] = {
 /* width height ncolors chars_per_pixel */
 "491 176 26 1",
 /* colors */
 ". c None",
-"a c #917DCA",
-"b c #295EB6",
-"c c #E3ABD8",
-"d c #C090D3",
-"e c #F6C8DC",
-"f c #596CBF",
-"g c #030404",
-"h c #9C82CC",
-"i c #837ACA",
-"j c #22529C",
-"k c #4D6ABF",
-"l c #0C1112",
-"m c #3F65BB",
-"n c #7574C5",
-"o c #D09AD9",
-"p c #C994D2",
-"q c #6771C4",
-"r c #6E6CAD",
-"s c #1D2628",
-"t c #AE82BD",
-"u c #3864BC",
-"v c #444A5E",
-"w c #6C73C4",
-"x c #B28BD4",
-"y c #3162BB",
+"a c #7B5F86",
+"b c #586CC0",
+"c c #D09BD6",
+"d c #907AC2",
+"e c #080B07",
+"f c #E1AAD2",
+"g c #C898D0",
+"h c #E02828",
+"i c #8278C6",
+"j c #6870C0",
+"k c #3964B6",
+"l c #305FB7",
+"m c #285BAF",
+"n c #873943",
+"o c #506CBF",
+"p c #B08BCE",
+"q c #205199",
+"r c #B47FB0",
+"s c #1B2423",
+"t c #7073BF",
+"u c #C08FCE",
+"v c #425EA4",
+"w c #9D82CC",
+"x c #F0C8D8",
+"y c #000400",
 /* pixels */
 "...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
 "...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
 "...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
 "...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
-"..................................................................................................................................................................................................................................xxxxxxxxxx...............................................................................................................................................................................................................................................................",
-".......................................................................mmm................................................................................................................................................xxxxxxxxxxxxxxxxxxxxxxxxx........................................................................................................................................................................................................................................................",
-"......................................................................mmmmg..........................................................................................................................................xxxxxxxxxxxxxxxxxxxxxxxxxxdddddxxx....................................................................................................................................................................................................................................................",
-".....................................................................mmmmmll......................................................................................................................................xxxxxxxxxxxxxxxxxxxxxxxxxxdddxxxxddddddxd................................................................................................................................................................................................................................................",
-"....................................................................ummmmmsg..................................................................................................................................hhxxxxtxxxxxxxxxxxxxxxxxdxdxxxxxxdddxddxddpdddt..............................................................................................................................................................................................................................................",
-"...................................................................mmmmmmmsg................................................................................................................................hxxxxxxxxxxtxtxxxxxxxxxxxxxxxxxxxxdxxxddddddddddddpt...........................................................................................................................................................................................................................................",
-".................................................................mmmummmmkvg.............................................................................................................................hxxxxxhxxxxxxxxxxxxxxxxxxxxxxxxdxxxxxxddxxxdxdddddppdpdpa.........................................................................................................................................................................................................................................",
-"................................................................uuummmmmmmjg...........................................................................................................................hhxhhhxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxdxdxxdddddddddpddpdpppdt.......................................................................................................................................................................................................................................",
-"...............................................................mmmumummmmmjg........................................................................................................................ahhhhhxxhhxhxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxdxxdxdxddddddddddpppdtr.....................................................................................................................................................................................................................................",
-"..............................................................muuummmmmmmkvg......................................................................................................................ahhhhxhxhhxxxxxtxxtxxxxxxxxxxxxxxxxxxxxxxxdxdxddxddddddddddpppdppppor....................................................................................................................................................................................................................................",
-"............................................................uummmmumummmmmsg....................................................................................................................hhahhhhhhhxhxhxxxxxxxxxxxxxxtxxxxxxxxxxddxxxxxdxxddxddddddddddddpdppppdtv..................................................................................................................................................................................................................................",
-"...........................................................uuumuuummmmmmmksg...................................................................................................................hahhhahhxhxhxhxxhxxxxxxxxxxxxxxxxxxxxxxxxxxxxdxxddxxddxddddppppppppppdooppv.................................................................................................................................................................................................................................",
-"..........................................................uuuummmmummmmmmmsg.................................................................................................................haahhahhhhhhhhxxhxhxxxxxxxxxxxxxxxxxdxxxxxxxxxxxxxxdddxddddddddddddpdppppoppor................................................................................................................................................................................................................................",
-"........................................................uuuumuuuuummmmmmmksg...............................................................................................................ahahhaahhahhxhxxhhxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxdxxdxxxddddddddddpdpppppppppopotv..............................................................................................................................................................................................................................",
-".......................................................uyuuuuummmmuummmmmmgg...............................................qqq...........................................................aaaaaahahahhhhhhhxxxxxxxxxxxtxxxtxtxxxxxxxxxxxdxxxxddxdddddxddddddddpddpdpdppopppopts.............................................................................................................................................................................................................................",
-".....................................................yuuuuummuuuuummmmmmmkgg.............................................qqqqqwwm.......................................................aaaahhhahhhhhhaxhhhhhhxxxxxxxxxxxxxxxxxxdxxxxxxxxxxxxxxxxxxxdxddddddpdppppppppppoopoots............................................................................................................................................................................................................................",
-"...................................................uuyuuuuuumuummmmummmmmjgg...........................................fqqqqqqqwqv....................................................aaaaaaaahhahhhahhhhhxxxhhxxxxxxxtxxxxxxxxxxxxxxxxxdxxxxxxdddddddddddpdddddpdpppppppopoootl...........................................................................................................................................................................................................................",
-"..................................................uyyuyuuuuuummuuummummmmsg...........................................qqqqqwwqwqwws..................................................aaaaaaaahaahaahhhaxxxhhhxtxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxddxxxxddddddddddpddppppppopppoppoorl..........................................................................................................................................................................................................................",
-"................................................yyuuyuyuuuuumuummummummmmsg..........................................qqrqqqqqqwqwwjg...............................................aaaaaaahaahhaahahhhhhhhxxxxahxxxxtxxxxtxtxxxxxxxxxxxxdxxxxxxdddxdxddddddddppdddpdppppppoopooov..........................................................................................................................................................................................................................",
-"..............................................yyuuuyuuuuuuuuuumuummmmmmmmgg.........................................fqqqqqqqwqqwqwfg..............................................aaaaaaaaahaaaahhhhhhhhhxhhhxxxxxxxxxxarrrrrrrrrtxxxxxxxxxxxxdxxxdxdddddddppdddpppppdooooppopooos.........................................................................................................................................................................................................................",
-"............................................yyyuyyuuuuyuyuuuuuumuummummmjgg........................................qffqfqqqqqqqwqwqgl............................................aaiaaaaahahhhhhhhahhhhhhhxxhxxrrsssgggggl.........llvsrrxxxpxxddxddxdddddddpppdpppppppppooooooootl........................................................................................................................................................................................................................",
-"..........................................byyyyyyyuuyyuuuuuumumummummmmmsg........................................ffqqqqqqqqwwwqwwwgg..........................................iiiaaaaaaaahaaaaaahhhhhhxhxrvsgggg.........................vvrxdxxdxddddddddddddpddppppppppppopoooovl.......................................................................................................................................................................................................................",
-"........................................yyybyyyyyyyuuuuuuuuuuuuuumumummbgg.......................................fqfqqqqqqqqqqwqqwqgg.........................................iaaaaaaaaaaaaahahhahahhhrvsggg..................................vrxdxdxxddddddppddppdppppppoopopooooos.......................................................................................................................................................................................................................",
-".....................................byybyyyyyyuuyuyyyuuuuuumummmummmmmsgl.......................................qfqffqqqqqqqqqwwwjgg........................................iiaiiaaaaaaaahaahaahairsggg.........................................rrddddddddddddpppppdooooppooopooootg......................................................................................................................................................................................................................",
-"..................................bbbbbybbybyyyybyuuuyyuuuuuuuuummumumjgg.......................................fqfqqfrfqqqqwqqqqqvg.......................................iiaiaaaaaaaaaaahaahhhrsggl...............................................tdddddddpppdppppppdpooppoooooooovl.....................................................................................................................................................................................................................",
-"...................bbj........bbbbbbbbybybyyyyyyyuyyyuuuuuuumuumuummmmsgl......................................frfqffqqqqqqwqwwwwwsg......................................iiaiiaiaaaaaaaaaaaarsggg....................................................tddddddddpddppppppppoooooooooodg.....................................................................................................................................................................................................................",
-"...................bbbbbbbbbbbbbbbbybbuyyyyyyyuyuyuuuuyuuuuuuuummmummjgg......................................qqffqqqqqqqqqqqqqqwfgg.....................................iiiiiiaiaaaaaaaaahvsggl........................................................dddpdpdppdppppppppppooooooooosl....................................................................................................................................................................................................................",
-"....................bbbbbbbbbbbbbbbbybbbybyyyyyyyuuyuyuuuuuummuuuummmlgl.....................................ffffffffqqqqqqqqqwwqvgl....................................iaiiiaiiaaaaaaaanvlgg............................................................xddddpdppdppoopooooppoooooootg....................................................................................................................................................................................................................",
-"....................bbbbbbbbbbbbbbbbbyybybbyyyuyyyyyuuuuuuuuuummmmuusgg......................................ffqfrqqfffqqqqqwqqwwlg....................................iiiiaiaaiaaaaaanvggl................................................................dpddpdppdppodpppooppoooooooll...................................................................................................................................................................................................................",
-"....................bbbbbbbbbbbbbbbbybbybyybyyyyyyuuyyyuuuuuumuuuumvgg......................................ffffqqffqqqqqqqwqqwqvgg...................................iiiaiiiaiaiaaarvggl...................................................................dppdppppdpppdoopoooooooooovg...................................................................................................................................................................................................................",
-"....................bbbbbbbbbbbbbbbbbbbyyyybyyybuyyuuuuuuuuuuuummmjgg......................................ffffffqqfqqfqqqqqqqwwlg...................................iiiiiiiiaiaaaavggl......................................................................ddpddpppppoppopoopoooooootg...................................................................................................................................................................................................................",
-".....................bbbbbbbbbbbbbbbbbybbyyyyyuyyyuyuyyuuuumuumuujgg......................................kfffffffrqfqqqqqqqwqqvgg..................................iiiiiiiiiiaaijlgg.........................................................................pdppppppoppopooooooooooooll..................................................................................................................................................................................................................",
-".....................bbbbbbbbbbbbbbyybyybyyyyyyyyuuuuuyumuuumuumsgg.......................................kffffqfqfqfqrfqqqqqqjgg..................................iiiiiiiiiiiirsgg............................................................................ppdpppppopopppoooooooooovg..................................................................................................................................................................................................................",
-".....................bbbbbbbbbbbbbbbbbbbybybyyyuuyuyyyuuuuuuuubsgg.......................................fffffqfffqfqqqqqqqqwflgl.................................iiiiiiiiiiirvggl..............................................................................ppdppppppdooooooooooooorg..................................................................................................................................................................................................................",
-"......................bbbbbbbbbbbybbbyybybybyyyyyyuuuuyuuuuumjlgl.......................................ffffffffffqffqqqqqqqqsgl.................................iiiiiiiiiiirlgl.................................................................................ppdpoppoppodppooooooootg..................................................................................................................................................................................................................",
-"......................bbbbbbbbbbbbbyybbybyyyyyyyyyuyuyuuuuuusggl........................................kfkffffqrffqqqqqqqqqvgg.................................iiiiiiiiiaisgg...................................................................................ppppppopoopoooooooooooogl.................................................................................................................................................................................................................",
-".......................bbbbbbbbbbbbbbbbyyyyyyyyuyyuuuuyuuujlgg.........................................fkffffrfqqfffffqfqqqjgg.................................iiiiiiiiiirlgg.....................................................................................pppodpppoooopooooooooosg.................................................................................................................................................................................................................",
-".......................bbbbbbbbbbbbbbyybbbybyyyyuyyyyyuujsggl.........................................kkfffffffffqqqqqfqqqjgg.................................iiiiiiiiaivggl.......................................................................................dpppppoppoooooooooooovg.................................................................................................................................................................................................................",
-"........................bbbbbbbbbbbybbyyybyyyyyyyyuuuuysggl...........................................ffffffqffffrffqqqqqjgg.................................niiiiiiiirsgg.........................................................................................pppoopooppooooooooooovg.................................................................................................................................................................................................................",
-".........................bbbbbbbbbbbbbbbbyyyyyyyuuyyyjlgg............................................kkkfkffffqfffqqfqqqjgg.................................iiiiiiiiirlgl...........................................................................................dopppdpooooooooooooorg.................................................................................................................................................................................................................",
-"..........................bbbbbbbbbbbyyyyyybyyyyuyujlgg.............................................ffffffffffqfqffqffqjgg.................................iiiiiiiiivggl............................................................................................pppppopoppoooooooooorg.................................................................................................................................................................................................................",
-"...........................bbbbbbbbyybbbbbyyyyyyyyvggl..............................................kkkffkfffffqffqfqqvgg.................................iiiiiiiiivgg...............................................................................................ppoopopoooooooooopxrg...............................................................................xx................................................................................................................................",
-".............................bbbbbbbbbyyybyyyyyyjsgg...............................................ffffffffffffffrqfqsgg.................................niniiiiiisgg................................................................................................oppppooopooooooopinnsl.............................................................................xxxtg..............................................................................................................................",
-"...............................jjbbbbybbbyyyyyyjlgl................................................kkkkfffffffffqqfksgg.................................niiiiniirsgg.................................................................................................pppoopdoooooooopinnnvg............................................................................xxxxxgl.............................................................................................................................",
-"..................................sssslljbbyyyjggl................................................fkffkkffffffqfffjlgl.................................inniiiiirlgl...................................................................................................pppoopopooooooannnnvg...........................................................................xxxxxxgg.............................................................................................................................",
-".......................................bbyybujgg.................................................kkkfkfffffffffffvggl..................................niiiiiirlgl....................................................................................................oppppoooooooohnnnnnng...........................................................................xxxxxxgg.............................................................................................................................",
-"......................................buyyybjlgl.................................................ffkfkkfffkrfffksgg...................................nnnniiirlgl.....................................................................................................pppoppopoooodnnnnnnngg.........................................................................xxxxxtxgg.............................................................................................................................",
-"......................................ybbbyjgg..................................................kkkkkffkfkffffjlgl...................................niiiiinrlgl......................................................................................................ooodooooooooinnnninngg........................................................................xxxxxxxxgg.............................................................................................................................",
-".....................................byyyyjlgl..................................................kkfkkffffffffvggl...................................innnniirlgl.......................................................................................................ppppppooooohnnnnnnnfgg........................................................................xxxxxxxxgg.............................................................................................................................",
-"....................................bbbbyjlgl..................................................kkkfkkfkkfffjlgg.....................................niniiirlgl.........................................................................................................pooooopoodnnnnnnnnvgl.......................................................................xxxxxxxxxgg.............................................................................................................................",
-"...................................ybyybjlgl...................................................kkkffkfffkfkggl.....................................nninnnrlgl..........................................................................................................pppdpoppoinnnnnnnnvg........................................................................xxxxxxxtrgg.............................................................................................................................",
-"...................................bybbysgl...................................................fkkkkkfkkfffvgl.....................................nninniilgl...........................................................................................................ppooooooxwwnnnnnnnvg.......................................................................xxxxxxxxxrg................................................................................................c.............................",
-"..................................bbbbbsgg....................................................kkkkkfkfkfffgg.....................................nnnninnsgg............................................................................................................pppppoodnnnnnnnnnnsg......................................................................xtxxxxxxxxsg.............................................................................................ccccco...........................",
-".................................bbbbyvgg....................................................kfkkkfkfkfkfvgg.....................................nnnnnnsgg.............................................................................................................opoooooawwnnnnnnnngg......................................................................xxxxtxtxxxsg...........................................................................................ccccccccgl.........................",
-"................................bbbybjgg.....................................................kkkkkkkfkfkflg.....................................nnnnnivgg..............................................................................................................ppppppxnnwwnnnnnnvgg.....................................................................xxxxxxxxxxagg..........................................................................................ccccccccrgg.........................",
-"................................bbbbjgg.....................................................kkkkkkkkffkfvgg....................................nnnnnnvgg...............................................................................................................opooooiwwnnnnnnnnsg......................................................................xxxxxxxtxxvgl.........................................................................................ccccccccclg..........................",
-"...............................bbbbjlgl.....................................................kkfkkkkkkfkklg.....................................nnnnnflg................................................................................................................ppppoxnnnnnnnnnnrgg.....................................................................xxxxxxxxxxxlg..........................................................................................ccccccccrgg..........................",
-"..............................bbbbbsgl.....................................................kkkkkkkfkfkfjgg....................................nnnnnnlgl................................................................................................................opoodwnwnwnnnnnnsgl.....................................................................xxxtxxxxtxvgg.........................................................................................ccccccccpgg...........................",
-"..............................bbbbsgg.....................................................kkkkkkkkkfkkfsg....................................nwnnnnsgg.................................................................................................................pppphwnwnwnnnnnrgg.....................................................................xxxxxxxxxxalg.........................................................................................ccccccccplgl...........................",
-".............................bbbbjgg.....................................................kkkkkfkkkfkffjgg....................................wnnnnvgg..................................................................................................................opopwwwnwnwnnnilgl....................................................................xxxxxxxxxxxsgl.........................................................................................ccccccccvgl............................",
-"............................bbbbjgg....................................................kkkkkkkkkkkkkkfvgl...................................nnnnnrlg...................................................................................................................oppinwwnnnwnnnrgg.....................................................................xxxxxxxxxxrgg.........................................................................................ccccccccvgg.............................",
-"...........................bbbbblgl...................................................kkkkkkkkkkkkfkkmgg...................................wwnnnnsgl...................................................................................................................ppxnnnnwnnnnnxvgl....................................................................xxxxtxxxxxrgg.........................................................................................ccccccccrgg..............................",
-"...........................bbbbsgg...................................................kkkkkkkkkkkkkkfkvgl...................................nnnnnvgg...................................................................................................................pppiwnwnwnnwnatgg.....................................................................txxxxxxxxalg..........................................................................................cccccccrgg...............................",
-"..........................bbbbjgg..................................................kkkkkkkkkkkkkkkffklg...................................nwwwnfgg....................................................................................................................poxwwwwnnwwnaovgl....................................................................xxxxxxxxxalgl.................................................................ooo.....................ccccccctgg................................",
-".........................bbbbjlgl.................................................kkkkjjkfkkkkfkkkkfjgg...................................nnnnnsgl....................................................................................................................ppiwwnwwnnnaoolg............................................a........................xxxxtxxtilgl.................................................................ooooll...................ccccccplgl................................",
-"........................bbbbbsgl................................................mkmkkjgukkkkkkkkkfkkvgl..................................wwwnwvgg.....................................................................................................................pxwwnwwnwnaootgg...........................................aaar.....................xxhxxxxxalgl.................................................................oooovgg..................coccccplgl.................................",
-"........................bbbbjgg................................................kkkkksgskkkkkkkkkkkkklg...................................nnnnflg........................yyy...........................................................................................piwwwwwnnaooosgl...................iiiiii.................aaailg....................hxxxxxxilgl................................................................oooootgg...................ccccccsgl..................................",
-".......................bbbbblgl...............................................kmkkusggkkkkkkkkkkkkkmgg..................................nwnwwsgl......................yyyuuj.........................................................................................oxwwwnnnwaoootgg.................iiiiiiiiiis.............aaahrlgl...................xxxxxxxilgl....................x...........................................oooooorgl...........ooocoooccocccvgg...................................",
-"......................bbbbbvgg..............................................kmkmkblgl.kkkkkkkkkkkfkjgl.................................wnwnnmgg.......................uuyuuug...........................mm................................................qqqqqwfr...piwwwwwwapooosgl...............iiiiiiiiiiiivg...........aaaaavgl...................hxxxxxxalgl...................xxxxr........................................opooooool...........oooococcccccctvv........c...........................",
-".....................bbbbbjgg..............................................mmmkkjggl.kkkkkkkkkkkkkfjg..................................wwwwwsgl......................yuuyyuugg........................mkkkmg...........................................fqqqfvlggg....dwwwwwwaooootgg..............niiiiiiiiiiiiivg..........aaaaaavg....................xxhhhxalgl..................xxxxxxxg......................................oooooooootl.........occcoocococccccccccccccccp...........................",
-".....................bbbbbsgl.............................................mkkmkvgg...kkkkkkkkkfkkkkkg.................................wwwnnvgg...............bbbbbyyyyyyuyyjgg......................mmmmkkjgl.......................................fqqfksggl.......panwwnnaooooosgl.............iinvsvriiiiiiiisg.........aaaaaaaar....................hxxxhilgl..................xxxxxxdtgg...............dddd.................ppopooooooots........oooooococcooccccccccccpvggl..........................",
-"....................bbbbbjgg............................................mmmmkbsgg...kkkkkkkkkkkkkkfksg................................wwnwnlg............bbyybjvsggsyyyuyuusgl.....................mmkmkmmsg..........kkkkk.......................fqqqmlgg..........pwwwwwaopoootgg............nii.ggl..iiiiiiiilg........aaaaaaaaaaar.................xxxxxalgl..................xxxxxxxxvgl..............dddpptg...............ooooooooooootl........oocccoccoccccccccctrsggl............................",
-"...................bbbbbbsgl...........................................mmkmmulgl....kkkkkkkkkkkkkkkkvg...............................wnwnwvgg..........bbbbjsggl...yyyyyyyjgg.....................mkmkmkkjgg........kkkkkkkvl....................qfffsgg............hqqnwapopooosgl...........ini.gl....iiiiiiivgg.......aiiaaaaaaaaaaan...............hhxxilgl..................xxxxxxxxtlg..............dddddpdgl...............pooooooooooorl.........vvvtocccrrrrvvsgggl...............................",
-"..................bbbbbbjgg..........................................mmmmmmjggl.....mkkkkkkkkkkkkkfkmg...............................wwwwwlg.........bbbbjlgg......yyuyyyuvg.....................mmmmmmmmsgl.......kkkkkkkkkg..................fqfqflgl............pinwwioopoppvgg...........inilg.......iiiiivgg........iaaaaaaaahaaaaans............xxxhrggl...................xxxxxxxtvgl.............dddddddvgg.............ppodpoooooooooos............cccctgg........................................",
-"..................bbbbbbvgl.........................................ummmmksgg......kkkkkkkkkkkkkkkfkkvl..............................wwwwvgg.......bbbbyjggl.......yyyuyyuyj....................mmmmmkkkvgg.......kkkkkkkkkksg................ffffklgl.............xwwqndpooootlg...........ninsg........iiiivgg..........aaaaaaaaaahhaaasl...........hhxrgg....................xxxxxdxtlgl.............ddddddptlg.............oo..gtoooooooooorg..........ooooosgl........................................",
-".................bbbbbbbsg.........................................mmmmmbsgg.......kmkkkfkkkkkkkkkfkkmg.............................wwwwnlg.......bbbbbjgg..........yuyuyuuujs.................mmmmkkmmmlg.......kkkkkkkkkkksg...............fffqqvgl.............pawwwxpoppoovgl..........ninvgl.......iiiivgg..........aaiaaaaaaaaaaaahsg..........hxxrgg....................xxxxxxxvggl.............ddddddphlgl............p...l..ooooooooootg..........cccctgg.........................................",
-"................bbbbbbbjgg.......................................mmmummjlgl........kkkkmkkkkkkfkkkffkkvl............................nwwwvgg.....bbbbbbblgl..........yyyuyyuuujs................mmmmmmmkvgg......kkkkkkkkkkkkvg..............fqfrfkgg..............pqqwxppooporgg...........nirgg.......iiirsgg..........ii.lgrnaaaaaaaaavgg..........hhtlgl...................xxxdxxrlgg...............xdddddtlgl............p..l.....oooooooooogl........oooccvgl.........................................",
-"...............bbbbbbbbjgl......................................mummmmvgg..........kmkkkkkkkkkkkkkkfkfmg...........................wwnnwlg.....bbbbbbbvgg............yyyyuuuyuvl..............mmmmmmmkbgg......kkmkkkkkkkkkkjg.............fffqffvgl..............hwwnpopppotlg...........innlg......iiiirggl..........i.......iaaaaahhvgg...........axvgl....................xxxxxvggl...............ddddddrlgl............p..........ooooooooogg........occocgg..........................................",
-"...............bbbbbbbbsg.....................................ummuumjsgg...........kkkkkkkkkkkkkkkkkkfkvl..........................wwwwvgg....bbbbbbbbsg............uy.uyyyuuyul.............mummmmkmmvgl.....k..gvkkkkkkkkkjg.............fffqffsg..............xwwqhpooopovgl...........nnmgg...niiiirggg...........a.........aaaaaasgg...........hhxgg....................xxxxxvgg................xdxdddvgg..........................oooooootgg........oocorgg..........................................",
-"..............bbbbbbbbbsg....................................ummummjlgl............kkkkkfkkkkkkkkfkfkkffl.........................wqwwwsg.....bbbbbbbbgg...........yy..jyuuyyuusg............mmmmmkmmklg.....k..l..kkkkkkkkkjg............fffffqfsg.............anqwwxpppporgg...........niiinniiiirvlggl........................aaaasgg............xhhgg....................xxxxrgg................xdddddvgg............................oooooorgl.......cococvg...........................................",
-".............bbbbbbbbbbsg..................................uuuumumvggl.............kkkkmfkkkkkfkkkkfkfkfjg........................wqwnmgg....bbbbbbbbbgg...........y....yyuuuuusg...........ummmmmmmmjgg............kkkkkkkkjg...........kfffffqfvg............wiiqwwxpppptgg............nnnrvssggggl............................aaasgg.............xhhvg...................xxxdxsgl...............ddxdddrgg.............................oooooosg........cocoovg...........................................",
-".............jbbbbbbbbbsg.................................uuuuuubsgg...............mkkkkkkkkkkkkkkkffffffs........................wwwwsgl...bbbbbbbbbblg..........y.....yuyuyuusg...........mmmmmmmkmvgl............kkkkkkkkjg...........ffffffffjg...........qidnwwwnppoolgl...........ninnsgl.................................aaasgg.............hhxxxs...................xxxxxsg................xxddddlg...............................ooootgg.......ooooccvg...........................................",
-"............bbbbbbbbbbbjg...............................uuuuummjlgl................kkkkkkkkkkkkkkkkkkkkffmg......................wwwwfgg....bbbbbbbbbbsg........yb.....uyuuuuuugg..........mummmmkmmksg.............kkkkkkkkkg...........fffffrfffvl.........qwdpqqqwwappvgg............nninmg..................................aargg............h.hhhhxxv.................xxxxxxrg...............dddxdddlg............p..................oooosgl.......ocooootg...........................................",
-"...........bbjbbbbbbbbbjg..............................uuuuummsgg...................kkkkkkkkkkkkkkkfkfffffvl.....................qwqwvgl...bbbbbbbbbbbjl.......by......uyyyyyujgg........m.mmummmmmmmsg.............kkkkkkkkklg........kffffffqqqqqv.......qqqxdxwwwwwqavgg............nnininvl....................ii..........aaasg............h..hhhxhhxr................xxxxxxxrl............xxxxxdxxdvg...........d.....ppp...........ooorgg........oocccccrl...............c..........................",
-"...........jbbbbbbbbbbbbsl...........................uuuyuuujsgg....................kkkkfkkkkkkkkkkkkkkfkffs....................wqwqwsg....bbbbbbbbbbbbjv....yyy.l....yuuuuuyujgl......mu..mmmmmmmkmmbvm............kkkkkkkkkvg......ff.ffffqffffffqjk..qqqqqrpdhqwwwwwwfs............n.nnnninvs..................ii..........aaaagg..........hh..shhhxxhxxha.............xxxxxxxxxrv..........xxddddddxddv.........pp..l..pppots.........oodlg.........ooooococrv............cc...........................",
-"..........bbbjbbbbbbbbbbjg.........................yuyuuuuuvggl......................kkkkkkkkkfkfkffkffffffkg...................qwwwmgg....bbbbbbbbbbbbbbbbbybb.g.....yyyyyyuujg.....uu..lvmmummmmmmkmmj.l..........kkkkkkkkkkv....kfk..fkffffrffqqfqqqqqqqfvdppiwqqqwwwwwr.........nn..nniiniinr...............iaa.l........aaaaasg........ahh.lg.xxhhhxhxxxxxhh.......xxxxxxxxxxxxxtx......xxx.xxxxddddddr......dpp..l..pppopovl.......ooosgl........ooooccoccoct........ccc..l..........................",
-"..........jbbbbbbbbbbbbbbvl.......................uuuyyuujsgg........................kkkkkkkkkkkkkkfkkffffffjl..................wwwwvgl...bbbbbbbbbbbbbbbbbbysgg.....yyyuuuuyyusv.uuuu.lg..mmuummmkmmmjgg...........kkkkkkkkkkkkkkfkfsglfffffqffffqffqqfqqkstddpiwwwwqqwwnwwwqwwwwnnn.lvnnninnininnn..........iii..g.......aaaaaaarg......hhhavgg..hxhxhxhxhxxxxxxxxxxxxx.rxxxxxxxxxxxxxxxxxxxdlvdddxddddddddddppddxlg....oopppppg.......oorgg.........cooooccccoocccccccccccrlg...........................",
-".........jbbjbbbbbbbbbbbbbs.....................yyuuyuuujlgl..........................kkkkkkkkkkkkkkkffkkfkffs.................qqqwqlg....bbbbbbbbbbbbbbybyysgg.....yuuuyyyuuuuuuuuujggl..mummmmmmmmmjgg............kkkkkkkkkkkkfkfjlgl.ffffffqqfqfqqqqqqklrddpdiqqwqwwwwwnnwnnnnnnnsgl.ninniiiiiiiiiiiiiiiiiiiivgg........iaaaaaaarraaahhaaalgl...hhxhxhxxxhxxxxxxxxxxrggrxxxxxxxxxxxxxxxxxxrggvxxxdxdxdddddddddpvgg....ppppoooovg.....ooogg..........occocoooccccccccccccplgg............................",
-".........bjbbjbbbbbbbbbbbbbs..................yyuyyuuujsgg.............................kkkkkkkkkkkfkkfffffkffml................wwqwmgg....bbbbbbbbbbbbbbybjlgg......yuyyuuyuuuuuuujsgg....mmmmummmmkjgg..............kkkkkkkkkkffkvgg...ffffrffqrqffffqfflvpdddpawqwwwwwwwwnnnwnnnnsgg..nnninnniiiiiiiiiiiiiiirsgg........aaaaaaaaaaaaaaahailgl....hhhhxhhxxhxxxxtxxxxvgg..xxxxxxxxxxxxxxxxxsgg..ddxdxdxdddddddptsgg.....pppppppptl....ooolg............oooccccccoccccccccrggl.............................",
-"........jbbjbbbbbbbbbbbbbbbbj...............yyyyyyuyujlgl..............................kfkkkkkkkkkkffkkkffffffjl...............qqwwvgl....bbbbbbbbbbbbbbbjggl......yyyuyuyuuyuuuujlgl.....uummmmmmmjgg...............kkkkkkkkkkkksgg....ffffffffffqqqqqjlvpdpppdxqwwwwwwwwwwwwnnwflgg...ninniiiiiiiniiiiiiiiirlgl........iaaaaaaaaaahahaharggl.....hhxxhxxxxxxxxxxxtasgg...xxxxxxxxxxxxxxxxsgg...xxdxddddddddpdrlgl......ppoppooootv.ooo.lg.............ocooooocccccccccpvgg...............................",
-"........bjbbjbbbbbbbbbbbbbbbbbj..........bybyyyyyyujsgg.................................kkkkkkkkkkkffffkfffffffvl.............wwwwwsg......bbbbbbbbbbybjsgg........yyyuyyyyuyuyjsgg.......muummmmkjgg................kkkkkkkkkkmlgg......ffffffqffffqfvgsddddddppwqqqqnwwwnwwwwnflgl.....iinnnniniiiiiiiiiiivggl.........aiiaaaaaaaahaaahvgg........hhxhhhxxxxxxxxxrlgl....xxxxxdxxxxxdxxtlgg....dxdddddddddddvgg.........pppppppopopoovgg..............ococccoococccccrlgl................................",
-"........bbjbbjbbbbbbbbbbbbbbbbbbjb....bbyyyyyybyuujlgl...................................kkkkkkkkkfkkkkfffffffqqs.............qqqqfgg......bbbbbbbbbbbvggl.........yyyyyuuuyujsggl........ummmmmmjgg.................kkkkkkkkkvggl.......ffffqffqqqqksglxdddpppddvwwwwwwwwwwnnnjlgl.......nniiiiiiiiiiiiiirsgg...........iaaaaaaaaaaaahnsgg..........hhxxxhxhxxxxasgg.......xxxxxxdxxxxxvggl......dxxxddddddrlgg..........doopooopopotlgg................ocooocccccccdsgg..................................",
-".......bjbbbbbbbbbbbbbbbbbbbbbbbbbbbbbybyyybyyuyjsgg......................................kkkkkffkkfkfkffkffffffkl............wwwwjgl.......bbbbbbbbvlgg...........yyyyyyyujsggl...........muummjgg...................kkkkkkjsgg..........fffqffrffvlgsxpddddddtsgjwwqqwnwnnwwvgg..........nnnniniiiiiiiivggl.............aaaaaaaaaaaarlgl............hhhxhxxxxivggl.........xxxxxxxxxrsgg.........ddxddddtvggl............pppppoootvggl..................occccococpvggl...................................",
-".......bbjbjbjbbbbbbbbbbbbbbbbbbbbbbbybybbyyyyyvlgl.......................................kkkkkfkffkfkfkfffffffffjl..........wqqqqsg..........jjjvsggg..............yyuyujsggl.............mmmmsgg....................kkkkmvggl............fffffkvlgg.pdddpddptlgl..wwwwwwwwvlgg............niiiiiiiiiivlgg................iaaaaaaaanvggl..............tihxxxrsggl............txxxxxrsggl...........xdxxrvggl...............ppooptvggl.....................oooccctvggl.....................................",
-".......jbbbbbbbjbbbbbbbbbbbbbbbbbbbybbbyybyyyjlgg..........................................kkkkkkkfkfkfffffqffqqqqv..........wwwwwlg..................................jsggg.................mjsgg.......................vsggl................vslggl..dpddddddtlgl....kvjvjsggg................vriiirvsggg....................raaahnvlgl...................sgggg.................vvvggg................vlggl...................vsgggl.........................vvvgggl.......................................",
-".......bjbjbjbbbbbbbbbbbbbbbbbbbbbbbbyybbyyjsggl............................................kfkfffkfkffffffffqffffqs.........qwwwfgg..........................................................l.....................................................dddddddptlgl.................................lgggl.........................vssggl......................................................................................................................................................................",
-".......jbbbbbjbbbbbbbbbbbbbbbbbbbbbbbbyyybvlgl...............................................ffqffkfffffqffqfqqqqfqfl........wwwwjgl...............................................................................................................xdpppdpdrggl............................................................................................................................................................................................................................................",
-".......jbjbjbbbbbbbbbbbbbbbbbbbybbbybbbbjsgg..................................................wwqqrfkffffqffqfffrqqqml......wwnwwsg...............................................................................................................dddppoopvgg..............................................................................................................................................................................................................................................",
-".......bbbbbjbbbbbbbbbbbbbbbbbbbbbbbbbjsggl............ls....ss..............................ssinwffffqqqqqqqqqwqqwwnvs.....iiiinsl.....................................ss.....sss...............................................................xdpdvlpovll...................................................................................sssss.......................sssssss.........................................................................................................................",
-".......bjbjbbbbbbbbbbbbbbbbbbbbybbbyjsggl...............sp...sce..sssssss.ssssssss..........svvtaiwqfvvrwnwvvwwqwfvvvfv..lssvvvvrlls.....l....lssssss...sssss...........ssv....svre...sssssss....sss......sss......ss........ss......lssssss....xdddptscvsls.....l..ssssssss..sssssss...sssss......ssssss....ss.......sss....sssssss..........svectvv....ss....s...........stppttte...s.....s......ss.......sss.....sss.....sssssss...ss....s..............................................................",
-".......jbbbjbjbbbbbbbbbbbbbbbbbbbbjsggl.................vv..stc...stttttte.ttvvttte.........sttveinqqvsvhnivtonwrsrttvvs..ttsttttvsse....ve...stttttte..stttts..........svvp..svrte...stttttte.ssttrv...ssttrv.....svv.....lsrtvs....stttttrc.ddddddptscss.ss....ve..ttvvttte.stttttrc..sttttvv...sreeeepe..svse....ssrtrs...stttttrc........src....vv...sst...se..........ve.........lp...sst....svse....ssrtrs...s.ttvv...stttttrc..sst...se.............................................................",
-".......jbjbbbbbbbbbbbbbbbbbbbbbbjsggl....................vrvrc....se.........vve............secvc.nwqrtvraivtpnrsdecpovts..ovtcotvsse....ve...se........se...vt.........srtr..vtrre...se.......sce..pe..spe..pc....scsc...s.ce..tc...se.....eddddxxppvse...srv...ve....vve....se........se...vv...st........scvt...svce..pc..se..............sc......ve..sts...sc..........vtvvv......vv...svt....scvt...svce..pc..ve...ce..se........sts...sc.............................................................",
-"........jbbjbbbbbbbbbbbbbbbbbbjsggl.......................vre.....svvss......sve...........sre.vr..nwrtdvtavtpivvcxaaavrts.hvtchvs.svvvvvve...svvss.....svsssve.........svcvpvvevre...svvss.....ssss.....ssss.....srevt...se.........svsss..ppddddxtssse...sevv..ve....sve....svsss.....svsssste..svvss.....sc.v...se........svsss...........sc......vc..se.v..vc..........vttrve.....rvt.s.vt....sc.v...se........svss.....svsss.....se.v..vc.............................................................",
-".........jbbjbbbbbbbbbbbbbbjvlggl.........................vpe.....stttte.....sve...........svvvvvp..qmrphvtvtoivreaaiivrcrvhvpchvs.veeeetre...stttte....sttrvee...iii...svevvvpevre...stttte.....pttvv....pttvv...str.vc..se..sss....srtttpcodddddvllsse...se.vv.ve....sve....srtttt....stttvce...steetc...svt.vt..sc........srtttt..........sc.....sve..se.rv.ve..........veeeee.....r.v.sevt...svt.vt..sc.........cttvs...srtttt....se.rv.ve.............................................................",
-"..........bbjbbbbbbbbbbbjjsggl............................vp......se.........sve..........sveeeetr...vrpitvvtoanscaiiisccarastchsl.se....ve...se........se..vt..aaiiiiahvve.vte.vve...se............tve......tve.svtrrvt..st...ert...ste.cccpdddtsgg..sc...se..vvve....sve....ste.......se..vr....st.......sttrvv..sr....s...ste.............vv.....ste..se..vvve..........ve.........r.vs.est...sttrvv..sr....s........vc..ste.......se..vvve.............................................................",
-"............jbbbbbbbbjssggl...............................st......srvssss....sve..........se.....vc...rxiitstoiirvvrvvrcxiiastoall.se....ve...srvssss...se...vcxaaiiiiahvve.vce.sve...srvssss..sss.ss.e.sss.ss.e.se....sc..vvs.sst...svvrrvvopdvggl...sc...se...vre....sve....svvssss...se...vt...st......s.e...vt..vvsssst..svvssss..........rsssssrc...se...vve..........vrvvsss....v..vc.st..s.e...vt..vvsssst..sss.sse..svvssss...se...vve.............................................................",
-"..............sssssgggg....................................t.......tttttte....te...........c......p...vpniittpiiiptttcepaiinrpoill..c....rp....tttttte...p...rtaaaiiiiiartexte...tc....tttttte..etttcc...ctttcc...c.....p...ttt.ec...vttttttetsgg.....rc....p....tc.....te.....tttttrc...t....t....t.......c.....t...ctttce...tttttrc..........ctttec.....t....tp..........rttttttp.......e..t...c.....t...ctttce...ptttee...tttttrc...t....tp.............................................................",
-"........................................................................................................qwnappnnnnipppiinnwnhpxvll...........................xoxaiiiiiiaxooxxxa.....................................................docccccctlll...........................................................................................................................................................................................................................................................",
-".........................................................................................................fwnnnqwwwnwnnnnnwwwniivg............................aaiiiiiiiiaahhahahhv.................................................xxdddppprsll.............................................................................................................................................................................................................................................................",
-"..........................................................................................................fqqqqqqqqwwqwqqwwwnwwvg...........................iiiiiiiiiiiiaaaaaaaaav..............................................xxxxxxddrslg...............................................................................................................................................................................................................................................................",
-"...........................................................................................................qfqfqqqqqqqqwqqqwwwwvg...........................iiiiiiiiaaiiiiiiaaaaaal...........................................xxxxxxxxhsggl................................................................................................................................................................................................................................................................",
-".............................................................................................................fqfqfffqqqqqqwqqqwsg...........................iiiiiiiiiiiiiiaaiaaaaarg........................................xxxxxxxxtvggl..................................................................................................................................................................................................................................................................",
-"..............................................................................................................qfqqqqqqqqqqwwwqqsg...........................niiiiiiiiiiiiiaaiiiaaaas......................................xxxxxxxxtvggl....................................................................................................................................................................................................................................................................",
-"...............................................................................................................fffqfqqfqqqqqqwwfg............................iiiiiiiiiiiiiiiiiaiaaaas...................................xxxxxxxxrsggl......................................................................................................................................................................................................................................................................",
-"................................................................................................................ffqfqqqqqqqwqqqqvl...........................iiiiiiiiiiiiiiiaiiiiaaaas...............................xxxxxxxxxrsggl........................................................................................................................................................................................................................................................................",
-".................................................................................................................ffqfqqqqqqqqwwwws............................iiiiiiiiiiiiiiiaaaaaaaaav...........................xxxxxxxxxavlggl..........................................................................................................................................................................................................................................................................",
-"..................................................................................................................fqffqqqqqwqqqqqmg............................iiiiiiiiiiiaiiaaiaaiaaaarr.....................hhxxxxxxxxxrsggl.............................................................................................................................................................................................................................................................................",
-"....................................................................................................................qqfrqqqqqqwwwqsl............................iiiiiiiiiaiiiiiiiaaaaaaaain..............hhhxxxxxxxxxxavlggl...............................................................................................................................................................................................................................................................................",
-".....................................................................................................................qqqqqqqqqqqwwfg..............................riiiiiiiiiiaaaaiaaaaaaaaaaaaaaaahahhhhhhxhxxxhxxxavsggl..................................................................................................................................................................................................................................................................................",
-"......................................................................................................................qfqqqwwqwwqqwvl...............................riiiiiiiiiiiiaaaaaaaaahahahhhhahhhhhhxhxhxxxrvlggl.....................................................................................................................................................................................................................................................................................",
-".......................................................................................................................qqqqqqqqwwwwmg.................................rvriiiiiiaiiiaaaaaaaaaahaaahahhhhxhhhxrvsggg.........................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqwqwqqwqwsl....................................vvvaaiaaaaaaaaaahahahahhhahhhrrssgggl............................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqqqwwqwqwmg.........................................sssvvrraaaaaaaahrrrvsslgggl.................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqwqqqwwwqwll.................................................gggggggggl.........................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqwwwqqwwwwvg....................................................................................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqqqqwwwwwwfg....................................................................................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqqwqqqwqwwwsl...................................................................................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqqqwwwqwqwwvg...................................................................................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqwqqqqwwwnwwfg...................................................................................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqqqwwqwwwwwwsl..................................................................................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqwqqqwqwwqwwwvg..................................................................................................................................................................................................................................................................................................................................................................",
-"........................................................................................................................qqqqwqwqwqqwwnwvg..................................................................................................................................................................................................................................................................................................................................................................",
-".........................................................................................................................qqqwqwqwwwwwnwwg..................................................................................................................................................................................................................................................................................................................................................................",
-".........................................................................................................................qqqqqqwqwwwwwwwsg.................................................................................................................................................................................................................................................................................................................................................................",
-".........................................................................................................................qqqqwqwqqqwwwwwsg.................................................................................................................................................................................................................................................................................................................................................................",
-".........................................................................................................................qqqwqwqwwwqwwwwjg.................................................................................................................................................................................................................................................................................................................................................................",
-".........................................................................................................................qqqqqwqwwwwwnnwmg.................................................................................................................................................................................................................................................................................................................................................................",
-"..........................................................................................................................qqqqqwqwwqwwwwwgl................................................................................................................................................................................................................................................................................................................................................................",
-"..........................................................................................................................qwqwqwqwwqwwnwwgg................................................................................................................................................................................................................................................................................................................................................................",
-"..........................................................................................................................qqwqwqwqwwwwwwwsg................................................................................................................................................................................................................................................................................................................................................................",
-"..........................................................................................................................qqqqwqwwwqwwnnwsg................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................qqqqwqqwwwwwwnsg................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................wwqqwwqwwwwwwwsg................................................................................................................................................................................................................................................................................................................................................................",
-"...........................................................................................................................qqwwqqwnqwwwwwsg................................................................................................................................................................................................................................................................................................................................................................",
-"............................................................................................................................qqwwwqwwwwwnwsg................................................................................................................................................................................................................................................................................................................................................................",
-"............................................................................................................................qqqqqwwwwnnwwsg................................................................................................................................................................................................................................................................................................................................................................",
-".............................................................................................................................wwwwwqwwwwnwsg................................................................................................................................................................................................................................................................................................................................................................",
-".............................................................................................................................qqqqqnqwwwwwlg................................................................................................................................................................................................................................................................................................................................................................",
-"..............................................................................................................................wwwwwwwwwnwgg................................................................................................................................................................................................................................................................................................................................................................",
-"..............................................................................................................................qqqwwwwnwwvgg................................................................................................................................................................................................................................................................................................................................................................",
-"...............................................................................................................................wqwqwwwwwsg.................................................................................................................................................................................................................................................................................................................................................................",
-"................................................................................................................................wqwwwnwvgg.................................................................................................................................................................................................................................................................................................................................................................",
-".................................................................................................................................wwwwwmlgl.................................................................................................................................................................................................................................................................................................................................................................",
-"...................................................................................................................................vssggl..................................................................................................................................................................................................................................................................................................................................................................",
+"...............................................................................................................................................................................................................................hhh.........................................................................................................................................................................................................................................................................",
+"..............................................................................................................................................................................................................................hhhh.........................................................................................................................................................................................................................................................................",
+"............................................................................................................................................................................................................................hhhhhhh........................................................................................................................................................................................................................................................................",
+".............................................................................................................................................................................................................................hhhhhh........................................................................................................................................................................................................................................................................",
+"...............................................................................................................................................................................................................................hhhh........................................................................................................................................................................................................................................................................",
+"....................................................................................................................................................................................................................hhhh.........hh........................................................................................................................................................................................................................................................................",
+"..................................................................................................................................................................................................................hhhhhhhh.......hhrpppppppp...............................................................................................................................................................................................................................................................",
+".......................................................................kkk........................................................................................................................................hhhhhhhhwwwwppprhhppppppppppppppp........................................................................................................................................................................................................................................................",
+"......................................................................kkkky........................................................................................................................................hhhhhhhhrwppwprhhruppppuppupuuuuuppp....................................................................................................................................................................................................................................................",
+".....................................................................kkkkkee.............................................................................................................................hhh......wwhhhhhhhhrppwprhhrpppppppuuuppppuuuuuupu................................................................................................................................................................................................................................................",
+"....................................................................kkkkkksy..........................................................................................................................hhhhhhhhrwwwwwrrhhhhhhhrppwrhhhwpuppuppppuuupuupuuuuuur..............................................................................................................................................................................................................................................",
+"...................................................................kkkkkkksy.........................................................................................................................hhhhhhhhhhrwwwwwwhhhhhhhhwpppahhrppppppppupppuupuupuupuuuur...........................................................................................................................................................................................................................................",
+".................................................................kkkkkkkkoqy........................................................................................................................hhhh.drrhhhhrwwwwwrhhhhhhhrrpprhhrpppuppuppuupppupuuuuuuuuguud.........................................................................................................................................................................................................................................",
+"................................................................kklkkkkkkkqy........................................................................................................................hhhdwwwwwrhhhhwwpwwhhrprhhhhrprhhhruppppupuppuuuuuuupuuuuuugugur.......................................................................................................................................................................................................................................",
+"...............................................................kkkkklkkkkkqy.......................................................................................................................hhhrwwwwwwwrhhhrwwpwahrrwprhhhrrhhhrpppuppppuppupupupuuupuuuugugura.....................................................................................................................................................................................................................................",
+"..............................................................kklkkkkkkkloqy......................................................................................................................dhhhrwwwwwwwwwhhrwrwprhhwwpwhhhhhhhhhpppppupupuuppuupuupuuuguguugggga....................................................................................................................................................................................................................................",
+"............................................................kkvkkkkkkkkkkksy...........................................................................................................hhhh.....wwdhhnwwwwwwwwwwrhhwwwwwhhrrrwrrhhhhhhhrupppppuppuupuupuuuupuuupuuguugura..................................................................................................................................................................................................................................",
+"...........................................................lklkklkkkkkkkkosy........................................................................................................hhhhhhh....wdwdhhrwwwwwwwwwwwhhrwwwprhhpwpwphhhhhhhhppupuppuuppuupuuuuuguuugggugugcuga.................................................................................................................................................................................................................................",
+"..........................................................kklkkkkklkkkkkkksy......................................................................................................hhhhhhhhh..wddwwdhhawwwwwwwwwwwahhpwrwwhhrwpwprhhhhhhhrppppuppuuupuupupuuuuuuugpgggucugga................................................................................................................................................................................................................................",
+"........................................................lklkklklklkkkkkkkvsy....................................................................................................hhhhhhhhh..dddwwddrhhwwwwwwwwrwwwrhhwwwpwahawppprrhhhhhhrpupuppupppupuuuuuupuuuugugugugugggrs..............................................................................................................................................................................................................................",
+".......................................................kllklklkkkkklkkkkkkyy...............................................jjj..................................................hhhhhhhh.ddddidwdwdahrdwwwwwwwwwwwhhrrwwwrhhpwppwphhhhhhhpppuupuuuuupupupuuuuuuuuugugggguucurs.............................................................................................................................................................................................................................",
+".....................................................lkklklvklklklkkkkkkkoyy.............................................jjjjbtjv...............................................hhhh..hhhdiwwwwdwwwwrhwwwwwwwwwwwwrhhwwpwphhrpwppwprhhhhrpppppppppppupuuuuuuuuugguuugugucggggps............................................................................................................................................................................................................................",
+"...................................................kklllklklkklkkkklkkkkkqyy...........................................bjbjjjjbjjq....................................................hhrdddddwwdwwwahrwwwwwwwwrwwhhhrrwwwrhharpppwprhhhrpuppupuuuuuuupupuuuuuuuuuggugguggggcgre...........................................................................................................................................................................................................................",
+"..................................................llllllklklkvkllkkkkkkkksy...........................................jjbjbjjjjjjjs....................................hhhh..........dnhaididwddwdddnhawwwwwwwrwwwhhhrwpwrhhhhharwppprrhrppppuupppppuupuuupuugpuuguguggguggguggae..........................................................................................................................................................................................................................",
+"................................................lllllllklklkklkkklkklkkkksy..........................................jjbjbjbjjjjjtqy...............................hhhhhhhh........dddrhhrddwwwwwwdwrhhwwwwwwwwwwrhhhwwpwrhhhhhhhpppppppppuppppuuupupupuuuupuuguupguuguggucgggcgq..........................................................................................................................................................................................................................",
+"..............................................lllkllkllklklklkkllkkkkkkkkyy.........................................bbbjbjjjjjjjjjvy.............................hhhhhhhhhh.......dididhhhawiddiwwwwwhhrwwwwwwwwwwhhhrpdanhhhhhharppppppupppupupppupuuuuupuguuupgggugugggcuggggggs.........................................................................................................................................................................................................................",
+"............................................lllllllllkllllklklkkklkklkkkqyy........................................jbbjojbjbjjjjjjjye...........................hhhh...hhhhh.....ddiiddahhhwwwwwwwdwwrhhwwwwwwwaashhhsyyyehhhhhh...eessaapppuppuupuupupuuuuuuguuguguguggucgcgcgcgpe........................................................................................................................................................................................................................",
+"..........................................mlllllllklllllklklklklkklkkkkksy........................................bbjjjjjjbjjjjjjtjyy...........................hhh......hhh...iiiidddidhhhrddwddwwwwdhhhrassyyyy.hhh.....................qqapuppupupuuuuuupuuuguuuggugugugugugcggae.......................................................................................................................................................................................................................",
+"........................................lllmllllllllklkllklklklkkkkklkkmyy.......................................bjbbjbjbjjjbjjjjjjyy...........................hh.......hhh..iidiididddnhhnwdwwdwdwwwnhhney.....hhh..........................aapupuppupupuuuuuuuguuggugggggcucggcgs.......................................................................................................................................................................................................................",
+".....................................mllmllllmlllllllllkklklkkkkkkkkkkksye.......................................jbjbbbbjjbjbjjjtjqyy...........................hh........hh.iidiididdidrhhhdwddwwdvsyyehhhhhh...hhh.............................aduuuuuuuuuuupguuucpgcgggucgcugcgcry......................................................................................................................................................................................................................",
+"..................................mmmmmlmmlmllmlmllklllklklklklkkkkkkkmyy.......................................bjobjbbbjjjjjjjbjjqy...........................hhh.........ridiididddidddhhhawwwasyye....hhhhhhhhhh.................................duupuupuguguggugggpggggggcgcgcggqe.....................................................................................................................................................................................................................",
+"...................mmm........mmmmmmmmlmlmlmlllllllllkklllklkklkklkkkksye......................................obbjbbjbjjbbjjjjjjjsy.............hhhhhh.........hh........iiiiididiiididdahhhasyyy........hhhhhhhh....................................duuuuuuuugpuuguugguggcgggggggcpy.....................................................................................................................................................................................................................",
+"...................mmmmmmmmmmmmmmmmlmmlmlllllllllllllkllkklklklkkklkkqyy......................................jjbbbjbbjbjbjbjbjjjbyy...........hhhhhhhhh........hh.......iiiiiidiiddddidddhhheye............hhhhh.......................................upuuuuuggucugguggugucgccgcgggse....................................................................................................................................................................................................................",
+"....................mmmmmmmmmmmmmmmmlmlmlmllllllllkllllklklkkklklkkkkeye.....................................bbbbbbbbjbjbjjjjjjjjqye.........hhhhhhhhhhhh........hhh....ahanariiidididdiisnhhh................h..........................................ppuuugpuuuuggcucggcugggggcccry....................................................................................................................................................................................................................",
+"....................mmmmmmmmmmmmmmmlmllmlmmlmllllllllklkllklklkkkklksyy......................................bbbbbjbbbbjjbjbjjjjjey........hhhhhh.....hhh........hhhhhhhhhhhhhnidddidwtsyyshhhh..h.........................................................uuuuguguugggpgugcggucgcggggee...................................................................................................................................................................................................................",
+"....................mmmmmmmmmmmlmlmllmmlmllmllllllllllllklklkkklklkqyy......................................obbojbbbjjjbjjjjjjjjqyy........hhhhh.......hhh.......hhhhhhhhhhhhhhriiidtqyye..hhhhhhhhh........................................................uugpguucpgucpcgugcgcggcgccay...................................................................................................................................................................................................................",
+"....................mmmmmmmmlmmmlmmmmmmllllmlllmllllllkkllklklkkkkqyy......................................bbbbbbjbbbjbbjbbjjjjjey....h....hhhh.........hh.........hhhhhhanhhhhhidisyye....hhhhhhhhh.........................................................uuguuuucuucgucuggggcgcgggry...................................................................................................................................................................................................................",
+".....................lmmmmmmmmmmmmmmmmllmlllllllllllllmklklvklkklqyy......................................obbbbbbbbjbbjbjjjjjbjsyyhhhhh......hhh.......hhh..........diraiiidahhhdqeyy.....hhhhhhhhh...........................................................gpgugguucugggggcgcgggccccee..................................................................................................................................................................................................................",
+".....................mmmmmmmmmmmmlmllmllmlllllllllllkllkkllkklkksyy.......................................obbbbjbbbbbjbbjbjbjbvyhhhhhhhh.....hhh.......hhh.........iiiiiiiiiihhhnyy......hhhhhhhhh.............................................................ggpcuggucucugggggcgcgggcsy..................................................................................................................................................................................................................",
+".....................mmmmmmlmlmlmmmlmmmmlllmlllkllllllkllkkllkmsyy.......................................bbobobbbbjbjjbjjjjjjanhhhhhhhhh......hhh......hhh........iiiiiiiiiiianhye......hhhhhhh.................................................................gguugugugpgcgggcgggcccgay..................................................................................................................................................................................................................",
+"......................mmmlmmlmmmlllmmllmlmlllllllllllllklllkvqeye.......................................ojbbbbbobbbbbbjbbjbahhhhhhhhhhhh.......hh....hhhhh.......iiiiiiiiiiivehh........hhhhh....................................................................uguucggcgggpgggcgcgggcpy..................................................................................................................................................................................................................",
+"......................mmmmlmmmmmlmmlllmlllllllllllkllllklkklsyye........................................obobbbojbbbbjjbjjthhhhhhh.....hhh......hhhhhhhhhhh......iiitriiiiiisynhhh........h.......................................................................guuggugugggccgcgggcccccye.................................................................................................................................................................................................................",
+".......................mmmmmlmlmmmlmmmmllllllllllllklkllklqeyy.........................................bobobojojbbbbbbjbjahhhhh.......hhh.......hhhhhhhhh......iiiiihhaiiaeyehhh..................................................................................ggucpggggggcucgcgcgcggsy.................................................................................................................................................................................................................",
+".......................mmlmmmmmmmmmmlllmlmlmlllllllllllkmsyye.........................................oobbbobobbbjjhnhajbahhhhh.................hhhhhhhhhh....iiiiiiahhaqyye.hhh...................................................................................pguguggggggcggggcggccsy.................................................................................................................................................................................................................",
+"........................mmmlmmlmlmmlmmlllmlllllllllklllsyye...........................................boobbbjbbbbahhhhabjvehhh......hh..........hhhhhhhhhh...tiiiiiidhhhns.hhhhh...................................................................................gggcgggggugggccggcgccsy.................................................................................................................................................................................................................",
+".........................mmmmmmmmmmmmmmmmlllllllkllllqeyy............................................ooobooobobahhhhhhbjqyy.hhh....hhh...........hhhh...hhhhiiiitiiidhhhhhhhhhhh....................................................................................pgguguucgcgcgggcccggay.................................................................................................................................................................................................................",
+"..........................mmmmlmmlmmmllllllmlllllllmeyy.............................................obbobbbobbjbhhhhhajqyy...hh....hhhh..........hhh.....hhhdiiiiiiiahhhhhhhhh......................................................................................gguggcucuuggccgcggcgay.................................................................................................................................................................................................................",
+"...........................lmmmlmmmllmmmmmllllllllqyye..............................................oooboanbbobbbanhhtqyy....hhhhhhhhhh...........hh.....hhhhhadtiiqyhhhhhh..h.......................................................................................ugggugucccgggcggcgpay...............................................................................ww................................................................................................................................",
+".............................mmmmlmmmllllmllllllmsey...............................................boohhhhhabbbbbbthhsyy......hhhhhhhh............hh.....taahhhhadsyy.hhh............................................................................................cugggcggugcgcggcuittse.............................................................................ppwry..............................................................................................................................",
+"...............................qmmmmmlmmmllllllqeye................................................oahhhhhhnbbbojbbnhny.......hhhhhhhhh...........hhh...tiiihhhhhnyy.................................................................................................guggggpgcggggccuitttvy............................................................................wpwpwye.............................................................................................................................",
+"..................................ssssesmmmlllqeye................................................ooanhhhhhabbjbobvshh........hhhhhhhhh............hh..ittitahhhhee...................................................................................................guggcgcucgccgcittttvy...........................................................................pwpwpwyy.............................................................................................................................",
+".......................................mmllllmyy.................................................ooooohhhhhaobbbbqynhh.........hhhh.hhh....hh.....hhhh.tiiiiitahne....................................................................................................gguguggcgggggwtttttty...........................................................................wpwpppyy.............................................................................................................................",
+"......................................mllllmqeye.................................................boobooanhhhobbosyyhhh.........hh..........hh......hhhhhtttiibeee.....................................................................................................gugcugcucggcutttttttyy.........................................................................pwpwwrwyy.............................................................................................................................",
+"......................................lmmmlmyy..................................................oooooooobhhhaoveye.hhh..........hh.........hhh....hhhhhhaiitbeye......................................................................................................cgcpgcgggggctttttittyy........................................................................wwpwpwwpyy.............................................................................................................................",
+".....................................mlllmmeye..................................................oovoobobbnhhnsyye..hhh..........hh..........hh....hhhhhhtitbeye.......................................................................................................uggguggcgcgwtttttttbyy........................................................................pwpwppwpyy.............................................................................................................................",
+"....................................mmmmlmeye..................................................oooooooooobthhse....hhh..........hhh........hhh.....hhhnaiijeye.........................................................................................................gggcgcucguttttttttvye.......................................................................pwpwwpwpwyy.............................................................................................................................",
+"...................................lmlllmeee...................................................oooboobbbovvnhhh.....hh...........hh.......hhhhh....tadtttbeye..........................................................................................................gugpgguggittttttttvy........................................................................wwpwwwprayy.............................................................................................................................",
+"...................................mllmmsye...................................................vooooobooooosenhh.....hh...........hh....hhhhhhhh...ttittiieye...........................................................................................................gggccgcgwtjtttttttqy.......................................................................wwpwwppwway................................................................................................c.............................",
+"..................................mmmmlsyy....................................................ooooooooobojyy.hh....hhhh..........hhhhhhhhhhhhh...ttttittsyy............................................................................................................uguuucgpttttttttttsy......................................................................wrwpwwwwpwsy.............................................................................................fccccg...........................",
+".................................mmmmlqyy....................................................ovooooobobobqyy..hhh..hhh...........hhhhhhhhhhhh....ttttttsyy.............................................................................................................cucgcggwtjttttttttyy......................................................................wwwwrprpppsy...........................................................................................ccccccffye.........................",
+"................................mmmlmqyy.................................h...................ooooooobobobey...hhhhhhhhh.........hhhhhhhhhh......tttttivyy..............................................................................................................ugguugpttjjttttttvyy.....................................................................wpwpwwwwwwdyy..........................................................................................cccfccccayy.........................",
+"................................mmmmqyy................................hhhh.................ookokoooooobqyy....hhhhhhhh..........hhhhhhh.......ttttttvyy...............................................................................................................cgggcgijjtittttttsy......................................................................wwwwwpwrppaye.........................................................................................cccccccccey..........................",
+"...............................mmmmmeye.............................hhhhhhhh................oovoooooooooey......hhhhhh...........hhhh..........tttttbey................................................................................................................uggggwttttttttttvyy.....................................................................wwwwwwwpwwpey..........................................................................................ccccccccayy..........................",
+"..............................mmmmmsye..............................hhhhhhhhhh.............okooooooobobqyy.......hhhhhh.......................tttttteye................................................................................................................cugcpttjijttttttsye.....................................................................wwwrwpwwrpayy.........................................................................................ccccccccuyy...........................",
+"..............................mmmmsyy.................................hhhhhhhh............oooooooooooobsy.........hhhhh......................tjttttsyy.................................................................................................................ugguwjtjtjtttttvyy.....................................................................wwwwwrwpwwdey.........................................................................................cccccccfueye...........................",
+".............................mmmmqyy........................h...........hhhhhhh..........oookovooooobovyy.........hhhh.......................jttttvyy..................................................................................................................cgggjjjijijtttieye....................................................................wwwwwwwwwwwsye.........................................................................................ccccccccsye............................",
+"............................mmmmmyy.......................hhhhh.........hhhhhhh........ookookooooooooosye..........hhhh.....................tttttbey...................................................................................................................gugitjjtttjttttyy.....................................................................wwrwwpwpwpayy.........................................................................................ccccccccnyy.............................",
+"...........................mmmmmeye...................hhhhhhhhh.........hhhhhhhh......vkooooooooooooovyy............hh.....................jjttttsye...................................................................................................................ugpttttjtttttpsye....................................................................wwwwrwwwwwayy.........................................................................................ccccccccayy..............................",
+"...........................mmmmsyy...................hhhhhhhhhhh........hhh...hhh....ookokkoookooooboqye...................................tttttqyy...................................................................................................................gguijtjtjttjtdpyy.....................................................................rwwwwwwwpdey..........................................................................................cccccccayy...............................",
+"..........................mmmmqyy.................hhhhhhhhh...hh.........hh....hhh.ookokookokkoooooooey...................................ijjjtbyy....................................................................................................................ugujjjjttjjtdcaye....................................................................wwwwwwwwpdeye.................................................................ccg.....................cccccccryy................................",
+".........................mmmmqeye...............hhhhhhhhhh....hh........hhh....hhhnvkoqqkooooovooooovyy...................................tttttsye....................................................................................................................guijtijjtttdcgey............................................d........................wwwwrrwrdeye.................................................................cgccee...................ccccccueye................................",
+"........................mmmmmsye................hhhhh.hhh......hh.......hhhh..hhhhhnvqylokoookoooooosye..................................jtjtjqyy.....................................................................................................................uujjtjjtjticgryy...........................................ddda.....................wwdwwwwpdeye.................................................................cgcgayy..................ccccccpeye.................................",
+"........................mmmmqyy..........h.h....hhh.....hh...............hhhhhhhhhhhnysookooookoooooey...................................ttttbey........................lll...........................................................................................gijtjtjttdcggsye...................iiiiii.................dddiey....................dwwwwwwdeye................................................................cggggpyy...................ccccccsye..................................",
+".......................mmmmmeye........hhhhh....hhh.....hh...............hhhhhhhhhhhheokokokooooooovyy..................................tjtjjsye......................lllklq.........................................................................................cpjjjttijigcgryy.................iiiiiiiiiis.............dddwteye...................wwwwwwwieye....................p...........................................gggcgcaye...........cccccccccccccsyy...................................",
+"......................mmmmmqyy......hhhhhhhhh....hh.....hh..............hhhhhhhhhhhhhhaokoookookoooqye.................................jtjttvyy.......................lllllky...........................kk................................................jjjbjjbb...gijtjtjjdggggsye...............iiiiiiiiiiiivy...........ddiddsye...................wwwwwwrdeye...................ppppa........................................cgcgcggge...........cccccccccccccrss........c...........................",
+".....................mmmmmmyy.....hhhhhhhhhhh....hh......hh..............hhhhhnannnhhhhnvokkoooooooqy..................................jjtjjsye......................lklllklyy........................kvkoky...........................................bjjjbqeyyy....utjjtjjicgcgryy..............tiiiiiiiiiiiiivy..........ddddidqy....................wwwwwwdeye..................pppppppy......................................gcgggggcgre.........cccccccccccccccccccfccfccu...........................",
+".....................mmmmmsye....hhhhhhhh.hhh.....hh.....hh..............hhhnkoqyy.hhhhhhaookovoooooy.................................jtjttqyy...............mmmmmlllllllllqyy......................kkkkokqye.......................................bjjbvsyye.......gitjtttdggggcsye.............iitqssbiiiiiiiisy.........diididddv....................wwwwwdeye..................ppppuppdyy...............uuuu.................gggggccgcgcps........ccccccccccccccccccccccuayye..........................",
+"....................mmmmmqyy..hhhhhhhh....hhhh....hh......hh............nhhhamsyy..hhhhhhnoookoooobosy................................tjtjtey............mmllmmqsyyslllllllsye.....................kkolokksy..........ooooo.......................bjjbveyy..........utjjjjdgggcgryy............tii.yye..iiiiiiiiey........iddddddiddda.................wwwwwdeye..................ppppppppaye..............uuuuury...............gcgcggggccggpe........ccccccccccccccccccrasyye............................",
+"...................mmmmmmsye..hhhhhhh.......hh....hh......hh...........kohhvleye....hhhhhnooooookoooqy...............................jtjtjqyy..........mmmmqsyye...lllllllqyy.....................kokkkkoqyy........oooookoqe....................jbbosyy............wbjtjdggucggsye...........iti.ye....iiiiiiisyy.......diidiwiwiwidddi...............dwwwreye..................ppppppppdey..............uuuupuuye...............ggggccgcgccgae.........sssrccccaaaasssyyye...............................",
+"..................mmmmmmqyy....hhhhh...............h......hh.........kkkknhnyye....hhhhhaookoooooooovy...............................jtjjjey.........mmmmqeyy......lllmlllqy.....................kkkkkkkksye.......vkokkooooy..................bjbbveye............uittjigcucugayy...........itiey.......iiiiivyy........iddidididwdddddts............wwwwayye...................ppppppudsye.............uuupuuuayy.............ggguucgggggcgcgs............ccccryy........................................",
+"..................mmmvavsye......hhh.......................hh.......kkkkkahhs......nnnhnvokookooooboose..............................jtjtqyy.......mmmmlqyye.......lllllmllq....................kkkkkkvoqyy.......oooooookoosy................bbbbveye.............pjjjtuugcgcpey...........titsy........iiiivyy..........idwidwididwwdwwse...........wwwayy....................pppppppdeye.............uupuuuurey.............cg..ypgcgcgccgccay..........cccccsye........................................",
+".................mmhhhhhns.......hh.......h................hh......kkkkkmhhhhh.....okooookoooookooooovy.............................jtjjtey.......mmmmmqyy..........lllklkllms.................kkkkkokkkey.......okookkooooosy...............bbbbjqye.............gwjtjpucguggsye..........titsye.......iiiivyy..........ddiidiiddiwiwdidsy..........wwwayy....................pppwpwusyye.............upuupuuweye............g...e..ggggcggcggpy..........ccccryy.........................................",
+"................nahhhhhhhh........hh....hhh................hhh...kkklkkqnhhhhhh....ooookookooooooooboose............................tjtjqyy.....mmmmmmmeye..........llllllllkms................kkkkkkkoqyy......ookkoookokoosy..............bjbjbvyy..............gbjjwgggggcayy...........tibyy.......iiitsyy..........ii.eyatidwidiwiwvyy..........dwdeye...................ppwpppaeyy...............puuuuureye............g..e.....cgggcgcccgye........cccccsye.........................................",
+"..............hhhhhnhhhhhhh.......hhhh.hhhhh................hh..klkkkkqenhhhhh.....olookokokokooooooobvy...........................tjttjey.....mmmmmmmqyy............lllmkkkmlqe..............kkkkkkkvmyy......okkookkooooooqy.............obobbbqye..............wjjtggugucrey...........ittyy......iiiiayye..........i.......iiiwidwwqyy...........wwsye....................wppppqyye...............uuuupuaeye............g..........cgcgcgcgcyy........cccccyy..........................................",
+"............hhhhhhnmvvanhhh.......hhhhhhhhhh................hhavkkkkmsyy.hhhhh.....okkkokookoooookooooose..........................jjtjqyy....mmmmmmmmsy............ll.lllmkklle.............klkkkkolkqye.....o..ysookokooooqy.............bbbjobsy..............wtjjwggcgggsye...........ttvyy...tiiiiayyy...........d.........ddiwiwsyy...........wwwyy....................pppppsyy................puppuuayy..........................cgccccgryy........ccccayy..........................................",
+"............hhhhhhvmmmmshhh........hhhhhhhhhh................hhhnhaqeye...h........oovoookooooooobooooobe.........................jjtjjsy.....mmmmmlmmyy...........ll..qllklllksy............kkkkkokkoey.....v..e..okoooookoqy............bbbbbbbsy.............dtjjtwgugugayy...........ttiittiiiitqeyye........................widisyy............wwwyy....................pwwwayy................pupuuusyy............................cgcggcaye.......cccccay...........................................",
+"............hhhhhnqmmmmsnhhh.......hhhhhhhhhh..............khhhhhhheye.............okkoloookkkvoooobobobqy........................tjjtvyy....mmmmmmmlmyy...........l....llllkllsy...........kkkkkkkkkqyy............okkkkoooqy...........obbbbbjbsy............jiijjjwggugwyy............tttvqssyyyye............................ddwsyy.............wdwsy...................pppuwsye...............uupuuuayy.............................cgccggsy........cccccsy...........................................",
+".............ahhhammmmmsehh.........hhhh..h...............kahhhhhhny...............kkokokokoooooooooooooos........................jjjjsye...mmmmmlmlmmey..........l.....lllllllsy...........kkkkkkkokqye............ooooooooqy...........bobbbbbbvy...........jiutjtjtgucgeye...........tittsye.................................ddisyy.............wwwwws...................wpwwpsy................ppuupuey...............................ggccryy.......ccccccay...........................................",
+"............mmahhhmmmmmqnhh.........hhh..........h......kkknhhhhhsy................oookokoooookoooooooobovy......................jtjtvyy....mmmmmmlmmmsy........lm.....llklkklkyy..........kkkkkkolkosy.............okoookkooy...........bbobbbbbbse.........jjuujjjjjdugsyy............ttitvy..................................ddayy............w.wwwwwws.................wpppppay...............uuuppupey............g..................ccgcsye.......ccccccry...........................................",
+"...........mmqqhhhvmmmmnhhhh........hhh.........hhh....klklhhhhhn...................kkookokkoooookobobbobbqe.....................jjjjqye...mmmmmmmmmmmqe.......ml......klmllllqyy........k.kkkkkkkkkksy.............oookkooooey........obobbbojbjbbs.......jjjwuwjjjtjjdayy............ttititve....................ii..........dddsy............w..wwwwwwwa................ppwpwpwae............pppppuppuqy...........u.....ggg...........ggcayy........cccccccae...............f..........................",
+"...........qmmmnhhnamanhhhhh.........hh..........hhh.kklllkaasee....................ookkooookookooooooooobbs....................jjtjjsy....mmmmlmmmmmmmmq....lll.e....llkklkllqye......kk..kkkkkkkvkkmsk............okooookooqy......bb.bobbjbobbbbjvv..jjjjbaguwjtjjtjjbs............t.ttttitvs..................ii..........ddidyy..........dw..sdwwwwwwwwi.............pwpwpppwpaq..........ppuuuuuupups.........gg..e..ggugrs.........cgpey.........ccccccccas............fc...........................",
+"..........mmmqmvnhhhhhhhhhhhhh.......hh..........hhhallklklqyye......................ovkokooooooboooooobboovy...................jjjjvyy....mmlmmmmmmmmmmmmmmlmm.y.....lllmlllkqy.....kk..eqkklkkkkkkokkq.e..........kookoooooos....obo..bobobojbojbbjjjjjbbbsuugijjjjjtjjjv.........tt..ttiitiitv...............iid.e........ddiddsy........dww.ey.wwwwwwwwwwwwdw.......wpwpppppppppprw......ppp.pppppuuuuua......ugg..e..guggggae.......gccsye........cccccccccccp........ccc..e..........................",
+"..........qmmmmmahhhhhhhhhhhhhh.......hh.......hhhhhnlllkmsyy........................okokvokoooooooooooobbobqe..................tjtjsye...mmmmmmlmlmlmmmmmmmlsyy.....llllklllllss.kkkl.ey..kklkkkkolkkqyy...........oookkokooooooobobsyebobbbjbbbbbbbbjojjvsruuuijjtjjjjttjtjjjtjjttt.estttijtitittt..........iii..y.......dddidwiay......wwwwsyy..wwwwwwwwwwwwwwwwwwpppw.awpwpwpppppppppppppppssuuupuupupuuuuuuguupey....gggugggy.......cgayy.........ccccccccccccccccccccccaey...........................",
+".........qmmqmmmahhhhhhhmas.hhhh.......hh...hhhhhhhnalllqeye..........................okookokoooooooooboobobbs.................jjjjjey....mmmmmmmmmlmmmmlmllsyy.....lllllllkkllklkllmyye..klkkkkkkkkkqyy............okkooooooooobooqeye.obbbbojbbjbjjbjjboeauuuuijjjjjjtjjttjtttttttsye.tittitiiiiiiiiiiiiiiiiiiqyy........idiwdiddtadddwwdwdeye...dwwwwwwwwwwwwrwwwwwwayyapwpwppppppppppppppayyapppupupuuupupuuuusyy....gguggcggny.....gggyy..........ccccccccccccccccccccueyy............................",
+".........mqmmqmmmhhhhhavmmms.hhh.......hhhhhhhhhhhakkkqsyy.............................okooookookoooooboobobbve................jjjjvyy....mmmmlmlmlmlmlmlmmeyy......lllllllllklklkmsyy....kkkklkkkkoqyy..............oookokookooooqyy...bobojobbbbbbbbjbveauuuuudjjtjtjjtjttttjttttsyy..tttitttitiiiiiiiiiiiiitsyy........diidiiwiwidddddwdieye....wwdwwwwwwwwwwwrwwppsyy..ppppppppppppupppusyy..uupupupuuuuuuuursyy.....guguguguwe....cgcey............ccccccccccccccccccayye.............................",
+"........qmmqmmmmqnhhhnmmmmmmqhhh.......hhhhhhhhhhnvllqeye..............................ookookooooooobooobbbbbbve...............jjtjsye....mmmmmlmmmlmlmmmqyye......lllkllllklllklqeye.....klkkkkkkkqyy...............kokooooooooosyy....obobbbbbbbjbjjbqesguuuguwjtjjjtjtjjjjjttjbeyy...tittiiiiititiiiiiiiiiaeye........iiddiddididddddwdayye.....wwwwwwwwwwwwwwwprdsyy...wpwpwpwpppppppppsyy...ppupuuuupupuuuaeye......ugggggcggra.cgc.ey.............cccccccccccccccfpsyy...............................",
+"........mqmmmmmmmvhhhmmmmmmmmahhh.....hhhhhhhhhavlkqsyy.................................okoookooooooobboobbbbbbse.............jtjjjsy......mmmmmlmmmllmmsyy........llllllllllklqsyy.......kklkkkkoqyy................oookookoooveyy......bobbbbjbbbbjbqysupuuuuugjjjjjtjjttjtjttveye.....iittttitiiitiiiiiiiqyye.........diiddwiwiwiwwiwwqyy........wwwwwwwrwwwwwwwaeye....pwpppppwppppppreyy....upuuupupuuuuusyy.........gugugugggggggayy..............cccccccccccccccaeye................................",
+"........mmqmmqmmmmhhhammmlmmmvhhhv....hhhnnhnamlllqeye...................................ookoookoovoooobbooobbjbs.............jjjjvyy......mmmmlmmmlmmqyye.........llmlllllllmsyye........kkkkkkkqyy.................ookooooooqyye.......obbojbojbjbosyeppuuuuguuqjjjtjjtjjjtttqeye.......ttiiiiititiiiiiitsyy...........iddidiiiddiwdwtsyy..........wwwwwwwwwwrwdsyy.......ppwwwpppppppayye......upppupuuupdeyy..........ucgggcgggggreyy................ccccccccccccpsyy..................................",
+".......mqmmmmmmmmmahhnmmmmmmmmnhnmmmmvhnhvlmllklqsyy......................................kooooboooooooobobbbbbbve............jjjtqye.......mmlmmlmmqeyy...........llllllllmsyye...........kllkkqyy...................ookkkomsyy..........obbbbbbbbqeyspuuuuuuudsyqjtbjjtjttjjqyy..........ttttttiiiiiiiiqyye.............dididddwiwiiaeye............wwwrwwwwwisyye.........pupupwuppasyy.........uupuuuprsyye............ugugucgcpqyye..................cccccccccpayye...................................",
+".......mmqmqmqmmmmqhhhvmmmmmanhhvmmmmlmlvmlmlllqeye.......................................koooooooboboboobbbbbbbbqe..........jjjjbsy..........qqqqseyy..............lllllqsyye.............kkkksyy....................kooovsyye............bobbooqeyy.uuuuuuuudeye..jjjtjtjjqeyy............tiiiiiitiitqeyy................iddddiiditsyye..............ddwwwwasyye............rpwppwasyye...........puppaqyye...............gucgursyye.....................gcccccrsyye.....................................",
+".......qmmmmmmmqmmmmnhnmmmnhhhhnmmmlmmmllmlllqeyy..........................................oooooooooboobobojobbjbjs..........jjtjjey..................................qsyyy.................kqsyy.......................qsyye................qseyye..uuuuuuuudeye....vvqvqsyyy................vbiiijvsyyy....................aiwiwiqeye...................syyyy.................assyyy................qeyye...................qsyyye.........................assyyye.......................................",
+".......mmmqmqmmmmmmmahhammhhhhhammmmmllmmllqsyye............................................ooooboooobbobobbbjbbbojs.........jtjjvyy..........................................................e.....................................................upuuuuuudeye.................................eyyye.........................assyye......................................................................................................................................................................",
+".......qmmmmmmmmmmmmhhhhnhhhhhvmmmmmmmlllmqeye...............................................bbbbbobobbbjbbbbbjbjbbve........jjjtqye...............................................................................................................puuguuuuayye............................................................................................................................................................................................................................................",
+".......qmqmmmmmmmmmahhhhhhhhhnmlmmmlmlmmqsyy..................................................jjjjboobbbojbbjbbbbjjbve......tjtjjsy...............................................................................................................uuugugggayy..............................................................................................................................................................................................................................................",
+".......mmmmmqmmmmmmnhhhhhhhammmmmlmlmmqsyye............es....ss..............................ssitjbbbbjbjbbjjjbjjbjttqs.....iiiitsy.....................................ss.....sss...............................................................puuuaeugsee...................................................................................sssss.......................sssssss.........................................................................................................................",
+".......mqmqmmmmmmmmmhhhhnvmmmmmlmmmlmsyye...............sg...sfx..sssssss.ssssssss..........sssriijjbqsjjtjqvjjjjbqsqvs..essqaaqaees.....e....essssss...sssss...........ssa....ssax...sssssss....sss......sss......ss........ss......essssss....puuuursfnses.....e..ssssssss..sssssss...sssss......ssssss....ss.......sss....sssssss..........snxfrns....ss....s...........srrrrrrx...s.....s......ss.......sss.....sss.....sssssss...ss....s..............................................................",
+".......qmmmqmqmmmmmmanammmmmmmmmmmmsyye.................ss..srf...srrrrrrx.rrnnrrrx.........srraxitbjvsadtisrctjasarrnas..rrsrrrrnssx....sx...srrrrrrx..srrrrs..........snng..ssaax...srrrrrrx.ssaras...ssaras.....sna.....esaras....srrrrraf.uuupupgrsfss.ss....sx..arnnrrrx.srrrrraf..srrrrna...saxfxxgf..sssx....ssaras...srrrrraf........saf....sn...ssr...sx..........sx.........eg...ssr....sssx....ssaras...s.rrnn...srrrrraf..ssr...sx.............................................................",
+".......qmmmmmmmmmmmmmmmmmmmmmmmmqsyye....................sasaf....sx.........naf............sxfnf.ijbaasadiqrutbspfcugsrs..csrfcrsssx....sx...sx........sf...sr.........sara..sraax...sf.......sfx..gx..sgx..gf....sfsf...s.fx..rf...sx.....fuuuuppggssx...sas...sx....naf....sx........sx...an...sr........sfnr...ssfx..gf..sx..............sf......sx..srs...sf..........srnns......na...sar....sfnr...ssfx..gf..nx...fx..sx........srs...sf.............................................................",
+"........qmmqmmmmmmmmmmmmmmmmmmqsyye.......................sax.....snsss......sax...........sax.na..tjaapsrwargiaafwdiiaars.wsrcwss.ssssssnx...sasss.....sassssf.........safngsnxnax...sasss.....ssss.....ssss.....safsr...sx.........snsss..guupuuprsssf...sxaa..sx....sax....snsss.....snssssrx..snsss.....sf.s...sx........snsss...........sf......sf..sx.n..sf..........sraanx.....anr.s.ar....sf.s...sx........ssss.....snsss.....sx.n..sf.............................................................",
+".........qmmmmmmmmmmmmmmmmmmqeyye.........................srx.....srrrrx.....sax...........snnanng..jvagdnrarciaafddiiaafavdsrcwss.sxxxxrax...srrrrx....srraaxx...iii...saxnanrxsax...srrrrx.....rrann....rrrnn...sra.sf..sx..sss....sarrrrfgupupuaeessx...sx.aa.nx....sax....sarrrr....srrrsfx...srxxrf...sar.sr..sf........sarrrr..........sf.....ssx..sx.an.sx..........sxxxxx.....a.s.sxsr...sar.sr..sf.........frras...sarrrr....sx.an.sx.............................................................",
+"..........mmqmmmmmmmmmmmmqsyye............................sr......sx.........snx..........safxxxra...vauirsarcdisfdiiisffiadsrcdse.sx....nx...sx........sx..sr..ddiiiiidsax.nrx.sax...sx............rax......rax.snraana..sr...xar...srx.ffcguuudsyy..sf...sx..snsx....snx....srx.......sx..na....sr.......srraan..sa....s...srx.............sn.....srf..sx..aasx..........sx.........a.ss.xsr...srraan..sa....s........sf..srx.......sx..aasx.............................................................",
+"............qmmmmmmmmqssyye...............................sr......sasssss....snx..........sx.....sf...aptiasrgiianaavsafwiidsrcdee.sx....nx...sasssss...sx...sfwddiiiidwaaf.nfx.sax...sasssss..sss.ss.x.sss.ss.x.sx....sf..nss.ssr...ssaaaaqcuuayye...sf...sx...nax....snx....snnssss...sx...sr...sr......s.x...sr..nsssssr..snnssss..........asssssaf...sx...nsx..........sasssss....a..af.sr..s.x...sr..nsssssr..sss.ssx..ssnssss...sx...asx.............................................................",
+"..............ssssseyyy....................................r.......rrrrrrx....rf...........f......r...aptiirruiiigrrrffudtitarciee..f....ag....rrrrrrx...g...ardiiiiiiidarfprf...rf....rrrrrrx..xrraff...frraff...f.....r...rrr.xf...arrrrrrfrsyy.....af....g....rf.....rf.....rrrrraf...r....r....r.......f.....r...frrrff...rrrrraf..........frrrxf.....r....rr..........arrrrrrg.......x..r...f.....r...frrrff...rrrrxx...rrrrraf...r....rr.............................................................",
+"........................................................................................................bjtdugttttiuuuiittjtwupvee...........................wcpdiiiiiidpccwwwd.....................................................ugffffffreee...........................................................................................................................................................................................................................................................",
+".........................................................................................................bjtttjjjttjtttttjjttiiqy............................ddiiiiiiiiidwwdwwwwq.................................................ppuuuuugasee.............................................................................................................................................................................................................................................................",
+"..........................................................................................................bjbjbjjjjjjjjjjtjjtjjvy...........................iiiiiiiiiiiiiddddidddq..............................................pppppppuasey...............................................................................................................................................................................................................................................................",
+"...........................................................................................................jojbbjbjjjjjjbbjtjjtqy...........................iiiiiiiiiiiiiiiiiididie...........................................ppppupppdsyye................................................................................................................................................................................................................................................................",
+".............................................................................................................bbbbbbbjbbjjjjjjjjsy...........................iiiitiiiiiiiiiiiididddvy........................................wpppppppdqyye..................................................................................................................................................................................................................................................................",
+"..............................................................................................................jbbjbjbjjbjbjtjjjsy...........................tiiiiiiiiiiiiiddiiididds......................................ppppppppdqyye....................................................................................................................................................................................................................................................................",
+"...............................................................................................................bbbbbbjbjjjjbjjjvy............................iiiiiiiiiiiiiiiiididdids...................................wppwpwpwasyye......................................................................................................................................................................................................................................................................",
+"................................................................................................................bbjbbjbjjbjjjjjjqe...........................iiiiiitiiiiiiiiiiiiiidids...............................wppwpwpwpasyye........................................................................................................................................................................................................................................................................",
+".................................................................................................................bojbbjbbbjbjjjjjs............................iiitiiiiiiiiiiiiiiididddq...........................wwwpwwwpwdaeyye..........................................................................................................................................................................................................................................................................",
+"..................................................................................................................bjbbjbjjjjbjjjjvy............................iiiiiiiitiiiiiididdiddidta.....................wwwwwwwwppwasyye.............................................................................................................................................................................................................................................................................",
+"....................................................................................................................bjbbjbbjjjjjjjse............................iiiiiiiiiiiiiiiiiidddidddii..............wwdwwwwwwwpwpdseyye...............................................................................................................................................................................................................................................................................",
+".....................................................................................................................jbjjjjjjjjjtjvy..............................jiiiitiiiiiiiddiiididddddddddddddwwwwwdwwwwwwwwwwdasyye..................................................................................................................................................................................................................................................................................",
+"......................................................................................................................jbbbjjjbjjjjjse...............................atiiiiiiiiiiiidddddddiddddwwwwdwwwwwwwwwwwwwaseyye.....................................................................................................................................................................................................................................................................................",
+".......................................................................................................................jjbjbjjjjjtjvy.................................aqbiiiiiiiiiiiidiwiwiddddwwwdwwdwwwwwwaqsyyy.........................................................................................................................................................................................................................................................................................",
+"........................................................................................................................bjjbjjjjjjjjse....................................qqviiidiiddiwidiwwwwwdwwwwwwwaassyyye............................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jbjjjjjjjtbjvy.........................................sssvvaaidwididiwaaaqsseyyye.................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jjbjjbjjtjjjjee.................................................yyyyyyyyye.........................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jjjbjjjbjjtjtqy....................................................................................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jbjjjjjjjtjjjvy....................................................................................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jjbjjjjjjjjtjjse...................................................................................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jjjjbjjjjjjjtjqy...................................................................................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jbbjjjjjjtjtjjvy...................................................................................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jjjjbjjjjjtjjtjse..................................................................................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jbjjjjjjjjjjtjjsy..................................................................................................................................................................................................................................................................................................................................................................",
+"........................................................................................................................jbjbjjjbtjjjjttvy..................................................................................................................................................................................................................................................................................................................................................................",
+".........................................................................................................................jbjjbjjjjtjttjjy..................................................................................................................................................................................................................................................................................................................................................................",
+".........................................................................................................................jjjjjjjjjtjjjtjsy.................................................................................................................................................................................................................................................................................................................................................................",
+".........................................................................................................................jbjjjjjjjjjtjjtsy.................................................................................................................................................................................................................................................................................................................................................................",
+".........................................................................................................................jjbjjjbtjjjjtjjqy.................................................................................................................................................................................................................................................................................................................................................................",
+".........................................................................................................................jbjjbjjjjtjjttjvy.................................................................................................................................................................................................................................................................................................................................................................",
+"..........................................................................................................................jbjjjjjtjjtjtjjye................................................................................................................................................................................................................................................................................................................................................................",
+"..........................................................................................................................jjjjjjjjjjjjtjtyy................................................................................................................................................................................................................................................................................................................................................................",
+"..........................................................................................................................bjjjjjjjtjtjtjjsy................................................................................................................................................................................................................................................................................................................................................................",
+"..........................................................................................................................jjbjjjjjjjjjttjsy................................................................................................................................................................................................................................................................................................................................................................",
+"...........................................................................................................................jjbjjjjtjtjtjtsy................................................................................................................................................................................................................................................................................................................................................................",
+"...........................................................................................................................jjjjjtbjjjtjjjsy................................................................................................................................................................................................................................................................................................................................................................",
+"...........................................................................................................................jjjjjjjtjtjjtjsy................................................................................................................................................................................................................................................................................................................................................................",
+"............................................................................................................................bjjjtjjjjtjtjsy................................................................................................................................................................................................................................................................................................................................................................",
+"............................................................................................................................jjjjjjjtjttjjsy................................................................................................................................................................................................................................................................................................................................................................",
+".............................................................................................................................jjjjtjjtjjtjsy................................................................................................................................................................................................................................................................................................................................................................",
+".............................................................................................................................jjjjbtjjtjtjey................................................................................................................................................................................................................................................................................................................................................................",
+"..............................................................................................................................jjtjjtjjjtjyy................................................................................................................................................................................................................................................................................................................................................................",
+"..............................................................................................................................bjjjtjjttjqyy................................................................................................................................................................................................................................................................................................................................................................",
+"...............................................................................................................................jjjjjtjjtsy.................................................................................................................................................................................................................................................................................................................................................................",
+"................................................................................................................................jjjtjtjvyy.................................................................................................................................................................................................................................................................................................................................................................",
+".................................................................................................................................jtjjtveye.................................................................................................................................................................................................................................................................................................................................................................",
+"...................................................................................................................................vssyye..................................................................................................................................................................................................................................................................................................................................................................",
 "...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
 "...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
 "...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
index 8aa0354..2d14a9e 100644 (file)
@@ -61,8 +61,8 @@
 (defun bbdb-wl-show-bbdb-buffer ()
   (save-selected-window
     (if (get-buffer-window bbdb-buffer-name)
-       nil  
-      (let ((mes-win (get-buffer-window 
+       nil
+      (let ((mes-win (get-buffer-window
                      (save-excursion
                        (if (buffer-live-p  wl-current-summary-buffer)
                            (set-buffer wl-current-summary-buffer))
@@ -75,7 +75,7 @@
                        window-min-height 1)
                     (- (window-height mes-win)
                        (max window-min-height
-                            (1+ bbdb-pop-up-target-lines))))))    
+                            (1+ bbdb-pop-up-target-lines))))))
          (split-window mes-win (if (> size 0) size window-min-height)))
        ;; goto the bottom of the two...
        (select-window (next-window))
@@ -88,7 +88,7 @@
   (let ((hit (bbdb-search-simple nil (wl-address-header-extract-address
                                      string)))
        first-name last-name from-str)
-    (if hit 
+    (if hit
        (progn
          (setq first-name (aref hit 0))
          (setq last-name (aref hit 1))
       string)))
 
 (defun bbdb-wl-update-record (&optional offer-to-create)
-  "Returns the record corresponding to the current WL message, 
-creating or modifying it as necessary.  A record will be created if 
+  "Returns the record corresponding to the current WL message,
+creating or modifying it as necessary.  A record will be created if
 bbdb/mail-auto-create-p is non-nil, or if OFFER-TO-CREATE is true and
 the user confirms the creation."
   (save-excursion
     (if bbdb-use-pop-up
        (bbdb-wl-pop-up-bbdb-buffer offer-to-create)
-      (let ((key 
+      (let ((key
             (save-excursion
-              (set-buffer 
+              (set-buffer
                (save-excursion
                  (if (buffer-live-p wl-current-summary-buffer)
                      (set-buffer wl-current-summary-buffer))
@@ -149,7 +149,7 @@ the user confirms the creation."
                         offer-to-create))))))))))
 
 (defun bbdb-wl-annotate-sender (string)
-  "Add a line to the end of the Notes field of the BBDB record 
+  "Add a line to the end of the Notes field of the BBDB record
 corresponding to the sender of this message."
   (interactive (list (if bbdb-readonly-p
                         (error "The Insidious Big Brother Database is read-only.")
@@ -191,8 +191,8 @@ This buffer will be in bbdb-mode, with associated keybindings."
   "Make the *BBDB* buffer be displayed along with the WL window(s),
 displaying the record corresponding to the sender of the current message."
   (if (get-buffer-window bbdb-buffer-name)
-      nil  
-    (let ((mes-win (get-buffer-window 
+      nil
+    (let ((mes-win (get-buffer-window
                    (save-excursion
                      (if (buffer-live-p  wl-current-summary-buffer)
                          (set-buffer wl-current-summary-buffer))
@@ -206,7 +206,7 @@ displaying the record corresponding to the sender of the current message."
                      window-min-height 1)
                   (- (window-height mes-win)
                      (max window-min-height
-                          (1+ bbdb-pop-up-target-lines))))))    
+                          (1+ bbdb-pop-up-target-lines))))))
        (split-window mes-win (if (> size 0) size window-min-height)))
       ;; goto the bottom of the two...
       (select-window (next-window))
@@ -235,7 +235,6 @@ displaying the record corresponding to the sender of the current message."
 ;;; @ bbdb-extract-field-value -- stolen from tm-bbdb.
 ;;;
 (and (not (fboundp 'bbdb-extract-field-value-internal))
-     (not (fboundp 'tm:bbdb-extract-field-value)) ;; tm-bbdb
 ;;   (not (fboundp 'PLEASE_REPLACE_WITH_SEMI-BASED_MIME-BBDB)) ;; mime-bbdb
     (progn
       ;; (require 'bbdb-hooks) ; not provided.
@@ -243,11 +242,17 @@ displaying the record corresponding to the sender of the current message."
       (or (fboundp 'bbdb-header-start)
           (load "bbdb-hooks"))
       (fset 'bbdb-extract-field-value-internal
-            (symbol-function 'bbdb-extract-field-value))
+           (cond
+            ((fboundp 'tm:bbdb-extract-field-value)
+             (symbol-function 'tm:bbdb-extract-field-value))
+            (t (symbol-function 'bbdb-extract-field-value))))
       (defun bbdb-extract-field-value (field)
        (let ((value (bbdb-extract-field-value-internal field)))
-         (and value
-              (eword-decode-string value))))
+         (with-temp-buffer ; to keep raw buffer unibyte.
+           (elmo-set-buffer-multibyte
+            default-enable-multibyte-characters)
+           (and value
+                (eword-decode-string value)))))
       ))
 
 
index 947646c..053bcb0 100644 (file)
@@ -116,7 +116,7 @@ This is most commonly `imput(impost)' or `inews-nifty4u'.")
        (while (and (re-search-forward "\n\n\n*" delimline t)
                    (< (point) delimline))
          (replace-match "\n"))
-       ;; Find and handle any FCC fields. 
+       ;; Find and handle any FCC fields.
        ;; 'cause imput can NOT handle `Fcc: %IMAP'.
        (goto-char (point-min))
        (if (re-search-forward "^FCC:" delimline t)
diff --git a/utils/ptexinfmt.el b/utils/ptexinfmt.el
new file mode 100644 (file)
index 0000000..79657ec
--- /dev/null
@@ -0,0 +1,757 @@
+;;; ptexinfmt.el -- portable Texinfo formatter.
+
+;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993,
+;;               1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1999 Yoshiki Hayashi <yoshiki@xemacs.org>
+;; Copyright (C) 2000 TAKAHASHI Kaoru <kaoru@kaisei.org>
+
+;; Author: TAKAHASHI Kaoru <kaoru@kaisei.org>
+;;     Yoshiki Hayashi <yoshiki@xemacs.org>
+;; Maintainer: TAKAHASHI Kaoru <kaoru@kaisei.org>
+;; Created: 7 Jul 2000
+;; Keywords: maint, tex, docs, emulation, compatibility
+
+;; 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:
+
+;; Original code: Yoshiki Hayashi <yoshiki@xemacs.org>
+;;     makeinfo.el (gnujdoc project)
+
+;; Support texinfmt.el 2.32 or later.
+
+;;; Code:
+(require 'texinfmt)
+(require 'poe)
+(require 'broken)
+
+(provide 'ptexinfmt)
+
+;;; Broken
+(defvar ptexinfmt-disable-broken-notice t
+  "If non-nil disable notice, when call `broken-facility'.")
+
+;; sort -fd
+(broken-facility texinfo-format-printindex
+  "Can't sort on Mule for Windows."
+  (if (and (memq system-type '(windows-nt ms-dos))
+;;;       (string< texinfmt-version "2.37 of 24 May 1997")
+          (not (featurep 'meadow)))
+      nil
+    t)
+  ptexinfmt-disable-broken-notice)
+
+;; @var
+(broken-facility texinfo-format-var
+  "Don't perse @var argument."
+  (condition-case nil
+      (with-temp-buffer
+       (let (texinfo-enclosure-list texinfo-alias-list)
+         (texinfo-mode)
+         (insert "@var{@asis{foo}}\n")
+         (texinfo-format-expand-region (point-min) (point-max))
+         t))
+    (error nil))
+  ptexinfmt-disable-broken-notice)
+
+;; @xref
+(broken-facility texinfo-format-xref
+  "Can't format @xref, 1st argument is empty."
+  (condition-case nil
+      (with-temp-buffer
+       (let (texinfo-enclosure-list texinfo-alias-list)
+         (texinfo-mode)
+         (insert "@xref{, xref, , file}\n")
+         (texinfo-format-expand-region (point-min) (point-max))
+         t))
+    (error nil))
+  ptexinfmt-disable-broken-notice)
+
+;; @uref
+(broken-facility texinfo-format-uref
+  "Parse twice @uref argument."
+  (condition-case nil
+      (with-temp-buffer
+       (let (texinfo-enclosure-list texinfo-alias-list)
+         (texinfo-mode)
+         (insert "@uref{mailto:foo@@bar.com}\n")
+         (texinfo-format-expand-region (point-min) (point-max))
+         t))
+    (error nil))
+  ptexinfmt-disable-broken-notice)
+
+;; @multitable
+(broken-facility texinfo-multitable-widths
+  "texinfo-multitable-widths unsupport wide-char."
+  (if (fboundp 'texinfo-multitable-widths)
+      (with-temp-buffer
+       (let ((str "\e$BI}9-J8;z\e(B"))
+         (texinfo-mode)
+         (insert (format " {%s}\n" str))
+         (goto-char (point-min))
+         (if (= (car (texinfo-multitable-widths)) (length str))
+             nil
+           t)))
+    ;; function definition is void
+    t)
+  ptexinfmt-disable-broken-notice)
+
+(broken-facility texinfo-multitable-item
+  "texinfo-multitable-item unsupport wide-char."
+  (if-broken texinfo-multitable-widths nil t)
+  ptexinfmt-disable-broken-notice)
+
+
+;;; Obsolete
+;; Removed Texinfo 3.8
+(put 'overfullrule 'texinfo-format 'texinfo-discard-line)
+(put 'smallbreak 'texinfo-format 'texinfo-discard-line)
+(put 'medbreak 'texinfo-format 'texinfo-discard-line)
+(put 'bigbreak 'texinfo-format 'texinfo-discard-line)
+;; Removed Texinfo 3.9
+(put 'setchapterstyle 'texinfo-format 'texinfo-discard-line-with-args)
+
+;;; Hardcopy and HTML (discard)
+;; I18N
+(put 'documentlanguage 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'documentencoding 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; size
+(put 'smallbook 'texinfo-format 'texinfo-discard-line)
+(put 'afourpaper 'texinfo-format 'texinfo-discard-line)
+(put 'afourlatex 'texinfo-format 'texinfo-discard-line)
+(put 'afourwide 'texinfo-format 'texinfo-discard-line)
+(put 'pagesizes 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; style
+(put 'setchapternewpage 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'kbdinputstyle 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; flags
+(put 'setcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line)
+(put 'setshortcontentsaftertitlepage 'texinfo-format 'texinfo-discard-line)
+(put 'novalidate 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; head & foot
+(put 'headings 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'evenfooting 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'evenheading 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'oddfooting 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'oddheading 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'everyfooting 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'everyheading 'texinfo-format 'texinfo-discard-line-with-args)
+
+;; misc
+(put 'page 'texinfo-format 'texinfo-discard-line)
+(put 'hyphenation 'texinfo-format 'texinfo-discard-command-and-arg)
+
+
+\f
+;;; Directory File
+;; @direcategory
+(put 'dircategory 'texinfo-format 'texinfo-format-dircategory)
+(defun-maybe texinfo-format-dircategory ()
+  (let ((str (texinfo-parse-arg-discard)))
+    (delete-region (point)
+                  (progn
+                    (skip-chars-forward " ")
+                    (point)))
+    (insert "INFO-DIR-SECTION " str "\n")))
+
+;; @direntry
+(put 'direntry 'texinfo-format 'texinfo-format-direntry)
+(defun-maybe texinfo-format-direntry ()
+  (texinfo-push-stack 'direntry nil)
+  (texinfo-discard-line)
+  (insert "START-INFO-DIR-ENTRY\n\n"))
+
+(put 'direntry 'texinfo-end 'texinfo-end-direntry)
+(defun-maybe texinfo-end-direntry ()
+  (texinfo-discard-command)
+  (insert "END-INFO-DIR-ENTRY\n\n")
+  (texinfo-pop-stack 'direntry))
+
+
+;;; Block Enclosing and Conditional
+;; @detailmenu ... @end detailmenu
+(put 'detailmenu 'texinfo-format 'texinfo-discard-line)
+(put 'detailmenu 'texinfo-end 'texinfo-discard-command)
+
+;; @smalldisplay ... @end smalldisplay
+(put 'smalldisplay 'texinfo-format 'texinfo-format-example)
+(put 'smalldisplay 'texinfo-end 'texinfo-end-example)
+
+;; @smallformat ... @end smallformat
+(put 'smallformat 'texinfo-format 'texinfo-format-flushleft)
+(put 'smallformat 'texinfo-end 'texinfo-end-flushleft)
+
+;; @ifnottex ... @end ifnottex
+(put 'ifnottex 'texinfo-format 'texinfo-discard-line)
+(put 'ifnottex 'texinfo-end 'texinfo-discard-command)
+
+;; @ifnothtml ... @end ifnothtml
+(put 'ifnothtml 'texinfo-format 'texinfo-discard-line)
+(put 'ifnothtml 'texinfo-end 'texinfo-discard-command)
+
+;; @ifnotinfo ... @end ifnotinfo
+(put 'ifnotinfo 'texinfo-format 'texinfo-format-ifnotinfo)
+(put 'endifnotinfo 'texinfo-format 'texinfo-discard-line)
+(defun-maybe texinfo-format-ifnotinfo ()
+  (delete-region texinfo-command-start
+                (progn (re-search-forward "@end ifnotinfo[ \t]*\n")
+                       (point))))
+
+;; @html ... @end html
+(put 'html 'texinfo-format 'texinfo-format-html)
+(put 'endhtml 'texinfo-format 'texinfo-discard-line)
+(defun-maybe texinfo-format-html ()
+  (delete-region texinfo-command-start
+                 (progn (re-search-forward "@end html[ \t]*\n")
+                        (point))))
+
+
+\f
+;;; Marking
+;; @url, @env, @command
+(put 'url 'texinfo-format 'texinfo-format-code)
+(put 'env 'texinfo-format 'texinfo-format-code)
+(put 'command 'texinfo-format 'texinfo-format-code)
+
+;; @acronym
+(put 'acronym 'texinfo-format 'texinfo-format-var)
+
+(when-broken texinfo-format-var
+  (fmakunbound 'texinfo-format-var))
+(defun-maybe texinfo-format-var ()
+  (let ((arg (texinfo-parse-expanded-arg)))
+    (texinfo-discard-command)
+    (insert (upcase arg))))
+
+;; @key
+(put 'key 'texinfo-format 'texinfo-format-key)
+(defun-maybe texinfo-format-key ()
+  (insert (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @email{EMAIL-ADDRESS[, DISPLAYED-TEXT]}
+(put 'email 'texinfo-format 'texinfo-format-email)
+(defun-maybe texinfo-format-email ()
+  "Format EMAIL-ADDRESS and optional DISPLAYED-TXT.
+Insert < ... > around EMAIL-ADDRESS."
+  (let ((args (texinfo-format-parse-args)))
+  (texinfo-discard-command)
+    ;; if displayed-text
+    (if (nth 1 args)
+       (insert (nth 1 args) " <" (nth 0 args) ">")
+      (insert "<" (nth 0 args) ">"))))
+
+;; @option
+(put 'option 'texinfo-format 'texinfo-format-option)
+(defun texinfo-format-option ()
+  "Insert ` ... ' around arg unless inside a table; in that case, no quotes."
+  ;; `looking-at-backward' not available in v. 18.57, 20.2
+  ;; searched-for character is a control-H
+  (if (not (search-backward "\010"
+                           (save-excursion (beginning-of-line) (point))
+                           t))
+      (insert "`" (texinfo-parse-arg-discard) "'")
+    (insert (texinfo-parse-arg-discard)))
+  (goto-char texinfo-command-start))
+
+
+\f
+;;; Accents and Special characters
+;; @pounds{}   ==>     #       Pounds Sterling
+(put 'pounds 'texinfo-format 'texinfo-format-pounds)
+(defun-maybe texinfo-format-pounds ()
+  (texinfo-parse-arg-discard)
+  (insert "#"))
+
+;; @OE{}       ==>     OE      French-OE-ligature
+(put 'OE 'texinfo-format 'texinfo-format-French-OE-ligature)
+(defun-maybe texinfo-format-French-OE-ligature ()
+  (insert "OE" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @oe{}       ==>     oe
+(put 'oe 'texinfo-format 'texinfo-format-French-oe-ligature)
+(defun-maybe texinfo-format-French-oe-ligature () ; lower case
+  (insert "oe" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @AA{}       ==>     AA      Scandinavian-A-with-circle
+(put 'AA 'texinfo-format 'texinfo-format-Scandinavian-A-with-circle)
+(defun-maybe texinfo-format-Scandinavian-A-with-circle ()
+  (insert "AA" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @aa{}       ==>     aa
+(put 'aa 'texinfo-format 'texinfo-format-Scandinavian-a-with-circle)
+(defun-maybe texinfo-format-Scandinavian-a-with-circle () ; lower case
+  (insert "aa" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @AE{}       ==>     AE      Latin-Scandinavian-AE
+(put 'AE 'texinfo-format 'texinfo-format-Latin-Scandinavian-AE)
+(defun-maybe texinfo-format-Latin-Scandinavian-AE ()
+  (insert "AE" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @ae{}       ==>     ae
+(put 'ae 'texinfo-format 'texinfo-format-Latin-Scandinavian-ae)
+(defun-maybe texinfo-format-Latin-Scandinavian-ae () ; lower case
+  (insert "ae" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @ss{}       ==>     ss      German-sharp-S
+(put 'ss 'texinfo-format 'texinfo-format-German-sharp-S)
+(defun-maybe texinfo-format-German-sharp-S ()
+  (insert "ss" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @questiondown{}     ==>     ?       upside-down-question-mark
+(put 'questiondown 'texinfo-format 'texinfo-format-upside-down-question-mark)
+(defun-maybe texinfo-format-upside-down-question-mark ()
+  (insert "?" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @exclamdown{}       ==>     !       upside-down-exclamation-mark
+(put 'exclamdown 'texinfo-format 'texinfo-format-upside-down-exclamation-mark)
+(defun-maybe texinfo-format-upside-down-exclamation-mark ()
+  (insert "!" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @L{}                ==>     L/      Polish suppressed-L (Lslash)
+(put 'L 'texinfo-format 'texinfo-format-Polish-suppressed-L)
+(defun-maybe texinfo-format-Polish-suppressed-L ()
+  (insert (texinfo-parse-arg-discard) "/L")
+  (goto-char texinfo-command-start))
+
+;; @l{}                ==>     l/      Polish suppressed-L (Lslash) (lower case)
+(put 'l 'texinfo-format 'texinfo-format-Polish-suppressed-l-lower-case)
+(defun-maybe texinfo-format-Polish-suppressed-l-lower-case ()
+  (insert (texinfo-parse-arg-discard) "/l")
+  (goto-char texinfo-command-start))
+
+;; @O{}                ==>     O/      Scandinavian O-with-slash
+(put 'O 'texinfo-format 'texinfo-format-Scandinavian-O-with-slash)
+(defun-maybe texinfo-format-Scandinavian-O-with-slash ()
+  (insert (texinfo-parse-arg-discard) "O/")
+  (goto-char texinfo-command-start))
+
+;; @o{}                ==>     o/      Scandinavian O-with-slash (lower case)
+(put 'o 'texinfo-format 'texinfo-format-Scandinavian-o-with-slash-lower-case)
+(defun-maybe texinfo-format-Scandinavian-o-with-slash-lower-case ()
+  (insert (texinfo-parse-arg-discard) "o/")
+  (goto-char texinfo-command-start))
+
+;; @,{c}       ==>     c,      cedilla accent
+(put ', 'texinfo-format 'texinfo-format-cedilla-accent)
+(defun-maybe texinfo-format-cedilla-accent ()
+  (insert (texinfo-parse-arg-discard) ",")
+  (goto-char texinfo-command-start))
+
+
+;; @dotaccent{o}       ==>     .o      overdot-accent
+(put 'dotaccent 'texinfo-format 'texinfo-format-overdot-accent)
+(defun-maybe texinfo-format-overdot-accent ()
+  (insert "." (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @ubaraccent{o}      ==>     _o      underbar-accent
+(put 'ubaraccent 'texinfo-format 'texinfo-format-underbar-accent)
+(defun-maybe texinfo-format-underbar-accent ()
+  (insert "_" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @udotaccent{o}      ==>     o-.     underdot-accent
+(put 'udotaccent 'texinfo-format 'texinfo-format-underdot-accent)
+(defun-maybe texinfo-format-underdot-accent ()
+  (insert (texinfo-parse-arg-discard) "-.")
+  (goto-char texinfo-command-start))
+
+;; @H{o}       ==>     ""o     long Hungarian umlaut
+(put 'H 'texinfo-format 'texinfo-format-long-Hungarian-umlaut)
+(defun-maybe texinfo-format-long-Hungarian-umlaut ()
+  (insert "\"\"" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @ringaccent{o}      ==>     *o      ring accent
+(put 'ringaccent 'texinfo-format 'texinfo-format-ring-accent)
+(defun-maybe texinfo-format-ring-accent ()
+  (insert "*" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @tieaccent{oo}      ==>     [oo     tie after accent
+(put 'tieaccent 'texinfo-format 'texinfo-format-tie-after-accent)
+(defun-maybe texinfo-format-tie-after-accent ()
+  (insert "[" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @u{o}       ==>     (o      breve accent
+(put 'u 'texinfo-format 'texinfo-format-breve-accent)
+(defun-maybe texinfo-format-breve-accent ()
+  (insert "(" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @v{o}       ==>     <o      hacek accent
+(put 'v 'texinfo-format 'texinfo-format-hacek-accent)
+(defun-maybe texinfo-format-hacek-accent ()
+  (insert "<" (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+;; @dotless{i} ==>     i       dotless i and dotless j
+(put 'dotless 'texinfo-format 'texinfo-format-dotless)
+(defun-maybe texinfo-format-dotless ()
+  (insert (texinfo-parse-arg-discard))
+  (goto-char texinfo-command-start))
+
+
+\f
+;;; Cross References
+;; @ref, @xref
+(put 'ref 'texinfo-format 'texinfo-format-xref)
+
+(when-broken texinfo-format-xref
+  (fmakunbound 'texinfo-format-xref))
+(defun-maybe texinfo-format-xref ()
+  (let ((args (texinfo-format-parse-args)))
+    (texinfo-discard-command)
+    (insert "*Note ")
+    (let ((fname (or (nth 1 args) (nth 2 args))))
+      (if (null (or fname (nth 3 args)))
+         (insert (nth 0 args) "::")
+       (insert (or fname (nth 0 args)) ": ")
+       (if (nth 3 args)
+           (insert "(" (nth 3 args) ")"))
+       (unless (null (nth 0 args))
+         (insert (nth 0 args)))))))
+
+;; @uref
+(put 'uref 'texinfo-format 'texinfo-format-uref)
+(when-broken texinfo-format-uref
+  (fmakunbound 'texinfo-format-uref))
+(defun-maybe texinfo-format-uref ()
+  "Format URL and optional URL-TITLE.
+Insert ` ... ' around URL if no URL-TITLE argument;
+otherwise, insert URL-TITLE followed by URL in parentheses."
+  (let ((args (texinfo-format-parse-args)))
+    (texinfo-discard-command)
+    ;; if url-title
+    (if (nth 1 args)
+        (insert  (nth 1 args) " (" (nth 0 args) ")")
+      (insert "`" (nth 0 args) "'"))))
+
+
+\f
+;;; New command definition
+;; @alias NEW=EXISTING
+(put 'alias 'texinfo-format 'texinfo-alias)
+(defun-maybe texinfo-alias ()
+  (let ((start (1- (point)))
+       args)
+    (skip-chars-forward " ")
+    (save-excursion (end-of-line) (setq texinfo-command-end (point)))
+    (if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
+       (error "Invalid alias command")
+      (setq texinfo-alias-list
+           (cons
+            (cons
+             (buffer-substring (match-beginning 1) (match-end 1))
+             (buffer-substring (match-beginning 2) (match-end 2)))
+            texinfo-alias-list))
+      (texinfo-discard-command))))
+
+;; @definfoenclose NEWCMD, BEFORE, AFTER
+
+
+\f
+;;; Special
+;; @image{FILENAME, [WIDTH], [HEIGHT]}
+(put 'image 'texinfo-format 'texinfo-format-image)
+(defun-maybe texinfo-format-image ()
+  (let ((args (texinfo-format-parse-args)) ; parse FILENAME?
+       filename)
+    (when (null (nth 0 args))
+      (error "Invalid image command"))
+    (texinfo-discard-command)
+    ;; makeinfo uses FILENAME.txt
+    (setq filename (format "%s.txt" (nth 0 args)))
+    (message "Reading included file: %s" filename)
+    ;; verbatim for Info output
+    (goto-char (+ (point) (cadr (insert-file-contents filename))))
+    (message "Reading included file: %s...done" filename)))
+
+
+;; @exampleindent
+
+
+\f
+;;; @multitable ... @end multitable
+(defvar-maybe texinfo-extra-inter-column-width 0
+  "*Number of extra spaces between entries (columns) in @multitable.")
+
+(defvar-maybe texinfo-multitable-buffer-name "*multitable-temporary-buffer*")
+(defvar-maybe texinfo-multitable-rectangle-name "texinfo-multitable-temp-")
+
+;; These commands are defined in texinfo.tex for printed output.
+(put 'multitableparskip 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'multitableparindent 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'multitablecolmargin 'texinfo-format 'texinfo-discard-line-with-args)
+(put 'multitablelinespace 'texinfo-format 'texinfo-discard-line-with-args)
+
+(put 'multitable 'texinfo-format 'texinfo-multitable)
+
+(defun-maybe texinfo-multitable ()
+  "Produce multi-column tables."
+
+;; This function pushes information onto the `texinfo-stack'.
+;; A stack element consists of:
+;;   - type-of-command, i.e., multitable
+;;   - the information about column widths, and
+;;   - the position of texinfo-command-start.
+;; e.g., ('multitable (1 2 3 4) 123)
+;; The command line is then deleted.
+  (texinfo-push-stack
+   'multitable
+   ;; push width information on stack
+   (texinfo-multitable-widths))
+  (texinfo-discard-line-with-args))
+
+(put 'multitable 'texinfo-end 'texinfo-end-multitable)
+(defun-maybe texinfo-end-multitable ()
+  "Discard the @end multitable line and pop the stack of multitable."
+  (texinfo-discard-command)
+  (texinfo-pop-stack 'multitable))
+
+(when-broken texinfo-multitable-widths
+  (fmakunbound 'texinfo-multitable-widths))
+
+(defun-maybe texinfo-multitable-widths ()
+  "Return list of widths of each column in a multi-column table."
+  (let (texinfo-multitable-width-list)
+    ;; Fractions format:
+    ;;  @multitable @columnfractions .25 .3 .45
+    ;;
+    ;; Template format:
+    ;;  @multitable {Column 1 template} {Column 2} {Column 3 example}
+    ;; Place point before first argument
+    (skip-chars-forward " \t")
+    (cond
+     ;; Check for common misspelling
+     ((looking-at "@columnfraction ")
+      (error "In @multitable, @columnfractions misspelled"))
+     ;; Case 1: @columnfractions .25 .3 .45
+     ((looking-at "@columnfractions")
+      (forward-word 1)
+      (while (not (eolp))
+        (setq texinfo-multitable-width-list
+              (cons
+               (truncate
+                (1-
+                 (* fill-column (read (get-buffer (current-buffer))))))
+               texinfo-multitable-width-list))))
+     ;;
+     ;; Case 2: {Column 1 template} {Column 2} {Column 3 example}
+     ((looking-at "{")
+      (let ((start-of-templates (point)))
+        (while (not (eolp))
+          (skip-chars-forward " \t")
+          (let* ((start-of-template (1+ (point)))
+                 (end-of-template
+                 ;; forward-sexp works with braces in Texinfo mode
+                  (progn (forward-sexp 1) (1- (point)))))
+            (setq texinfo-multitable-width-list
+                 (cons (- (progn (goto-char end-of-template) (current-column))
+                          (progn (goto-char start-of-template) (current-column)))
+                        texinfo-multitable-width-list))
+            ;; Remove carriage return from within a template, if any.
+            ;; This helps those those who want to use more than
+            ;; one line's worth of words in @multitable line.
+            (narrow-to-region start-of-template end-of-template)
+            (goto-char (point-min))
+            (while (search-forward "
+" nil t)
+              (delete-char -1))
+            (goto-char (point-max))
+            (widen)
+            (forward-char 1)))))
+     ;;
+     ;; Case 3: Trouble
+     (t
+      (error
+       "You probably need to specify column widths for @multitable correctly.")))
+    ;; Check whether columns fit on page.
+    (let ((desired-columns
+           (+
+            ;; between column spaces
+            (length texinfo-multitable-width-list)
+            ;; additional between column spaces, if any
+            texinfo-extra-inter-column-width
+            ;; sum of spaces for each entry
+            (apply '+ texinfo-multitable-width-list))))
+      (if (> desired-columns fill-column)
+          (error
+           (format
+            "Multi-column table width, %d chars, is greater than page width, %d chars."
+            desired-columns fill-column))))
+    texinfo-multitable-width-list))
+
+;; @item  A1  @tab  A2  @tab  A3
+(defun-maybe texinfo-multitable-extract-row ()
+  "Return multitable row, as a string.
+End of row is beginning of next @item or beginning of @end.
+Cells within rows are separated by @tab."
+  (skip-chars-forward " \t")
+  (let* ((start (point))
+         (end (progn
+                (re-search-forward "@item\\|@end")
+                (match-beginning 0)))
+         (row (progn (goto-char end)
+                     (skip-chars-backward " ")
+                     ;; remove whitespace at end of argument
+                     (delete-region (point) end)
+                     (buffer-substring start (point)))))
+    (delete-region texinfo-command-start end)
+    row))
+
+(when-broken texinfo-multitable-item
+  (fmakunbound 'texinfo-multitable-item))
+
+(put 'multitable 'texinfo-item 'texinfo-multitable-item)
+(defun-maybe texinfo-multitable-item ()
+  "Format a row within a multicolumn table.
+Cells in row are separated by @tab.
+Widths of cells are specified by the arguments in the @multitable line.
+All cells are made to be the same height.
+This command is executed when texinfmt sees @item inside @multitable."
+  (let ((original-buffer (current-buffer))
+        (table-widths (reverse (car (cdr (car texinfo-stack)))))
+        (existing-fill-column fill-column)
+        start
+        end
+        (table-column       0)
+        (table-entry-height 0)
+        ;; unformatted row looks like:  A1  @tab  A2  @tab  A3
+        ;; extract-row command deletes the source line in the table.
+        (unformated-row (texinfo-multitable-extract-row)))
+    ;; Use a temporary buffer
+    (set-buffer (get-buffer-create texinfo-multitable-buffer-name))
+    (delete-region (point-min) (point-max))
+    (insert unformated-row)
+    (goto-char (point-min))
+;; 1. Check for correct number of @tab in line.
+    (let ((tab-number 1))                       ; one @tab between two columns
+      (while (search-forward "@tab" nil t)
+        (setq tab-number (1+ tab-number)))
+      (if (/= tab-number (length table-widths))
+          (error "Wrong number of @tab's in a @multitable row.")))
+    (goto-char (point-min))
+;; 2. Format each cell, and copy to a rectangle
+    ;; buffer looks like this:    A1  @tab  A2  @tab  A3
+    ;; Cell #1: format up to @tab
+    ;; Cell #2: format up to @tab
+    ;; Cell #3: format up to eob
+    (while (not (eobp))
+      (setq start (point))
+      (setq end (save-excursion
+                  (if (search-forward "@tab" nil 'move)
+                      ;; Delete the @tab command, including the @-sign
+                      (delete-region
+                       (point)
+                       (progn (forward-word -1) (1- (point)))))
+                  (point)))
+      ;; Set fill-column *wider* than needed to produce inter-column space
+      (setq fill-column (+ 1
+                           texinfo-extra-inter-column-width
+                           (nth table-column table-widths)))
+      (narrow-to-region start end)
+      ;; Remove whitespace before and after entry.
+      (skip-chars-forward " ")
+      (delete-region (point) (save-excursion (beginning-of-line) (point)))
+      (goto-char (point-max))
+      (skip-chars-backward " ")
+      (delete-region (point) (save-excursion (end-of-line) (point)))
+      ;; Temorarily set texinfo-stack to nil so texinfo-format-scan
+      ;; does not see an unterminated @multitable.
+      (let (texinfo-stack)                      ; nil
+        (texinfo-format-scan))
+      (let (fill-prefix)                        ; no fill prefix
+        (fill-region (point-min) (point-max)))
+      (setq table-entry-height
+            (max table-entry-height (count-lines (point-min) (point-max))))
+;; 3. Move point to end of bottom line, and pad that line to fill column.
+      (goto-char (point-min))
+      (forward-line (1- table-entry-height))
+      (let* ((beg (point))                      ; beginning of line
+             ;; add one more space for inter-column spacing
+             (needed-whitespace
+              (1+
+              (- fill-column
+                 (progn (end-of-line) (current-column)))))) ; end of existing line
+        (insert (make-string
+                 (if (> needed-whitespace 0) needed-whitespace 1)
+                 ? )))
+      ;; now, put formatted cell into a rectangle
+      (set (intern (concat texinfo-multitable-rectangle-name
+                           (int-to-string table-column)))
+           (extract-rectangle (point-min) (point)))
+      (delete-region (point-min) (point))
+      (goto-char (point-max))
+      (setq table-column (1+ table-column))
+      (widen))
+;; 4. Add extra lines to rectangles so all are of same height
+    (let ((total-number-of-columns table-column)
+          (column-number 0)
+          here)
+      (while (> table-column 0)
+        (let ((this-rectangle (int-to-string table-column)))
+          (while (< (length this-rectangle) table-entry-height)
+            (setq this-rectangle (append this-rectangle '("")))))
+        (setq table-column (1- table-column)))
+;; 5. Insert formatted rectangles in original buffer
+      (switch-to-buffer original-buffer)
+      (open-line table-entry-height)
+      (while (< column-number total-number-of-columns)
+        (setq here (point))
+        (insert-rectangle
+         (eval (intern
+                (concat texinfo-multitable-rectangle-name
+                        (int-to-string column-number)))))
+        (goto-char here)
+        (end-of-line)
+        (setq column-number (1+ column-number))))
+    (kill-buffer texinfo-multitable-buffer-name)
+    (setq fill-column existing-fill-column)))
+
+\f
+(when-broken texinfo-format-printindex
+  (fmakunbound 'texinfo-format-printindex))
+
+(defun-maybe texinfo-format-printindex ()
+  (let ((indexelts (symbol-value
+                    (cdr (assoc (texinfo-parse-arg-discard)
+                                texinfo-indexvar-alist))))
+        opoint)
+    (insert "\n* Menu:\n\n")
+    (setq opoint (point))
+    (texinfo-print-index nil indexelts)
+
+    (if (memq system-type '(vax-vms windows-nt ms-dos))
+        (texinfo-sort-region opoint (point))
+      (shell-command-on-region opoint (point) "sort -fd" 1))))
+
+;;; ptexinfmt.el ends here
index 1877a56..134d4ff 100644 (file)
+2000-10-17  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-msgdb-load-async): Enclose
+       elmo-imap4-get-session with unwind-protect.
+       Don't cause error.
+       (wl-summary-sync-marks): Don't check plugged nor folder type.
+       (wl-summary-save-view-cache): Abolished argument `keep-current-buffer'
+       (Always keep current buffer).
+
+2000-10-16  Akihiro MOTOKI  <motoki@da.jp.nec.com>
+
+       * wl-highlight.el (wl-highlight-message-add-buttons-to-header):
+       Enclose with `save-excursion'.
+
+2000-10-16  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-version.el (wl-version): Remove interactive.
+
+2000-10-15  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-version.el (wl-generate-user-agent-string): Use
+       `product-string-verbose' instead of `product-string-1'.
+
+2000-10-15  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-vars.el (wl-draft-use-cache): New variable.
+       * wl-draft.el (wl-draft-dispatch-message): Sending message is cached,
+       if wl-draft-use-cache is non-nil.
+
+2000-10-15  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-summary (wl-summary-prefetch): Don't prefetch if cached.
+       (wl-summary-prefetch-msg): force prefetch if called with optional argument.
+
+2000-10-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-thread.el (wl-thread-msg-mark-as-read): Abolished.
+       (wl-thread-msg-mark-as-unread): Ditto.
+
+       * wl-summary.el (wl-summary-sync-marks): Delete argument 'no-cache.
+       (wl-summary-mark-as-unread): Check return value of `elmo-mark-as-read'.
+       (wl-summary-mark-as-read): Invert the meaning of 6 th argument.
+       Don't set mark in summary if return value of `elmo-mark-as-read'
+       is nil.
+       Use `wl-summary-mark-as-read' instead of `wl-thread-msg-mark-as-read'.
+       (wl-summary-mark-as-read-region):  Use `wl-summary-mark-as-read'
+       instead of `wl-thread-msg-mark-as-read'.
+       (wl-summary-mark-as-unread-region): Ditto.
+       (wl-summary-target-mark-mark-as-read): Ditto.
+
+       * wl-score.el (wl-summary-score-update-all-lines): Ditto.
+
+2000-10-12  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-xmas.el (wl-highlight-folder-current-line): Remove previous face.
+
+       * wl-mule.el (wl-highlight-folder-current-line): Ditto.
+
+2000-10-11  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-highlight.el (wl-highlight-folder-group-line): Remove previous
+       face.
+
+2000-10-11  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-util.el (toplevel): Use `wl-on-xemacs' instead of
+       `running-xemacs'.
+
+2000-10-11  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-version.el (toplevel): Use `product-version-as-string' for
+       set verstion-string, if defined.
+
+       * wl-version.el (wl-version-show): Insert string at point, when
+       call with argument.
+
+       * wl-version.el (wl-generate-user-agent-string): Use
+       `product-string-1' instead of `wl-appname', `wl-version' and
+       `wl-codename'.
+
+2000-10-10  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-address.el (toplevel): Use product-provide.
+       * wl-demo.el (toplevel): Ditto.
+       * wl-dnd.el (toplevel): Ditto.
+       * wl-draft.el (toplevel): Ditto.
+       * wl-e21.el (toplevel): Ditto.
+       * wl-expire.el (toplevel): Ditto.
+       * wl-fldmgr.el (toplevel): Ditto.
+       * wl-folder.el (toplevel): Ditto.
+       * wl-highlight.el (toplevel): Ditto.
+       * wl-message.el (toplevel): Ditto.
+       * wl-mime.el (toplevel): Ditto.
+       * wl-mule.el (toplevel): Ditto.
+       * wl-nemacs.el (toplevel): Ditto.
+       * wl-refile.el (toplevel): Ditto.
+       * wl-score.el (toplevel): Ditto.
+       * wl-summary.el (toplevel): Ditto.
+       * wl-template.el (toplevel): Ditto.
+       * wl-thread.el (toplevel): Ditto.
+       * wl-util.el (toplevel): Ditto.
+       * wl-vars.el (toplevel): Ditto.
+       * wl-xmas.el (toplevel): Ditto.
+       * wl.el (toplevel): Ditto.
+
+2000-10-10  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-fldmgr.el (wl-fldmgr-save-folders): Use (wl-version t)
+       instead of product.
+
+       * wl-version.el (wl-version): Compile time evalution elmo-version.
+
+2000-10-10  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-summary.el (wl-summary-sync-force-update): Append queue
+       `mark-as-read'if unplugged.
+
+2000-10-10  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-version.el: New file.  Use product.el.
+       * wl.el: add (require 'wl-version).
+       * wl-fldmgr.el (wl-fldmgr-save-folders): Use `product-string-1'
+       for ~/.folders header.
+       (wl-fldmgr-folders-header): Changed.
+       * wl-demo.el (wl-demo): Use product.el.
+
+       * wl-vars.el (wl-appname, wl-version, wl-codename): Move to
+       wl-version.el.
+       * wl-util.el (wl-version, wl-version-show): Ditto.
+
+       * wl-util.el (wl-generate-user-agent-string,
+       wl-extended-emacs-version, wl-extended-emacs-version2,
+       wl-extended-emacs-version3): Move to wl-version.el.
+       * wl-util.el (mule-version, nemacs-version, emacs-beta-version,
+       xemacs-codename, mime-edit-insert-user-agent-field,
+       mime-edit-user-agent-value, mime-editor/version,
+       mime-editor/codename): Compile warning killer move to
+       wl-version.el
+
+2000-10-09  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-summary.el (wl-summary-refile-subr): Fix.
+
+2000-10-09  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-sync-marks): Changed argument for
+       `elmo-list-folder-unread' and `elmo-list-folder-important'.
+
+2000-10-08  Kenichi OKADA      <okada@opaopa.org>
+
+       * wl.el (wl-check-environment): Check too many `@'.
+
+2000-10-08   Mikio Nakajima <minakaji@osaka.email.ne.jp>
+
+       * wl-thread.el (wl-thread-delete-message): Fix parentheses.
+
+2000-10-07  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-vars.el (wl-draft-reply-myself-with-argument-list,
+       wl-draft-reply-myself-without-argument-list): Add variables.
+       * wl-draft.el (wl-draft-reply): Use it.
+
+2000-10-06   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-fldmgr.el (wl-fldmgr-add-completion-all-completions): Pass
+       the 5th argument of `elmo-network-get-spec'.
+
+       * wl-thread.el (wl-thread-reparent-children): New inline function.
+       (wl-thread-delete-message): Use it.
+
+       * wl-score.el (wl-score-headers): Abolish local variable `buffers'.
+       (wl-summary-score-update-all-lines): Don't use `dolist'.
+
+2000-10-06  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-score.el (toplevel): Remove (provide 'elmo-msgdb).  And add
+       (require 'elmo-msgdb) for inline function.
+
+2000-10-06  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-vars.el (wl-draft-queue-save-variables): Add variables.
+
+2000-10-06  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-score.el (wl-score-headers): Fix for the confusing macro
+       `elmo-kill-buffer'.
+
+2000-10-05  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-summary.el: Don't use the 3rd argument of `require' because
+       it might be ignored by some wrappers (e.g. jam-zcat, efs, etc.).
+       * wl-util.el: Ditto.
+       * wl-draft.el: Ditto.
+
+2000-10-05  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Don't pass by the XEmacs routine when
+       window system is not used.
+
+2000-10-04   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-thread.el: Don't use `mapcar' only for iteration.
+       (wl-thread-resume-entity): Ditto.
+       (wl-thread-delete-message): Ditto.
+
+       * wl-summary.el: Bind `dragdrop-drop-functions',
+       `scrollbar-height' and `mail-reply-buffer'; specify 3rd argument
+       of `require' for `timezone', `easymenu' and `ps-print';
+       don't use `mapcar' only for iteration.
+
+       * wl-util.el: Bind `mule-version', `nemacs-version',
+       `emacs-beta-version', `xemacs-codename',
+       `mime-edit-insert-user-agent-field', `mime-edit-user-agent-value',
+       `mime-editor/version' and `mime-editor/codename'; specify 3rd
+       argument of `require' for `tm-edit' and `pp'; don't use `mapcar'
+       only for iteration.
+
+       * wl-score.el: Don't use `mapcar' only for iteration.
+       (wl-score-simplify-buffer-fuzzy): Ditto.
+       (wl-score-simplify-subject): Ditto.
+       (wl-score-headers): Ditto.
+       (wl-summary-score-update-all-lines): Ditto.
+
+       * wl-mime.el: Bind `xemacs-betaname', `xemacs-codename',
+       `enable-multibyte-characters' and `mule-version'.
+
+       * wl-message.el: Bind `mmelmo-imap4-skipped-parts'; don't use
+       `mapcar' only for iteration.
+
+       * wl-demo.el: Don't use `mapcar' only for iteration.
+
+       * wl-folder.el: Don't use `mapcar' only for iteration.
+       (wl-folder-open-all): Ditto.
+       (wl-folder-count-incorporates): Ditto.
+
+       * wl-fldmgr.el (wl-add-entity): Don't use `mapcar' only for iteration.
+       (wl-add-entity-sub): Ditto; use `delq' instead of `delete'.
+
+       * wl-draft.el: Bind `x-face-add-x-face-version-header',
+       `mail-reply-buffer', `mail-from-style', `smtp-authenticate-*' and
+       `smtp-connection-type'; specify 3rd argument of `require' for
+       `timezone'; don't use `mapcar' only for iteration.
+       (wl-draft-clone-local-variables): Don't use `mapcar'.
+       (wl-draft-generate-clone-buffer): Ditto.
+       (wl-user-agent-compose-internal): Ditto.
+
+       * wl-xmas.el (wl-folder-init-icons): Use `dolist' instead of `mapcar'.
+
+       * wl.el (wl-toggle-plugged): Don't use `mapcar' only for iteration.
+       (wl-save-status): Ditto.
+
+       * wl-address.el (wl-local-address-init): Don't use `mapcar' only
+       for iteration.
+
+2000-10-04  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-vars.el (wl-summary-pick-field-default): Added `Last', `First' and
+       removed `Date'.
+       (wl-fldmgr-make-filter-default): New user option.
+
+       * wl-fldmgr.el (wl-fldmgr-make-filter): Simplify.
+       Use `elmo-read-search-condition' and `wl-fldmgr-make-filter-default'
+       (wl-fldmgr-filter-completion-alist): Abolish.
+
+       * wl.el (wl): Don't check servers if arg is non-nil.
+
+       * wl-draft.el (wl-draft-reply): Set only message-id string to
+       In-Reply-To field.
+
+2000-10-03  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-pick): Rewrite.
+
+       * wl-draft.el (wl-draft-forward): Get references field from
+       original buffer.
+       (wl-draft-forward): Use `wl-draft-parse-msg-id-list-string'.
+
+2000-10-02  A. SAGATA  <sagata@nttvdt.hil.ntt.co.jp>
+
+       * wl-draft.el (wl-draft-forward): Add references field.
+
+2000-10-03  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-draft.el (wl-draft-parse-msg-id-list-string): New function.
+       (wl-draft-reply): Use it.
+
+2000-10-02  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-vars.el (wl-icon-dir): Default to $(data-directory)/wl/icons/
+       when Emacs 21 is running.
+
+       * wl-e21.el (wl-e21-make-toolbar-buttons): Invalidate the default
+       bindings.
+
+2000-09-29  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-e21.el (wl-e21-setup-toolbar): Make the background color of
+       XPM icons transparent.
+
+       * wl-demo.el (wl-demo): Hide toolbar while showing a logo under
+       Emacs 21.
+
+2000-09-29  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl.el (wl-toggle-plugged): Set `wl-biff-check-folders-running' as
+       nil.
+
+       * wl-summary.el (wl-summary-sync-force-update): Save seen-list only
+       when it is persistent.
+       (wl-summary-sync-marks): Changed argument for
+       `elmo-list-folder-unread' and `elmo-list-folder-important'.
+       (wl-summary-virtual): Use `elmo-read-search-condition'.
+       (wl-summary-redisplay-internal): If folder is local, mark as read
+       even when folder is plugged.
+
+2000-09-28  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-e21.el (wl-e21-make-toolbar-buttons): Don't modify the value
+       of `tool-bar-lines' in the frame parameters.
+       (after-make-frame-functions, post-command-hook): Don't modify the
+       value.
+       (wl-e21-switch-toolbar-after-make-frame, wl-e21-switch-toolbar,
+       wl-e21-tool-bar-lines): Removed.
+
+2000-09-28  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-highlight.el (wl-highlight-folder-path): Put overlay
+       properties `evaporate' and `wl-momentary-overlay' as well.
+       (wl-highlight-summary-displaying): Ditto.
+       (wl-delete-all-overlays): Don't delete overlay which does not have
+       a property `wl-momentary-overlay'.
+
+       * wl-e21.el (wl-biff-init-icons, wl-plugged-init-icons): Refer to
+       `display-mouse-p' and `display-graphic-p'.
+       (wl-folder-init-icons): Don't search for XBM or the other files.
+       (wl-plugged-set-folder-icon): Make icons if and only if
+       `display-graphic-p' returns non-nil.
+       (wl-highlight-plugged-current-line): Use `before-string' overlay
+       property to show icon images.
+       (wl-highlight-folder-current-line): Ditto.
+       (wl-e21-highlight-folder-group-line): Ditto.
+       (wl-e21-highlight-folder-by-numbers): Ditto.
+       (wl-e21-insert-image): Removed.
+       (wl-e21-setup-*-toolbar): Refer to `display-graphic-p'.
+       (wl-e21-make-toolbar-buttons): Set the value that Emacs itself
+       said.
+       (wl-e21-switch-toolbar-after-make-frame): Renamed from
+       `wl-e21-force-switch-toolbar'.
+       (wl-e21-make-icon-image): Removed.
+       (wl-e21-setup-toolbar): Don't search for XBM files.
+       (wl-use-toolbar): Don't refer to `display-graphic-p' to determine
+       the default value.
+
+2000-09-27  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-util.el (wl-biff-check-folder-async): Set
+       `wl-biff-check-folders-running' even when it is not an IMAP folder.
+
+2000-09-26  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-e21.el (after-make-frame-functions): Add
+       `wl-e21-force-switch-toolbar'.
+       (wl-e21-force-switch-toolbar): New function force to switch the
+       toolbar appearance automatically.
+       (post-command-hook): Add `wl-e21-switch-toolbar'.
+       (wl-e21-switch-toolbar): New function to switch the toolbar
+       appearance automatically.
+       (wl-e21-tool-bar-lines): New buffer local variable.
+
+2000-09-25  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-util.el (wl-biff-check-folders-running): New variable.
+       (wl-biff-check-folders): Set and check `wl-biff-check-folders-running'.
+       (wl-biff-check-folder-async-callback):
+       Set `wl-biff-check-folders-running'.
+       (wl-biff-check-folders): Enclose `wl-folder-check-one-entity'
+       with unwind-protect.
+
+       * wl.el (wl): Call `wl-biff-start' before `wl-folder-auto-check'.
+       Enclose `wl-folder-auto-check' with unwind-protect.
+
+       * wl-util.el (wl-biff-start) [Emacs19+]: require 'timer.
+       (toplevel) [Emacs19+]: Removed autoload setting for "timer".
+
+       * wl.el (wl): Call `wl-folder-auto-check' after `wl-plugged-init'.
+
+       * wl-util.el (wl-biff-notify): New inline function.
+       (wl-biff-check-folders): Bind `elmo-network-session-name-prefix'
+       locally.
+       Call `wl-biff-check-folder-async' if length of `wl-biff-check-
+       folder-list' is 1.
+       Use `wl-biff-notify'.
+       (wl-biff-check-folder-async-callback): New function.
+       (wl-biff-check-folder-async): Ditto.
+
+       * wl-folder.el (wl-folder): Don't check folders.
+       (wl-folder-auto-check): New function.
+
+2000-09-24  A. SAGATA  <sagata@nttvdt.hil.ntt.co.jp>
+
+       * wl-util.el (wl-biff-start) [Emacs19+]:
+       Use `timer-next-integral-multiple-of-time'.
+       (wl-biff-check-folders): Use `wl-default-folder'
+       if `wl-biff-check-folder-list' is nil.
+
 2000-09-24  OKAZAKI Tetsurou  <okazaki@be.to>
 
        * wl-summary.el (wl-summary-set-crosspost): Use `elmo-list-delete'
        instead of `elmo-delete-lists'.
 
-2000-09-11  OKAZAKI Tetsurou  <okazaki@be.to>
+2000-09-22  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl.el (wl-plugged-toggle-all): Set the value of
+       `wl-modeline-plug-status' instead of `wl-plug-state-indicator'.
+       (wl-plugged-toggle): Ditto.
+       (wl-toggle-plugged): Ditto.
+       (wl-plugged-init): Ditto.
+
+       * wl-xmas.el (wl-biff-init-icons): Set icons data to
+       `wl-modeline-biff-state-off' and `wl-modeline-biff-state-on'
+       instead of `wl-biff-state-indicator-off' and
+       `wl-biff-state-indicator-on'; don't modify the value and the type
+       of `wl-biff-state-indicator-off' and `wl-biff-state-indicator-on'.
+       (wl-plugged-init-icons): Set icons data to
+       `wl-modeline-plug-state-off' and `wl-modeline-plug-state-on'
+       instead of `wl-plug-state-indicator-off' and
+       `wl-plug-state-indicator-on'; don't modify the value and the type
+       of `wl-plug-state-indicator-off' and `wl-plug-state-indicator-on'.
+
+       * wl-vars.el (wl-modeline-biff-state-off,
+       wl-modeline-biff-state-on, wl-modeline-biff-status,
+       wl-modeline-plug-state-off, wl-modeline-plug-state-on,
+       wl-modeline-plug-status): New internal variables.
+       (wl-biff-state-indicator-off, wl-biff-state-indicator-on,
+       wl-biff-check-interval, wl-biff-check-folder-list): Change
+       customization group from `wl-folder' to `wl-highlight'.
+       (wl-plug-state-indicator-off, wl-plug-state-indicator-on,
+       wl-show-plug-status-on-modeline): Defcustomized.
+
+       * wl-util.el (wl-biff-check-folders): Set the value of the flag
+       `wl-modeline-biff-status' instead of `wl-biff-state-indicator'.
+       (wl-mode-line-buffer-identification): Set both ON and OFF data with
+       a flag to `mode-line-buffer-identification'.
+
+       * wl-e21.el (wl-biff-init-icons): Set icons data to
+       `wl-modeline-biff-state-off' and `wl-modeline-biff-state-on'
+       instead of `wl-biff-state-indicator-off' and
+       `wl-biff-state-indicator-on'.
+       (wl-plugged-init-icons): Set icons data to
+       `wl-modeline-plug-state-off' and `wl-modeline-plug-state-on'
+       instead of `wl-plug-state-indicator-off' and
+       `wl-plug-state-indicator-on'.
+
+2000-09-20  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * wl-util.el (wl-mode-line-buffer-identification): Don't breed
+       excessive titles.
+
+2000-09-20  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl.el (wl-plugged-mode): Use revised
+       `wl-mode-line-buffer-identification'.
+       (wl-plugged-init): Don't use `force-mode-line-update'.
+
+       * wl-xmas.el (wl-draft-overload-functions): Use revised
+       `wl-mode-line-buffer-identification'.
+       (wl-setup-summary): Renamed from `wl-xmas-setup-summary'.
+       (wl-setup-folder): Renamed from `wl-xmas-setup-folder'.
+       (TopLevel): Add `wl-setup-summary' to `wl-summary-mode-hook';
+       add `wl-plugged-init-icons' and `wl-biff-init-icons' to
+       `wl-make-plugged-hook';
+       add `wl-folder-init-icons' and `wl-setup-folder' to
+       `wl-folder-mode-hook'.
+
+       * wl-vars.el (wl-use-highlight-mouse-line): Activate it for Emacs
+       19 as well.
+       (wl-mode-line-display-priority-list): New user option.
+       (wl-biff-state-indicator-off, wl-biff-state-indicator-on):
+       Defcustomized.
+       (wl-make-plugged-hook, wl-summary-mode-hook, wl-folder-mode-hook):
+       Add docs.
+
+       * wl-util.el (wl-biff-start): Call `wl-biff-check-folders' at the
+       start.
+       (wl-mode-line-buffer-identification): Revised as a function.
+
+       * wl-summary.el (wl-summary-mode): Use revised
+       `wl-mode-line-buffer-identification'; don't call
+       `wl-e21-setup-summary' nor `wl-xmas-setup-summary' directly.
+       (TopLevel): Don't bind `wl-e21-setup-summary' nor
+       `wl-xmas-setup-summary'.
+
+       * wl-nemacs.el (wl-draft-overload-functions): Use revised
+       `wl-mode-line-buffer-identification'.
+
+       * wl-mule.el (wl-draft-overload-functions): Use revised
+       `wl-mode-line-buffer-identification'.
+
+       * wl-folder.el (wl-make-plugged-alist): Don't call
+       `wl-biff-init-icons' nor `wl-plugged-init-icons' directly.
+       (wl-folder): Don't call `wl-folder-init-icons' directly.
+       (wl-folder-mode): Don't call `wl-e21-setup-folder' nor
+       `wl-xmas-setup-folder' directly;
+       use revised `wl-mode-line-buffer-identification'.
+       (TopLevel): Don't bind `wl-biff-init-icons',
+       `wl-plugged-init-icons', `wl-folder-init-icons',
+       `wl-e21-setup-folder' nor `wl-xmas-setup-folder'.
+
+       * wl-e21.el (wl-draft-overload-functions): Use revised
+       `wl-mode-line-buffer-identification'.
+       (wl-setup-summary): Renamed from `wl-e21-setup-summary'.
+       (wl-setup-folder): Renamed from `wl-e21-setup-folder'.
+       (TopLevel): Add `wl-setup-summary' to `wl-summary-mode-hook';
+       add `wl-plugged-init-icons' and `wl-biff-init-icons' to
+       `wl-make-plugged-hook';
+       add `wl-folder-init-icons' and `wl-setup-folder' to
+       `wl-folder-mode-hook'.
+
+2000-09-18  A. SAGATA <sagata@nttvdt.hil.ntt.co.jp>
+            Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl.el (wl): Call `wl-biff-start'.
+       (wl-exit): Call `wl-biff-stop'.
+       (wl-plugged-mode): Show biff in modeline.
+       (wl-unplugged-glyph, wl-plugged-glyph): Removed.
+
+       * wl-xmas.el (wl-draft-overload-functions): Show biff in modeline.
+       (wl-biff-init-icons): New function.
+       (wl-plugged-init-icons): Don't make too much keymaps.
+       (wl-biff-nomail-glyph, wl-biff-mail-glyph): New variables.
+
+       * wl-vars.el (wl-biff-nomail-icon, wl-biff-mail-icon,
+       wl-biff-state-indicator-off, wl-biff-state-indicator-on): New
+       variables.
+       (wl-biff-check-interval, wl-biff-check-folder-list): New user
+       options.
+
+       * wl-util.el (wl-biff-check-folders, wl-biff-event-handler,
+       wl-biff-start, wl-biff-stop): New functions.
+       (timer-next-integral-multiple-of-time): Defined with `defun-meybe'.
+       (wl-biff-timer-name): New variable.
+
+       * wl-summary.el (wl-summary-mode): Show biff in modeline.
+
+       * wl-nemacs.el (wl-draft-overload-functions): Show biff in modeline.
+       (wl-plugged-init-icons, wl-folder-init-icons): Removed.
+
+       * wl-mule.el (wl-draft-overload-functions): Show biff in modeline.
+       (wl-plugged-init-icons, wl-folder-init-icons): Removed.
+
+       * wl-folder.el (wl-make-plugged-alist): Call `wl-biff-init-icons'.
+       (TopLevel): Bind `wl-biff-init-icons', `wl-plugged-init-icons' and
+       `wl-folder-init-icons' to `ignore' if they are not available.
+       (wl-folder-mode): Show biff in modeline.
+
+       * wl-e21.el (wl-draft-overload-functions): Show biff in modeline.
+       (wl-biff-init-icons): New function.
+       (wl-plugged-init-icons): Don't make too much keymaps.
+       (wl-biff-nomail-image, wl-biff-mail-image): New variables.
+
+2000-09-15  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-vars.el (wl-strict-diff-folders): Customization Type
+       and doc fix.  Define as a list of regular expressions for
+       folders or nil.
+       * wl-folder.el (wl-folder-check-one-entity): Use
+       `wl-string-match-member' instead of `wl-string-member' for
+       `wl-strict-diff-folders'.
+
+2000-09-14  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-xmas.el (wl-xmas-highlight-folder-group-line): New function.
+       (wl-highlight-folder-current-line): Use it; new implementation.
+       (wl-xmas-setup-draft-toolbar, wl-xmas-setup-message-toolbar,
+       wl-xmas-setup-summary-toolbar, wl-xmas-setup-folder-toolbar): Use
+       `defsubst' instead of `defun'.
+
+       * wl-vars.el (wl-highlight-folder-by-numbers): Renamed from
+       `wl-highlight-group-folder-by-numbers'; made it can also be a
+       number.  See info for more details.
+
+       * wl-summary.el: Bind `wl-xmas-setup-summary' when XEmacs is not
+       running.
+
+       * wl-nemacs.el (wl-xmas-setup-*, wl-delete-all-overlays): No need
+       to bind them.
+
+       * wl-mule.el (wl-xmas-setup-*): No need to bind them.
+       (wl-highlight-folder-current-line): New implementation.
+
+       * wl-highlight.el (wl-highlight-folder-group-line): New
+       implementation.
+       (wl-delete-all-overlays): Rewrite as a marco.
+       (TopLevel): Require `wl-e21' when Emacs 21 is running.
+
+       * wl-folder.el: Bind `wl-xmas-setup-folder' when XEmacs is not
+       running.
+       (wl-folder-*-glyph): No need to bind them.
+
+       * wl-e21.el (wl-e21-highlight-folder-group-line): Renamed from
+       `wl-e21-highlight-folder-group-icon'; rewrite.
+       (wl-e21-setup-draft-toolbar, wl-e21-setup-message-toolbar): Use
+       `defsubst' instead of `defun'.
+       (wl-folder-mode-map): Bind it when compiling.
+
+2000-09-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl.el (wl): Initialize plug-related settings before `wl-init'.
+
+       * wl-draft.el (wl-draft): funcall `wl-fcc' if it is a function.
+
+2000-09-13  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-folder.el (wl-folder-entity-assign-id): Undo the last change.
+
+2000-09-11  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-e21.el (wl-e21-highlight-folder-group-icon): New function.
+       (wl-highlight-folder-current-line): Use it.
+
+       * wl-folder.el (wl-folder-entity-assign-id): Don't put text props
+       in `id-name'.
+
+2000-09-08  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl.el: Require `wl-e21' when Emacs 21 is running.
+
+       * wl-vars.el (wl-highlight-folder-with-icon): Activate it by
+       default when Emacs 21 is running.
+       (wl-use-highlight-mouse-line): Ditto.
+       (wl-on-emacs21): New constant.
+       (wl-on-emacs20): Removed.
+
+       * wl-summary.el (wl-summary-mode): Call `wl-e21-setup-summary' when
+       Emacs 21 is running.
+
+       * wl-folder.el (wl-folder-mode): Call `wl-e21-setup-folder' when
+       Emacs 21 is running.
+
+       * wl-e21.el: New file.
+
+2000-09-08   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl.el (wl-plugged-init): Refer `wl-plug-state-indicator-on' indirectly.
+       (wl-toggle-plugged): Ditto.
+       (wl-plugged-toggle): Ditto.
+       (wl-plugged-toggle-all): Ditto.
+
+       * wl-vars.el (wl-plug-state-indicator): Refer
+       `wl-plug-state-indicator-on' indirectly.
+
+2000-08-31  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-sync-update3): Call `elmo-commit'.
+       Call `wl-folder-confirm-existence'.
+
+       * wl-folder.el (wl-folder-confirm-existence): Added optional
+       argument `force'.
+
+2000-08-30  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-summary.el (wl-summary-refile-subr): Assume
+       `copy-or-refile' as symbol.
+       (wl-summary-refile): Follow up above change.
+       (wl-summary-copy): Ditto.  Doc fix.
+
+2000-08-29  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-pick): Don't bind
+       `elmo-search-mime-charset'.
+
+       * wl-vars.el (wl-highlight-message-header-button-alist): Define
+       default using old backquote style.
+       (wl-search-mime-charset): Abolished.
+
+       * wl-highlight.el (wl-highlight-headers):
+       Call `point' after `re-search-forward'(for Nemacs).
+
+       * wl-summary.el (wl-summary-msgdb-load-async): Follow up the changes
+       for elmo-imap4.el.
+
+2000-08-29   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-message.el (wl-mmelmo-message-redisplay): Bind
+       `wl-message-ignored-field-list' instead of
+       `mime-view-ignored-field-list'.
+
+       * wl-folder.el (wl-folder-goto-top-of-current-folder):Simplified.
+       Add interactive spec.
+       (wl-folder-goto-bottom-of-current-folder): Ditto.
+       (wl-folder-mode-map): Bind them.
+
+       * wl-vars.el (wl-message-ignored-field-list): New variable.
+       (wl-message-visible-field-list): New variable.
+
+       * wl-mime.el (wl-mime-header-presentation-method): New function.
+       (wl-mime-setup): Set header-presentation-method.
+
+2000-08-28   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-nemacs.el (wl-draft-overload-functions): Set
+       `mode-line-buffer-identification' instead of using
+       `wl-make-modeline'.
+
+       * wl.el (wl-plugged-mode): Set `mode-line-buffer-identification'
+       instead of using `wl-make-modeline'.
+
+       * wl-xmas.el (wl-plugged-init-icons): Set up
+       `wl-plug-state-indicator-on' and `wl-plug-state-indicator-off'.
+       (wl-make-modeline): Abolish.
+       (wl-draft-overload-functions): Set
+       `mode-line-buffer-identification' instead of using
+       `wl-make-modeline'.
+
+       * wl-util.el (wl-make-modeline-subr): Abolish.
+       (wl-mode-line-buffer-identification): New alias.
+
+       * wl-summary.el (wl-summary-buffer-folder-indicator): New.
+       (wl-summary-make-modeline): Abolish.
+       (wl-summary-buffer-set-folder): Set
+       `wl-summary-buffer-folder-indicator'.
+       (wl-summary-mode): Set `mode-line-buffer-identification' instead
+       of using `wl-make-modeline'.
+       (wl-summary-switch-to-clone-buffer): Don't set
+       `mode-line-buffer-identification'.
+       (wl-summary-goto-folder-subr): Ditto.
+
+       * wl-mule.el (wl-draft-overload-functions): Set
+       `mode-line-buffer-identification' instead of using
+       `wl-make-modeline'.
+
+       * wl-folder.el (wl-folder-mode): Set
+       `mode-line-buffer-identification' instead of using
+       `wl-make-modeline'.
+       (wl-folder): Don't set `mode-line-buffer-identification'.
+
+2000-08-28  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-refile.el (wl-refile-learn): Simplified.  Use `memq'
+       instead of `member' for `wl-refile-guess-func-list' look-ups.
+       Use `cons' instead of `add-to-list' to update `wl-refile-alist'.
+
+2000-08-28   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-mime.el (wl-message-button-dispatcher-internal): Rename from
+       `wl-message-button-dispatcher'.
+
+       * tm-wl.el (wl-message-button-dispatcher-internal): Ditto.
+
+       * wl-message.el (wl-message-button-dispatcher): Use it.
+
+       * wl-vars.el (wl-highlight-message-header-button-alist): Add
+       "In-Reply-To".
+
+       * wl-highlight.el (wl-highlight-message-add-buttons-to-header):
+       Bind `case-fold-search' to t.
+
+2000-08-28   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-xmas.el (wl-message-overload-functions): Initialize
+       `wl-message-button-map'.
+
+       * wl-mule.el (wl-message-overload-functions): Initialize
+       `wl-message-button-map'.
+
+       * wl-vars.el (wl-highlight-message-header-button-alist): New.
+
+       * wl-message.el (wl-message-button-map): New keymap.
+       (wl-message-add-button): New function.
+       (wl-message-button-dispatcher): New function.
+       (wl-message-button-refer-article): New function.
+
+       * wl-highlight.el
+       (wl-highlight-message-add-buttons-to-header): New function.
+       (wl-highlight-headers): Use it.
+
+2000-08-28   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-summary.el (wl-summary-default-from): Use
+       `wl-address-get-petname-1'.
+       (wl-summary-simple-from): Ditto.
+
+       * wl-address.el (wl-address-get-petname-1): New inline function.
+       (wl-address-get-petname): Use it.
+
+2000-08-27   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-summary.el (wl-summary-default-from): Return full-name part
+       from the address if no petname was found.
+       (wl-summary-simple-from): Ditto.
+
+       * wl-address.el (wl-address-get-petname): Return nil if no petname
+       associated with the address was found.
+
+2000-08-23  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * wl-folder.el (wl-folder-open-all): Remove progress gauge when
+       display is finished.
+
+2000-08-23  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-folder.el (wl-folder-confirm-existence): Fixed typo in
+       `elmo-folder-exists-p' argument.
+
+2000-08-23   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-folder.el (wl-folder-confirm-existence): Check existence of
+       the folder.
+
+2000-08-23  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-msgdb-load-async): Rewrite.
+
+       * wl-draft.el (wl-draft-send-mail-with-pop-before-smtp):
+       Use `elmo-pop3-get-session' instead of `elmo-pop3-get-connection'.
+
+2000-08-22   Daiki Ueno  <ueno@unixuser.org>
+
+       * wl-folder.el (wl-folder-create-subr): New function.
+       (wl-folder-confirm-existence): Use it.
+       (wl-folder-check-one-entity): Use it.
+       Check the error symbol is derived from 'elmo-open-error.
+
+       * wl-summary.el (wl-summary-read-folder): Don't pass the argument
+       `ignore-error'.
+
+2000-08-21  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-util.el (toplevel): Add (eval-when-compile (require
+       'elmo-util)).  (Maybe `provide' is typo.)
+
+2000-08-21  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-util.el (toplevel): Removed (provide 'elmo-util).
+       (I don't know why this was needed.)
+
+       * wl-summary.el (wl-summary-jump-to-msg-by-message-id-via-nntp):
+       Follow up changes for stream-type.
+
+       * wl-draft.el (wl-draft-send-mail-with-pop-before-smtp): Ditto.
+       (wl-draft-elmo-nntp-send): Ditto.
+
+       * wl-vars.el (wl-pop-before-smtp-stream-type): New variable.
+       (wl-nntp-posting-stream-type): Ditto.
+       (wl-pop-before-smtp-ssl): Abolished.
+       (wl-nntp-posting-ssl): Ditto.
+
+       * wl-address.el (wl-address-quote-specials): New function.
+       (wl-address-make-completion-list): Use `wl-address-quote-specials'.
+
+       * wl-draft.el (wl-draft-reply): Ditto.
+
+2000-08-16  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-draft.el (wl-user-agent-compose): Add (require 'wl) for
+       use function `wl-string-match-assoc'.
+
+2000-08-10  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-vars.el (wl-draft-remove-group-list-contents): New user option.
+
+       * wl-draft.el (wl-draft-deduce-address-list): New function.
+       (wl-draft-parse-mailbox-list): Ditto.
+       (wl-draft-send-mail-with-smtp): Use `wl-draft-deduce-address-list'
+       instead of `smtp-deduce-address-list'.
+       (wl-draft-on-field-p): Follow group list.
+
+       * wl-address.el (wl-address-concat-token): New function.
+       (wl-address-string-without-group-list-contents): Ditto.
+       (wl-complete-field-body): Fixed problem of completion
+       by japanese petname.
+       (wl-address-make-completion-list): Rewrite.
+
+2000-08-11  Taro Kawagishi <taro.kawagishi@nokia.com>
+
+       * wl-address.el (wl-address-make-completion-list): Completion by
+       petname.
+       (wl-complete-field-body): Likewise.
+
+2000-08-08  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-draft.el (wl-draft-reply): Fixed problem when to or cc
+       contains invalid address syntax.
+
+2000-07-26  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-folder.el (wl-folder-check-entity-async): Use
+       `elmo-nntp-spec-hostname'.
+
+2000-08-02  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-summary.el (wl-summary-msgdb-load-async): Use
+       `elmo-imap4-mailbox' for `elmo-imap4-send-command'.
+
+2000-07-31  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-draft.el (wl-draft-reply): Set argument
+       `content-transfer-encoding' as nil.
+
+2000-07-26  Takaaki MORIYAMA <taka@airlab.cs.ritsumei.ac.jp>
+
+       * wl-refile.el (wl-refile-learn): Move hit element to the top of
+       `wl-refile-alist'.
+
+2000-07-26  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-draft.el (wl-draft): Added argument `content-transfer-encoding'.
+       (wl-draft-edit-string): Ditto.
+       (wl-draft-forward): Ditto.
+       * wl-summary.el (wl-summary-write): Ditto.
+
+2000-07-24  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-sync-update3): Call
+       `wl-summary-buffer-number-column-detect'.
+       (wl-summary-buffer-number-column-detect): Search from point-min.
+
+2000-07-19  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-draft.el (wl-draft-reply): Fixed problem when mail-followup-to
+       contains an address which is not included in original to or cc.
+
+2000-07-19  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-summary.el (wl-summary-target-mark-uudecode): Error when
+       begin-line does not exist.
+       * wl-message.el (wl-message-uu-substring): Ditto.
+
+2000-07-18  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-mode): Call `kill-all-local-variables' to
+       clear local variables.
+       (wl-summary-exit): Call `elmo-commit'.
+       (wl-summary-switch-to-clone-buffer): Call
+       `wl-summary-buffer-set-folder' after `wl-summary-mode'.
+       (wl-summary-goto-folder-subr): Ditto.
+
+       * wl-vars.el (wl-folder-sync-range-alist): Changed default value for
+       POP folder.
+
+2000-07-17  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * tm-wl.el, wl-address.el, wl-demo.el, wl-dnd.el, wl-draft.el,
-       wl-expire.el, wl-fldmgr.el, wl-folder.el, wl-highlight.el,
-       wl-message.el, wl-mime.el, wl-mule.el, wl-nemacs.el, wl-refile.el,
-       wl-score.el, wl-summary.el, wl-template.el, wl-thread.el, wl-util.el,
+       wl-draft.el.orig, wl-expire.el, wl-fldmgr.el, wl-folder.el,
+       wl-highlight.el, wl-message.el, wl-mime.el, wl-mule.el, wl-nemacs.el,
+       wl-refile.el, wl-refile.el.orig, wl-score.el, wl-summary.el,
+       wl-summary.el.orig, wl-template.el, wl-thread.el, wl-util.el,
        wl-vars.el, wl-xmas.el, wl.el (toplevel): Deleted time-stamp line.
 
+       * wl-draft.el (wl-draft-reply): Bind `eword-lexical-analyzer' locally.
+
+2000-07-12  Hironori Fukuchi <nory@valis.co.jp>
+
+       * wl-summary.el (wl-summary-search-by-subject):
+       Search parent message from the latest one.
+
+2000-07-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-draft.el (wl-draft-reply): Insert address with full-name.
+       (Thanks to MAKINO Takashi <makino@cyber.office.ne.jp>)
+
+       * wl-vars.el (wl-draft-reply-use-address-with-full-name):
+       New user option.
+
+       * wl-summary.el (wl-summary-sync-update3): Use `elmo-list-bigger-diff'
+       if elmo-nntp-use-killed-list is nil.
+       Use `elmo-msgdb-append-to-killed-list'.
+       (Append numbers confirmed as disappeared to the killed list.)
+       (wl-summary-confirm-appends): Don't display negative number.
+
+2000-07-07  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-summary.el (TopLevel): Define-maybe `ps-print-preprint'.
+
+2000-07-11  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-sync): Call `elmo-clear-killed' when
+       range is `all'.
+       (wl-summary-sync-update3): Use `elmo-list-diff' instead of
+       `elmo-list-bigger-diff'.
+
+2000-07-04  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-buffer-exit-func):
+       New buffer local variable.
+       (wl-summary-exit): Call `wl-summary-buffer-exit-func' if non-nil.
+
+2000-07-10  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Fix the last change.
+
+2000-07-07  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Don't use `eval'.
+
+2000-07-07  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-summary.el (wl-summary-buffer-thread-modified):
+       New buffer-local variable.
+       (wl-summary-set-thread-modified): New function.
+       (wl-summary-thread-modified-p): New function.
+       (wl-summary-save-status): Use function `wl-summary-thread-modified-p'.
+       (wl-summary-yank-saved-message): Use function
+       `wl-summary-set-thread-modified'
+       (wl-summary-switch-to-clone-buffer): Add
+       `wl-summary-buffer-thread-modified'.
+
+       * wl-vars.el (wl-summary-buffer-message-saved-hook): New variable.
+       (wl-summary-buffer-mark-saved-hook): Ditto.
+       * wl-summary.el (wl-summary-msgdb-save): New hook
+       `wl-summary-buffer-message-saved-hook' and
+       `wl-summary-buffer-mark-saved-hook'.
+
+2000-07-04  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Simplified `fringe' face manipulation.
+
+2000-07-04  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Make `kill-buffer-hook' buffer-local;
+       don't hide scroll bars under FSF Emacsen because it may incur an
+       undesirable redrawing.
+
+2000-07-04  Kenichi OKADA  <okada@opaopa.org>
+
+       * wl-draft.el (wl-draft-edit-string): Call
+       `wl-draft-reedit-hook' instead of `wl-mail-setup-hook'.
+
+2000-07-03  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Hide scroll bars, etc. first.
+
+2000-07-01  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-summary.el (wl-summary-msgdb-load-async): Call
+       `elmo-imap4-spec-mailbox' instead of `elmo-imap4-spec-folder'.
+
+2000-06-30  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Don't show scroll bars, gutter tabs or
+       fringes in demo buffer; center bitmap logo correctly even if old
+       Mule is used.
+
+2000-06-27  MAKINO Takashi <makino@cyber.office.ne.jp>
+
+       * wl.el (wl-save-status): Call `wl-refile-alist-save' without argument.
+
+       * wl-refile.el (wl-refile-subject-alist): New variable.
+       (wl-refile-subject-alist-file-name): Ditto.
+       (wl-refile-alist-setup): Rewrite.
+       (wl-refile-alist-save): Use `elmo-object-save'.
+       Eliminated arguments.
+       (wl-refile-learn): Check `wl-refile-guess-func-list'.
+       (wl-refile-guess-by-subject): New function.
+       (wl-refile-guess-func-list): Added it.
+
+2000-06-29  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo-with-temp-file-buffer): New macro.
+       (wl-logo-bitmap, wl-logo-xbm, wl-logo-xpm): Use it.
+
+2000-06-28  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-buffer-prev-folder-func):
+       New buffer-local variable.
+       (wl-summary-buffer-next-folder-func): Ditto.
+       (wl-summary-down): Call `wl-summary-buffer-next-folder-func'
+       if non-nil.
+       (wl-summary-up): Call `wl-summary-buffer-prev-folder-func'
+       if non-nil.
+       (wl-summary-next): Call `wl-summary-buffer-next-folder-func'
+       if non-nil.
+       (wl-summary-prev): Call `wl-summary-buffer-prev-folder-func'
+       if non-nil.
+
+2000-06-23  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Don't set the value of `fill-column'
+       permanently in the demo buffer.
+
+2000-06-22  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-mime.el (wl-summary-burst-subr): Use `mime-entity-body' and
+       `mime-entity-fetch-field'.
+
+       * wl.el (wl-exit): Delete plugged buffer.
+
+       * wl-xmas.el (wl-draft-overload-menubar): Override menubar only when
+       XEmacs has menubar feature.
+
+2000-06-19  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Don't use `end-of-line' with arg 0.  It
+       cannot arrive at the beginning of the buffer under old Emacsen.
+
+2000-06-19  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-address.el (wl-address-ldap-search):
+       Call `ldap-search-entries' with `withdn' argument t.
+       (wl-complete-field-body): Bind completion-ignore-case as t.
+       Clear ldap search hash when it was sole completion.
+       Use elmo-string for pattern string.
+       (wl-ldap-alias-safe-string): Eliminated needless let.
+
+2000-06-16  Shun-ichi GOTO <gotoh@taiyo.co.jp>
+
+       * wl-address.el (wl-ldap-alias-dn-level): New variable.
+       (wl-ldap-alias-sep): New constant.
+       (wl-ldap-search-attribute-type-list): Ditto.
+       (wl-ldap-get-value): New function.
+       (wl-ldap-make-filter): Ditto.
+       (wl-ldap-make-matched-value-list): Ditto.
+       (wl-ldap-alias-safe-string): Ditto.
+       (wl-ldap-register-dn-string): Ditto.
+       (wl-address-ldap-search): Rewrite.
+
+2000-06-17  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * wl-thread.el (wl-thread-delete-msgs): Fixed problem when closed
+       thread is deleted.
+       (wl-thread-delete-line-from-buffer): Ditto.
+       (wl-thread-get-exist-children): New function.
+
+2000-06-15  Katsumi Yamaoka    <yamaoka@jpl.org>
+
+       * wl-demo.el (wl-demo): Made it to select various image types.
+       (wl-logo-bitmap, wl-logo-xbm, wl-logo-xpm): Renamed and divided
+       from `wl-title-logo'.
+       (wl-logo-ascii): New variable.
+       (TopLevel): Require `wl-highlight'; no need to require `wl-xmas'.
+       (wl-demo-copyright-notice): New constant.
+
+       * wl-vars.el (wl-demo-display-logo): Made it can be a image type.
+
+2000-06-15  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-vars.el (wl-summary-target-above): Renamed from
+       wl-summary-temp-above.
+       * wl-score.el (wl-score-get-score-alist): Use it.
+       (wl-summary-score-update-all-lines): Use it.
+       * wl-summary.el: Ditto. (make-variable-buffer-local).
+
+2000-06-15  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-vars.el (wl-ldap-port): New user option.
+
+       * wl-address.el (wl-address-ldap-search): Renamed from wl-ldap-search.
+       Rewite whole implementation.
+       (wl-complete-field-body): Fixed.
+
+2000-06-14  Yuuichi Teranishi  <teranisi@quickhack.net>
+
+       * wl-address.el (wl-ldap-search-internal): Renamed to `wl-ldap-search'.
+       Choose implementation at compile time.
+
+2000-06-13  Takeshi Chiba <chiba@d3.bs1.fc.nec.co.jp>
+
+       * wl-address.el (wl-ldap-search-internal): New function.
+       (wl-complete-field-to): Use it.
+
+2000-06-12  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-address.el (wl-ldap-search): Use `with-temp-buffer'.
+       Use `let' instead of `let*'.
+       Require 'wl-vars.
+
+       * wl-vars.el (wl-ldap-server): Moved from wl-address.el.
+       Define as defcustom.
+       (wl-ldap-base): Ditto.
+       (wl-use-ldap): Ditto.
+
+2000-06-09  Takeshi Chiba <chiba@d3.bs1.fc.nec.co.jp>
+
+       * wl-address.el (wl-ldap-search): New function.
+       (wl-complete-field-body): Use `wl-ldap-search'.
+       (wl-ldap-server): New variable.
+       (wl-ldap-base): Ditto.
+       (wl-use-ldap): Ditto.
+
+2000-06-08  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-score.el (wl-score-guess-like-gnus): Use `elmo-string'
+       (Pointed out by Mito <mit@nines.nec.co.jp>).
+       * wl-summary.el (wl-summary-redisplay-no-mime): Update
+       buffer-local variables like `wl-summary-redisplay-internal'.
+       (wl-summary-redisplay-all-header): Likewise.  Update
+       Summary view too.
+
+2000-06-05  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-jump-to-parent-message):
+       Consider prefix argument.
+
+       * wl-thread.el (wl-thread-update-line-msgs): Fixed problem
+       when closed thread is deleted.
+
+2000-05-31  Yasushi ABE <yasushi@stbbs.net>
+
+       * wl-summary.el (wl-summary-jump-to-parent-message):
+       Consider thread modification.
+
 2000-06-03  OKAZAKI Tetsurou  <okazaki@be.to>
 
+       * wl-message.el (wl-message-normal-get-original-buffer): Use
+       `save-excursion'.
+
        * wl-vars.el (wl-smtp-posting-server): Customization Type fix.
        (wl-summary-showto-folder-regexp): Ditto.
 
+2000-05-31  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-util.el (wl-delete-alist): Doc fix.
+       (wl-delete-associations): New function.
+       (wl-inverse-alist): New function.
+       * wl-summary.el (wl-summary-exec-subr): Rename parameters.
+       Split temporary variables. Use `wl-delete-associations'
+       and `wl-inverse-alist'.
+       (wl-summary-delete-copy-marks-on-buffer): Rename the parameter.
+
+2000-05-30  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-folder.el (wl-folder-prefetch-entity):
+       Execute prefetching if new count is unknown.
+
+2000-05-27  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * wl-vars.el (wl-summary-insert-headers-hook): New variable.
+
+       * wl-thread.el (wl-thread-cleanup-symbols): If entity is exists,
+       delete entity.
+       (wl-thread-set-parent): If insert as top, set linked as nil.
+
+       * wl-summary.el (wl-summary-delete-messages-on-buffer): Call
+       `wl-thread-cleanup-symbols' when view mode is thread.
+
+2000-05-26  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-folder.el (wl-folder-create-folder-entity): Use
+       with-current-buffer.
+       (wl-local-folder-init): Call set-buffer to make sure we are in
+       the Folder buffer. Don't touch buffer-local variables here.
+       (wl-folder-mode): Initialize buffer-local variables here.
+
+       * wl-folder.el (wl-folder-get-path): Use let instead of let*.
+       (wl-folder-entity-assign-id): Ditto.
+       (wl-folder-create-entity-hashtb): Ditto.
+       (wl-local-folder-init): Ditto.
+       (wl-folder-create-group-alist): Initialize `cur-alist' with let.
+
 2000-05-24  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * wl-summary.el (wl-summary-default-from): Fix probrem when
        std11-extract-address-components return (nil "foo@bar").
 
+2000-05-24  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-draft.el (wl-draft-clone-local-variables):
+       Remove redundant `setq'.
+
+2000-05-19  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-draft.el (wl-draft-yank-from-mail-reply-buffer):
+       Bind wl-highlight-x-face-func as nil while highlighting header.
+
+2000-05-21  OKAZAKI Tetsurou  <okazaki@be.to>
+
+       * wl-folder.el (wl-folder-buffer-cur-path): Make buffer-local.
+
+2000-05-21  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * wl-summary.el (wl-summary-switch-to-clone-buffer): Remove
+       elmo-msgdb-overview-hashtb from copy-variables.
+       (wl-summary-refile-subr): Use `elmo-msgdb-overview-get-entity'
+       instead of `elmo-msgdb-overview-get-entity-by-number'.
+       (wl-summary-auto-refile): Ditto.
+
+       * wl-thread.el (wl-thread-update-line-on-buffer-sub): Use
+       `elmo-msgdb-overview-get-entity' instead of
+       `elmo-msgdb-search-overview-entity'.  Use
+       `elmo-msgdb-overview-get-entity' instead of
+       `elmo-msgdb-overview-get-entity-by-number'.
+       (wl-thread-insert-entity-sub): Ditto.
+       (wl-thread-insert-message): Ditto.
+
+       * wl-message.el (wl-mmelmo-message-redisplay): Change argument of
+       `elmo-msgdb-overview-get-entity'.
+       (wl-normal-message-redisplay): Ditto.
+
+2000-05-20  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * wl-thread.el (wl-thread-cleanup-symbols): Fix delete entity from
+       `wl-thread-entities'.
+       (wl-thread-delete-message): Fix remove top message from
+       `wl-thread-entity-list'.
+
+       * wl-summary.el (wl-summary-delete-messages-on-buffer): Don't use
+       wl-append(nconc), because update-list is broken on Meadow.
+
+       * wl-summary.el (wl-summary-insert-thread-entity): Changed delayed
+       updating process.
+       (wl-summary-rescan): Ditto.
+       (wl-summary-sync-update3): Ditto.
+       * wl-thread.el (wl-thread-set-parent): Renamed from
+       `wl-summary-set-parent'.
+       (wl-thread-insert-message): Updating buffer faster.
+       (wl-thread-delete-message): Updating buffer faster.
+
+       * wl-score.el (wl-summary-score-update-all-lines): Changed
+       interval for display progress gauge.
+
+2000-05-19  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-vars.el (wl-summary-always-sticky-folder-list): `t' means all
+       folder always-sticky.
+       * wl-summary.el (wl-summary-always-sticky-folder-p): defun instead of
+       defmacro.
+
+2000-05-18  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-vars.el (wl-draft-add-references): New user option.
+
+       * wl-draft.el (wl-draft-add-references): New function.
+       (wl-draft-yank-from-mail-reply-buffer): Use it.
+       (wl-draft-insert-current-message): Bind `wl-draft-add-references'
+       as nil.
+
+2000-05-12  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * wl-thread.el (wl-thread-update-line-msgs): Called
+       `wl-thread-update-line-on-buffer-sub'.
+       (wl-thread-update-line-on-buffer): Delete routine of inserting
+       thread.
+       (wl-thread-update-line-on-buffer-sub): Routine of inserting thread
+       moved from `wl-thread-update-line-on-buffer'.
+       Add threshold for displaying progress gauge.
+       * wl-summary.el (wl-summary-delete-messages-on-buffer): Change
+       argument of `wl-thread-update-line-msgs'.
+       Add threshold for displaying progress gauge.
+       * wl-folder.el:
+       Add threshold for displaying progress gauge.
+       * wl-score.el: Ditto.
+
+       * wl-expire.el (wl-summary-expire): Display deleting info.
+
+2000-05-12  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-thread.el (wl-thread-update-line-msgs): Added optional argument
+       `no-msg'.
+       * wl-summary.el (wl-summary-delete-messages-on-buffer): Set no-msg
+       argument of `wl-thread-update-line-msgs'.
+       (wl-summary-set-parent): Added optional argument `parent-number'.
+       (wl-summary-buffer-saved-message): New buffer local variable.
+       (wl-summary-save-current-message): New command.
+       (wl-summary-yank-saved-message): Ditto.
+       (wl-summary-mode-map): Added key binding for
+       `wl-summary-save-current-message' (\ew) and
+       `wl-summary-yank-saved-message' (\C-y).
+       (wl-summary-yank-saved-message): Inhibit setting itself as a parent.
+
+2000-05-11  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-mode-map): Added key binding for
+       `wl-summary-set-parent' (ts).
+
+2000-05-10  Masahiro MURATA  <muse@ba2.so-net.ne.jp>
+
+       * wl-summary.el (wl-summary-insert-thread-entity): Search same
+       subject faster. If thread number is reverse, delayed updating
+       thread.
+       (wl-summary-search-by-subject): Ditto.
+       (wl-summary-put-alike): Ditto.
+       (wl-summary-get-alike): Ditto.
+       (wl-summary-insert-headers): Insert header of all overview in
+       buffer.
+       (wl-summary-rescan): Delayed updating thread. Kill search subject
+       buffer for wl-summary-search-by-subject.
+       (wl-summary-sync-update3): Ditto.
+       (wl-summary-exit): Ditto.
+       (wl-summary-goto-bottom-of-current-thread): Change for linked
+       thread.
+       (wl-summary-overview-create-summary-line): Change line for linked
+       thread.
+
+       * wl-summary.el (wl-summary-update-thread): Use
+       wl-thread-maybe-get-children-num.
+       (wl-summary-set-parent): If change parent, move sub thread.
+       (wl-summary-redisplay-internal): Add horizontal recenter.
+       (wl-summary-redisplay-no-mime): Add horizontal recenter.
+
+       * wl-thread.el (wl-thread-entity-get-linked): New function.
+       (wl-thread-entity-set-linked): New function.
+       (wl-thread-create-entity): Add linked element.
+       (wl-thread-entity-insert-as-top): Use wl-append.
+       (wl-thread-maybe-get-children-num): If closing thread, return
+       children msgs.
+       (wl-thread-update-line-msgs): Displaying progress message.
+       (wl-thread-update-line-on-buffer-sub): Use
+       wl-thread-maybe-get-children-num.
+       (wl-thread-update-line-on-buffer): If update line is not exists,
+       insert thread.
+       (wl-thread-delete-message): If delete top msg of thread, search
+       parent by subject.
+       (wl-thread-insert-entity): Use
+       wl-thread-maybe-get-children-num.
+
+       * wl-highlight.el (wl-highlight-summary-current-line): change
+       sregexp for linked thread.
+       * wl-util.el (wl-count-lines): Count lines.
+       (wl-horizontal-recenter): horizontal recenter.
+       * wl-score.el (wl-score-put-alike): Use wl-count-lines
+       (wl-score-get-alike): Ditto.
+       * wl-vars.el (wl-summary-search-parent-by-subject-regexp): Changed.
+       (wl-subject-length-limit): New variable.
+       (wl-highlight-thread-indent-string-regexp): Changed for linked
+       thread.
+
+2000-05-10  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-vars.el (wl-summary-search-parent-by-subject-regexp):
+       New variable (revival).
+       * wl-summary.el (wl-summary-insert-thread-entity): Search parent
+       by subject matching if there's no in-reply-to nor references field
+       (revival).
+
+\f
 2000-05-10  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * wl-thread.el (wl-thread-close-all): Fixed typo in display-progress
index 1647bd5..5ca53e1 100644 (file)
@@ -110,7 +110,8 @@ By setting following-method as yank-content."
 (defalias 'wl-message-play-content    'mime-viewer/play-content)
 (defalias 'wl-message-extract-content 'mime-viewer/extract-content)
 (defalias 'wl-message-quit            'mime-viewer/quit)
-(defalias 'wl-message-button-dispatcher 'tm:button-dispatcher)
+(defalias 'wl-message-button-dispatcher-internal
+  'tm:button-dispatcher)
 
 ;;; Summary
 (defun wl-summary-burst-subr (children target number)
index 1aca6b9..bb5f79c 100644 (file)
@@ -30,6 +30,7 @@
 ;; 
 
 (require 'wl-util)
+(require 'wl-vars)
 (require 'std11)
 
 (defvar wl-address-complete-header-regexp "^\\(To\\|From\\|Cc\\|Bcc\\|Mail-Followup-To\\|Reply-To\\|Return-Receipt-To\\):")
 (defvar wl-address-completion-list nil)
 (defvar wl-address-petname-hash nil)
 
+(defvar wl-address-ldap-search-hash nil)
+
+(eval-when-compile (require 'pldap))
+
+(defvar wl-ldap-alias-dn-level nil
+"Level of dn data to make alias postfix.
+Valid value is nit, t, 1 or larget integer.
+
+If this value nil, minimum alias postfix is made depends on uniqness
+with other candidates. In this implementation, it's same to 1.  If t,
+always append all dn data. If number, always append spcified level of
+data but maybe appended more uniqness.  If invalid value, treat as
+nil.
+
+For example, following dn data is exsist, alias of each level is shown
+bellow.
+
+Match: Goto
+dn: CN=Shun-ichi GOTO,OU=Mew,OU=Emacs,OU=Lisper,O=Programmers Inc.
+  nil => Goto/Shun-ichi_GOTO
+    1 => Goto/Shun-ichi_GOTO
+    2 => Goto/Shun-ichi_GOTO/Mew
+    3 => Goto/Shun-ichi_GOTO/Mew/Emacs
+    4 => Goto/Shun-ichi_GOTO/Mew/Emacs/Lisper
+    5 => Goto/Shun-ichi_GOTO/Mew/Emacs/Lisper/Programmers_Inc_
+    6 => Goto/Shun-ichi_GOTO/Mew/Emacs/Lisper/Programmers_Inc_
+    t => Goto/Shun-ichi_GOTO/Mew/Emacs/Lisper/Programmers_Inc_
+
+If level 3 is required for uniqness with other candidates,
+  nil => Goto/Shun-ichi_GOTO/Mew/Emacs    ... appended more
+    1 => Goto/Shun-ichi_GOTO/Mew/Emacs    ... appended more
+    2 => Goto/Shun-ichi_GOTO/Mew/Emacs    ... appended more
+    3 => Goto/Shun-ichi_GOTO/Mew/Emacs
+    4 => Goto/Shun-ichi_GOTO/Mew/Emacs/Lisper
+    (so on...)
+")
+
+(defconst wl-ldap-alias-sep "/")
+
+(defconst wl-ldap-search-attribute-type-list
+  '("sn" "cn" "mail"))
+
+(defun wl-ldap-get-value (type entry)
+  ""
+  (let* ((values (cdr (assoc type entry)))
+        (ret (car values)))
+    (if (and ret (not ldap-ignore-attribute-codings))
+       (while values
+         (if (not (string-match "^[\000-\177]*$" (car values)))
+             (setq ret (car values)
+                   values nil)
+           (setq values (cdr values)))))
+    ret))
+         
+(defun wl-ldap-get-value-list (type entry)
+  ""
+  (cdr (assoc type entry)))
+
+(defun wl-ldap-make-filter (pat type-list)
+  "Make RFC1558 quiery filter for PAT from ATTR-LIST.
+Each are \"OR\" combination, and PAT is beginning-match."
+  (concat "(&(objectclass=person)(|"
+         (mapconcat (lambda (x) (format "(%s=%s*)" x pat)) ; fixed format
+                    type-list
+                    "")
+         "))"))
+
+(defun wl-ldap-make-matched-value-list (regexp type-list entry)
+  "Correct matching WORD with value of TYPE-LIST in ENTRY.
+Returns matched uniq string list."
+  (let (type val values result)
+    ;; collect matching value
+    (while entry
+      (setq type (car (car entry))
+           values (mapcar (function wl-ldap-alias-safe-string)
+                          (cdr (car entry)))
+           entry (cdr entry))
+      (if (string-match "::?$" type)
+         (setq type (substring type 0 (match-beginning 0))))
+      (if (member type type-list)
+         (while values
+           (setq val (car values)
+                 values (cdr values))
+           (if (and (string-match regexp val)
+                    (not (member val result)))
+               (setq result (cons val result))))))
+    result))
+
+(defun wl-ldap-alias-safe-string (str)
+  "Modify STR for alias.
+Replace space/tab in STR into '_' char.
+And remove domain part of mail addr."
+  (while (string-match "[^_a-zA-Z0-9+@%.!\\-/]+" str)
+    (setq str (concat (substring str 0 (match-beginning 0))
+                     "_"
+                     (substring str (match-end 0)))))
+  (if (string-match "@[^/@]+" str)
+      (setq str (concat (substring str 0 (match-beginning 0))
+                       (substring str (match-end 0)))))
+  str)
+
+(defun wl-ldap-register-dn-string (hash dn &optional str dn-list)
+  ""
+  (let (sym dnsym value level)
+    (setq dnsym (intern (upcase dn) hash))
+    (if (and (null str) (boundp dnsym))
+       ()                                      ; already processed
+      ;; make dn-list in fisrt time
+      (if (null dn-list)
+         (let ((case-fold-search t))
+           (setq dn-list (mapcar (lambda (str)
+                                   (if (string-match "[a-z]+=\\(.*\\)" str)
+                                       (wl-ldap-alias-safe-string
+                                        (wl-match-string 1 str))))
+                                 (split-string dn ",")))))
+      ;; prepare candidate for uniq str
+      (if str
+         (setq str (concat str wl-ldap-alias-sep (car dn-list))
+               dn-list (cdr dn-list))
+       ;; first entry, pre-build with given level
+       (cond
+        ((null wl-ldap-alias-dn-level) (setq level 1))
+        ((eq t wl-ldap-alias-dn-level) (setq level 1000)) ; xxx, big enough
+        ((numberp wl-ldap-alias-dn-level)
+         (if (< 0 wl-ldap-alias-dn-level)
+             (setq level  wl-ldap-alias-dn-level)
+           (setq level 1)))
+        (t
+         (setq level 1)))
+       (while (and (< 0 level) dn-list)
+         (if (null str)
+             (setq str (car dn-list))
+           (setq str (concat str wl-ldap-alias-sep (car dn-list))))
+         (setq level (1- level)
+               dn-list (cdr dn-list))))
+      (setq sym (intern (upcase str) hash))
+      (if (not (boundp sym))
+         ;; good
+         (progn (set sym (list dn str dn-list))
+                (set dnsym str))
+       ;; conflict
+       (if (not (eq (setq value (symbol-value sym)) t))
+           ;; move away deeper
+           (progn (set sym t)
+                  (apply (function wl-ldap-register-dn-string) hash value)))
+       (wl-ldap-register-dn-string hash dn str dn-list)))))
+
+(defun wl-address-ldap-search (pattern cl)
+  "Make address completion-list matched for PATTERN by LDAP search.
+Matched address lists are append to CL."
+  (require 'pldap)
+  (unless wl-address-ldap-search-hash
+    (setq wl-address-ldap-search-hash (elmo-make-hash 7)))
+  (let ((pat (if (string-match wl-ldap-alias-sep pattern)
+                (substring pattern 0 (match-beginning 0))
+              pattern))
+       (ldap-default-host wl-ldap-server)
+       (ldap-default-port (or wl-ldap-port 389))
+       (ldap-default-base wl-ldap-base)
+       (dnhash (elmo-make-hash))
+       cache len sym tmpl regexp entries ent values dn dnstr alias
+       result cn mails)
+    ;; check cache
+    (mapatoms (lambda (atom)
+               (if (and (string-match
+                         (concat "^" (symbol-name atom) ".*") pat)
+                        (or (null cache)
+                            (< (car cache)
+                               (setq len (length (symbol-name atom))))))
+                   (setq cache (cons
+                                (or len (length (symbol-name atom)))
+                                (symbol-value atom)))))
+             wl-address-ldap-search-hash)
+    ;; get matched entries
+    (if cache
+       (setq entries (cdr cache))
+      (condition-case nil
+         (progn
+           (message "Searching in LDAP...")
+           (setq entries (ldap-search-entries
+                          (wl-ldap-make-filter
+                           (concat pat "*")
+                           wl-ldap-search-attribute-type-list)
+                          nil wl-ldap-search-attribute-type-list nil t))
+           (message "Searching in LDAP...done")
+           (elmo-set-hash-val pattern entries wl-address-ldap-search-hash))
+       (error (message ""))))                  ; ignore error: No such object
+    ;;
+    (setq tmpl entries)
+    (while tmpl
+      (wl-ldap-register-dn-string dnhash (car (car tmpl))) ; car is 'dn'.
+      (setq tmpl (cdr tmpl)))
+    ;;
+    (setq regexp (concat "^" pat))
+    (while entries
+      (setq ent (cdar entries)
+           values (wl-ldap-make-matched-value-list
+                   regexp '("mail" "sn" "cn") ent)
+           mails (wl-ldap-get-value-list "mail" ent)
+           cn (wl-ldap-get-value "cn" ent)
+           dn (car (car entries))
+           dnstr (elmo-get-hash-val (upcase dn) dnhash))
+      ;; make alias list generated from LDAP data.
+      (while (and mails values)
+       ;; make alias like MATCHED/DN-STRING
+       (if (not (string-match (concat "^" (regexp-quote (car values))) dnstr))
+           (setq alias (concat (car values) wl-ldap-alias-sep dnstr))
+         ;; use DN-STRING if DN-STRING begin with MATCHED
+         (setq alias dnstr))
+       ;; check uniqness then add to list
+       (setq sym (intern (downcase alias) dnhash))
+       (when (not (boundp sym))
+         (set sym alias)
+         (setq result (cons (cons alias
+                                  (concat cn " <" (car mails) ">"))
+                            result)))
+       (setq values (cdr values)))
+      ;; make mail addrses list
+      (while mails
+       (if (null (assoc (car mails) cl)); Not already in cl.
+           ;; (string-match regexp (car mails))
+           ;; add mail address itself to completion list
+           (setq result (cons (cons (car mails)
+                                    (concat cn " <" (car mails) ">"))
+                              result)))
+       (setq mails (cdr mails)))
+      (setq entries (cdr entries)))
+    (append result cl)))
+
 (defun wl-complete-field-to ()
   (interactive)
   (let ((cl wl-address-completion-list))
        (completing-read "To: " cl)
       (read-string "To: "))))
 
+(defun wl-address-quote-specials (word)
+  "Make quoted string of WORD if needed."
+  (if (assq 'specials (std11-lexical-analyze word))
+      (prin1-to-string word)
+    word))
+
+(defun wl-address-make-completion-list (address-list)
+  (let (addr-tuple cl)
+    (while address-list
+      (setq addr-tuple (car address-list))
+      (setq cl
+            (cons
+             (cons (nth 0 addr-tuple)
+                   (concat
+                    (wl-address-quote-specials
+                     (nth 2 addr-tuple)) " <"(nth 0 addr-tuple)">"))
+             cl))
+      ;; nickname completion.
+      (unless (or (equal (nth 1 addr-tuple) (nth 0 addr-tuple))
+                 ;; already exists
+                 (assoc (nth 1 addr-tuple) cl))
+       (setq cl
+             (cons
+              (cons (nth 1 addr-tuple)
+                    (concat
+                     (wl-address-quote-specials
+                      (nth 2 addr-tuple)) " <"(nth 0 addr-tuple)">"))
+              cl)))
+      (setq address-list (cdr address-list)))
+    cl))
+
 (defun wl-complete-field-body-or-tab ()
   (interactive)
   (let ((case-fold-search t)
        epand-char skip-chars
+       (use-ldap nil)
        completion-list)
     (if (wl-draft-on-field-p)
        (wl-complete-field)
                (point)))
           (save-excursion
             (beginning-of-line)
+            (setq use-ldap nil)
             (while (and (looking-at "^[ \t]")
                         (not (= (point) (point-min))))
               (forward-line -1))
             (cond ((looking-at wl-address-complete-header-regexp)
                    (setq completion-list wl-address-completion-list)
+                   (if wl-use-ldap
+                       (setq use-ldap t))
                    (setq epand-char ?@))
                   ((looking-at wl-folder-complete-header-regexp)
                    (setq completion-list wl-folder-entity-hashtb)
                   ((looking-at wl-newsgroups-complete-header-regexp)
                    (setq completion-list wl-folder-newsgroups-hashtb)))))
          (wl-complete-field-body completion-list
-                                 epand-char skip-chars)
+                                 epand-char skip-chars use-ldap)
        (indent-for-tab-command)))))
 
 (defvar wl-completion-buf-name "*Completions*")
              (if (setq comp-win (get-buffer-window comp-buf))
                  (delete-window comp-win)))))))
 
-(defun wl-complete-field-body (completion-list &optional epand-char skip-chars)
+(defun wl-complete-field-body (completion-list
+                              &optional epand-char skip-chars use-ldap)
   (interactive)
   (let* ((end (point))
         (start (save-excursion
-;                (skip-chars-backward "_a-zA-Z0-9+@%.!\\-")
-                 (skip-chars-backward (or skip-chars
-                                          "_a-zA-Z0-9+@%.!\\-/"))
+                 (skip-chars-backward (or skip-chars "^:,>\n"))
+                 (skip-chars-forward " \t")
                  (point)))
         (completion)
         (pattern (buffer-substring start end))
         (len (length pattern))
         (cl completion-list))
+    (when use-ldap
+      (setq cl (wl-address-ldap-search pattern cl)))
     (if (null cl)
        nil
       (setq completion (try-completion pattern cl))
       (cond ((eq completion t)
-            (wl-complete-insert start end pattern completion-list)
+            (if use-ldap (setq wl-address-ldap-search-hash nil))
+            (wl-complete-insert start end pattern cl)
             (wl-complete-window-delete)
             (message "Sole completion"))
            ((and epand-char
            (append wl-address-completion-list
                    (wl-address-make-alist-from-alias-file wl-alias-file))))
   (setq wl-address-petname-hash (elmo-make-hash))
-  (mapcar
-   (function
-       (lambda (x)
-         (elmo-set-hash-val (downcase (car x))
-                                                (cadr x)
-                                                wl-address-petname-hash)))
-   wl-address-list)
+  (let ((addresses wl-address-list))
+    (while addresses
+      (elmo-set-hash-val (downcase (car (car addresses)))
+                        (cadr (car addresses))
+                        wl-address-petname-hash)
+      (setq addresses (cdr addresses))))
   (message "Updating addresses...done."))
 
 
            (forward-line))
          ret))))
 
-(defsubst wl-address-get-petname (str)
-  (let ((addr (downcase (wl-address-header-extract-address str))))
-    (or (elmo-get-hash-val addr wl-address-petname-hash)
-       str)))
+(defsubst wl-address-get-petname-1 (string)
+  (let ((address (downcase (wl-address-header-extract-address string))))
+    (elmo-get-hash-val address wl-address-petname-hash)))
 
-(defsubst wl-address-make-completion-list (address-list)
-  (mapcar '(lambda (entity)
-            (cons (nth 0 entity)
-                  (concat (nth 2 entity) " <"(nth 0 entity)">"))) address-list))
+(defsubst wl-address-get-petname (string)
+  (or (wl-address-get-petname-1 string)
+      string))
 
 (defsubst wl-address-user-mail-address-p (address)
   "Judge whether ADDRESS is user's or not."
@@ -310,6 +575,49 @@ e.g. \"Mr. bar <hoge@foo.com>\"
          (wl-match-string 1 str))
         (t "")))
 
+(defmacro wl-address-concat-token (string token)
+  (` (cond
+      ((eq 'quoted-string (car (, token)))
+       (concat (, string) "\"" (cdr (, token)) "\""))
+      ((eq 'comment (car (, token)))
+       (concat (, string) "(" (cdr (, token)) ")"))
+      (t
+       (concat (, string) (cdr (, token)))))))
+
+(defun wl-address-string-without-group-list-contents (sequence)
+  "Return address string from lexical analyzed list SEQUENCE.
+Group list contents is not included."
+  (let (address-string route-addr-end token seq)
+  (while sequence
+    (setq token (car sequence))
+    (cond
+     ;;   group       =  phrase ":" [#mailbox] ";"
+     ((and (eq 'specials (car token))
+          (string= (cdr token) ":"))
+      (setq address-string (concat address-string (cdr token))) ; ':'
+      (setq seq (cdr sequence))
+      (setq token (car seq))
+      (while (not (and (eq 'specials (car token))
+                      (string= (cdr token) ";")))
+       (setq token (car seq))
+       (setq seq (cdr seq)))
+      (setq address-string (concat address-string (cdr token))) ; ';'
+      (setq sequence seq))
+     ;;   route-addr  =  "<" [route] addr-spec ">"
+     ;;   route       =  1#("@" domain) ":"           ; path-relative
+     ((and (eq 'specials (car token))
+          (string= (cdr token) "<"))
+      (setq seq (std11-parse-route-addr sequence))
+      (setq route-addr-end (car (cdr seq)))
+      (while (not (eq (car sequence) route-addr-end))
+       (setq address-string (wl-address-concat-token address-string
+                                                     (car sequence)))
+       (setq sequence (cdr sequence))))
+     (t
+      (setq address-string (wl-address-concat-token address-string token))
+      (setq sequence (cdr sequence)))))
+  address-string))
+
 (defun wl-address-petname-delete (the-email)
   "Delete petname in wl-address-file."
   (let* ( (tmp-buf (get-buffer-create " *wl-petname-tmp*"))
@@ -375,6 +683,8 @@ If already registerd, change it."
       (message "Adding Petname...done")
       (kill-buffer tmp-buf))))
 
-(provide 'wl-address)
+(require 'product)
+(product-provide (provide 'wl-address) (require 'wl-version))
 
 ;;; wl-address.el ends here
+
index f05b347..0f97fb0 100644 (file)
 ;;; Code:
 ;;
 
+(defconst wl-demo-copyright-notice
+  "Copyright (C) 1998-2000 Yuuichi Teranishi <teranisi@gohome.org>")
+
 (require 'wl-vars)
-(provide 'wl-demo)
-(if (featurep 'xemacs)
-    (require 'wl-xmas))
+(require 'wl-version)
+(require 'wl-highlight)
+(require 'product)
+(product-provide (provide 'wl-demo) (require 'wl-version))
 
+;; Avoid byte compile warnings.
 (eval-when-compile
-  (defun-maybe device-on-window-system-p ())
-  (defun-maybe glyph-height (a))
-  (defun-maybe glyph-width (a))
-  (defun-maybe make-extent (a b))
-  (defun-maybe make-glyph (a))
-  (defun-maybe set-extent-end-glyph (a b))
-  (defun-maybe startup-center-spaces (a))
-  (defun-maybe window-pixel-height ())
-  (defun-maybe window-pixel-width ())
-  (condition-case nil
-      (require 'bitmap)
-    (error nil))
-  (defun-maybe bitmap-compose (a))
-  (defun-maybe bitmap-decode-xbm (a))
-  (defun-maybe bitmap-read-xbm-file (a))
-  (unless (boundp ':data)
-    (set (make-local-variable ':data) nil))
-  (unless (boundp ':type)
-    (set (make-local-variable ':type) nil))
-  (condition-case nil
-      (require 'image)
-    (error nil))
-  (defun-maybe frame-char-height ())
-  (defun-maybe frame-char-width ())
-  (defun-maybe image-type-available-p (a)))
-
-(static-condition-case nil
-    (progn
-      (insert-image '(image))
-      (defalias 'wl-insert-image 'insert-image))
-  (wrong-number-of-arguments
-   (defun wl-insert-image (image)
-     (insert-image image "x")))
-  (void-function
-   (defun wl-insert-image (image))))
+  (defalias-maybe 'bitmap-compose 'ignore)
+  (defalias-maybe 'bitmap-decode-xbm 'ignore)
+  (defalias-maybe 'bitmap-read-xbm-buffer 'ignore)
+  (defalias-maybe 'bitmap-read-xbm-file 'ignore)
+  (defalias-maybe 'create-image 'ignore)
+  (defalias-maybe 'device-on-window-system-p 'ignore)
+  (defalias-maybe 'display-graphic-p 'ignore)
+  (defalias-maybe 'frame-char-height 'ignore)
+  (defalias-maybe 'frame-char-width 'ignore)
+  (defalias-maybe 'frame-parameter 'ignore)
+  (defalias-maybe 'image-type-available-p 'ignore)
+  (defalias-maybe 'insert-image 'ignore)
+  (defalias-maybe 'make-extent 'ignore)
+  (defalias-maybe 'make-glyph 'ignore)
+  (defalias-maybe 'set-extent-end-glyph 'ignore)
+  (defalias-maybe 'set-glyph-face 'ignore)
+  (defalias-maybe 'set-specifier 'ignore)
+  (defalias-maybe 'tool-bar-mode 'ignore)
+  (defalias-maybe 'window-pixel-height 'ignore)
+  (defalias-maybe 'window-pixel-width 'ignore))
 
 ;;
 ;; demo ;-)
 ;;
+
+(defvar wl-logo-ascii "        o$                  oo$$$$$$ooo
+     oo$$$      o$$      o$$$\"\"\"\"\"\"$$$$$o
+  $$$$$$\"     o$$$\"    o$\"\"          \"$$$
+    $$\"      o$\"\"    o$\"              $$$
+   $\"      oo$\"     $\"                $$$
+ o$     oo\"\"$$     $                  $$
+o$$  oo$\"  \"$$$o  $                 o$$
+$$$$\"\"       \"$$oo$    o          o$\"
+               \"$$o   \"$$$o oooo$\"\"
+                 $$       \"\"\"\"
+              Wanderlust
+                  \"$
+Yet Another Message Interface On Emacsen")
+
+(eval-when-compile
+  (defmacro wl-demo-with-temp-file-buffer (file &rest forms)
+    "Create a temporary buffer, insert FILE's contents without
+any conversions and evaluate FORMS there like `progn'."
+    ( `(with-temp-buffer
+        (let ((coding-system-for-read 'binary)
+              (input-coding-system '*noconv*)
+              auto-mode-alist
+              file-name-handler-alist
+              format-alist
+              insert-file-contents-access-hook
+              insert-file-contents-post-hook
+              insert-file-contents-pre-hook
+              interpreter-mode-alist)
+          (insert-file-contents (, file))
+          (,@ forms)))))
+  (put 'wl-demo-with-temp-file-buffer 'lisp-indent-function 1))
+
 (eval-when-compile
-  (cond ((or (featurep 'xemacs) (featurep 'image))
-        (defmacro wl-title-logo ()
-          (let ((file (expand-file-name "wl-logo.xpm" wl-icon-dir)))
-            (if (file-exists-p file)
-                (let ((buffer (generate-new-buffer " *wl-logo*"))
-                      (coding-system-for-read 'binary)
-                      buffer-file-format format-alist
-                      insert-file-contents-post-hook
-                      insert-file-contents-pre-hook)
-                  (prog1
-                      (save-excursion
-                        (set-buffer buffer)
-                        (insert-file-contents file)
-                        (buffer-string))
-                    (kill-buffer buffer)))))))
-       ((condition-case nil
-            (require 'bitmap)
-          (error nil))
-        (defmacro wl-title-logo ()
-          (let ((file (expand-file-name "wl-logo.xbm" wl-icon-dir)))
-            (if (file-exists-p file)
-                (condition-case nil
-                    (bitmap-decode-xbm (bitmap-read-xbm-file file))
-                  (error (message "Bitmap Logo is not used.")))))))
-       (t
-        (defmacro wl-title-logo ()))))
-
-(defconst wl-title-logo
-  (cond ((or (and (featurep 'xemacs)
-                  (featurep 'xpm)
-                  (device-on-window-system-p))
-             (and (eval-when-compile (featurep 'image))
-                  (image-type-available-p 'xpm)))
-        (wl-title-logo))
-       ((and window-system
-             (condition-case nil
-                 (require 'bitmap)
-               (error nil)))
-        (let ((cmp (wl-title-logo)))
-          (if cmp
-              (condition-case nil
-                  (let ((len (length cmp))
-                        (bitmap (bitmap-compose (aref cmp 0)))
-                        (i 1))
+  (defmacro wl-logo-xpm ()
+    ;; (WIDTH HEIGHT DATA)
+    (let ((file (expand-file-name "wl-logo.xpm" wl-icon-dir)))
+      (if (file-exists-p file)
+         (wl-demo-with-temp-file-buffer file
+           (re-search-forward
+            (concat "\"[\t ]*\\([0-9]+\\)[\t ]+\\([0-9]+\\)"
+                    "[\t ]+[0-9]+[\t ]+[0-9]+[\t ]*\""))
+           (list 'list
+                 (string-to-number (match-string 1))
+                 (string-to-number (match-string 2))
+                 (buffer-string))))))
+  (defmacro wl-logo-xbm ()
+    ;; (WIDTH HEIGHT DATA)
+    (let ((file (expand-file-name "wl-logo.xbm" wl-icon-dir)))
+      (if (file-exists-p file)
+         (wl-demo-with-temp-file-buffer file
+           (let ((case-fold-search t)
+                 width height)
+             (search-forward "width")
+             (setq width (read (current-buffer)))
+             (goto-char (point-min))
+             (search-forward "height")
+             (setq height (read (current-buffer)))
+             (goto-char (point-min))
+             (search-forward "{")
+             (delete-region (point-min) (point))
+             (while (re-search-forward "[^0-9a-fx]+" nil t)
+               (replace-match ""))
+             (goto-char (point-min))
+             (insert "\"")
+             (while (search-forward "0x" nil t)
+               (replace-match "\\\\x"))
+             (goto-char (point-max))
+             (insert "\"")
+             (goto-char (point-min))
+             (list 'list width height (read (current-buffer))))))))
+  (defmacro wl-logo-bitmap ()
+    ;; (DECODED-P . DATA)
+    (let ((file (expand-file-name "wl-logo.xbm" wl-icon-dir)))
+      (if (file-exists-p file)
+         (if (condition-case nil (require 'bitmap) (error nil))
+             (list 'cons t (bitmap-decode-xbm
+                            (bitmap-read-xbm-file file)))
+           (wl-demo-with-temp-file-buffer file
+             (list 'cons nil (buffer-string))))))))
+
+(let ((xpm (wl-logo-xpm)))
+  (if (and xpm (or (and (featurep 'xemacs)
+                       (featurep 'xpm))
+                  (and (condition-case nil (require 'image) (error nil))
+                       (image-type-available-p 'xpm))))
+      (progn
+       (put 'wl-logo-xpm 'width (car xpm))
+       (put 'wl-logo-xpm 'height (nth 1 xpm))
+       (put 'wl-logo-xpm 'image
+            (if (featurep 'xemacs)
+                (make-glyph (vector 'xpm ':data (nth 2 xpm)))
+              (create-image (nth 2 xpm) 'xpm t))))))
+
+(let ((xbm (wl-logo-xbm))
+      (bm (wl-logo-bitmap)))
+  (if (and xbm (or (featurep 'xemacs)
+                  (featurep 'image)
+                  (condition-case nil (require 'bitmap) (error nil))))
+      (progn
+       (put 'wl-logo-xbm 'width (car xbm))
+       (put 'wl-logo-xbm 'height (nth 1 xbm))
+       (put 'wl-logo-xbm 'image
+            (cond
+             ((featurep 'xemacs)
+              (make-glyph (vector 'xbm ':data xbm)))
+             ((featurep 'image)
+              (create-image (nth 2 xbm) 'xbm t
+                            ':width (car xbm) ':height (nth 1 xbm)))
+             (t
+              (let ((default-enable-multibyte-characters t)
+                    (default-mc-flag t))
+                (with-temp-buffer
+                  (let* ((cmp (if (car bm)
+                                  (cdr bm)
+                                (insert (cdr bm))
+                                (prog1
+                                    (bitmap-decode-xbm (bitmap-read-xbm-buffer
+                                                        (current-buffer)))
+                                  (erase-buffer))))
+                         (len (length cmp))
+                         (i 1))
+                    (insert (bitmap-compose (aref cmp 0)))
                     (while (< i len)
-                      (setq bitmap (concat bitmap "\n"
-                                           (bitmap-compose (aref cmp i)))
-                            i (1+ i)))
-                    bitmap)
-                (error nil)))))))
-
-(defun wl-demo ()
-  (interactive)
-  (let ((demo-buf (get-buffer-create "*WL Demo*"))
-       logo-ext start)
+                      (insert "\n" (bitmap-compose (aref cmp i)))
+                      (setq i (1+ i)))
+                    (buffer-string))))))))))
+
+(defun wl-demo (&optional image-type)
+  "Demo on the startup screen.
+Optional IMAGE-TYPE overrides the variable `wl-demo-display-logo'."
+  (interactive "P")
+  (let ((demo-buf (let ((default-enable-multibyte-characters t)
+                       (default-mc-flag t)
+                       (default-line-spacing 0))
+                   (get-buffer-create "*WL Demo*"))))
     (switch-to-buffer demo-buf)
+    (cond ((featurep 'xemacs)
+          (if (device-on-window-system-p)
+              (progn
+                (if (boundp 'default-gutter-visible-p)
+                    (set-specifier (symbol-value 'default-gutter-visible-p)
+                                   nil demo-buf))
+                (set-specifier (symbol-value 'scrollbar-height) 0 demo-buf)
+                (set-specifier (symbol-value 'scrollbar-width) 0 demo-buf))))
+         ((and (> emacs-major-version 20) (display-graphic-p))
+          (make-local-hook 'kill-buffer-hook)
+          (let* ((frame (selected-frame))
+                 (toolbar (frame-parameter frame 'tool-bar-lines)))
+            (modify-frame-parameters frame '((tool-bar-lines)))
+            (add-hook
+             'kill-buffer-hook
+             (` (lambda ()
+                  (let ((frame (, frame)))
+                    (when (frame-live-p frame)
+                      (, (if (and toolbar (> toolbar 0))
+                             (` (modify-frame-parameters
+                                 frame '((tool-bar-lines . (, toolbar)))))))
+                      (set-face-background
+                       'fringe (, (face-background 'fringe frame)) frame)))))
+             nil t)
+            (set-face-background 'fringe (face-background 'default frame)
+                                 frame))))
     (erase-buffer)
-    (if (and wl-demo-display-logo wl-title-logo)
-       (cond
-         ((featurep 'xemacs)
-          (let ((wl-logo (make-glyph (vector 'xpm :data wl-title-logo))))
-            (insert-char ?\n (max 1 (/ (- (window-height) 6
-                                          (/ (glyph-height wl-logo)
-                                             (/ (window-pixel-height)
-                                                (window-height)))) 2)))
-            (indent-to (startup-center-spaces wl-logo))
-            (insert-char ?\ (max 0 (/ (- (window-width)
-                                         (/ (glyph-width wl-logo)
-                                            (/ (window-pixel-width)
-                                               (window-width)))) 2)))
-            (setq logo-ext (make-extent (point)(point)))
-            (set-extent-end-glyph logo-ext wl-logo)))
-         ((featurep 'image)
-          (let ((wl-logo (list 'image :type 'xpm :data wl-title-logo))
-                pixel-width pixel-height)
-            (with-temp-buffer
-              (insert wl-title-logo)
-              (goto-char (point-min))
-              (skip-syntax-forward "^\"")
-              (when (looking-at "\"[ \t]*\\([0-9]+\\)[ \t]*\\([0-9]+\\)")
-                (setq pixel-width (string-to-int (match-string 1))
-                      pixel-height (string-to-int (match-string 2)))))
-            (insert-char ?\n (max 1 (/ (- (window-height) 6
-                                          (/ pixel-height
-                                             (frame-char-height))) 2)))
-            (insert-char ?\  (max 0 (/ (- (window-width)
-                                          (/ pixel-width
-                                             (frame-char-width))) 2)))
-            (wl-insert-image wl-logo)
-            (insert "\n")))
-         (t
-         (insert wl-title-logo)
-         (indent-rigidly (point-min) (point-max)
-                         (max 0 (/ (- (window-width) (current-column)) 2)))
-         (insert "\n")
-         (goto-char (point-min))
-         (insert-char ?\n (max 0 (/ (- (window-height)
-                                       (count-lines (point) (point-max))
-                                       6) 2)))
-         (goto-char (point-max))))
-      (insert-char ?\n (max 1 (- (/ (window-height) 3) 2))))
-    (setq start (point))
-    (insert "\n" (if (and wl-demo-display-logo wl-title-logo)
-                    ""
-                  (concat wl-appname "\n")))
-    (let ((fill-column (window-width)))
-      (center-region start (point)))
-    (setq start (point))
-    (put-text-property (point-min) (point) 'face 'wl-highlight-logo-face)
-    (insert (format "\nversion %s - \"%s\"\n\n"
-                   wl-version wl-codename
-                   ))
-    (insert "Copyright (C) 1998-2000 Yuuichi Teranishi <teranisi@gohome.org>")
-    (put-text-property start (point-max) 'face 'wl-highlight-demo-face)
-    (let ((fill-column (window-width)))
-      (center-region start (point)))
-    (goto-char (point-min))
-    (sit-for
-     (if (featurep 'lisp-float-type) (/ (float 5) (float 10)) 1))
-    ;;(if (featurep 'xemacs) (delete-extent logo-ext))
-    demo-buf))
+    (setq truncate-lines t)
+    (let* ((wl-demo-display-logo
+           (if (and image-type (interactive-p))
+               (let* ((selection '(("xbm" . xbm) ("xpm" . xpm) ("ascii")))
+                      (type (completing-read "Image type: " selection nil t)))
+                 (if (assoc type selection)
+                     (cdr (assoc type selection))
+                   t))
+             (or image-type wl-demo-display-logo)))
+          (logo (if (cond ((featurep 'xemacs)
+                           (device-on-window-system-p))
+                          ((featurep 'image)
+                           (display-graphic-p))
+                          (t window-system))
+                    (cond ((and (eq 'xbm wl-demo-display-logo)
+                                (get 'wl-logo-xbm 'width))
+                           'wl-logo-xbm)
+                          (wl-demo-display-logo
+                           (cond ((get 'wl-logo-xpm 'width)
+                                  'wl-logo-xpm)
+                                 ((get 'wl-logo-xbm 'width)
+                                  'wl-logo-xbm))))))
+          (ww (window-width))
+          (wh (window-height))
+          rest)
+      (if logo
+         (let ((lw (get logo 'width))
+               (lh (get logo 'height))
+               (image (get logo 'image)))
+           (cond
+            ((featurep 'xemacs)
+             (if (eq 'wl-logo-xbm logo)
+                 (set-glyph-face image 'wl-highlight-logo-face))
+             (setq rest (- wh 1 (/ (+ (* lh wh) (window-pixel-height) -1)
+                                   (window-pixel-height))))
+             (insert-char ?\  (max 0 (/ (- (* (window-pixel-width) (1+ ww))
+                                           (* lw ww))
+                                        2 (window-pixel-width))))
+             (set-extent-end-glyph (make-extent (point) (point)) image))
+            ((featurep 'image)
+             (if (eq 'wl-logo-xbm logo)
+                 (let ((bg (face-background 'wl-highlight-logo-face))
+                       (fg (face-foreground 'wl-highlight-logo-face)))
+                   (if (stringp bg)
+                       (plist-put (cdr image) ':background bg))
+                   (if (stringp fg)
+                       (plist-put (cdr image) ':foreground fg))))
+             (setq rest (/ (- (* wh (frame-char-height)) lh 1)
+                           (frame-char-height)))
+             (insert-char ?\  (max 0 (/ (- (* (frame-char-width) (1+ ww)) lw)
+                                        2 (frame-char-width))))
+             (insert-image image))
+            (t
+             (insert image)
+             (put-text-property (point-min) (point) 'face
+                                'wl-highlight-logo-face)
+             (setq rest (/ (- (* 16 wh) lh 8) 16))
+             (indent-rigidly (point-min) (point-max)
+                             (/ (- (* 8 (1+ ww)) lw) 16))))
+           (goto-char (point-min)))
+       (insert (or wl-logo-ascii (product-name (product-find 'wl-version))))
+       (put-text-property (point-min) (point) 'face 'wl-highlight-logo-face)
+       (setq rest (- wh (count-lines (point-min) (point)) 1))
+       (let ((lw (current-column))
+             (lh (count-lines (point-min) (point))))
+         (while (progn (beginning-of-line) (not (bobp)))
+           (backward-char)
+           (setq lw (max lw (current-column))))
+         (indent-rigidly (point) (point-max) (max 0 (/ (- ww lw) 2)))))
+      (insert-char ?\n (max 0 (/ (- rest 4) 2)))
+      (goto-char (point-max))
+      (insert "\n")
+      (let ((start (point)))
+       (insert (format (cond ((<= rest 2)
+                              "version %s - \"%s\"\n%s")
+                             ((eq rest 3)
+                              "version %s - \"%s\"\n\n%s")
+                             (t
+                              "\nversion %s - \"%s\"\n\n%s"))
+                       (product-version-string (product-find 'wl-version))
+                       (product-code-name (product-find 'wl-version))
+                       wl-demo-copyright-notice))
+       (put-text-property start (point) 'face 'wl-highlight-demo-face)
+       (let ((fill-column ww))
+         (center-region start (point))))
+      (goto-char (point-min))
+      (sit-for (if (featurep 'lisp-float-type) (/ (float 5) (float 10)) 1))
+      demo-buf)))
 
 ;;; wl-demo.el ends here
index de96abc..b4297ca 100644 (file)
@@ -29,7 +29,8 @@
 ;;; Code:
 ;; 
 
-(provide 'wl-dnd)
+(require 'product)
+(product-provide (provide 'wl-dnd) (require 'wl-version))
 
 (static-cond
  ((featurep 'offix)
index df5ec08..f5c4926 100644 (file)
 (require 'sendmail)
 (require 'wl-template)
 (require 'emu)
-(if (module-installed-p 'timezone)
-    (require 'timezone))
+(condition-case nil (require 'timezone) (error nil))
 (require 'std11)
 (require 'wl-vars)
 
+(defvar x-face-add-x-face-version-header)
+(defvar mail-reply-buffer)
+(defvar mail-from-style)
+(defvar smtp-authenticate-type)
+(defvar smtp-authenticate-user)
+(defvar smtp-authenticate-passphrase)
+(defvar smtp-connection-type)
+
 (eval-when-compile
-  (require 'smtp)
   (require 'elmo-pop3)
-  (mapcar
-   (function
-    (lambda (symbol)
-      (unless (boundp symbol)
-       (set (make-local-variable symbol) nil))))
-   '(x-face-add-x-face-version-header
-     mail-reply-buffer
-     mail-from-style
-     smtp-authenticate-type
-     smtp-authenticate-user
-     smtp-authenticate-passphrase
-     smtp-connection-type
-     ))
-  (defun-maybe x-face-insert (a))
-  (defun-maybe x-face-insert-version-header ())
-  (defun-maybe wl-init (&optional a))
-  (defun-maybe wl-draft-mode ()))
+  (defalias-maybe 'x-face-insert 'ignore)
+  (defalias-maybe 'x-face-insert-version-header 'ignore)
+  (defalias-maybe 'wl-init 'ignore)
+  (defalias-maybe 'wl-draft-mode 'ignore))
 
 (defvar wl-draft-buf-name "Draft")
 (defvar wl-caesar-region-func nil)
@@ -263,69 +256,101 @@ the `wl-smtp-features' variable."
        cc))))
 
 (defun wl-draft-forward (original-subject summary-buf)
-  (wl-draft "" (concat "Forward: " original-subject)
-           nil nil nil nil nil nil nil nil summary-buf)
+  (let (references)
+    (with-current-buffer (wl-message-get-original-buffer)
+      (setq references (nconc
+                       (std11-field-bodies '("References" "In-Reply-To"))
+                       (list (std11-field-body "Message-Id"))))
+      (setq references (delq nil references)
+           references (mapconcat 'identity references " ")
+           references (wl-draft-parse-msg-id-list-string references)
+           references (wl-delete-duplicates references)
+           references (if references
+                          (mapconcat 'identity references "\n\t"))))
+    (wl-draft "" (concat "Forward: " original-subject)
+             nil nil references nil nil nil nil nil nil summary-buf))
   (goto-char (point-max))
   (wl-draft-insert-message)
   (mail-position-on-field "To"))
 
 (defun wl-draft-reply (buf no-arg summary-buf)
 ;  (save-excursion
-  (let ((r-list (if no-arg wl-draft-reply-without-argument-list
-                 wl-draft-reply-with-argument-list))
+  (let (r-list
+       (eword-lexical-analyzer '(eword-analyze-quoted-string
+                                 eword-analyze-domain-literal
+                                 eword-analyze-comment
+                                 eword-analyze-spaces
+                                 eword-analyze-special
+                                 eword-analyze-encoded-word
+                                 eword-analyze-atom))
        to mail-followup-to cc subject in-reply-to references newsgroups
-       from)
+       from addr-alist)
     (set-buffer buf)
-    (if (wl-address-user-mail-address-p
-        (setq from
-              (wl-address-header-extract-address (std11-field-body "From"))))
-       (setq to (mapconcat 'identity (elmo-multiple-field-body "To") ",")
-             cc (mapconcat 'identity (elmo-multiple-field-body "Cc") ",")
-             newsgroups (or (std11-field-body "Newsgroups") ""))
-      (catch 'done
-       (while r-list
-         (when (let ((condition (car (car r-list))))
-                 (cond ((stringp condition)
-                        (std11-field-body condition))
-                       ((listp condition)
-                        (catch 'done
-                          (while condition
-                            (if (not (std11-field-body (car condition)))
-                                (throw 'done nil))
-                            (setq condition (cdr condition)))
-                          t))
-                       ((symbolp condition)
-                        (funcall condition))))
-           (let ((r-to-list (nth 0 (cdr (car r-list))))
-                 (r-cc-list (nth 1 (cdr (car r-list))))
-                 (r-ng-list (nth 2 (cdr (car r-list)))))
-             (when (and (member "Followup-To" r-ng-list)
-                        (string= (std11-field-body "Followup-To") "poster"))
-               (setq r-to-list (cons "From" r-to-list))
-               (setq r-ng-list (delete "Followup-To" (copy-sequence r-ng-list))))
-             (setq to (wl-concat-list (cons to
-                                            (elmo-multiple-fields-body-list
-                                             r-to-list))
-                                      ","))
-             (setq cc (wl-concat-list (cons cc
-                                            (elmo-multiple-fields-body-list
-                                             r-cc-list))
-                                      ","))
-             (setq newsgroups (wl-concat-list (cons newsgroups
-                                                    (std11-field-bodies
-                                                     r-ng-list))
-                                              ",")))
-           (throw 'done nil))
-         (setq r-list (cdr r-list)))
-       (error "No match field: check your `wl-draft-reply-without-argument-list'")))
+    (setq from (wl-address-header-extract-address (std11-field-body "From")))
+    (setq r-list 
+         (if (wl-address-user-mail-address-p from)
+             (if no-arg wl-draft-reply-myself-without-argument-list
+               wl-draft-reply-myself-with-argument-list)
+           (if no-arg wl-draft-reply-without-argument-list
+             wl-draft-reply-with-argument-list)))
+    (catch 'done
+      (while r-list
+       (when (let ((condition (car (car r-list))))
+               (cond ((stringp condition)
+                      (std11-field-body condition))
+                     ((listp condition)
+                      (catch 'done
+                        (while condition
+                          (if (not (std11-field-body (car condition)))
+                              (throw 'done nil))
+                          (setq condition (cdr condition)))
+                        t))
+                     ((symbolp condition)
+                      (funcall condition))))
+         (let ((r-to-list (nth 0 (cdr (car r-list))))
+               (r-cc-list (nth 1 (cdr (car r-list))))
+               (r-ng-list (nth 2 (cdr (car r-list)))))
+           (when (and (member "Followup-To" r-ng-list)
+                      (string= (std11-field-body "Followup-To") "poster"))
+             (setq r-to-list (cons "From" r-to-list))
+             (setq r-ng-list (delete "Followup-To" (copy-sequence r-ng-list))))
+           (setq to (wl-concat-list (cons to
+                                          (elmo-multiple-fields-body-list
+                                           r-to-list))
+                                    ","))
+           (setq cc (wl-concat-list (cons cc
+                                          (elmo-multiple-fields-body-list
+                                           r-cc-list))
+                                    ","))
+           (setq newsgroups (wl-concat-list (cons newsgroups
+                                                  (std11-field-bodies
+                                                   r-ng-list))
+                                            ",")))
+         (throw 'done nil))
+       (setq r-list (cdr r-list)))
+      (error "No match field: check your `wl-draft-reply-without-argument-list'"))
     (setq subject (std11-field-body "Subject"))
-    (with-temp-buffer ; to keep raw buffer unibyte.
+    (setq to (wl-parse-addresses to)
+         cc (wl-parse-addresses cc))
+    (with-temp-buffer                  ; to keep raw buffer unibyte.
       (elmo-set-buffer-multibyte default-enable-multibyte-characters)
       (setq subject (or (and subject
                             (eword-decode-string
                              (decode-mime-charset-string
                               subject
-                              wl-mime-charset))))))
+                              wl-mime-charset)))))
+      (if wl-draft-reply-use-address-with-full-name
+         (setq addr-alist
+               (mapcar
+                '(lambda (addr)
+                   (setq addr (eword-extract-address-components addr))
+                   (cons (nth 1 addr)
+                         (if (nth 0 addr)
+                             (concat
+                              (wl-address-quote-specials (nth 0 addr))
+                              " <" (nth 1 addr) ">")
+                           (nth 1 addr))))
+                (append to cc)))))
     (and subject wl-reply-subject-prefix
         (let ((case-fold-search t))
           (not
@@ -334,16 +359,10 @@ the `wl-smtp-features' variable."
                           subject)
             0)))
         (setq subject (concat wl-reply-subject-prefix subject)))
-    (and (setq in-reply-to (std11-field-body "Message-Id"))
-        (setq in-reply-to
-              (format "In your message of \"%s\"\n\t%s"
-                      (or (std11-field-body "Date") "some time ago")
-                      in-reply-to)))
+    (setq in-reply-to (std11-field-body "Message-Id"))
     (setq references (nconc
                      (std11-field-bodies '("References" "In-Reply-To"))
                      (list in-reply-to)))
-    (setq to (wl-parse-addresses to)
-         cc (wl-parse-addresses cc))
     (setq to (mapcar '(lambda (addr)
                        (wl-address-header-extract-address
                         addr)) to))
@@ -369,29 +388,67 @@ the `wl-smtp-features' variable."
              (append (wl-delete-duplicates cc nil t)
                      to (copy-sequence to))
              t t))
-    (and to (setq to (mapconcat 'identity to ",\n\t")))
-    (and cc (setq cc (mapconcat 'identity cc ",\n\t")))
-    (and mail-followup-to (setq mail-followup-to
-                               (mapconcat 'identity
-                                          mail-followup-to ",\n\t")))
+    (and to (setq to (mapconcat
+                     '(lambda (addr)
+                        (if wl-draft-reply-use-address-with-full-name
+                            (or (cdr (assoc addr addr-alist)) addr)
+                          addr))
+                     to ",\n\t")))
+    (and cc (setq cc (mapconcat
+                     '(lambda (addr)
+                        (if wl-draft-reply-use-address-with-full-name
+                            (or (cdr (assoc addr addr-alist)) addr)
+                          addr))
+                     cc ",\n\t")))
+    (and mail-followup-to
+        (setq mail-followup-to
+              (mapconcat
+               '(lambda (addr)
+                  (if wl-draft-reply-use-address-with-full-name
+                      (or (cdr (assoc addr addr-alist)) addr)
+                    addr))
+               mail-followup-to ",\n\t")))
     (and (null to) (setq to cc cc nil))
     (setq references (delq nil references)
          references (mapconcat 'identity references " ")
-         references (wl-parse references "[^<]*\\(<[^>]+>\\)")
+         references (wl-draft-parse-msg-id-list-string references)
          references (wl-delete-duplicates references)
          references (if references
                         (mapconcat 'identity references "\n\t")))
     (wl-draft
      to subject in-reply-to cc references newsgroups mail-followup-to
-     nil nil nil summary-buf)
+     nil nil nil nil summary-buf)
     (setq wl-draft-reply-buffer buf))
   (run-hooks 'wl-reply-hook))
 
+(defun wl-draft-add-references ()
+  (let* ((mes-id (save-excursion
+                   (set-buffer mail-reply-buffer)
+                   (std11-field-body "message-id")))
+         (ref (std11-field-body "References"))
+         (ref-list nil) (st nil))
+    (when (and mes-id ref)
+      (while (string-match "<[^>]+>" ref st)
+        (setq ref-list
+              (cons (substring ref (match-beginning 0) (setq st (match-end 0)))
+                    ref-list)))
+      (if (and ref-list
+               (member mes-id ref-list))
+          (setq mes-id nil)))
+    (when mes-id
+      (save-excursion
+        (when (mail-position-on-field "References")
+          (forward-line)
+          (while (looking-at "^[ \t]")
+            (forward-line))
+          (setq mes-id (concat "\t" mes-id "\n")))
+        (insert mes-id))
+      t)))
+
 (defun wl-draft-yank-from-mail-reply-buffer (decode-it
                                             &optional ignored-fields)
   (interactive)
   (save-restriction
-    (current-buffer)
     (narrow-to-region (point)(point))
     (insert
      (save-excursion
@@ -413,6 +470,10 @@ the `wl-smtp-features' variable."
          (t (and wl-draft-cite-func
                  (funcall wl-draft-cite-func)))) ; default cite
     (run-hooks 'wl-draft-cited-hook)
+    (and wl-draft-add-references
+        (if (wl-draft-add-references)
+            (let (wl-highlight-x-face-func)
+              (wl-highlight-headers))))
     (if wl-highlight-body-too
        (wl-highlight-body-region beg (point-max)))))
 
@@ -449,7 +510,7 @@ the `wl-smtp-features' variable."
   (let ((cur-buf (current-buffer))
        (tmp-buf (get-buffer-create " *wl-draft-edit-string*"))
        to subject in-reply-to cc references newsgroups mail-followup-to
-       content-type
+       content-type content-transfer-encoding
        body-beg buffer-read-only
        )
     (set-buffer tmp-buf)
@@ -478,6 +539,7 @@ the `wl-smtp-features' variable."
     (setq newsgroups (std11-field-body "Newsgroups"))
     (setq mail-followup-to (std11-field-body "Mail-Followup-To"))
     (setq content-type (std11-field-body "Content-Type"))
+    (setq content-transfer-encoding (std11-field-body "Content-Transfer-Encoding"))
     (goto-char (point-min))
     (or (re-search-forward "\n\n" nil t)
        (search-forward (concat mail-header-separator "\n") nil t))
@@ -485,7 +547,7 @@ the `wl-smtp-features' variable."
        (set-buffer
         (wl-draft to subject in-reply-to cc references newsgroups
                   mail-followup-to
-                  content-type
+                  content-type content-transfer-encoding
                   (buffer-substring (point) (point-max))
                   'edit-again
                   ))
@@ -493,13 +555,13 @@ the `wl-smtp-features' variable."
       (delete-other-windows)
       (kill-buffer tmp-buf)))
   (setq buffer-read-only nil) ;;??
-  (run-hooks 'wl-mail-setup-hook))
+  (run-hooks 'wl-draft-reedit-hook))
 
 (defun wl-draft-insert-current-message (dummy)
   (interactive)
   (let ((mail-reply-buffer (wl-message-get-original-buffer))
        mail-citation-hook mail-yank-hooks
-       wl-draft-cite-func)
+       wl-draft-add-references wl-draft-cite-func)
     (if (eq 0
            (save-excursion
              (set-buffer mail-reply-buffer)
@@ -753,6 +815,91 @@ to find out how to use this."
        ;; should never happen
        (t   (error "qmail-inject reported unknown failure"))))))
 
+(defun wl-draft-parse-msg-id-list-string (string)
+  "Get msg-id list from STRING."
+  (let ((parsed (std11-parse-msg-ids-string string))
+       tokens msg-id msg-id-list)
+    (while parsed
+      (setq msg-id nil)
+      (when (eq (car (car parsed)) 'msg-id)
+       (setq tokens (cdr (car parsed)))
+       (while tokens
+         (if (or (eq (car (car tokens)) 'atom)
+                 (eq (car (car tokens)) 'specials))
+             (setq msg-id (concat msg-id (cdr (car tokens)))))
+         (setq tokens (cdr tokens))))
+      (if msg-id (setq msg-id-list (cons (concat "<" msg-id ">")
+                                        msg-id-list)))
+      (setq parsed (cdr parsed)))
+    (nreverse msg-id-list)))
+
+(defun wl-draft-parse-mailbox-list (field &optional remove-group-list)
+  "Get mailbox list of FIELD from current buffer.
+The buffer is expected to be narrowed to just the headers of the message.
+If optional argument REMOVE-GROUP-LIST is non-nil, remove group list content
+from current buffer."
+  (save-excursion
+    (let ((case-fold-search t)
+         (inhibit-read-only t)
+         addresses address
+         mailbox-list beg seq has-group-list)
+      (goto-char (point-min))
+      (while (re-search-forward (concat "^" (regexp-quote field) "[\t ]*:")
+                               nil t)
+       (setq beg (point))
+       (re-search-forward "^[^ \t]" nil 'move)
+       (beginning-of-line)
+       (skip-chars-backward "\n")
+       (setq seq (std11-lexical-analyze
+                  (buffer-substring-no-properties beg (point))))
+       (setq addresses (std11-parse-addresses seq))
+       (while addresses
+         (cond ((eq (car (car addresses)) 'group)
+                (setq has-group-list t)
+                (setq mailbox-list
+                      (nconc mailbox-list
+                             (mapcar
+                              'std11-address-string
+                              (nth 2 (car addresses))))))
+               ((eq (car (car addresses)) 'mailbox)
+                (setq address (nth 1 (car addresses)))
+                (setq mailbox-list
+                      (nconc mailbox-list
+                             (list
+                              (std11-addr-to-string
+                               (if (eq (car address) 'phrase-route-addr)
+                                   (nth 2 address)
+                                 (cdr address))))))))
+         (setq addresses (cdr addresses)))
+       (when (and remove-group-list has-group-list)
+         (delete-region beg (point))
+         (insert " " (wl-address-string-without-group-list-contents seq))))
+      mailbox-list)))
+
+(defun wl-draft-deduce-address-list (buffer header-start header-end)
+  "Get address list suitable for smtp RCPT TO:<address>.
+Group list content is removed if `wl-draft-remove-group-list-contents' is
+non-nil."
+  (let ((fields        '("to" "cc" "bcc"))
+       (resent-fields '("resent-to" "resent-cc" "resent-bcc"))
+       (case-fold-search t)
+       addrs recipients)
+    (save-excursion
+      (save-restriction
+       (narrow-to-region header-start header-end)
+       (goto-char (point-min))
+       (save-excursion
+         (if (re-search-forward "^resent-to[\t ]*:" nil t)
+             (setq fields resent-fields)))
+       (while fields
+         (setq recipients
+               (nconc recipients
+                      (wl-draft-parse-mailbox-list
+                       (car fields)
+                       wl-draft-remove-group-list-contents)))
+         (setq fields (cdr fields)))
+       recipients))))
+
 ;;
 ;; from Semi-gnus
 ;;
@@ -772,21 +919,32 @@ to find out how to use this."
                       (concat "^" (regexp-quote mail-header-separator)
                               "$\\|^$") nil t)
                      (point-marker)))
-        (recipients (smtp-deduce-address-list (current-buffer)
-                                              (point-min) delimline))
-        (smtp-server (or wl-smtp-posting-server
-                         (if (functionp smtp-server)
-                             (funcall smtp-server sender
-                                      recipients)
-                           (or smtp-server "localhost"))))
+        (smtp-server
+         (or wl-smtp-posting-server
+             ;; Compatibility stuff for FLIM 1.12.5 or earlier.
+             ;; They don't accept a function as the value of `smtp-server'.
+             (if (functionp smtp-server)
+                 (funcall
+                  smtp-server
+                  sender
+                  ;; no harm..
+                  (let (wl-draft-remove-group-list-contents)
+                    (wl-draft-deduce-address-list
+                     (current-buffer) (point-min) delimline)))
+               (or smtp-server "localhost"))))
         (smtp-service (or wl-smtp-posting-port smtp-service))
         (smtp-local-domain (or smtp-local-domain wl-local-domain))
-        (id (std11-field-body "message-id")))
+        (id (std11-field-body "message-id"))
+        recipients)
     (if (not (elmo-plugged-p smtp-server smtp-service))
        (wl-draft-set-sent-message 'mail 'unplugged
                                   (cons smtp-server smtp-service))
       (unwind-protect
          (save-excursion
+           ;; Instead of `smtp-deduce-address-list'.
+           (setq recipients (wl-draft-deduce-address-list
+                             (current-buffer) (point-min) delimline))
+           (unless recipients (error "No recipients"))
            ;; Insert an extra newline if we need it to work around
            ;; Sun's bug that swallows newlines.
            (goto-char (1+ delimline))
@@ -819,7 +977,7 @@ to find out how to use this."
   "Send the prepared message buffer with POP-before-SMTP."
   (require 'elmo-pop3)
   (condition-case ()
-      (elmo-pop3-get-connection
+      (elmo-pop3-get-session
        (list 'pop3
             (or wl-pop-before-smtp-user
                 elmo-default-pop3-user)
@@ -829,8 +987,8 @@ to find out how to use this."
                 elmo-default-pop3-server)
             (or wl-pop-before-smtp-port
                 elmo-default-pop3-port)
-            (or wl-pop-before-smtp-ssl
-                elmo-default-pop3-ssl)))
+            (or wl-pop-before-smtp-stream-type
+                elmo-default-pop3-stream-type)))
     (error))
   (wl-draft-send-mail-with-smtp))
 
@@ -897,9 +1055,14 @@ to find out how to use this."
             (unplugged-via (car status))
             (sent-via (nth 1 status)))
        ;; If one sent, process fcc folder.
-       (when (and sent-via wl-draft-fcc-list)
-         (wl-draft-do-fcc (wl-draft-get-header-delimiter) wl-draft-fcc-list)
-         (setq wl-draft-fcc-list nil))
+       (if (and sent-via wl-draft-fcc-list)
+           (progn
+             (wl-draft-do-fcc (wl-draft-get-header-delimiter) wl-draft-fcc-list)
+             (setq wl-draft-fcc-list nil))
+         (if wl-draft-use-cache
+             (let ((id (std11-field-body "Message-ID"))
+                   (elmo-enable-disconnected-operation t))
+               (elmo-cache-save id nil nil nil))))
        ;; If one unplugged, append queue.
        (when (and unplugged-via
                   wl-sent-message-modified)
@@ -933,16 +1096,13 @@ to find out how to use this."
 (defun wl-draft-clone-local-variables ()
   (let ((locals (buffer-local-variables))
        result)
-    (mapcar
-     (function
-      (lambda (local)
-       (when (and (consp local)
-                  (car local)
-                  (string-match
-                   wl-draft-clone-local-variable-regexp
-                   (symbol-name (car local))))
-         (setq result (wl-append result (list (car local)))))))
-     locals)
+    (while locals
+      (when (and (consp (car locals))
+                (car (car locals))
+                (string-match wl-draft-clone-local-variable-regexp
+                              (symbol-name (car (car locals)))))
+       (wl-append result (list (car (car locals)))))
+      (setq locals (cdr locals)))
     result))
 
 (defun wl-draft-send (&optional kill-when-done mes-string)
@@ -1124,7 +1284,9 @@ If optional argument is non-nil, current draft buffer is killed"
              t
            (save-excursion
              (forward-line -1)
-             (if (looking-at ".*,[ \t]?$") nil t)))
+             (if (or (looking-at ".*,[ \t]?$")
+                     (looking-at "^[^ \t]+:[ \t]+.*:$")); group list name
+                 nil t)))
        (let ((pos (point)))
          (save-excursion
            (beginning-of-line)
@@ -1139,7 +1301,7 @@ If optional argument is non-nil, current draft buffer is killed"
 ;;;###autoload
 (defun wl-draft (&optional to subject in-reply-to cc references newsgroups
                           mail-followup-to
-                          content-type
+                          content-type content-transfer-encoding
                           body edit-again summary-buf)
   "Write and send mail/news message with Wanderlust."
   (interactive)
@@ -1202,7 +1364,7 @@ If optional argument is non-nil, current draft buffer is killed"
     (if (or wl-bcc mail-self-blind)
        (insert "Bcc: " (or wl-bcc (user-login-name)) "\n"))
     (if wl-fcc
-       (insert "FCC: " wl-fcc "\n"))
+       (insert "FCC: " (if (functionp wl-fcc) (funcall wl-fcc) wl-fcc) "\n"))
     (if wl-organization
        (insert "Organization: " wl-organization "\n"))
     (and wl-auto-insert-x-face
@@ -1216,7 +1378,11 @@ If optional argument is non-nil, current draft buffer is killed"
        (let (start)
          (setq start (point))
          (when content-type
-           (insert "Content-type: " content-type "\n\n"))
+           (insert "Content-type: " content-type "\n"))
+         (when content-transfer-encoding
+           (insert "Content-Transfer-encoding: " content-transfer-encoding "\n"))
+         (if (or content-type content-transfer-encoding)
+             (insert "\n"))
          (and body (insert body))
          (save-restriction
            (narrow-to-region start (point))
@@ -1269,8 +1435,8 @@ If optional argument is non-nil, current draft buffer is killed"
         (or wl-nntp-posting-server elmo-default-nntp-server))
        (elmo-default-nntp-port
         (or wl-nntp-posting-port elmo-default-nntp-port))
-       (elmo-default-nntp-ssl
-        (or wl-nntp-posting-ssl elmo-default-nntp-ssl)))
+       (elmo-default-nntp-stream-type
+        (or wl-nntp-posting-stream-type elmo-default-nntp-stream-type)))
     (if (not (elmo-plugged-p elmo-default-nntp-server elmo-default-nntp-port))
        (wl-draft-set-sent-message 'news 'unplugged
                                   (cons elmo-default-nntp-server
@@ -1291,15 +1457,13 @@ If optional argument is non-nil, current draft buffer is killed"
       (wl-draft-editor-mode)
       (insert-buffer editing-buffer)
       (message "")
-      (when local-variables
-       (mapcar
-        (function
-         (lambda (var)
-           (make-local-variable var)
-           (set var (save-excursion
-                      (set-buffer editing-buffer)
-                      (symbol-value var)))))
-        local-variables))
+      (while local-variables
+       (make-local-variable (car local-variables))
+       (set (car local-variables)
+            (save-excursion
+              (set-buffer editing-buffer)
+              (symbol-value (car local-variables))))
+       (setq local-variables (cdr local-variables)))
       (current-buffer))))
 
 (defun wl-draft-reedit (number)
@@ -1783,6 +1947,8 @@ Only support for TO, SUBJECT, and OTHER-HEADERS has been implemented.
 Support for CONTINUE, YANK-ACTION, and SEND-ACTIONS has not
 been implemented yet.  Partial support for SWITCH-FUNCTION now supported."
 
+  (unless (featurep 'wl)
+    (require 'wl))
   ;; protect these -- to and subject get bound at some point, so it looks
   ;; to be necessary to protect the values used w/in
   (let ((wl-user-agent-headers-and-body-alist other-headers)
@@ -1831,16 +1997,15 @@ been implemented yet.  Partial support for SWITCH-FUNCTION now supported."
   (if wl-user-agent-compose-p
       (progn
        ;; insert headers
-       (let ((case-fold-search t))
-         (mapcar
-          (lambda (x)
-            (let ((header-name (car x))
-                  (header-value (cdr x)))
-              ;; skip body
-              (if (not (string-match "^body$" header-name))
-                  (wl-user-agent-insert-header header-name header-value)
-                t)))
-          wl-user-agent-headers-and-body-alist))
+       (let ((headers wl-user-agent-headers-and-body-alist)
+             (case-fold-search t))
+         (while headers
+           ;; skip body
+           (if (not (string-match "^body$" (car (car headers))))
+               (wl-user-agent-insert-header
+                (car (car headers)) (cdr (car headers)))
+             t)
+           (setq headers (cdr headers))))
        ;; highlight headers (from wl-draft in wl-draft.el)
        (let (wl-highlight-x-face-func)
          (wl-highlight-headers))
@@ -1853,6 +2018,7 @@ been implemented yet.  Partial support for SWITCH-FUNCTION now supported."
                   wl-user-agent-headers-and-body-alist 'ignore-case)))))
     t))
 
-(provide 'wl-draft)
+(require 'product)
+(product-provide (provide 'wl-draft) (require 'wl-version))
 
 ;;; wl-draft.el ends here
diff --git a/wl/wl-e21.el b/wl/wl-e21.el
new file mode 100644 (file)
index 0000000..2f6bba5
--- /dev/null
@@ -0,0 +1,600 @@
+;;; wl-e21.el -- Wanderlust modules for Emacs 21.
+
+;; Copyright 2000 Yuuichi Teranishi <teranisi@gohome.org>
+
+;; Author: Katsumi Yamaoka <yamaoka@jpl.org>
+;; Keywords: mail, net news
+
+;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
+
+;; 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:
+;;
+;; This module uses `before-string' overlay property to show icon
+;; images instead of `insert-image', so don't delete such overlays
+;; sloppily.  Here is a sample code to show icons in the buffer.
+;;
+;;(let* ((load-path (cons wl-icon-dir load-path))
+;;       (image (find-image `((:type xpm :file ,wl-nntp-folder-icon
+;;                                :ascent center))))
+;;       (icon (copy-sequence wl-nntp-folder-icon))
+;;       (folder "-fj.wanderlust:0/0/0")
+;;       overlay)
+;;  (put-text-property 0 (length icon) 'display image icon)
+;;  (pop-to-buffer (get-buffer-create "*wl-e21-demo*"))
+;;  (erase-buffer)
+;;  (insert "   ")
+;;  (setq overlay (make-overlay (point) (progn (insert folder) (point))))
+;;  (overlay-put overlay 'before-string icon)
+;;  (overlay-put overlay 'wl-e21-icon t)
+;;  (overlay-put overlay 'evaporate t)
+;;  (insert "\n"))
+
+;;; Code:
+;;
+
+(eval-when-compile
+  (require 'wl-folder)
+  (require 'wl-summary)
+  (require 'wl-draft)
+  (require 'wl-message)
+  (require 'wl-highlight)
+  (defvar-maybe wl-folder-mode-map (make-sparse-keymap))
+  (defvar-maybe wl-draft-mode-map (make-sparse-keymap)))
+
+(add-hook 'wl-folder-mode-hook 'wl-setup-folder)
+(add-hook 'wl-folder-mode-hook 'wl-folder-init-icons)
+
+(add-hook 'wl-make-plugged-hook 'wl-biff-init-icons)
+(add-hook 'wl-make-plugged-hook 'wl-plugged-init-icons)
+
+(add-hook 'wl-summary-mode-hook 'wl-setup-summary)
+
+(defvar wl-use-toolbar (image-type-available-p 'xpm))
+(defvar wl-plugged-image nil)
+(defvar wl-unplugged-image nil)
+(defvar wl-biff-mail-image nil)
+(defvar wl-biff-nomail-image nil)
+
+(defvar wl-folder-toolbar
+  '([wl-folder-jump-to-current-entity
+     wl-folder-jump-to-current-entity t "Enter Current Folder"]
+    [wl-folder-next-entity
+     wl-folder-next-entity t "Next Folder"]
+    [wl-folder-prev-entity
+     wl-folder-prev-entity t "Previous Folder"]
+    [wl-folder-check-current-entity
+     wl-folder-check-current-entity t "Check Current Folder"]
+    ;;[wl-draft
+    ;; wl-draft t "Write a New Message"]
+    [wl-folder-sync-current-entity
+     wl-folder-sync-current-entity t "Sync Current Folder"]
+    [wl-draft
+     wl-draft t "Write a New Message"]
+    [wl-folder-empty-trash
+     wl-folder-empty-trash t "Empty Trash"]
+    [wl-exit
+     wl-exit t "Quit Wanderlust"]
+    )
+  "The Folder buffer toolbar.")
+
+(defvar wl-summary-toolbar
+  '([wl-summary-read
+     wl-summary-read t "Read Messages"]
+    [wl-summary-next
+     wl-summary-next t "Next Message"]
+    [wl-summary-prev
+     wl-summary-prev t "Previous Message"]
+    [wl-summary-jump-to-current-message
+     wl-summary-jump-to-current-message t "Jump to Current Message"]
+    [wl-summary-sync-force-update
+     wl-summary-sync-force-update t "Sync Current Folder"]
+    [wl-summary-delete
+     wl-summary-delete t "Delete Current Message"]
+    [wl-summary-mark-as-important
+     wl-summary-mark-as-important t "Mark Current Message as Important"]
+    [wl-draft
+     wl-draft t "Write a New Message"]
+    [wl-summary-reply
+     wl-summary-reply t "Reply to Current Message" ]
+    [wl-summary-reply-with-citation
+     wl-summary-reply-with-citation t "Reply to Current Message with Citation"]
+    [wl-summary-forward
+     wl-summary-forward t "Forward Current Message"]
+    [wl-summary-exit
+     wl-summary-exit t "Exit Current Summary"]
+    )
+  "The Summary buffer toolbar.")
+
+(defvar wl-message-toolbar
+  '([wl-message-read
+     wl-message-read t "Read Contents"]
+    [wl-message-next-content
+     wl-message-next-content t "Next Content"]
+    [wl-message-prev-content
+     wl-message-prev-content t "Previous Content"]
+    [wl-message-quit
+     wl-message-quit t "Back to Summary"]
+    [wl-message-play-content
+     wl-message-play-content t "Play Content"]
+    [wl-message-extract-content
+     wl-message-extract-content t "Extract Content"]
+    )
+  "The Message buffer toolbar.")
+
+(defalias 'wl-draft-insert-signature 'insert-signature);; for draft toolbar.
+
+(defvar wl-draft-toolbar
+  '([wl-draft-send-from-toolbar
+     wl-draft-send-from-toolbar t "Send Current Draft"]
+    [wl-draft-yank-original
+     wl-draft-yank-original t "Yank Displaying Message"]
+    [wl-draft-insert-signature
+     wl-draft-insert-signature t "Insert Signature"]
+    [wl-draft-kill
+     wl-draft-kill t "Kill Current Draft"]
+    )
+  "The Draft buffer toolbar.")
+
+(defun wl-e21-setup-toolbar (bar)
+  (let ((load-path (cons wl-icon-dir load-path))
+       (props '(:type xpm :ascent center
+                      :color-symbols (("backgroundToolBarColor" . "None"))
+                      :file))
+       (success t)
+       icon up down disabled name success)
+    (while bar
+      (setq icon (aref (pop bar) 0))
+      (unless (boundp icon)
+       (setq name (symbol-name icon)
+             up (find-image `((,@props ,(concat name "-up.xpm")))))
+       (if up
+           (progn
+             (setq down (find-image `((,@props ,(concat name "-down.xpm"))))
+                   disabled (find-image `((,@props
+                                           ,(concat name "-disabled.xpm")))))
+             (set icon (vector down up disabled disabled)))
+         (setq bar nil
+               success nil))))
+    success))
+
+(defvar wl-e21-toolbar-configurations
+  '((auto-resize-tool-bar        . t)
+    (auto-raise-tool-bar-buttons . t)
+    (tool-bar-button-margin      . 0)
+    (tool-bar-button-relief      . 2)))
+
+(defun wl-e21-make-toolbar-buttons (keymap defs)
+  (let ((configs wl-e21-toolbar-configurations)
+       config)
+    (while (setq config (pop configs))
+      (set (make-local-variable (car config)) (cdr config))))
+  ;; Invalidate the default bindings.
+  (let ((keys (cdr (key-binding [tool-bar] t)))
+       item)
+    (while (setq item (pop keys))
+      (when (setq item (car-safe item))
+       (define-key keymap (vector 'tool-bar item) 'undefined))))
+  (let ((n (length defs))
+       def)
+    (while (>= n 0)
+      (setq n (1- n)
+           def (nth n defs))
+      (define-key keymap (vector 'tool-bar (aref def 1))
+       (list 'menu-item (aref def 3) (aref def 1)
+             :enable (aref def 2)
+             :image (symbol-value (aref def 0)))))))
+
+(defun wl-e21-setup-folder-toolbar ()
+  (and wl-use-toolbar
+       (display-graphic-p)
+       (wl-e21-setup-toolbar wl-folder-toolbar)
+       (wl-e21-make-toolbar-buttons wl-folder-mode-map wl-folder-toolbar)))
+
+(defun wl-e21-setup-summary-toolbar ()
+  (and wl-use-toolbar
+       (display-graphic-p)
+       (wl-e21-setup-toolbar wl-summary-toolbar)
+       (wl-e21-make-toolbar-buttons wl-summary-mode-map wl-summary-toolbar)))
+
+(eval-when-compile
+  (defsubst wl-e21-setup-message-toolbar ()
+    (and wl-use-toolbar
+        (display-graphic-p)
+        (wl-e21-setup-toolbar wl-message-toolbar)
+        (wl-e21-make-toolbar-buttons (current-local-map) wl-message-toolbar)))
+
+  (defsubst wl-e21-setup-draft-toolbar ()
+    (and wl-use-toolbar
+        (display-graphic-p)
+        (wl-e21-setup-toolbar wl-draft-toolbar)
+        (wl-e21-make-toolbar-buttons wl-draft-mode-map wl-draft-toolbar))))
+
+(defvar wl-folder-toggle-icon-list
+  '((wl-folder-opened-image       . wl-opened-group-folder-icon)
+    (wl-folder-closed-image       . wl-closed-group-folder-icon)))
+
+(eval-when-compile
+  (defsubst wl-e21-highlight-folder-group-line (start end icon numbers)
+    (when (display-graphic-p)
+      (let (overlay)
+       (let ((overlays (overlays-in start end)))
+         (while (and (setq overlay (pop overlays))
+                     (not (overlay-get overlay 'wl-e21-icon)))))
+       (unless overlay
+         (setq overlay (make-overlay start end))
+         (overlay-put overlay 'wl-e21-icon t)
+         (overlay-put overlay 'evaporate t))
+       (let ((image (get icon 'image)))
+         (unless image
+           (let ((name (copy-sequence
+                        (symbol-value
+                         (cdr (assq icon wl-folder-toggle-icon-list)))))
+                 (load-path (cons wl-icon-dir load-path)))
+             (when (setq image (find-image `((:type xpm :file ,name
+                                                    :ascent center))))
+               (put-text-property 0 (length name) 'display image name)
+               (setq image (put icon 'image name)))))
+         (overlay-put overlay 'before-string image)
+         (overlay-put overlay 'invisible (and image t))
+         (when (and wl-use-highlight-mouse-line (display-mouse-p))
+           (let ((inhibit-read-only t))
+             (put-text-property (if image
+                                    (max (1- start) (line-beginning-position))
+                                  start)
+                                (line-end-position)
+                                'mouse-face 'highlight)))))))
+
+  (defsubst wl-e21-highlight-folder-by-numbers (start end text-face numbers)
+    (when (display-color-p)
+      (let ((inhibit-read-only t))
+       (if (and wl-highlight-folder-by-numbers
+                numbers (nth 0 numbers) (nth 1 numbers)
+                (re-search-forward "[0-9-]+/[0-9-]+/[0-9-]+"
+                                   (line-end-position) t))
+           (let* ((unsync (nth 0 numbers))
+                  (unread (nth 1 numbers))
+                  (face (cond ((and unsync (zerop unsync))
+                               (if (and unread (zerop unread))
+                                   'wl-highlight-folder-zero-face
+                                 'wl-highlight-folder-unread-face))
+                              ((and unsync
+                                    (>= unsync
+                                        wl-folder-many-unsync-threshold))
+                               'wl-highlight-folder-many-face)
+                              (t
+                               'wl-highlight-folder-few-face))))
+             (if (numberp wl-highlight-folder-by-numbers)
+                 (progn
+                   (put-text-property start (match-beginning 0)
+                                      'face text-face)
+                   (put-text-property (match-beginning 0) (match-end 0)
+                                      'face face))
+               (put-text-property start (match-end 0) 'face face)))
+         (put-text-property start (line-end-position) 'face text-face))))))
+
+(defun wl-highlight-folder-current-line (&optional numbers)
+  (interactive)
+  (save-excursion
+    (beginning-of-line)
+    (let (fld-name start end)
+      (cond
+       (;; opened folder group
+       (looking-at wl-highlight-folder-opened-regexp)
+       (setq start (match-beginning 1)
+             end (match-end 1))
+       (wl-e21-highlight-folder-group-line start end
+                                           'wl-folder-opened-image
+                                           numbers)
+       (wl-e21-highlight-folder-by-numbers start end
+                                           'wl-highlight-folder-opened-face
+                                           numbers))
+       (;; closed folder group
+       (looking-at wl-highlight-folder-closed-regexp)
+       (setq start (match-beginning 1)
+             end (match-end 1))
+       (wl-e21-highlight-folder-group-line start end
+                                           'wl-folder-closed-image
+                                           numbers)
+       (wl-e21-highlight-folder-by-numbers start end
+                                           'wl-highlight-folder-closed-face
+                                           numbers))
+       (;; basic folder
+       (and (setq fld-name (wl-folder-get-folder-name-by-id
+                            (get-text-property (point) 'wl-folder-entity-id)))
+            (looking-at "[\t ]+\\([^\t\n ]+\\)"))
+       (setq start (match-beginning 1)
+             end (match-end 1))
+       (let (image)
+         (when (display-graphic-p)
+           (let (overlay)
+             (let ((overlays (overlays-in start end)))
+               (while (and (setq overlay (pop overlays))
+                           (not (overlay-get overlay 'wl-e21-icon)))))
+             (unless overlay
+               (setq overlay (make-overlay start end))
+               (overlay-put overlay 'wl-e21-icon t)
+               (overlay-put overlay 'evaporate t))
+             (let (type)
+               (setq image
+                     (cond ((string= fld-name wl-trash-folder);; trash folder
+                            (let ((num (nth 2 numbers)));; number of messages
+                              (get (if (or (not num) (zerop num))
+                                       'wl-folder-trash-empty-image
+                                     'wl-folder-trash-image)
+                                   'image)))
+                           ((string= fld-name wl-draft-folder);; draft folder
+                            (get 'wl-folder-draft-image 'image))
+                           ((string= fld-name wl-queue-folder);; queue folder
+                            (get 'wl-folder-queue-image 'image))
+                           (;; and one of many other folders
+                            (setq type (elmo-folder-get-type fld-name))
+                            (get (intern (format "wl-folder-%s-image" type))
+                                 'image)))))
+             (overlay-put overlay 'before-string image)))
+         (when (and wl-use-highlight-mouse-line (display-mouse-p))
+           (let ((inhibit-read-only t))
+             (put-text-property (if image
+                                    (max (1- start)
+                                         (line-beginning-position))
+                                  start)
+                                (line-end-position)
+                                'mouse-face 'highlight))))
+       (when (display-color-p)
+         (wl-e21-highlight-folder-by-numbers
+          start end
+          (if (looking-at (format "^[\t ]*\\(%s\\|%s\\)"
+                                  wl-folder-unsubscribe-mark
+                                  wl-folder-removed-mark))
+              'wl-highlight-folder-killed-face
+            'wl-highlight-folder-unknown-face)
+          numbers)))))))
+
+(defun wl-highlight-plugged-current-line ()
+  (interactive)
+  (when (display-graphic-p)
+    (save-excursion
+      (beginning-of-line)
+      (when (looking-at "[\t ]*\\(\\[\\([^]]+\\)\\]\\)")
+       (let* ((start (match-beginning 1))
+              (end (match-end 1))
+              (status (match-string-no-properties 2))
+              (image (if (string-equal wl-plugged-plug-on status)
+                         wl-plugged-image
+                       wl-unplugged-image)))
+         (when image
+           (let (overlay)
+             (let ((overlays (overlays-in start end)))
+               (while (and (setq overlay (pop overlays))
+                           (not (overlay-get overlay 'wl-e21-icon)))))
+             (unless overlay
+               (setq overlay (make-overlay start end))
+               (overlay-put overlay 'wl-e21-icon t)
+               (overlay-put overlay 'evaporate t))
+             (put-text-property 0 (length status) 'display image status)
+             (overlay-put overlay 'before-string status)
+             (overlay-put overlay 'invisible t))))))))
+
+(defun wl-plugged-set-folder-icon (folder string)
+  (if (display-graphic-p)
+      (let ((istring (concat " " string))
+           type)
+       (cond ((string= folder wl-queue-folder)
+              (put-text-property 0 1 'display
+                                 (get 'wl-folder-queue-image 'image) istring)
+              istring)
+             ((setq type (elmo-folder-get-type folder))
+              (put-text-property 0 1 'display
+                                 (get (intern (format "wl-folder-%s-image"
+                                                      type))
+                                      'image)
+                                 istring)
+              istring)
+             (t
+              string)))
+    string))
+
+(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-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-filter-image       . wl-filter-folder-icon)
+    (wl-folder-archive-image      . wl-archive-folder-icon)
+    (wl-folder-pipe-image         . wl-pipe-folder-icon)
+    (wl-folder-maildir-image      . wl-maildir-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)))
+
+(defun wl-folder-init-icons ()
+  (let ((load-path (cons wl-icon-dir load-path))
+       (icons wl-folder-internal-icon-list)
+       icon name image)
+    (while (setq icon (pop icons))
+      (unless (get (car icon) 'image)
+       (setq name (symbol-value (cdr icon))
+             image (find-image `((:type xpm :file ,name :ascent center))))
+       (when image
+         (let* ((str (copy-sequence name))
+                (len (length str)))
+           (put-text-property 0 len 'display image str)
+           (put (car icon) 'image str)))))))
+
+(defun wl-plugged-init-icons ()
+  (unless wl-plugged-image
+    (let ((load-path (cons wl-icon-dir load-path)))
+      (setq wl-plugged-image (find-image `((:type xpm
+                                                 :file ,wl-plugged-icon
+                                                 :ascent center)))
+           wl-unplugged-image (find-image `((:type xpm
+                                                   :file ,wl-unplugged-icon
+                                                   :ascent center)))))
+    (setq wl-modeline-plug-state-on (copy-sequence
+                                    wl-plug-state-indicator-on)
+         wl-modeline-plug-state-off (copy-sequence
+                                     wl-plug-state-indicator-off)))
+  (let ((props (when (display-mouse-p)
+                (list 'local-map (purecopy (make-mode-line-mouse2-map
+                                            #'wl-toggle-plugged))
+                      'help-echo "mouse-2 toggles plugged status"))))
+    (add-text-properties 0 (length wl-modeline-plug-state-on)
+                        (nconc props (when (display-graphic-p)
+                                       (list 'display wl-plugged-image)))
+                        wl-modeline-plug-state-on)
+    (add-text-properties 0 (length wl-modeline-plug-state-off)
+                        (nconc props (when (display-graphic-p)
+                                       (list 'display wl-unplugged-image)))
+                        wl-modeline-plug-state-off)))
+
+(defun wl-biff-init-icons ()
+  (unless wl-biff-mail-image
+    (let ((load-path (cons wl-icon-dir load-path)))
+      (setq wl-biff-mail-image (find-image
+                               `((:type xpm :file ,wl-biff-mail-icon
+                                        :ascent center)))
+           wl-biff-nomail-image (find-image
+                                 `((:type xpm :file ,wl-biff-nomail-icon
+                                          :ascent center)))))
+    (setq wl-modeline-biff-state-on (copy-sequence
+                                    wl-biff-state-indicator-on)
+         wl-modeline-biff-state-off (copy-sequence
+                                     wl-biff-state-indicator-off)))
+  (let ((props (when (display-mouse-p)
+                (list 'local-map (purecopy (make-mode-line-mouse2-map
+                                            (lambda nil
+                                              (call-interactively
+                                               'wl-biff-check-folders))))
+                      'help-echo "mouse-2 checks new mails"))))
+    (add-text-properties 0 (length wl-modeline-biff-state-on)
+                        (nconc props (when (display-graphic-p)
+                                       (list 'display wl-biff-mail-image)))
+                        wl-modeline-biff-state-on)
+    (add-text-properties 0 (length wl-modeline-biff-state-off)
+                        (nconc props (when (display-graphic-p)
+                                       (list 'display wl-biff-nomail-image)))
+                        wl-modeline-biff-state-off)))
+
+(defun wl-make-date-string ()
+  (format-time-string "%a, %d %b %Y %T %z"))
+
+(defalias 'wl-setup-folder 'wl-e21-setup-folder-toolbar)
+
+(defalias 'wl-setup-summary 'wl-e21-setup-summary-toolbar)
+
+(defun wl-message-overload-functions ()
+  (wl-e21-setup-message-toolbar)
+  (let ((keymap (current-local-map)))
+    (define-key keymap "l" 'wl-message-toggle-disp-summary)
+    (define-key keymap [mouse-2] 'wl-message-refer-article-or-url)
+    (define-key keymap [mouse-4] 'wl-message-wheel-down)
+    (define-key keymap [mouse-5] 'wl-message-wheel-up)
+    (define-key keymap [S-mouse-4] 'wl-message-wheel-down)
+    (define-key keymap [S-mouse-5] 'wl-message-wheel-up)
+    (set-keymap-parent wl-message-button-map keymap))
+  (define-key wl-message-button-map [mouse-2] 'wl-message-button-dispatcher))
+
+(defun wl-message-wheel-up (event)
+  (interactive "e")
+  (if (string-match wl-message-buf-name (buffer-name))
+      (wl-message-next-page)
+    (let ((cur-buf (current-buffer))
+         proceed)
+      (save-selected-window
+       (select-window (posn-window (event-start event)))
+       (set-buffer cur-buf)
+       (setq proceed (wl-message-next-page)))
+      (if proceed
+         (if (memq 'shift (event-modifiers event))
+             (wl-summary-down t)
+           (wl-summary-next t))))))
+
+(defun wl-message-wheel-down (event)
+  (interactive "e")
+  (if (string-match wl-message-buf-name (buffer-name))
+      (wl-message-prev-page)
+    (let ((cur-buf (current-buffer))
+         proceed)
+      (save-selected-window
+       (select-window (posn-window (event-start event)))
+       (set-buffer cur-buf)
+       (setq proceed (wl-message-prev-page)))
+      (if proceed
+         (if (memq 'shift (event-modifiers event))
+             (wl-summary-up t)
+           (wl-summary-prev t))))))
+
+(defun wl-draft-overload-menubar ()
+  (let ((keymap (current-local-map)))
+    (define-key keymap [menu-bar mail send]
+      '("Send Message" . wl-draft-send-and-exit))
+    (define-key keymap [menu-bar mail send-stay]
+      '("Send, Keep Editing" . wl-draft-send))
+    (define-key keymap [menu-bar mail cancel]
+      '("Kill Current Draft" . wl-draft-kill))
+    (define-key keymap [menu-bar mail yank]
+      '("Cite Message" . wl-draft-yank-original))
+    (define-key keymap [menu-bar mail signature]
+      '("Insert Signature" . insert-signature))
+    (define-key keymap [menu-bar headers fcc]
+      '("FCC" . wl-draft-fcc))))
+
+(defun wl-draft-mode-setup ()
+  (require 'derived)
+  (define-derived-mode wl-draft-mode mail-mode "Draft"
+    "draft mode for Wanderlust derived from mail mode.
+See info under Wanderlust for full documentation.
+
+Special commands:
+\\{wl-draft-mode-map}"))
+
+(defun wl-draft-key-setup ()
+  (define-key wl-draft-mode-map "\C-c\C-y" 'wl-draft-yank-original)
+  (define-key wl-draft-mode-map "\C-c\C-s" 'wl-draft-send)
+  (define-key wl-draft-mode-map "\C-c\C-a" 'wl-draft-insert-x-face-field)
+  (define-key wl-draft-mode-map "\C-c\C-c" 'wl-draft-send-and-exit)
+  (define-key wl-draft-mode-map "\C-c\C-z" 'wl-draft-save-and-exit)
+  (define-key wl-draft-mode-map "\C-c\C-k" 'wl-draft-kill)
+  (define-key wl-draft-mode-map "\C-l" 'wl-draft-highlight-and-recenter)
+  (define-key wl-draft-mode-map "\C-i" 'wl-complete-field-body-or-tab)
+  (define-key wl-draft-mode-map "\C-c\C-r" 'wl-draft-caesar-region)
+  (define-key wl-draft-mode-map "\M-t" 'wl-toggle-plugged)
+  (define-key wl-draft-mode-map "\C-c\C-o" 'wl-jump-to-draft-buffer)
+  (define-key wl-draft-mode-map "\C-c\C-e" 'wl-draft-config-exec)
+  (define-key wl-draft-mode-map "\C-c\C-j" 'wl-template-select)
+  (define-key wl-draft-mode-map "\C-c\C-p" 'wl-draft-preview-message)
+  (define-key wl-draft-mode-map "\C-x\C-s" 'wl-draft-save)
+  (define-key wl-draft-mode-map "\C-xk"    'wl-draft-mimic-kill-buffer))
+
+(defun wl-draft-overload-functions ()
+  (wl-mode-line-buffer-identification)
+  (local-set-key "\C-c\C-s" 'wl-draft-send);; override
+  (wl-e21-setup-draft-toolbar)
+  (wl-draft-overload-menubar))
+
+(defalias 'wl-defface 'defface)
+
+(require 'product)
+(product-provide (provide 'wl-e21) (require 'wl-version))
+
+;;; wl-e21.el ends here
index b22f5ef..7182c11 100644 (file)
@@ -546,7 +546,7 @@ Refile to archive folder followed message date."
                        (t
                         (error "%s: invalid type" rm-type))))
            (when (and (not notsummary) delete-list)
-             (wl-summary-delete-messages-on-buffer delete-list)
+             (wl-summary-delete-messages-on-buffer delete-list t)
              (wl-summary-folder-info-update)
              (wl-summary-set-message-modified)
              (wl-summary-set-mark-modified)
@@ -723,6 +723,7 @@ Refile to archive folder followed message date."
          (message (format "%s is not writable." filename)))
        (kill-buffer tmp-buf)))))
 
-(provide 'wl-expire)
+(require 'product)
+(product-provide (provide 'wl-expire) (require 'wl-version))
 
 ;;; wl-expire.el ends here
index b3dc8d5..dbec82a 100644 (file)
@@ -33,6 +33,7 @@
 (require 'wl-folder)
 (require 'wl-summary)
 (require 'wl-highlight)
+(require 'wl-version)
 (eval-when-compile
   (require 'wl-util))
 
 (defconst wl-fldmgr-folders-header
   "#
 # Folder definition file
-# This file is generated automatically by %s %s (%s).
+# This file is generated automatically by %s.
 #
 
 ")
 
-(defconst wl-fldmgr-filter-completion-alist
-  '(("/last:")
-    ("/first:")
-    ("/since:")
-    ("/before:")
-    ("/from=")
-    ("/subject=")
-    ("/date=")
-    ("/to=")
-    ("/cc=")
-    ("/tocc=")
-    ("/body=")))
-
 ;;; Initial setup
 
 (defvar wl-fldmgr-mode-map nil)
@@ -363,13 +351,10 @@ return value is diffs '(-new -unread -all)."
 
 (defun wl-add-entity (key-path new entity prev-entity-id &optional errmes)
   (when (string= (caar key-path) (car entity))
-    (mapcar
-     '(lambda (ent)
+    (let ((entities new))
+      (while entities
        (wl-folder-entity-assign-id
-        ent
-        wl-folder-entity-id-name-hashtb
-        t))
-     new)
+        (pop entities) wl-folder-entity-id-name-hashtb t)))
     (when (wl-add-entity-sub (cdr key-path) new entity errmes)
       ;; return value is non-nil (diffs)
       (wl-fldmgr-add-entity-hashtb new))))
@@ -415,20 +400,15 @@ return value is diffs '(-new -unread -all)."
          ;; do it
          (when access
            ;; remove from unsubscribe
-           (mapcar
-            '(lambda (x)
-               (cond
-                ((consp x)
+           (setq new2 new)
+           (while new2
+             (if (consp (car new2))
                  (setq unsubscribes
-                       (delete (wl-string-assoc (car x) unsubscribes)
-                               unsubscribes)))
-                (t
-                 (setq unsubscribes (delete (elmo-string x) unsubscribes)))))
-            new)
-;;         (setq new2 new)
-;;         (while new2
-;;           (setq unsubscribes (delete (elmo-string (car new2)) unsubscribes))
-;;           (setq new2 (cdr new2)))
+                       (delq (wl-string-assoc (car (car new2)) unsubscribes)
+                             unsubscribes))
+               (setq unsubscribes (delete (elmo-string (car new2))
+                                          unsubscribes)))
+             (setq new2 (cdr new2)))
            (setcdr (cddr entity) (list unsubscribes))
            (wl-fldmgr-add-modified-access-list group))
          (if (not key-path);; insert group top
@@ -782,7 +762,7 @@ return value is diffs '(-new -unread -all)."
        (pattern
         (if (string-match "\\.$"
                           (car (elmo-network-get-spec
-                                string nil nil nil)))
+                                string nil nil nil nil)))
             (substring string 0 (match-beginning 0))
           (concat string nil))))
     (or table
@@ -1012,37 +992,16 @@ return value is diffs '(-new -unread -all)."
     (beginning-of-line)
     (if (looking-at wl-folder-group-regexp)
        (message "This folder is group")
-      (let ((tmp (wl-fldmgr-get-path-from-buffer)))
+      (let ((tmp (wl-fldmgr-get-path-from-buffer))
+           entity)
        (if (eq (cdr (nth 2 tmp)) 'access)
-           (message "Tan't change access group")
-         (let* ((entity (nth 4 tmp))
-                (old-entity entity)
-                old-filter
-                filter new-entity)
-           (unless entity (error "no folder"))
-           (when (string-match "^\\(\\(/[^/]+/\\)+\\)\\(.*\\)" entity)
-             (setq old-filter (substring entity
-                                         (match-beginning 1)
-                                         (match-end 1)))
-             (setq old-entity (substring entity
-                                         (match-beginning 3)
-                                         (match-end 3))))
-           (setq filter (completing-read "Filter: "
-                                         wl-fldmgr-filter-completion-alist
-                                         nil nil
-                                         (or old-filter "/")))
-           (unless (or (string= filter "")
-                       (string-match "/$" filter))
-             (setq filter (concat filter "/")))
-           (setq new-entity (concat filter old-entity))
-           (let ((entity new-entity)
-                 spec)
-             ;; check filter syntax
-             (while (eq
-                     (car (setq spec (elmo-folder-get-spec entity)))
-                     'filter)
-               (setq entity (nth 2 spec))))
-           (wl-fldmgr-add new-entity)))))))
+           (message "Can't change access group")
+         (setq entity (nth 4 tmp))
+         (unless entity (error "no folder"))
+         (wl-fldmgr-add (concat "/"
+                                (elmo-read-search-condition
+                                 wl-fldmgr-make-filter-default)
+                                "/" entity)))))))
 
 (defun wl-fldmgr-sort ()
   (interactive)
@@ -1350,8 +1309,7 @@ return value is diffs '(-new -unread -all)."
     (message "Saving folders...")
     (set-buffer tmp-buf)
     (erase-buffer)
-    (insert (format wl-fldmgr-folders-header
-                   wl-appname wl-version wl-codename))
+    (insert (format wl-fldmgr-folders-header (wl-version t)))
     (wl-fldmgr-delete-disused-petname)
     (setq save-petname-entities
          (wl-fldmgr-insert-folders-buffer "" (nth 2 wl-folder-entity)))
@@ -1384,6 +1342,7 @@ return value is diffs '(-new -unread -all)."
     (setq wl-fldmgr-modified-access-list nil)
     (message "Saving folders...done")))
 
-(provide 'wl-fldmgr)
+(require 'product)
+(product-provide (provide 'wl-fldmgr) (require 'wl-version))
 
 ;;; wl-fldmgr.el ends here
index 62b55b1..e28588a 100644 (file)
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
 (require 'elmo-vars)
 (require 'elmo-util)
 
 (defvar wl-folder-mode-map nil)
 
-(defvar wl-folder-opened-glyph nil)
-(defvar wl-folder-closed-glyph nil)
-(defvar wl-folder-nntp-glyph nil)
-(defvar wl-folder-imap4-glyph nil)
-(defvar wl-folder-pop3-glyph nil)
-(defvar wl-folder-localdir-glyph nil)
-(defvar wl-folder-localnews-glyph nil)
-(defvar wl-folder-internal-glyph nil)
-(defvar wl-folder-multi-glyph nil)
-(defvar wl-folder-filter-glyph nil)
-(defvar wl-folder-archive-glyph nil)
-(defvar wl-folder-pipe-glyph nil)
-(defvar wl-folder-maildir-glyph nil)
-(defvar wl-folder-trash-empty-glyph nil)
-(defvar wl-folder-trash-glyph nil)
-(defvar wl-folder-draft-glyph nil)
-(defvar wl-folder-queue-glyph nil)
-
 (defvar wl-folder-buffer-disp-summary nil)
-(make-variable-buffer-local 'wl-folder-buffer-disp-summary)
 (defvar wl-folder-buffer-cur-entity-id nil)
-(make-variable-buffer-local 'wl-folder-buffer-cur-entity-id)
 (defvar wl-folder-buffer-cur-path nil)
-(make-variable-buffer-local 'wl-folder-buffer-cur-entity-id)
 (defvar wl-folder-buffer-cur-point nil)
+
+(make-variable-buffer-local 'wl-folder-buffer-disp-summary)
+(make-variable-buffer-local 'wl-folder-buffer-cur-entity-id)
+(make-variable-buffer-local 'wl-folder-buffer-cur-path)
 (make-variable-buffer-local 'wl-folder-buffer-cur-point)
 
 (defconst wl-folder-entity-regexp "^\\([ ]*\\)\\(\\[[\\+-]\\]\\)?\\([^\\[].+\\):[-*0-9]+/[-*0-9]+/[-*0-9]+")
   (define-key wl-folder-mode-map "\C-x\C-s" 'wl-save)
   (define-key wl-folder-mode-map "\M-s"     'wl-save)
   (define-key wl-folder-mode-map "\C-xk"    'wl-folder-mimic-kill-buffer)
+  (define-key wl-folder-mode-map "\M-\C-a"
+    'wl-folder-goto-top-of-current-folder)
+  (define-key wl-folder-mode-map "\M-\C-e"
+    'wl-folder-goto-bottom-of-current-folder)
+
   (wl-folder-setup-mouse)
   (easy-menu-define
    wl-folder-mode-menu
        (setq entity (wl-pop entities))
        (cond
         ((consp entity)
-;;       (if (and (string= name (car entity))
-;;                (eq id (wl-folder-get-entity-id (car entity))))
-;;           (throw 'done last-entity))
+;;       (if (and (string= name (car entity))
+;;                (eq id (wl-folder-get-entity-id (car entity))))
+;;           (throw 'done last-entity))
          (and entities
               (wl-push entities entity-stack))
          (setq entities (nth 2 entity)))
        (setq entity (wl-pop entities))
        (cond
         ((consp entity)
-;;       (if (and (string= name (car entity))
-;;                (eq id (wl-folder-get-entity-id (car entity))))
-;;           (setq found t))
+;;       (if (and (string= name (car entity))
+;;                (eq id (wl-folder-get-entity-id (car entity))))
+;;           (setq found t))
          (and entities
               (wl-push entities entity-stack))
          (setq entities (nth 2 entity)))
       (and trash-buf
           (kill-buffer trash-buf)))))
 
-(defun wl-folder-goto-top-of-current-folder ()
-  (if (re-search-backward "^\\([ ]*\\)\\[\\([\\+-]\\)\\]\\(.+\\)\n" nil t)
+(defun wl-folder-goto-top-of-current-folder (&optional arg)
+  "Move backward to the top of the current folder group.
+Optional argument ARG is repeart count."
+  (interactive "P")
+  (if (re-search-backward
+       "^ *\\[[\\+-]\\]" nil t (if arg (prefix-numeric-value arg)))
       (beginning-of-line)
     (goto-char (point-min))))
 
 (defun wl-folder-goto-bottom-of-current-folder (indent)
+  "Move forward to the bottom of the current folder group."
+  (interactive
+   (let ((indent
+         (save-excursion
+           (beginning-of-line)
+           (if (looking-at "^ *")
+               (buffer-substring (match-beginning 0)(1- (match-end 0)))
+             ""))))
+     (list indent)))
   (if (catch 'done
-       (while (re-search-forward "^\\([ ]*\\)[^ ]" nil t)
-         (if (<= (length (wl-match-buffer 1))
+       (while (re-search-forward "^ *" nil t)
+         (if (<= (length (match-string 0))
                  (length indent))
              (throw 'done nil)))
        (throw 'done t))
     (cond
      ((string= (wl-match-buffer 2) "+")
       (save-excursion
-       (if entity ()
-         (setq entity
-               (wl-folder-search-group-entity-by-name
-                (wl-folder-get-realname (wl-match-buffer 3))
-                wl-folder-entity)))
-       (let ((inhibit-read-only t)
-             (entities (list entity))
-             entity-stack err indent)
-         (while (and entities (not err))
-           (setq entity (wl-pop entities))
-           (cond
-            ((consp entity)
-             (wl-folder-close-entity entity)
-             (setcdr (assoc (car entity) wl-folder-group-alist) t)
-             (unless (wl-folder-buffer-search-group
-                      (wl-folder-get-petname (car entity)))
-               (error "%s: not found group" (car entity)))
-             (setq indent (wl-match-buffer 1))
-             (if (eq 'access (cadr entity))
-                 (wl-folder-maybe-load-folder-list entity))
-             (beginning-of-line)
-             (setq err nil)
-             (save-excursion
-               (condition-case errobj
-                   (wl-folder-update-newest indent entity)
-                 (quit
-                  (setq err t)
-                  (setcdr (assoc (car entity) wl-folder-group-alist) nil))
-                 (error
-                  (elmo-display-error errobj t)
-                  (ding)
-                  (setq err t)
-                  (setcdr (assoc (car entity) wl-folder-group-alist) nil)))
-               (if (not err)
-                   (delete-region (save-excursion (beginning-of-line)
-                                                  (point))
-                                  (save-excursion (end-of-line)
-                                                  (+ 1 (point))))))
-             ;;
-             (and entities
-                  (wl-push entities entity-stack))
-             (setq entities (nth 2 entity))))
-           (unless entities
-             (setq entities (wl-pop entity-stack)))))
+       (if entity ()
+         (setq entity
+               (wl-folder-search-group-entity-by-name
+                (wl-folder-get-realname (wl-match-buffer 3))
+                wl-folder-entity)))
+       (let ((inhibit-read-only t)
+             (entities (list entity))
+             entity-stack err indent)
+         (while (and entities (not err))
+           (setq entity (wl-pop entities))
+           (cond
+            ((consp entity)
+             (wl-folder-close-entity entity)
+             (setcdr (assoc (car entity) wl-folder-group-alist) t)
+             (unless (wl-folder-buffer-search-group
+                      (wl-folder-get-petname (car entity)))
+               (error "%s: not found group" (car entity)))
+             (setq indent (wl-match-buffer 1))
+             (if (eq 'access (cadr entity))
+                 (wl-folder-maybe-load-folder-list entity))
+             (beginning-of-line)
+             (setq err nil)
+             (save-excursion
+               (condition-case errobj
+                   (wl-folder-update-newest indent entity)
+                 (quit
+                  (setq err t)
+                  (setcdr (assoc (car entity) wl-folder-group-alist) nil))
+                 (error
+                  (elmo-display-error errobj t)
+                  (ding)
+                  (setq err t)
+                  (setcdr (assoc (car entity) wl-folder-group-alist) nil)))
+               (if (not err)
+                   (delete-region (save-excursion (beginning-of-line)
+                                                  (point))
+                                  (save-excursion (end-of-line)
+                                                  (+ 1 (point))))))
+             ;;
+             (and entities
+                  (wl-push entities entity-stack))
+             (setq entities (nth 2 entity))))
+           (unless entities
+             (setq entities (wl-pop entity-stack)))))
        (set-buffer-modified-p nil)))
      (t
       (wl-folder-jump-to-current-entity)))))
 (defun wl-folder-check-one-entity (entity)
   (let* ((elmo-use-server-diff (wl-folder-use-server-diff-p entity))
         (nums (condition-case err
-                  (if (wl-string-member entity wl-strict-diff-folders)
+                  (if (wl-string-match-member entity wl-strict-diff-folders)
                       (elmo-strict-folder-diff entity)
                     (elmo-folder-diff entity))
                 (error
                  ;; maybe not exist folder.
-                 (if (not (elmo-folder-exists-p entity))
-                     (if (not (elmo-folder-creatable-p entity))
-                         (error "Folder %s is not found" entity)
-                       (if (y-or-n-p
-                            (format "Folder %s does not exist, create it?"
-                                    entity))
-                           (progn
-                             (unless (elmo-create-folder entity)
-                               (error "Create folder failed"))
-                             ;; one more try.
-                             (if (wl-string-member entity wl-strict-diff-folders)
-                                 (elmo-strict-folder-diff entity)
-                               (elmo-folder-diff entity)))
-                         (error "Folder is not created")))
+                 (if (and (not (memq 'elmo-open-error
+                                     (get (car err) 'error-conditions)))
+                          (not (elmo-folder-exists-p entity)))
+                     (wl-folder-create-subr entity)
                    (signal (car err) (cdr err))))))
         unread unsync nomif)
     (if (and (eq wl-folder-notify-deleted 'sync)
               (wl-append net-elist (list (car elist)))
               (while spec-list
                 (when (eq (caar spec-list) 'nntp)
-                  (when (not (string= server (nth 2 (car spec-list))))
-                    (setq server (nth 2 (car spec-list)))
+                  (when (not (string= server (elmo-nntp-spec-hostname (car spec-list))))
+                    (setq server (elmo-nntp-spec-hostname (car spec-list)))
                     (message "Checking on \"%s\"" server))
                   (setq nntp-connection-keys
                         (elmo-nntp-get-folders-info-prepare
@@ -1224,24 +1215,24 @@ If current line is group folder, all subfolders are marked."
        entity ret-val)
     (condition-case ()
        (progn
-         (set-buffer tmp-buf)
-         (erase-buffer)
-         (insert-file-contents wl-folders-file)
-         (goto-char (point-min))
-         (while (and (not (eobp))
-                     (setq entity (wl-create-folder-entity-from-buffer)))
-           (unless (eq entity 'ignore)
-             (wl-append ret-val (list entity))))
+         (with-current-buffer tmp-buf
+           (erase-buffer)
+           (insert-file-contents wl-folders-file)
+           (goto-char (point-min))
+           (while (and (not (eobp))
+                       (setq entity (wl-create-folder-entity-from-buffer)))
+             (unless (eq entity 'ignore)
+               (wl-append ret-val (list entity)))))
          (kill-buffer tmp-buf))
       (file-error nil))
     (setq ret-val (list wl-folder-desktop-name 'group ret-val))))
 
 (defun wl-folder-entity-assign-id (entity &optional hashtb on-noid)
-  (let* ((hashtb (or hashtb
-                    (setq wl-folder-entity-id-name-hashtb
-                          (elmo-make-hash wl-folder-entity-id))))
-        (entities (list entity))
-        entity-stack)
+  (let ((hashtb (or hashtb
+                   (setq wl-folder-entity-id-name-hashtb
+                         (elmo-make-hash wl-folder-entity-id))))
+       (entities (list entity))
+       entity-stack)
     (while entities
       (setq entity (wl-pop entities))
       (cond
@@ -1406,10 +1397,14 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
   (setq buffer-read-only t)
   (setq inhibit-read-only nil)
   (setq truncate-lines t)
-  (when wl-show-plug-status-on-modeline
-    (setq mode-line-format (wl-make-modeline)))
+  (setq wl-folder-buffer-cur-entity-id nil
+       wl-folder-buffer-cur-path nil
+       wl-folder-buffer-cur-point nil)
+  (wl-mode-line-buffer-identification)
   (easy-menu-add wl-folder-mode-menu)
-  (wl-xmas-setup-folder)
+  ;; This hook may contain the functions `wl-folder-init-icons' and
+  ;; `wl-setup-folder' for reasons of system internal to accord
+  ;; facilities for the Emacs variants.
   (run-hooks 'wl-folder-mode-hook))
 
 (defun wl-folder-append-petname (realname petname)
@@ -1427,44 +1422,44 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
   (interactive "P")
   (let (initialize)
 ;  (delete-other-windows)
-  (if (get-buffer wl-folder-buffer-name)
-      (switch-to-buffer  wl-folder-buffer-name)
-    (switch-to-buffer (get-buffer-create wl-folder-buffer-name))
-    (setq mode-line-buffer-identification '("Wanderlust: %12b"))
-    (wl-folder-mode)
-    (wl-folder-init)
-    (wl-folder-init-icons)
-    (set-buffer wl-folder-buffer-name)
-    (let ((inhibit-read-only t)
-         (buffer-read-only nil))
-      (erase-buffer)
-      (setcdr (assoc (car wl-folder-entity) wl-folder-group-alist) t)
-      (save-excursion
-       (wl-folder-insert-entity " " wl-folder-entity)))
-    (set-buffer-modified-p nil)
-    (sit-for 0)
-    (setq initialize t))
-  (if (not arg)
-      (progn
-       (run-hooks 'wl-auto-check-folder-pre-hook)
-       (cond
-        ((eq wl-auto-check-folder-name 'none))
-        ((or (consp wl-auto-check-folder-name)
-             (stringp wl-auto-check-folder-name))
-         (let ((folder-list (if (consp wl-auto-check-folder-name)
-                                wl-auto-check-folder-name
-                              (list wl-auto-check-folder-name)))
-               entity)
-           (while folder-list
-             (if (setq entity (wl-folder-search-entity-by-name
-                               (car folder-list)
-                               wl-folder-entity))
-                 (wl-folder-check-entity entity 'auto))
-             (setq folder-list (cdr folder-list)))))
-        (t
-         (wl-folder-check-entity wl-folder-entity 'auto)))
-       (run-hooks 'wl-auto-check-folder-hook)))
-  initialize))
+    (if (get-buffer wl-folder-buffer-name)
+       (switch-to-buffer  wl-folder-buffer-name)
+      (switch-to-buffer (get-buffer-create wl-folder-buffer-name))
+      (wl-folder-mode)
+      (wl-folder-init)
+      (set-buffer wl-folder-buffer-name)
+      (let ((inhibit-read-only t)
+           (buffer-read-only nil))
+       (erase-buffer)
+       (setcdr (assoc (car wl-folder-entity) wl-folder-group-alist) t)
+       (save-excursion
+         (wl-folder-insert-entity " " wl-folder-entity)))
+      (set-buffer-modified-p nil)
+      ;(sit-for 0)
+      (setq initialize t))
+    initialize))
+
+(defun wl-folder-auto-check ()
+  "Check and update folders in `wl-auto-check-folder-name'."
+  (interactive)
+  (when (get-buffer wl-folder-buffer-name)
+    (switch-to-buffer  wl-folder-buffer-name)
+    (cond
+     ((eq wl-auto-check-folder-name 'none))
+     ((or (consp wl-auto-check-folder-name)
+         (stringp wl-auto-check-folder-name))
+      (let ((folder-list (if (consp wl-auto-check-folder-name)
+                            wl-auto-check-folder-name
+                          (list wl-auto-check-folder-name)))
+           entity)
+       (while folder-list
+         (if (setq entity (wl-folder-search-entity-by-name
+                           (car folder-list)
+                           wl-folder-entity))
+             (wl-folder-check-entity entity 'auto))
+         (setq folder-list (cdr folder-list)))))
+     (t
+      (wl-folder-check-entity wl-folder-entity 'auto)))))
 
 (defun wl-folder-set-folder-updated (name value)
   (save-excursion
@@ -1472,11 +1467,11 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
       (if (setq buf (get-buffer wl-folder-buffer-name))
          (wl-folder-entity-hashtb-set
           wl-folder-entity-hashtb name value buf))
-;;       (elmo-folder-set-info-hashtb (elmo-string name)
-;;                               nil
-;;                               (nth 2 value)
-;;                               (nth 0 value)
-;;                               (nth 1 value))
+;;      (elmo-folder-set-info-hashtb (elmo-string name)
+;;                                nil
+;;                                (nth 2 value)
+;;                                (nth 0 value)
+;;                                (nth 1 value))
       (setq wl-folder-info-alist-modified t))))
 
 (defun wl-folder-calc-finfo (entity)
@@ -1648,16 +1643,13 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
                  (setq new    (+ (or new 0) (or (nth 0 ret-val) 0)))
                  (setq unread (+ (or unread 0) (or (nth 1 ret-val) 0)))
                  (setq all    (+ (or all 0) (or (nth 2 ret-val) 0)))
-                 (when mes
+                 (when (and mes
+                            (> len elmo-display-progress-threshold))
                    (setq i (1+ i))
                    (elmo-display-progress
                     'wl-folder-insert-entity "Inserting group %s..."
                     (/ (* i 100) len) (car entity)))
-                 (setq flist (cdr flist)))
-               (when mes
-                 (elmo-display-progress
-                  'wl-folder-insert-entity "Inserting group %s..."
-                  100 (car entity))))
+                 (setq flist (cdr flist))))
              (save-excursion
                (goto-char group-name-end)
                (delete-region (point) (save-excursion (end-of-line)
@@ -1769,9 +1761,9 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
                (wl-folder-update-line newvalue)))))))))
 
 (defun wl-folder-create-entity-hashtb (entity &optional hashtb reconst)
-  (let* ((hashtb (or hashtb (elmo-make-hash wl-folder-entity-id)))
-        (entities (list entity))
-        entity-stack)
+  (let ((hashtb (or hashtb (elmo-make-hash wl-folder-entity-id)))
+       (entities (list entity))
+       entity-stack)
     (while entities
       (setq entity (wl-pop entities))
       (cond
@@ -1790,31 +1782,31 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
     hashtb))
 
 ;; Unsync number is reserved.
-;; (defun wl-folder-reconstruct-entity-hashtb (entity &optional hashtb id-name)
-;;   (let* ((hashtb (or hashtb (elmo-make-hash wl-folder-entity-id)))
-;;      (entities (list entity))
-;;      entity-stack)
-;;     (while entities
-;;       (setq entity (wl-pop entities))
-;;       (cond
-;;        ((consp entity)
-;;     (if id-name
-;;         (wl-folder-set-id-name (wl-folder-get-entity-id (car entity))
-;;                                (car entity)))
-;;     (and entities
-;;          (wl-push entities entity-stack))
-;;     (setq entities (nth 2 entity))
-;;     )
-;;        ((stringp entity)
-;;     (wl-folder-set-entity-info entity
-;;                          (wl-folder-get-entity-info entity)
-;;                          hashtb)
-;;     (if id-name
-;;         (wl-folder-set-id-name (wl-folder-get-entity-id entity)
-;;                                entity))))
-;;       (unless entities
-;;     (setq entities (wl-pop entity-stack))))
-;;     hashtb))
+;;(defun wl-folder-reconstruct-entity-hashtb (entity &optional hashtb id-name)
+;;  (let* ((hashtb (or hashtb (elmo-make-hash wl-folder-entity-id)))
+;;      (entities (list entity))
+;;      entity-stack)
+;;    (while entities
+;;      (setq entity (wl-pop entities))
+;;      (cond
+;;       ((consp entity)
+;;     (if id-name
+;;         (wl-folder-set-id-name (wl-folder-get-entity-id (car entity))
+;;                                (car entity)))
+;;     (and entities
+;;          (wl-push entities entity-stack))
+;;     (setq entities (nth 2 entity))
+;;     )
+;;       ((stringp entity)
+;;     (wl-folder-set-entity-info entity
+;;                                (wl-folder-get-entity-info entity)
+;;                                hashtb)
+;;     (if id-name
+;;         (wl-folder-set-id-name (wl-folder-get-entity-id entity)
+;;                                entity))))
+;;      (unless entities
+;;     (setq entities (wl-pop entity-stack))))
+;;    hashtb))
 
 (defun wl-folder-create-newsgroups-from-nntp-access2 (entity)
   (let ((flist (nth 2 entity))
@@ -1875,8 +1867,8 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
        (elmo-nntp-make-groups-hashtb folders))))
 
 (defun wl-folder-get-path (entity target-id &optional string)
-  (let* ((entities (list entity))
-        entity-stack result-path)
+  (let ((entities (list entity))
+       entity-stack result-path)
     (reverse
      (catch 'done
        (while entities
@@ -1905,8 +1897,9 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
 
 (defun wl-folder-create-group-alist (entity)
   (if (consp entity)
-      (let ((flist (nth 2 entity)) cur-alist append-alist)
-       (setq cur-alist (list (cons (car entity) nil)))
+      (let ((flist (nth 2 entity))
+           (cur-alist (list (cons (car entity) nil)))
+            append-alist)
        (while flist
          (if (consp (car flist))
              (wl-append append-alist
@@ -1957,8 +1950,9 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
                        wl-nntp-posting-server
                        elmo-default-nntp-port
                        nil nil "nntp" add))
-    (wl-plugged-init-icons)
-    ;; user setting
+    ;; This hook may contain the functions `wl-plugged-init-icons' and
+    ;; `wl-biff-init-icons' for reasons of system internal to accord
+    ;; facilities for the Emacs variants.
     (run-hooks 'wl-make-plugged-hook)))
 
 (defvar wl-folder-init-func 'wl-local-folder-init)
@@ -1970,8 +1964,9 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
 (defun wl-local-folder-init ()
   (message "Initializing folder...")
   (save-excursion
-    (let* ((entity (wl-folder-create-folder-entity))
-          (inhibit-read-only t))
+    (set-buffer wl-folder-buffer-name)
+    (let ((entity (wl-folder-create-folder-entity))
+         (inhibit-read-only t))
       (setq wl-folder-entity entity)
       (setq wl-folder-entity-id 0)
       (wl-folder-entity-assign-id wl-folder-entity)
@@ -1981,10 +1976,7 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
            (wl-folder-create-group-alist entity))
       (setq wl-folder-newsgroups-hashtb
            (wl-folder-create-newsgroups-hashtb wl-folder-entity))
-      (wl-folder-init-info-hashtb)
-      (setq wl-folder-buffer-cur-entity-id nil
-           wl-folder-buffer-cur-path nil
-           wl-folder-buffer-cur-point nil)))
+      (wl-folder-init-info-hashtb)))
   (message "Initializing folder...done."))
 
 (defun wl-folder-get-realname (petname)
@@ -2335,10 +2327,10 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
     (if refresh
        (let ((id (progn
                    (wl-folder-prev-entity-skip-invalid t)
-                   (wl-folder-get-entity-from-buffer t))))
-         (mapcar '(lambda (x)
-                    (setcdr x t))
-                 wl-folder-group-alist)
+                   (wl-folder-get-entity-from-buffer t)))
+             (alist wl-folder-group-alist))
+         (while alist
+           (setcdr (pop alist) t))
          (erase-buffer)
          (wl-folder-insert-entity " " wl-folder-entity)
          (wl-folder-move-path id))
@@ -2362,13 +2354,16 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
                                         (point))
                         (save-excursion (end-of-line)
                                         (+ 1 (point))))
-         (setq i (1+ i))
-         (and (zerop (% i 10))
-              (elmo-display-progress
-               'wl-folder-open-all "Opening all folders..."
-               (/ (* i 100) len))))))
-    (elmo-display-progress
-     'wl-folder-open-all "Opening all folders..." 100)
+         (when (> len elmo-display-progress-threshold)
+           (setq i (1+ i))
+           (if (or (zerop (% i 5)) (= i len))
+               (elmo-display-progress
+                'wl-folder-open-all "Opening all folders..."
+                (/ (* i 100) len)))))
+       (when (> len elmo-display-progress-threshold)
+         (elmo-display-progress
+          'wl-folder-open-all "Opening all folders..." 100))))
+    (message "Opening all folders...done.")
     (set-buffer-modified-p nil)))
 
 (defun wl-folder-close-all ()
@@ -2455,11 +2450,12 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
            (setq diff t)))
         (t
          (wl-append removes (list folder))))))
-      (setq i (1+ i))
-      (and (zerop (% i 10))
-          (elmo-display-progress
-           'wl-folder-update-access-group "Updating access group..."
-           (/ (* i 100) len)))
+      (when (> len elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (if (or (zerop (% i 10)) (= i len))
+           (elmo-display-progress
+            'wl-folder-update-access-group "Updating access group..."
+            (/ (* i 100) len))))
       (setq flist (cdr flist)))
     ;; check unsubscribed groups
     (while unsubscribes
@@ -2472,15 +2468,13 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
        (when (member (car unsubscribes) new-flist)
          (setq new-flist (delete (car unsubscribes) new-flist))
          (wl-append new-unsubscribes (list (car unsubscribes))))))
-      (setq i (1+ i))
-      (and (zerop (% i 10))
-          (elmo-display-progress
-           'wl-folder-update-access-group "Updating access group..."
-           (/ (* i 100) len)))
+      (when (> len elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (if (or (zerop (% i 10)) (= i len))
+           (elmo-display-progress
+            'wl-folder-update-access-group "Updating access group..."
+            (/ (* i 100) len))))
       (setq unsubscribes (cdr unsubscribes)))
-    (elmo-display-progress
-     'wl-folder-update-access-group "Updating access group..."
-     100)
     ;;
     (if (or new-flist removes)
        (setq diff t))
@@ -2515,7 +2509,7 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
        (setq new-list (cdr new-list))))
     (if new-flist
        (message "%d new folder(s)." (length new-flist))
-      (message "Updating access group...done"))
+      (message "Updating access group...done."))
     (wl-append new-flist subscribed-list)      ;; new is first
     (run-hooks 'wl-folder-update-access-group-hook)
     (setcdr (cdr entity) (list new-flist new-unsubscribes))
@@ -2549,7 +2543,8 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
          count)
       (setq count (or (car nums) 0))
       (setq count (+ count (wl-folder-count-incorporates entity)))
-      (if (< 0 count)
+      (if (or (null (car nums)) ; unknown
+             (< 0 count))
          (save-window-excursion
            (save-excursion
              (wl-summary-goto-folder-subr entity
@@ -2561,12 +2556,13 @@ Entering Folder mode calls the value of `wl-folder-mode-hook'."
        (cons 0 0))))))
 
 (defun wl-folder-count-incorporates (folder)
-  (let ((sum 0))
-    (mapcar '(lambda (x)
-              (if (member (cadr x)
-                          wl-summary-incorporate-marks)
-                  (incf sum)))
-           (elmo-msgdb-mark-load (elmo-msgdb-expand-path folder)))
+  (let ((marks (elmo-msgdb-mark-load (elmo-msgdb-expand-path folder)))
+       (sum 0))
+    (while marks
+      (if (member (cadr (car marks))
+                 wl-summary-incorporate-marks)
+         (incf sum))
+      (setq marks (cdr marks)))
     sum))
 
 (defun wl-folder-prefetch-current-entity (&optional no-check)
@@ -2646,39 +2642,30 @@ If optional arg exists, don't check any folders."
        (wl-exit)
       (kill-buffer bufname))))
 
-(defun wl-folder-confirm-existence (fld &optional ignore-error)
-  (if (or (wl-folder-entity-exists-p fld)
-         (file-exists-p (elmo-msgdb-expand-path fld)))
-      ()
-    (if ignore-error
-       (condition-case nil
-           (if (elmo-folder-exists-p fld)
-               ()
-             (if (elmo-folder-creatable-p fld)
-                 (if (y-or-n-p
-                      (format "Folder %s does not exist, create it?" fld))
-                     (progn
-                       (setq wl-folder-entity-hashtb
-                             (wl-folder-create-entity-hashtb
-                              fld
-                              wl-folder-entity-hashtb))
-                       (elmo-create-folder fld)))))
-         (error))
-      (if (elmo-folder-exists-p fld)
-         ()
-       (if (not (elmo-folder-creatable-p fld))
-           (error "Folder %s is not found" fld)
-         (if (y-or-n-p
-              (format "Folder %s does not exist, create it?" fld))
-             (progn
-               (setq wl-folder-entity-hashtb
-                     (wl-folder-create-entity-hashtb
-                      fld
-                      wl-folder-entity-hashtb))
-               (unless (elmo-create-folder fld)
-                 (error "Create folder failed")))
-           (error "Folder is not created")))))))
-
-(provide 'wl-folder)
+(defun wl-folder-create-subr (entity)
+  (if (not (elmo-folder-creatable-p entity))
+      (error "Folder %s is not found" entity)
+    (if (y-or-n-p
+        (format "Folder %s does not exist, create it?"
+                entity))
+       (progn
+         (setq wl-folder-entity-hashtb
+               (wl-folder-create-entity-hashtb
+                entity wl-folder-entity-hashtb))
+         (unless (elmo-create-folder entity)
+           (error "Create folder failed")))
+      (error "Folder %s is not created" entity))))
+
+(defun wl-folder-confirm-existence (folder &optional force)
+  (if force
+      (unless (elmo-folder-exists-p folder)
+       (wl-folder-create-subr folder))
+    (unless (or (wl-folder-entity-exists-p folder)
+               (file-exists-p (elmo-msgdb-expand-path folder))
+               (elmo-folder-exists-p folder))
+      (wl-folder-create-subr folder))))
+
+(require 'product)
+(product-provide (provide 'wl-folder) (require 'wl-version))
 
 ;;; wl-folder.el ends here
index 551e332..b3e105b 100644 (file)
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
 (if (and (featurep 'xemacs)
         (featurep 'dragdrop))
     (require 'wl-dnd))
 (require 'wl-vars)
-(provide 'wl-highlight)
+(require 'product)
+(product-provide (provide 'wl-highlight) (require 'wl-version))
 
 (eval-when-compile
-  (if wl-on-xemacs
-      (require 'wl-xmas)
-    (if wl-on-nemacs
-       (require 'wl-nemacs)
-      (require 'wl-mule)))
+  (cond (wl-on-xemacs
+        (require 'wl-xmas))
+       (wl-on-emacs21
+        (require 'wl-e21))
+       (wl-on-nemacs
+        (require 'wl-nemacs))
+       (t
+        (require 'wl-mule)))
   (defun-maybe extent-begin-glyph (a))
   (defun-maybe delete-extent (a))
   (defun-maybe make-extent (a b))
       () ; noop
     (` (defun (, name) (,@ everything-else)))))
 
+(defmacro wl-delete-all-overlays ()
+  "Delete all momentary overlays."
+  (if wl-on-nemacs
+      nil
+    '(let ((overlays (overlays-in (point-min) (point-max)))
+          overlay)
+       (while (setq overlay (car overlays))
+        (if (overlay-get overlay 'wl-momentary-overlay)
+            (delete-overlay overlay))
+        (setq overlays (cdr overlays))))))
+
 (defun-hilit wl-highlight-summary-displaying ()
   (interactive)
   (wl-delete-all-overlays)
       (setq bol (point))
       (save-excursion (end-of-line) (setq eol (point)))
       (setq ov (make-overlay bol eol))
-      (overlay-put ov 'face 'wl-highlight-summary-displaying-face))))
+      (overlay-put ov 'face 'wl-highlight-summary-displaying-face)
+      (overlay-put ov 'evaporate t)
+      (overlay-put ov 'wl-momentary-overlay t))))
 
 (defun-hilit2 wl-highlight-folder-group-line (numbers)
-  (if wl-highlight-group-folder-by-numbers
-      (let (fsymbol bol eol)
-       (beginning-of-line)
-       (setq bol (point))
-       (save-excursion (end-of-line) (setq eol (point)))
-       (setq fsymbol
-             (let ((unsync (nth 0 numbers))
-                   (unread (nth 1 numbers)))
-               (cond ((and unsync (eq unsync 0))
-                      (if (and unread (> unread 0))
-                          'wl-highlight-folder-unread-face
-                        'wl-highlight-folder-zero-face))
-                     ((and unsync
-                           (>= unsync wl-folder-many-unsync-threshold))
-                      'wl-highlight-folder-many-face)
-                     (t
-                      'wl-highlight-folder-few-face))))
-       (put-text-property bol eol 'face fsymbol))
-    (let ((highlights (list "opened" "closed"))
-         fregexp fsymbol bol eol matched type extent num type)
-      (beginning-of-line)
-      (setq bol (point))
-      (save-excursion (end-of-line) (setq eol (point)))
-      (catch 'highlighted
-       (while highlights
-         (setq fregexp (symbol-value
-                        (intern (format "wl-highlight-folder-%s-regexp"
-                                        (car highlights)))))
-         (setq fsymbol (intern (format "wl-highlight-folder-%s-face"
-                                       (car highlights))))
-         (when (looking-at fregexp)
-           (put-text-property bol eol 'face fsymbol)
-           (setq matched t)
-           (throw 'highlighted nil))
-         (setq highlights (cdr highlights)))))))
+  (end-of-line)
+  (let ((eol (point))
+       bol)
+    (beginning-of-line)
+    (setq bol (point))
+    (let ((text-face (cond ((looking-at wl-highlight-folder-opened-regexp)
+                           'wl-highlight-folder-opened-face)
+                          ((looking-at wl-highlight-folder-closed-regexp)
+                           'wl-highlight-folder-closed-face))))
+      (if (and wl-highlight-folder-by-numbers
+              (re-search-forward "[0-9-]+/[0-9-]+/[0-9-]+" eol t))
+         (let* ((unsync (nth 0 numbers))
+                (unread (nth 1 numbers))
+                (face (cond ((and unsync (zerop unsync))
+                             (if (and unread (> unread 0))
+                                 'wl-highlight-folder-unread-face
+                               'wl-highlight-folder-zero-face))
+                            ((and unsync
+                                  (>= unsync wl-folder-many-unsync-threshold))
+                             'wl-highlight-folder-many-face)
+                            (t
+                             'wl-highlight-folder-few-face))))
+           (if (numberp wl-highlight-folder-by-numbers)
+               (progn
+                 (put-text-property bol (match-beginning 0) 'face text-face)
+                 (put-text-property (match-beginning 0) (match-end 0)
+                                    'face face))
+             ;; Remove previous face.
+             (put-text-property bol (match-end 0) 'face nil)
+             (put-text-property bol (match-end 0) 'face face)))
+       (put-text-property bol eol 'face text-face)))))
 
 (defun-hilit2 wl-highlight-summary-line-string (line mark temp-mark indent)
   (let (fsymbol)
     (put-text-property 0 (length line) 'face fsymbol line))
   (if wl-use-highlight-mouse-line
       (put-text-property 0 (length line) 'mouse-face 'highlight line)))
-  
+
 (defun-hilit2 wl-highlight-summary-current-line (&optional smark regexp temp-too)
   (interactive)
   (save-excursion
                    wl-summary-buffer-number-regexp
                    "\\(.\\)\\(.\\)../..\(.*\)..:.. \\("
                    wl-highlight-thread-indent-string-regexp
-                   "\\)\\["))
+                   "\\)[[<]"))
          fregexp fsymbol bol eol matched thread-top looked-at)
       (beginning-of-line)
       (setq bol (point))
@@ -921,12 +934,6 @@ Variables used:
            (wl-highlight-folder-current-line)
            (forward-line 1)))))))
 
-(if (not wl-on-nemacs)
-    (defsubst wl-delete-all-overlays ()
-      (mapcar (lambda (x)
-               (delete-overlay x))
-             (overlays-in (point-min) (point-max)))))
-
 (defun-hilit2 wl-highlight-folder-path (folder-path)
   "Highlight current folder path...overlay"
   (save-excursion
@@ -946,7 +953,9 @@ Variables used:
                    (match-beginning 1)
                    (match-end 1)))
          (setq wl-folder-buffer-cur-point (point))
-         (overlay-put ov 'face 'wl-highlight-folder-path-face))
+         (overlay-put ov 'face 'wl-highlight-folder-path-face)
+         (overlay-put ov 'evaporate t)
+         (overlay-put ov 'wl-momentary-overlay t))
        (forward-line 1)))))
 
 (defun-hilit2 wl-highlight-refile-destination-string (string)
@@ -958,7 +967,7 @@ Variables used:
   "For evaluation"
   (interactive)
   (wl-highlight-summary (point-min)(point-max)))
-  
+
 (defun-hilit2 wl-highlight-summary (start end)
   "Highlight summary between start and end.
 Faces used:
@@ -999,24 +1008,52 @@ interpreted as cited text.)"
              (setq i 0)
              (while (not (eobp))
                (wl-highlight-summary-current-line nil nil wl-summary-scored)
-               (setq i (+ i 1))
-               (setq percent (/ (* i 100) lines))
-               (if (eq (% percent 5) 0)
-                   (elmo-display-progress
-                    'wl-highlight-summary "Highlighting..."
-                    percent))
+               (when (> lines elmo-display-progress-threshold)
+                 (setq i (+ i 1))
+                 (setq percent (/ (* i 100) lines))
+                 (if (or (eq (% percent 5) 0) (= i lines))
+                     (elmo-display-progress
+                      'wl-highlight-summary "Highlighting..."
+                      percent)))
                (forward-line 1))
              (message "Highlighting...done.")))))))
 
 (defun wl-highlight-headers ()
   (let ((beg (point-min))
-       (end (or (save-excursion (re-search-forward "^$" nil t))
+       (end (or (save-excursion (re-search-forward "^$" nil t)
+                                (point))
                 (point-max))))
     (wl-highlight-message beg end nil)
+    (wl-highlight-message-add-buttons-to-header beg end)
     (and wl-highlight-x-face-func
         (funcall wl-highlight-x-face-func beg end))
     (run-hooks 'wl-highlight-headers-hook)))
 
+(defun wl-highlight-message-add-buttons-to-header (start end)
+  (save-excursion
+    (save-restriction
+      (narrow-to-region start end)
+      (let ((case-fold-search t)
+           (alist wl-highlight-message-header-button-alist)
+           entry)
+       (while alist
+         (setq entry (car alist)
+               alist (cdr alist))
+         (goto-char (point-min))
+         (while (re-search-forward (car entry) nil t)
+           (setq start (match-beginning 0)
+                 end (if (re-search-forward "^[^ \t]" nil t)
+                         (match-beginning 0)
+                       (point-max)))
+           (goto-char start)
+           (while (re-search-forward (nth 1 entry) end t)
+             (goto-char (match-end 0))
+             (wl-message-add-button
+              (match-beginning (nth 2 entry))
+              (match-end (nth 2 entry))
+              (nth 3 entry) (match-string (nth 4 entry))))
+           (goto-char end)))))))
+
 (defun wl-highlight-body-all ()
   (wl-highlight-message (point-min) (point-max) t t))
 
@@ -1152,13 +1189,13 @@ interpreted as cited text.)"
                (put-text-property
                 (match-beginning 2) (match-end 2)
                 'face 'wl-highlight-message-header-contents)))
-             (goto-char hend))
+             (goto-char hend))
             ((looking-at mail-header-separator)
              (put-text-property (match-beginning 0) (match-end 0)
                                 'face 'wl-highlight-header-separator-face)
              (goto-char (match-end 0)))
-            ;; ignore non-header field name lines
-            (t (forward-line 1)))))
+            ;; ignore non-header field name lines
+            (t (forward-line 1)))))
        ;; now do the body, unless it's too big....
        (if too-big
            nil
index f323d3b..c1c7684 100644 (file)
        (require 'mime-view)
        (require 'mmelmo-imap4))
     (require 'tm-wl))
-  (mapcar
-   (function
-    (lambda (symbol)
-      (unless (boundp symbol)
-       (set (make-local-variable symbol) nil))))
-   '(mime-view-ignored-field-list mmelmo-imap4-skipped-parts))
-  (defun-maybe event-window (a))
-  (defun-maybe posn-window (a))
-  (defun-maybe event-start (a))
-  (defun-maybe mime-open-entity (a b)))
+  (defalias-maybe 'event-window 'ignore)
+  (defalias-maybe 'posn-window 'ignore)
+  (defalias-maybe 'event-start 'ignore)
+  (defalias-maybe 'mime-open-entity 'ignore))
 
 (defvar wl-original-buf-name "*Message*")
 (defvar wl-message-buf-name "Message")
 (defvar wl-original-buffer-cur-number nil)
 (defvar wl-original-buffer-cur-msgdb  nil)
 
-(mapcar
- (function make-variable-buffer-local)
- (list 'wl-message-buffer-cur-folder
-       'wl-message-buffer-cur-number))
+(defvar mmelmo-imap4-skipped-parts)
 
-(provide 'wl-message)
+(make-variable-buffer-local 'wl-message-buffer-cur-folder)
+(make-variable-buffer-local 'wl-message-buffer-cur-number)
+
+(require 'product)
+(product-provide (provide 'wl-message) (require 'wl-version))
 
 (defvar wl-fixed-window-configuration nil)
 
        (setq wl-message-buffer-cur-summary-buffer sum-buf)))))
 
 (defun wl-message-normal-get-original-buffer ()
-  (let (ret-val)
-    (if (setq ret-val (get-buffer wl-original-buf-name))
-       ret-val
-      (set-buffer (setq ret-val
-                       (get-buffer-create wl-original-buf-name)))
-      (wl-message-original-mode)
-      ret-val)))
+  (let ((ret-val (get-buffer wl-original-buf-name)))
+    (if (not ret-val)
+       (save-excursion
+         (set-buffer (setq ret-val
+                           (get-buffer-create wl-original-buf-name)))
+         (wl-message-original-mode)))
+    ret-val))
 
 
 (if wl-use-semi
         (message-id (cdr (assq number
                                (elmo-msgdb-get-number-alist msgdb))))
         (size (elmo-msgdb-overview-entity-get-size
-               (assoc message-id
-                      (elmo-msgdb-get-overview msgdb))))
+               (elmo-msgdb-overview-get-entity number msgdb)))
         (backend (wl-message-decide-backend folder number message-id size))
         cur-entity ret-val header-end real-fld-num summary-win)
     (require 'mmelmo)
          (erase-buffer)
          (if backend
              (let (mime-display-header-hook ;; bind to nil...
-                   (mime-view-ignored-field-list
+                   (wl-message-ignored-field-list
                     (if (eq flag 'all-header)
                         nil
-                      mime-view-ignored-field-list))
+                      wl-message-ignored-field-list))
                    (mmelmo-force-reload force-reload)
                    (mmelmo-imap4-threshold wl-fetch-confirm-threshold))
                (setq real-fld-num (elmo-get-real-folder-number
         (message-id (cdr (assq number
                                (elmo-msgdb-get-number-alist msgdb))))
         (size (elmo-msgdb-overview-entity-get-size
-               (assoc message-id
-                      (elmo-msgdb-get-overview msgdb))))
-        header-end ret-val summary-win
-        )
+               (elmo-msgdb-overview-get-entity number msgdb)))
+        header-end ret-val summary-win)
     (wl-select-buffer view-message-buffer)
     (unwind-protect
        (progn
       ret-val
       )))
 
+(defvar wl-message-button-map (make-sparse-keymap))
+
+(defun wl-message-add-button (from to function &optional data)
+  "Create a button between FROM and TO with callback FUNCTION and DATA."
+  (add-text-properties
+   from to
+   (nconc (list 'mouse-face 'highlight)
+         (list 'local-map wl-message-button-map)
+         (list 'wl-message-button-callback function)
+         (if data
+             (list 'wl-message-button-data data)))))
+
+(defun wl-message-button-dispatcher (event)
+  "Select the button under point."
+  (interactive "@e")
+  (mouse-set-point event)
+  (let ((callback (get-text-property (point) 'wl-message-button-callback))
+       (data (get-text-property (point) 'wl-message-button-data)))
+    (if callback
+       (funcall callback data)
+      (wl-message-button-dispatcher-internal event))))
+
+(defun wl-message-button-refer-article (data)
+  "Read article specified by Message-ID DATA at point."
+  (switch-to-buffer-other-window
+   wl-message-buffer-cur-summary-buffer)
+  (if (wl-summary-jump-to-msg-by-message-id data)
+      (wl-summary-redisplay)))
+
 (defun wl-message-refer-article-or-url (e)
   "Read article specified by message-id around point. If failed,
    attempt to execute button-dispatcher."
                 wl-message-buffer-cur-summary-buffer)
                (if (wl-summary-jump-to-msg-by-message-id msg-id)
                    (wl-summary-redisplay)))
-           (wl-message-button-dispatcher e)))
+           (wl-message-button-dispatcher-internal e)))
       (if (eq mouse-window (get-buffer-window (current-buffer)))
          (select-window window)))))
 
     (search-forward "\n\n")
     (let ((sp (point))
          ep filename case-fold-search)
-      (if first
-         (progn
-           (re-search-forward "^begin[ \t]+[0-9]+[ \t]+\\([^ ].*\\)" nil t)
-           (setq filename (buffer-substring (match-beginning 1)(match-end 1))))
-       (re-search-forward "^M.*$" nil t)) ; uuencoded string
-      (beginning-of-line)
-      (setq sp (point))
-      (goto-char (point-max))
-      (if last
-         (re-search-backward "^end" sp t)
-        (re-search-backward "^M.*$" sp t)) ; uuencoded string
-      (forward-line 1)
-      (setq ep (point))
-      (set-buffer outbuf)
-      (goto-char (point-max))
-      (insert-buffer-substring buf sp ep)
-      (set-buffer buf)
-      filename)))
+      (catch 'done
+       (if first
+           (progn
+             (if (re-search-forward "^begin[ \t]+[0-9]+[ \t]+\\([^ ].*\\)" nil t)
+                 (setq filename (buffer-substring (match-beginning 1)(match-end 1)))
+               (throw 'done nil)))
+         (re-search-forward "^M.*$" nil t)) ; uuencoded string
+       (beginning-of-line)
+       (setq sp (point))
+       (goto-char (point-max))
+       (if last
+           (re-search-backward "^end" sp t)
+         (re-search-backward "^M.*$" sp t)) ; uuencoded string
+       (forward-line 1)
+       (setq ep (point))
+       (set-buffer outbuf)
+       (goto-char (point-max))
+       (insert-buffer-substring buf sp ep)
+       (set-buffer buf)
+       filename))))
 
 ;;; wl-message.el ends here
+
+
index 2682bca..c4b291c 100644 (file)
 (require 'mmelmo)
 
 (eval-when-compile
-  (defun-maybe Meadow-version ())
-  (mapcar
-   (function
-    (lambda (symbol)
-      (unless (boundp symbol)
-       (set (make-local-variable symbol) nil))))
-   '(xemacs-betaname
-     xemacs-codename
-     enable-multibyte-characters
-     mule-version)))
+  (defalias-maybe 'Meadow-version 'ignore))
+
+(defvar xemacs-betaname)
+(defvar xemacs-codename)
+(defvar enable-multibyte-characters)
+(defvar mule-version)
 
 ;;; Draft
 
@@ -202,7 +198,8 @@ By setting following-method as yank-content."
 (defalias 'wl-message-play-content    'mime-preview-play-current-entity)
 (defalias 'wl-message-extract-content 'mime-preview-extract-current-entity)
 (defalias 'wl-message-quit            'mime-preview-quit)
-(defalias 'wl-message-button-dispatcher 'mime-button-dispatcher)
+(defalias 'wl-message-button-dispatcher-internal
+  'mime-button-dispatcher)
 
 ;;; Summary
 (defun wl-summary-burst-subr (children target number)
@@ -220,13 +217,10 @@ By setting following-method as yank-content."
           (message (format "Bursting...%s" (setq number (+ 1 number))))
           (setq message-entity
                 (car (mime-entity-children (car children))))
-          (save-restriction
-            (narrow-to-region (mime-entity-point-min message-entity)
-                              (mime-entity-point-max message-entity))
-            (elmo-append-msg target
-                             ;;(mime-entity-content (car children))))
-                             (buffer-substring (point-min) (point-max))
-                             (std11-field-body "Message-ID")))))
+         (elmo-append-msg target
+                          (mime-entity-body (car children))
+                          (mime-entity-fetch-field message-entity
+                                                   "Message-ID"))))
       (setq children (cdr children)))
     number))
 
@@ -324,6 +318,13 @@ automatically."
          (setq overviews (cdr overviews)))
        (message "Not all partials found.")))))
 
+(defun wl-mime-header-presentation-method (entity situation)
+  (let ((mmelmo-sort-field-list wl-message-sort-field-list))
+    (mime-insert-header entity
+                       wl-message-ignored-field-list
+                       wl-message-visible-field-list)
+    (wl-highlight-headers)))
+
 ;;; Setup methods.
 (defun wl-mime-setup ()
   (set-alist 'mime-preview-quitting-method-alist
@@ -366,11 +367,19 @@ automatically."
   (set-alist 'mime-raw-representation-type-alist
             'mmelmo-original-mode 'binary)
   ;; Sort and highlight header fields.
-  (setq mmelmo-sort-field-list wl-message-sort-field-list)
-  (add-hook 'mmelmo-header-inserted-hook 'wl-highlight-headers)
+  (or wl-message-ignored-field-list
+      (setq wl-message-ignored-field-list
+           mime-view-ignored-field-list))
+  (or wl-message-visible-field-list
+      (setq wl-message-visible-field-list
+           mime-view-visible-field-list))
+  (set-alist 'mime-header-presentation-method-alist
+            'mmelmo-original-mode
+            (function wl-mime-header-presentation-method))
   (add-hook 'mmelmo-entity-content-inserted-hook 'wl-highlight-body))
   
 
-(provide 'wl-mime)
+(require 'product)
+(product-provide (provide 'wl-mime) (require 'wl-version))
 
 ;;; wl-mime.el ends here
index 900bf78..3d0e40a 100644 (file)
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
 (eval-when-compile
   (require 'wl-folder)
@@ -53,72 +53,62 @@ Special commands:
   "Highlight current folder line."
   (interactive)
   (save-excursion
-    (let ((highlights (list "opened" "closed"))
+    (end-of-line)
+    (let ((end (point))
+         (start (progn (beginning-of-line) (point)))
          (inhibit-read-only t)
-         (fld-name (wl-folder-get-folder-name-by-id
-                    (get-text-property (point) 'wl-folder-entity-id)))
-         fregexp fsymbol bol eol matched type extent num type)
-      (beginning-of-line)
-      (setq bol (point))
-      (save-excursion (end-of-line) (setq eol (point)))
-      (if (and numbers (nth 0 numbers) (nth 1 numbers))
-         (progn
-           (setq fsymbol
-                 (let ((unsync (nth 0 numbers))
-                       (unread (nth 1 numbers)))
-                   (cond ((and unsync (eq unsync 0))
-                          (if (and unread (> unread 0))
-                              'wl-highlight-folder-unread-face
-                            'wl-highlight-folder-zero-face))
-                         ((and unsync
-                               (>= unsync wl-folder-many-unsync-threshold))
-                          'wl-highlight-folder-many-face)
-                         (t
-                          'wl-highlight-folder-few-face))))
-           (put-text-property bol eol 'face fsymbol)
-           (setq matched t)))
-      (catch 'highlighted
-       (while highlights
-         (setq fregexp (symbol-value
-                        (intern (format "wl-highlight-folder-%s-regexp"
-                                        (car highlights)))))
-         (if (not wl-highlight-group-folder-by-numbers)
-             (setq fsymbol (intern (format "wl-highlight-folder-%s-face"
-                                           (car highlights)))))
-         (when (looking-at fregexp)
-           (put-text-property bol eol 'face fsymbol)
-           (setq matched t)
-           (throw 'highlighted nil))
-         (setq highlights (cdr highlights))))
-      (if (not matched)
-         (if (looking-at (format "^[ ]*\\(%s\\|%s\\)"
-                                 wl-folder-unsubscribe-mark
-                                 wl-folder-removed-mark))
-             (put-text-property bol eol 'face
-                                'wl-highlight-folder-killed-face)
-           (put-text-property bol eol 'face
-                              'wl-highlight-folder-unknown-face)))
-      (if wl-use-highlight-mouse-line
-         (wl-highlight-folder-mouse-line)))))
-  
+         (text-face
+          (cond ((looking-at wl-highlight-folder-opened-regexp)
+                 'wl-highlight-folder-opened-face)
+                ((looking-at wl-highlight-folder-closed-regexp)
+                 'wl-highlight-folder-closed-face)
+                (t
+                 (if (looking-at (format "^[ \t]*\\(%s\\|%s\\)"
+                                         wl-folder-unsubscribe-mark
+                                         wl-folder-removed-mark))
+                     'wl-highlight-folder-killed-face
+                   'wl-highlight-folder-unknown-face)))))
+      (if (and wl-highlight-folder-by-numbers
+              numbers (nth 0 numbers) (nth 1 numbers)
+              (re-search-forward "[0-9-]+/[0-9-]+/[0-9-]+" end t))
+         (let* ((unsync (nth 0 numbers))
+                (unread (nth 1 numbers))
+                (face (cond
+                       ((and unsync (zerop unsync))
+                        (if (and unread (zerop unread))
+                            'wl-highlight-folder-zero-face
+                          'wl-highlight-folder-unread-face))
+                       ((and unsync
+                             (>= unsync wl-folder-many-unsync-threshold))
+                        'wl-highlight-folder-many-face)
+                       (t
+                        'wl-highlight-folder-few-face))))
+           (if (numberp wl-highlight-folder-by-numbers)
+               (progn
+                 (put-text-property start (match-beginning 0) 'face text-face)
+                 (put-text-property (match-beginning 0) (point) 'face face))
+             ;; Remove previous face.
+             (put-text-property start (point) 'face nil)
+             (put-text-property start (point) 'face face))
+           (goto-char start))
+       (put-text-property start end 'face text-face)))
+    (when wl-use-highlight-mouse-line
+      (wl-highlight-folder-mouse-line))))
+
 (defun wl-highlight-plugged-current-line ())
 (defun wl-plugged-set-folder-icon (folder string)
   string)
 
-(defun wl-folder-init-icons ()) ; dummy.
-(defun wl-plugged-init-icons ()) ; dummy.
-
-(defun wl-xmas-setup-folder ()) ; dummy
-(defun wl-xmas-setup-summary ())
-(defun wl-xmas-setup-draft-toolbar ())
-
 (defun wl-message-overload-functions ()
   (local-set-key "l" 'wl-message-toggle-disp-summary)
   (local-set-key [mouse-2] 'wl-message-refer-article-or-url)
   (local-set-key [mouse-4] 'wl-message-wheel-down)
   (local-set-key [mouse-5] 'wl-message-wheel-up)
   (local-set-key [S-mouse-4] 'wl-message-wheel-down)
-  (local-set-key [S-mouse-5] 'wl-message-wheel-up))
+  (local-set-key [S-mouse-5] 'wl-message-wheel-up)
+  (set-keymap-parent wl-message-button-map (current-local-map))
+  (define-key wl-message-button-map [mouse-2]
+    'wl-message-button-dispatcher))
 
 (defun wl-message-wheel-up (event)
   (interactive "e")
@@ -183,14 +173,9 @@ Special commands:
     '("FCC" . wl-draft-fcc)))
 
 (defun wl-draft-overload-functions ()
-  (setq mode-line-buffer-identification
-       (format "Wanderlust: %s" (buffer-name)))
-  (local-set-key "\C-c\C-s" 'wl-draft-send)    ; override
-  (wl-draft-overload-menubar)
-  (when wl-show-plug-status-on-modeline
-    (setq mode-line-format (wl-make-modeline))))
-
-(defalias 'wl-make-modeline 'wl-make-modeline-subr)
+  (wl-mode-line-buffer-identification)
+  (local-set-key "\C-c\C-s" 'wl-draft-send);; override
+  (wl-draft-overload-menubar))
 
 ;; for "ja-mule-canna-2.3.mini" on PocketBSD
 (defun-maybe make-face (a))
@@ -293,6 +278,7 @@ Warning: Unknown req `%S' with options `%S'" req options))
                             nil))))
        match)))))
 
-(provide 'wl-mule)
+(require 'product)
+(product-provide (provide 'wl-mule) (require 'wl-version))
 
 ;;; wl-mule.el ends here
index 38e0e48..fa0f2d0 100644 (file)
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
-
-(defun wl-xmas-setup-folder ()) ; dummy
-(defun wl-xmas-setup-summary ())
-(defun wl-xmas-setup-draft-toolbar ())
+;;
 
-(defun wl-summary-setup-mouse ())
 (defun wl-message-overload-functions ()
   (local-set-key "l" 'wl-message-toggle-disp-summary))
 
 (defun wl-highlight-summary-line-string (line mark indent before-indent))
 (defun wl-highlight-body-region (beg end))
 (defun wl-highlight-message (start end hack-sig &optional body-only))
-(defun wl-delete-all-overlays ())
 (defun wl-highlight-summary-current-line (&optional smark regexp temp-too))
 
 (defun wl-highlight-plugged-current-line ())
 (defun wl-plugged-set-folder-icon (folder string)
   string)
 
-(defun wl-folder-init-icons ()) ; dummy.
-(defun wl-plugged-init-icons ()) ; dummy.
-
 (defmacro wl-defface (face spec doc &rest args)
   (` (defvar (, face) (, spec) (, doc))))
 
@@ -75,8 +66,7 @@
   (list (cons t (mime-charset-to-coding-system default-mime-charset))))
 
 (defun wl-draft-overload-functions ()
-  (setq mode-line-buffer-identification
-       (format "Wanderlust: %s" (buffer-name)))
+  (wl-mode-line-buffer-identification)
   (local-set-key "\C-c\C-y" 'wl-draft-yank-original)
   (local-set-key "\C-c\C-s" 'wl-draft-send)
   (local-set-key "\C-c\C-a" 'wl-draft-insert-x-face-field)
   (local-set-key "\C-c\C-j" 'wl-template-select)
   (local-set-key "\C-c\C-p" 'wl-draft-preview-message)
   (local-set-key "\C-x\C-s" 'wl-draft-save)
-  (local-set-key "\C-xk"    'wl-draft-mimic-kill-buffer)
-  (when wl-show-plug-status-on-modeline
-    (set (make-variable-buffer-local 'mode-line-format) (wl-make-modeline))))
-
-(defalias 'wl-make-modeline 'wl-make-modeline-subr)
+  (local-set-key "\C-xk"    'wl-draft-mimic-kill-buffer))
 
 ;;; Emulations.
 
@@ -166,6 +152,7 @@ However, if `mail-yank-prefix' is non-nil, insert that prefix on each line."
 ;; a dead duck... We MUST re-load it certainly.
 (load-library "poe-18")
 
-(provide 'wl-nemacs)
+(require 'product)
+(product-provide (provide 'wl-nemacs) (require 'wl-version))
 
 ;;; wl-nemacs.el ends here
index b7cc69a..ccecc93 100644 (file)
 
 (require 'wl-vars)
 (require 'wl-util)
-(provide 'wl-refile)
-
+(require 'product)
+(product-provide (provide 'wl-refile) (require 'wl-version))
 
 (defvar wl-refile-alist nil)
 (defvar wl-refile-alist-file-name "refile-alist")
 ;; should be renamed to "refile-from-alist"
 (defvar wl-refile-msgid-alist nil)
 (defvar wl-refile-msgid-alist-file-name "refile-msgid-alist")
+(defvar wl-refile-subject-alist nil)
+(defvar wl-refile-subject-alist-file-name "refile-subject-alist")
 
 (defvar wl-refile-alist-max-length 1000)
 
 (defun wl-refile-alist-setup ()
-  (setq wl-refile-alist
-       (elmo-object-load
-        (expand-file-name wl-refile-alist-file-name
-                          elmo-msgdb-dir)))
-  (setq wl-refile-msgid-alist
-       (elmo-object-load
-        (expand-file-name wl-refile-msgid-alist-file-name
-                          elmo-msgdb-dir))))
+  (let ((flist wl-refile-guess-func-list))
+    (while flist
+      (cond
+       ((eq (car flist) 'wl-refile-guess-by-history)
+       (setq wl-refile-alist
+             (elmo-object-load
+              (expand-file-name wl-refile-alist-file-name
+                                elmo-msgdb-dir) elmo-mime-charset)))
+       ((eq (car flist) 'wl-refile-guess-by-msgid)
+       (setq wl-refile-msgid-alist
+             (elmo-object-load
+              (expand-file-name wl-refile-msgid-alist-file-name
+                                elmo-msgdb-dir) elmo-mime-charset)))
+       ((eq (car flist) 'wl-refile-guess-by-subject)
+       (setq wl-refile-subject-alist
+             (elmo-object-load
+              (expand-file-name wl-refile-subject-alist-file-name
+                                elmo-msgdb-dir) elmo-mime-charset))))
+      (setq flist (cdr flist)))))
+
+(defun wl-refile-alist-save ()
+  (if wl-refile-alist
+      (wl-refile-alist-save-file
+       wl-refile-alist-file-name wl-refile-alist))
+  (if wl-refile-msgid-alist
+      (wl-refile-alist-save-file
+       wl-refile-msgid-alist-file-name wl-refile-msgid-alist))
+  (if wl-refile-subject-alist
+      (wl-refile-alist-save-file
+       wl-refile-subject-alist-file-name wl-refile-subject-alist)))
 
-(defun wl-refile-alist-save (file-name alist)
-  (save-excursion
-    (let ((filename (expand-file-name file-name
-                                     elmo-msgdb-dir))
-         (tmp-buffer (get-buffer-create " *wl-refile-alist-tmp*")))
-      (set-buffer tmp-buffer)
-      (erase-buffer)
-      (if (> (length alist) wl-refile-alist-max-length)
-         (setcdr (nthcdr (1- wl-refile-alist-max-length) alist) nil))
-      (prin1 alist tmp-buffer)
-      (princ "\n" tmp-buffer)
-      (if (file-writable-p filename)
-         (write-region (point-min) (point-max)
-                       filename nil 'no-msg)
-       (message (format "%s is not writable." filename)))
-      (kill-buffer tmp-buffer))))
+(defun wl-refile-alist-save-file (file-name alist)
+  (if (> (length alist) wl-refile-alist-max-length)
+      (setcdr (nthcdr (1- wl-refile-alist-max-length) alist) nil))
+  (elmo-object-save (expand-file-name file-name elmo-msgdb-dir)
+                   alist elmo-mime-charset))
 
 (defun wl-refile-learn (entity dst)
   (let (tocc-list from key hit ml)
                  (wl-address-header-extract-address
                   (elmo-msgdb-overview-entity-get-from
                    entity)))))
-         (setq key from)))
-    (if (not ml)
-       (wl-refile-msgid-learn entity dst))
-    (if key
-       (if (setq hit (assoc key wl-refile-alist))
-           (setcdr hit dst)
-         (setq wl-refile-alist
-               (nconc wl-refile-alist (list (cons key dst))))))))
+         (setq key from))
+      (if (or wl-refile-msgid-alist
+             (memq 'wl-refile-guess-by-msgid
+                   wl-refile-guess-func-list))
+         (wl-refile-msgid-learn entity dst))
+      (if (or wl-refile-subject-alist
+             (memq 'wl-refile-guess-by-subject
+                   wl-refile-guess-func-list))
+         (wl-refile-subject-learn entity dst)))
+    (when key
+      (if (setq hit (assoc key wl-refile-alist))
+          (setq wl-refile-alist (delq hit wl-refile-alist)))
+      (setq wl-refile-alist (cons (cons key dst)
+                                 wl-refile-alist)))))
 
 (defun wl-refile-msgid-learn (entity dst)
   (let ((key (elmo-msgdb-overview-entity-get-id entity))
          (setq wl-refile-msgid-alist (cons (cons key dst)
                                            wl-refile-msgid-alist))))))
 
+(defun wl-refile-subject-learn (entity dst)
+  (let ((subject (wl-summary-subject-filter-func-internal
+                 (elmo-msgdb-overview-entity-get-subject entity)))
+       hit)
+    (setq dst (elmo-string dst))
+    (if (and subject (not (string= subject "")))
+       (if (setq hit (assoc subject wl-refile-subject-alist))
+           (setcdr hit dst)
+         (setq wl-refile-subject-alist (cons (cons subject dst)
+                                           wl-refile-subject-alist))))))
+
 ;;
 ;; refile guess
 ;;
 (defvar wl-refile-guess-func-list
   '(wl-refile-guess-by-rule
     wl-refile-guess-by-msgid
+    wl-refile-guess-by-subject
     wl-refile-guess-by-history)
   "*Functions in this list are used for guessing refile destination folder.")
 
@@ -257,4 +288,9 @@ If RULE does not match ENTITY, returns nil."
   (cdr (assoc (elmo-msgdb-overview-entity-get-references entity)
              wl-refile-msgid-alist)))
 
+(defun wl-refile-guess-by-subject (entity)
+  (cdr (assoc (wl-summary-subject-filter-func-internal
+              (elmo-msgdb-overview-entity-get-subject entity))
+             wl-refile-subject-alist)))
+
 ;;; wl-refile.el ends here
index 9c32f52..9ec2ade 100644 (file)
@@ -34,7 +34,7 @@
 (require 'wl-vars)
 (require 'wl-util)
 (eval-when-compile
-  (provide 'elmo-msgdb))
+  (require 'elmo-msgdb))               ; for inline functions
 
 (defvar wl-score-edit-header-char
   '((?a "from" nil string)
 (defvar wl-score-edit-exit-func nil
   "Function run on exit from the score buffer.")
 
-(mapcar
- (function make-variable-buffer-local)
- (list 'wl-current-score-file
-       'wl-score-alist))
+(make-variable-buffer-local 'wl-current-score-file)
+(make-variable-buffer-local 'wl-score-alist)
 
 ;; Utility functions
 
@@ -118,18 +116,17 @@ It is assumed to be a single-line subject.
 Whitespace is generally cleaned up, and miscellaneous leading/trailing
 matter is removed.  Additional things can be deleted by setting
 wl-score-simplify-fuzzy-regexp."
-  (let ((case-fold-search t)
-       (modified-tick))
+  (let ((regexp
+        (if (listp wl-score-simplify-fuzzy-regexp)
+            (mapconcat (function identity) wl-score-simplify-fuzzy-regexp
+                       "\\|")
+          wl-score-simplify-fuzzy-regexp))
+       (case-fold-search t)
+       modified-tick)
     (elmo-buffer-replace "\t" " ")
     (while (not (eq modified-tick (buffer-modified-tick)))
       (setq modified-tick (buffer-modified-tick))
-      (cond
-       ((listp wl-score-simplify-fuzzy-regexp)
-       (mapcar 'elmo-buffer-replace
-               wl-score-simplify-fuzzy-regexp))
-       (wl-score-simplify-fuzzy-regexp
-       (elmo-buffer-replace
-        wl-score-simplify-fuzzy-regexp)))
+      (elmo-buffer-replace regexp)
       (elmo-buffer-replace "^ *\\[[-+?*!][-+?*!]\\] *")
       (elmo-buffer-replace
        "^ *\\(re\\|fw\\|fwd\\|forward\\)[[{(^0-9]*[])}]?[:;] *")
@@ -150,15 +147,14 @@ See `wl-score-simplify-buffer-fuzzy' for details."
 
 (defun wl-score-simplify-subject (subject)
   (elmo-set-work-buf
-   (let ((case-fold-search t))
+   (let ((regexp
+         (if (listp wl-score-simplify-fuzzy-regexp)
+             (mapconcat (function identity) wl-score-simplify-fuzzy-regexp
+                        "\\|")
+           wl-score-simplify-fuzzy-regexp))
+        (case-fold-search t))
      (insert subject)
-     (cond
-      ((listp wl-score-simplify-fuzzy-regexp)
-       (mapcar 'elmo-buffer-replace
-              wl-score-simplify-fuzzy-regexp))
-      (wl-score-simplify-fuzzy-regexp
-       (elmo-buffer-replace
-       wl-score-simplify-fuzzy-regexp)))
+     (elmo-buffer-replace regexp)
      (elmo-buffer-replace
       "^[ \t]*\\(re\\|was\\|fw\\|fwd\\|forward\\)[:;][ \t]*")
      (buffer-string))))
@@ -338,7 +334,7 @@ See `wl-score-simplify-buffer-fuzzy' for details."
   (let* (score-list
          (spec (elmo-folder-get-spec folder))
          (method (symbol-name (car spec)))
-         (fld-name (car (cdr spec))))
+         (fld-name (elmo-string (car (cdr spec)))))
     (when (stringp fld-name)
       (while (string-match "[\\/:,;*?\"<>|]" fld-name)
         (setq fld-name (replace-match "." t nil fld-name)))
@@ -388,12 +384,13 @@ See `wl-score-simplify-buffer-fuzzy' for details."
       (let ((mark (car (wl-score-get 'mark alist)))
            (expunge (car (wl-score-get 'expunge alist)))
            (mark-and-expunge (car (wl-score-get 'mark-and-expunge alist)))
-           (temp (car (wl-score-get 'temp alist)))
+           (temp (car (wl-score-get 'temp alist))) ; obsolate
+           (target (car (wl-score-get 'target alist)))
            (important (car (wl-score-get 'important alist))))
        (setq wl-summary-important-above
              (or important wl-summary-important-above))
-       (setq wl-summary-temp-above
-             (or temp wl-summary-temp-above))
+       (setq wl-summary-target-above
+             (or target temp wl-summary-target-above))
        (setq wl-summary-mark-below
              (or mark mark-and-expunge wl-summary-mark-below))
        (setq wl-summary-expunge-below
@@ -465,9 +462,8 @@ See `wl-score-simplify-buffer-fuzzy' for details."
        (setq wl-scores-messages (cdr wl-scores-messages))))
     (message "Scoring...done")
     ;; Remove buffers.
-    (mapcar '(lambda (x) (elmo-kill-buffer x))
-           wl-score-header-buffer-list)
-    (setq wl-score-header-buffer-list nil)))
+    (while wl-score-header-buffer-list
+      (elmo-kill-buffer (pop wl-score-header-buffer-list)))))
 
 (defun wl-score-integer (scores header now expire)
   (let ((wl-score-index (nth 2 (assoc header wl-score-header-index)))
@@ -561,11 +557,6 @@ See `wl-score-simplify-buffer-fuzzy' for details."
          (setq entries rest)))))
   nil)
 
-(defsubst wl-score-lines ()
-  (save-excursion
-    (beginning-of-line)
-    (count-lines 1 (point))))
-
 (defun wl-score-extra (scores header now expire)
   (let ((score-list scores)
        entries alist extra extras)
@@ -583,17 +574,13 @@ See `wl-score-simplify-buffer-fuzzy' for details."
     nil))
 
 (defmacro wl-score-put-alike ()
-  (` (elmo-set-hash-val (format "#%d" (wl-score-lines))
+  (` (elmo-set-hash-val (format "#%d" (wl-count-lines))
                        alike
                        wl-score-alike-hashtb)))
-;;(push (cons (wl-score-lines) alike) wl-score-alike-alist)
-;;(put-text-property (1- (point)) (point) 'messages alike)
 
 (defmacro wl-score-get-alike ()
-  (` (elmo-get-hash-val (format "#%d" (wl-score-lines))
+  (` (elmo-get-hash-val (format "#%d" (wl-count-lines))
                        wl-score-alike-hashtb)))
-;;(cdr (assq (wl-score-lines) wl-score-alike-alist))
-;;(get-text-property (point) 'messages)))
 
 (defun wl-score-insert-header (header messages &optional extra-header)
   (let ((mime-decode (nth 3 (assoc header wl-score-header-index)))
@@ -1244,33 +1231,32 @@ See `wl-score-simplify-buffer-fuzzy' for details."
               (wl-push num dels))
              ((< score wl-summary-mark-below)
               (if visible
-                  (wl-summary-mark-as-read
-                   t nil nil nil (elmo-use-cache-p folder num));; opened
+                  (wl-summary-mark-as-read t); opened
                 (setq update-unread t)
-                (wl-thread-msg-mark-as-read num)));; closed
+                (wl-summary-mark-as-read t nil nil num))) ; closed
              ((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 " ")))
-             ((and wl-summary-temp-above
-                   (> score wl-summary-temp-above))
+             ((and wl-summary-target-above
+                   (> score wl-summary-target-above))
               (if visible
                   (wl-summary-mark-line "*"))
               (setq wl-summary-buffer-target-mark-list
                     (cons num wl-summary-buffer-target-mark-list))))
-       (setq i (1+ i))
-       (and (zerop (% i 10))
-            (message "Updating score...%d%%" (/ (* i 100) count)))
-       (setq alist (cdr alist)))
+       (setq alist (cdr alist))
+       (when (> count elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (elmo-display-progress
+          'wl-summary-score-update-all-lines "Updating score..."
+          (/ (* i 100) count))))
       (when dels
-;      (elmo-msgdb-delete-msgs wl-summary-buffer-folder-name
-;                              dels wl-summary-buffer-msgdb t)
-       ;; mark as read.
-       (setq mark-alist (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
-       (mapcar (function (lambda (x)
-                           (setq mark-alist
-                                 (elmo-msgdb-mark-set mark-alist x nil))))
-               dels)
+       (setq mark-alist
+             (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
+       (let ((marks dels))
+         (while marks
+           (setq mark-alist
+                 (elmo-msgdb-mark-set mark-alist (pop marks) nil))))
        (elmo-mark-as-read wl-summary-buffer-folder-name
                           dels wl-summary-buffer-msgdb)
        (elmo-msgdb-set-mark-alist wl-summary-buffer-msgdb mark-alist)
@@ -1493,6 +1479,7 @@ Entering Score mode calls the value of `wl-score-mode-hook'."
        (pp form (current-buffer)))
       (goto-char (point-min)))))
 
-(provide 'wl-score)
+(require 'product)
+(product-provide (provide 'wl-score) (require 'wl-version))
 
 ;;; wl-score.el ends here
index 5c80980..dc912db 100644 (file)
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
 (require 'elmo2)
 (require 'elmo-multi)
 (require 'wl-highlight)
 (require 'wl-refile)
 (require 'wl-util)
-(condition-case ()
-    (progn
-      (require 'timezone)
-      (require 'easymenu))
-  (error))
+(condition-case nil (require 'timezone) (error nil))
+(condition-case nil (require 'easymenu) (error nil))
 (require 'elmo-date)
-(condition-case nil
-    (require 'ps-print)
-  (error))
+(condition-case nil (require 'ps-print) (error nil))
 
 (eval-when-compile
   (require 'cl)
   (condition-case () (require 'timer) (error nil))
-  (mapcar
-   (function
-    (lambda (symbol)
-      (unless (boundp symbol)
-       (set (make-local-variable symbol) nil))))
-   '(dragdrop-drop-functions scrollbar-height mail-reply-buffer))
-  (defun-maybe ps-print-buffer-with-faces (a))
-  (defun-maybe elmo-database-msgid-put (a b c))
-  (defun-maybe elmo-database-close ())
-  (defun-maybe elmo-database-msgid-get (a))
-  (defun-maybe run-with-idle-timer (secs repeat function &rest args)))
+  (defalias-maybe 'ps-print-buffer-with-faces 'ignore)
+  (defalias-maybe 'elmo-database-msgid-put 'ignore)
+  (defalias-maybe 'elmo-database-close 'ignore)
+  (defalias-maybe 'elmo-database-msgid-get 'ignore)
+  (defalias-maybe 'run-with-idle-timer 'ignore)
+  (defalias-maybe 'ps-print-preprint 'ignore))
+
+(defvar dragdrop-drop-functions)
+(defvar scrollbar-height)
+(defvar mail-reply-buffer)
 
 (defvar wl-summary-buffer-name "Summary")
 (defvar wl-summary-mode-map nil)
@@ -68,6 +61,7 @@
 
 (defvar wl-summary-buffer-msgdb       nil)
 (defvar wl-summary-buffer-folder-name nil)
+(defvar wl-summary-buffer-folder-indicator nil)
 (defvar wl-summary-buffer-disp-msg    nil)
 (defvar wl-summary-buffer-disp-folder nil)
 (defvar wl-summary-buffer-refile-list nil)
@@ -84,6 +78,7 @@
 (defvar wl-summary-buffer-view 'thread)
 (defvar wl-summary-buffer-message-modified nil)
 (defvar wl-summary-buffer-mark-modified nil)
+(defvar wl-summary-buffer-thread-modified nil)
 (defvar wl-summary-buffer-number-column nil)
 (defvar wl-summary-buffer-number-regexp nil)
 (defvar wl-summary-buffer-persistent nil)
 (defvar wl-summary-buffer-copy-list nil)
 (defvar wl-summary-buffer-prev-refile-destination nil)
 (defvar wl-summary-buffer-prev-copy-destination nil)
+(defvar wl-summary-buffer-saved-message nil)
+(defvar wl-summary-buffer-prev-folder-func nil)
+(defvar wl-summary-buffer-next-folder-func nil)
+(defvar wl-summary-buffer-exit-func nil)
 (defvar wl-thread-indent-level-internal nil)
 (defvar wl-thread-have-younger-brother-str-internal nil)
 (defvar wl-thread-youngest-child-str-internal nil)
 (defvar wl-read-folder-hist nil)
 (defvar wl-summary-scored nil)
 (defvar wl-crosspost-alist-modified nil)
+(defvar wl-summary-alike-hashtb nil)
+(defvar wl-summary-search-buf-name " *wl-search-subject*")
+(defvar wl-summary-delayed-update nil)
 
 (defvar wl-summary-message-regexp "^ *\\([0-9]+\\)")
 
 (defvar wl-ps-preprint-hook nil)
 (defvar wl-ps-print-hook nil)
 
-(mapcar
- (function make-variable-buffer-local)
- (list 'wl-summary-buffer-msgdb
-       'wl-summary-buffer-disp-msg
-       'wl-summary-buffer-disp-folder
-       'wl-summary-buffer-refile-list
-       'wl-summary-buffer-copy-list
-       'wl-summary-buffer-target-mark-list
-       'wl-summary-buffer-delete-list
-       'wl-summary-buffer-folder-name
-       'wl-summary-buffer-last-displayed-msg
-       'wl-summary-buffer-unread-status
-       'wl-summary-buffer-unread-count
-       'wl-summary-buffer-new-count
-       'wl-summary-buffer-mime-charset
-       'wl-summary-buffer-weekday-name-lang
-       'wl-summary-buffer-thread-indent-set
-       'wl-summary-buffer-message-redisplay-func
-       'wl-summary-buffer-view
-       'wl-summary-buffer-message-modified
-       'wl-summary-buffer-mark-modified
-       'wl-summary-buffer-number-column
-       'wl-summary-buffer-number-regexp
-       'wl-summary-buffer-persistent
-       'wl-summary-buffer-thread-nodes
-       'wl-summary-buffer-prev-refile-destination
-       'wl-summary-scored
-       'wl-summary-default-score
-       'wl-summary-move-direction-downward
-       'wl-summary-important-above
-       'wl-summary-temp-above
-       'wl-summary-mark-below
-       'wl-summary-expunge-below
-       'wl-thread-indent-level-internal
-       'wl-thread-have-younger-brother-str-internal
-       'wl-thread-youngest-child-str-internal
-       'wl-thread-vertical-str-internal
-       'wl-thread-horizontal-str-internal
-       'wl-thread-space-str-internal))
+(make-variable-buffer-local 'wl-summary-buffer-msgdb)
+(make-variable-buffer-local 'wl-summary-buffer-disp-msg)
+(make-variable-buffer-local 'wl-summary-buffer-disp-folder)
+(make-variable-buffer-local 'wl-summary-buffer-refile-list)
+(make-variable-buffer-local 'wl-summary-buffer-copy-list)
+(make-variable-buffer-local 'wl-summary-buffer-target-mark-list)
+(make-variable-buffer-local 'wl-summary-buffer-delete-list)
+(make-variable-buffer-local 'wl-summary-buffer-folder-name)
+(make-variable-buffer-local 'wl-summary-buffer-folder-indicator)
+(make-variable-buffer-local 'wl-summary-buffer-last-displayed-msg)
+(make-variable-buffer-local 'wl-summary-buffer-unread-status)
+(make-variable-buffer-local 'wl-summary-buffer-unread-count)
+(make-variable-buffer-local 'wl-summary-buffer-new-count)
+(make-variable-buffer-local 'wl-summary-buffer-mime-charset)
+(make-variable-buffer-local 'wl-summary-buffer-weekday-name-lang)
+(make-variable-buffer-local 'wl-summary-buffer-thread-indent-set)
+(make-variable-buffer-local 'wl-summary-buffer-message-redisplay-func)
+(make-variable-buffer-local 'wl-summary-buffer-view)
+(make-variable-buffer-local 'wl-summary-buffer-message-modified)
+(make-variable-buffer-local 'wl-summary-buffer-mark-modified)
+(make-variable-buffer-local 'wl-summary-buffer-thread-modified)
+(make-variable-buffer-local 'wl-summary-buffer-number-column)
+(make-variable-buffer-local 'wl-summary-buffer-number-regexp)
+(make-variable-buffer-local 'wl-summary-buffer-persistent)
+(make-variable-buffer-local 'wl-summary-buffer-thread-nodes)
+(make-variable-buffer-local 'wl-summary-buffer-prev-refile-destination)
+(make-variable-buffer-local 'wl-summary-buffer-saved-message)
+(make-variable-buffer-local 'wl-summary-scored)
+(make-variable-buffer-local 'wl-summary-default-score)
+(make-variable-buffer-local 'wl-summary-move-direction-downward)
+(make-variable-buffer-local 'wl-summary-important-above)
+(make-variable-buffer-local 'wl-summary-target-above)
+(make-variable-buffer-local 'wl-summary-mark-below)
+(make-variable-buffer-local 'wl-summary-expunge-below)
+(make-variable-buffer-local 'wl-thread-indent-level-internal)
+(make-variable-buffer-local 'wl-thread-have-younger-brother-str-internal)
+(make-variable-buffer-local 'wl-thread-youngest-child-str-internal)
+(make-variable-buffer-local 'wl-thread-vertical-str-internal)
+(make-variable-buffer-local 'wl-thread-horizontal-str-internal)
+(make-variable-buffer-local 'wl-thread-space-str-internal)
+(make-variable-buffer-local 'wl-summary-buffer-prev-folder-func)
+(make-variable-buffer-local 'wl-summary-buffer-next-folder-func)
+(make-variable-buffer-local 'wl-summary-buffer-exit-func)
 
 ;; internal functions (dummy)
 (unless (fboundp 'wl-summary-append-message-func-internal)
   (defun wl-summary-append-message-func-internal (entity overview
-                                                        mark-alist update)))
+                                                        mark-alist update
+                                                        &optional force-insert)))
 (unless (fboundp 'wl-summary-from-func-internal)
   (defun wl-summary-from-func-internal (from)
     from))
                               (lambda (to)
                                 (eword-decode-string
                                  (if wl-use-petname
-                                     (wl-address-get-petname to)
-                                   (or
-                                    (car (std11-extract-address-components to))
-                                    to)))))
+                                     (or
+                                      (wl-address-get-petname-1 to)
+                                      (car
+                                       (std11-extract-address-components to))
+                                      to)
+                                   to))))
                              (wl-parse-addresses tos)
                              ","))))
              ((setq ng (elmo-msgdb-overview-entity-get-extra-field
                         entity "newsgroups"))
               (setq retval (concat "Ng:" ng)))))
       (if wl-use-petname
-         (setq retval (wl-address-get-petname from))
+         (setq retval (or (wl-address-get-petname-1 from)
+                          (car (std11-extract-address-components from))
+                          from))
        (setq retval from)))
     retval))
 
 (defun wl-summary-simple-from (string)
   (if wl-use-petname
-      (wl-address-get-petname string)
+      (or (wl-address-get-petname-1 string)
+         (car (std11-extract-address-components string))
+         string)
     string))
 
 (defvar wl-summary-mode-menu-spec
   (define-key wl-summary-mode-map "g"    'wl-summary-goto-folder)
   (define-key wl-summary-mode-map "c"    'wl-summary-mark-as-read-all)
   (define-key wl-summary-mode-map "D"    'wl-summary-drop-unsync)
-  
+
   (define-key wl-summary-mode-map "a"    'wl-summary-reply)
   (define-key wl-summary-mode-map "A"    'wl-summary-reply-with-citation)
   (define-key wl-summary-mode-map "C"    'wl-summary-cancel-message)
   (define-key wl-summary-mode-map "|"    'wl-summary-pipe-message)
   (define-key wl-summary-mode-map "q"    'wl-summary-exit)
   (define-key wl-summary-mode-map "Q"    'wl-summary-force-exit)
-  
+
   (define-key wl-summary-mode-map "j"    'wl-summary-jump-to-current-message)
   (define-key wl-summary-mode-map "J"    'wl-thread-jump-to-msg)
   (define-key wl-summary-mode-map "I"    'wl-summary-incorporate)
   (define-key wl-summary-mode-map "\M-j" 'wl-summary-jump-to-msg-by-message-id)
   (define-key wl-summary-mode-map "^"    'wl-summary-jump-to-parent-message)
   (define-key wl-summary-mode-map "!"    'wl-summary-mark-as-unread)
-  
+
   (define-key wl-summary-mode-map "s"    'wl-summary-sync)
   (define-key wl-summary-mode-map "S"    'wl-summary-sort)
   (define-key wl-summary-mode-map "\M-s"    'wl-summary-stick)
   (define-key wl-summary-mode-map "?"    'wl-summary-pick)
   (define-key wl-summary-mode-map "\ee"  'wl-summary-expire)
 
+  ;; copy & paste.
+  (define-key wl-summary-mode-map "\ew"  'wl-summary-save-current-message)
+  (define-key wl-summary-mode-map "\C-y"  'wl-summary-yank-saved-message)
+
   ;; line commands
   (define-key wl-summary-mode-map "R"    'wl-summary-mark-as-read)
   (define-key wl-summary-mode-map "i"    'wl-summary-prefetch)
   (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 "ty" 'wl-thread-save)
+  (define-key wl-summary-mode-map "ts" 'wl-thread-set-parent)
 
   ;; target-mark commands
   (define-key wl-summary-mode-map "m"    (make-sparse-keymap))
   (define-key wl-summary-mode-map "mA"   'wl-summary-target-mark-reply-with-citation)
   (define-key wl-summary-mode-map "mf"   'wl-summary-target-mark-forward)
   (define-key wl-summary-mode-map "m?"   'wl-summary-target-mark-pick)
-  
+
   ;; region commands
   (define-key wl-summary-mode-map "r"    (make-sparse-keymap))
   (define-key wl-summary-mode-map "rR"   'wl-summary-mark-as-read-region)
              wl-summary-buffer-unread-count unread))
     (+ new unread)))
 
-(defun wl-summary-make-modeline ()
-  "Create new modeline format for Wanderlust"
-  (let* ((duplicated (copy-sequence mode-line-format))
-        (cur-entry duplicated)
-        return-modeline)
-    (if (memq 'wl-plug-state-indicator mode-line-format)
-       duplicated
-      (catch 'done
-       (while cur-entry
-         (if (or (and (symbolp (car cur-entry))
-                      (eq 'mode-line-buffer-identification
-                             (car cur-entry)))
-                 (and (consp (car cur-entry))
-                      (or
-                       (eq 'modeline-buffer-identification
-                              (car (car cur-entry)))
-                       (eq 'modeline-buffer-identification
-                              (cdr (car cur-entry))))))
-             (progn
-               (setq return-modeline (append return-modeline
-                                             (list
-                                              'wl-plug-state-indicator
-                                              (car cur-entry)
-                                              'wl-summary-buffer-unread-status)
-                                             (cdr cur-entry)))
-               (throw 'done return-modeline))
-           (setq return-modeline (append return-modeline
-                                         (list (car cur-entry)))))
-         (setq cur-entry (cdr cur-entry)))))))
-
 (defun wl-summary-reedit (&optional arg)
   "Re-edit current message.
 If optional argument is non-nil, Supersedes message"
@@ -678,36 +666,36 @@ you."
       (message "Resending message to %s...done" address))))
 
 (defun wl-summary-msgdb-load-async (folder)
-  "Loading msgdb and selecting folder is executed asynchronously in IMAP4.
-Returns nil if selecting folder was in failure."
+  "Loading msgdb and selecting folder is executed asynchronously in IMAP4."
   (if (and (elmo-folder-plugged-p folder)
           (eq (elmo-folder-get-type folder) 'imap4))
-      (let* ((spec (elmo-folder-get-spec folder))
-            (connection (elmo-imap4-get-connection spec))
-            (process (elmo-imap4-connection-get-process connection))
-            msgdb response)
-       (save-excursion
-         (unwind-protect
-             (progn
-               (elmo-imap4-send-command (process-buffer process)
-                                        process
-                                        (format "select \"%s\""
-                                                (elmo-imap4-spec-folder
-                                                 spec)))
-               (setq msgdb (elmo-msgdb-load (elmo-string folder)))
-               (setq response (elmo-imap4-read-response
-                               (process-buffer process)
-                               process)))
-           (if (null response)
-               (progn
-                 (setcar (cddr connection) nil)
-                 (error "Select folder failed"))
-             (setcar (cddr connection) (elmo-imap4-spec-folder spec))))
-         (if response msgdb)))
+      (let ((spec (elmo-folder-get-spec folder))
+           session mailbox
+           msgdb response tag)
+       (unwind-protect
+           (progn
+             (setq session (elmo-imap4-get-session spec)
+                   mailbox (elmo-imap4-spec-mailbox spec)
+                   tag (elmo-imap4-send-command session
+                                                (list "select "
+                                                      (elmo-imap4-mailbox
+                                                       mailbox))))
+             (setq msgdb (elmo-msgdb-load (elmo-string folder)))
+             (setq response (elmo-imap4-read-response session tag)))
+         (if response
+             (elmo-imap4-session-set-current-mailbox-internal session mailbox)
+           (and session
+                (elmo-imap4-session-set-current-mailbox-internal session nil))
+           (message "Select mailbox %s failed" mailbox)))
+       msgdb)
     (elmo-msgdb-load (elmo-string folder))))
 
 (defun wl-summary-buffer-set-folder (folder)
   (setq wl-summary-buffer-folder-name folder)
+  (setq wl-summary-buffer-folder-indicator
+       (if (memq 'modeline wl-use-folder-petname)
+           (wl-folder-get-petname folder)
+         folder))
   (when (wl-summary-sticky-p)
     (make-local-variable 'wl-message-buf-name)
     (setq wl-message-buf-name (format "%s:%s" wl-message-buf-name folder)))
@@ -801,29 +789,27 @@ ma      Put the '*' mark onto all messages.
 q      Goto folder mode.
 "
   (interactive)
+  (unless (interactive-p) (kill-all-local-variables))
   (setq major-mode 'wl-summary-mode)
   (setq mode-name "Summary")
   (use-local-map wl-summary-mode-map)
-  (setq wl-summary-buffer-refile-list nil)
-  (setq wl-summary-buffer-target-mark-list nil)
-  (setq wl-summary-buffer-delete-list nil)
-  (setq wl-summary-scored nil)
-  (setq wl-summary-buffer-disp-msg nil)
 ;; (setq default-directory (or wl-tmp-dir (expand-file-name "~/")))
   (setq buffer-read-only t)
   (setq truncate-lines t)
-;  (make-local-variable 'tab-width)
-;  (setq tab-width 1)
+;; (make-local-variable 'tab-width)
+;; (setq tab-width 1)
   (buffer-disable-undo (current-buffer))
   (if wl-use-semi
       (setq wl-summary-buffer-message-redisplay-func
            'wl-mmelmo-message-redisplay)
     (setq wl-summary-buffer-message-redisplay-func
          'wl-normal-message-redisplay))
-  (wl-xmas-setup-summary) ; setup toolbar, dnd, etc.
-  (when wl-show-plug-status-on-modeline
-    (setq mode-line-format (wl-summary-make-modeline)))
+  (wl-mode-line-buffer-identification '("Wanderlust: "
+                                       wl-summary-buffer-folder-indicator
+                                       wl-summary-buffer-unread-status))
   (easy-menu-add wl-summary-mode-menu)
+  ;; This hook may contain the function `wl-setup-summary' for reasons
+  ;; of system internal to accord facilities for the Emacs variants.
   (run-hooks 'wl-summary-mode-hook))
 
 (defun wl-summary-overview-entity-compare-by-date (x y)
@@ -908,17 +894,31 @@ q Goto folder mode.
     (setq wl-summary-buffer-target-mark-list nil)
     (setq wl-summary-buffer-refile-list nil)
     (setq wl-summary-buffer-delete-list nil)
-    (message "Constructing summary structure..." percent)
+    (setq wl-summary-delayed-update nil)
+    (elmo-kill-buffer wl-summary-search-buf-name)
+    (message "Constructing summary structure...")
     (while curp
       (setq entity (car curp))
       (wl-summary-append-message-func-internal entity overview mark-alist
                                               nil)
       (setq curp (cdr curp))
-      (setq i (+ i 1))
-      (elmo-display-progress
-       'wl-summary-rescan "Constructing summary structure..."
-       (/ (* i 100) num)))
-    (message "Constructing summary structure...done." percent)
+      (when (> num elmo-display-progress-threshold)
+       (setq i (+ i 1))
+       (if (or (zerop (% i 5)) (= i num))
+           (elmo-display-progress
+            'wl-summary-rescan "Constructing summary structure..."
+            (/ (* i 100) num)))))
+    (when wl-summary-delayed-update
+      (while wl-summary-delayed-update
+       (message "Parent (%d) of message %d is no entity"
+                (caar wl-summary-delayed-update)
+                (elmo-msgdb-overview-entity-get-number
+                 (cdar wl-summary-delayed-update)))
+       (wl-summary-append-message-func-internal
+        (cdar wl-summary-delayed-update)
+        overview mark-alist nil t)
+       (setq wl-summary-delayed-update (cdr wl-summary-delayed-update))))
+    (message "Constructing summary structure...done.")
     (set-buffer cur-buf)
     (when (eq wl-summary-buffer-view 'thread)
       (message "Inserting thread...")
@@ -929,16 +929,16 @@ q Goto folder mode.
       (wl-summary-score-headers nil msgdb
                                (wl-summary-rescore-msgs number-alist)
                                t)
-      (setq expunged (wl-summary-score-update-all-lines))
-      (if expunged
-         (message "%d message(s) are expunged by scoring." (length expunged))))
+      (when (and wl-summary-scored
+                (setq expunged (wl-summary-score-update-all-lines)))
+       (message "%d message(s) are expunged by scoring." (length expunged))))
     (wl-summary-set-message-modified)
     (wl-summary-count-unread mark-alist)
     (wl-summary-update-modeline)
     (goto-char (point-max))
     (forward-line -1)
     (set-buffer-modified-p nil)))
-    
+
 (defun wl-summary-next-folder-or-exit (&optional next-entity upward)
   (if (and next-entity
           wl-auto-select-next)
@@ -990,6 +990,10 @@ q  Goto folder mode.
   (setq wl-summary-buffer-mark-modified t))
 (defun wl-summary-mark-modified-p ()
   wl-summary-buffer-mark-modified)
+(defun wl-summary-set-thread-modified ()
+  (setq wl-summary-buffer-thread-modified t))
+(defun wl-summary-thread-modified-p ()
+  wl-summary-buffer-thread-modified)
 
 (defun wl-summary-msgdb-save ()
   "Save msgdb if modified."
@@ -1008,7 +1012,8 @@ q Goto folder mode.
           (elmo-string wl-summary-buffer-folder-name)
           (elmo-msgdb-get-number-alist
            wl-summary-buffer-msgdb))
-         (setq wl-summary-buffer-message-modified nil))
+         (setq wl-summary-buffer-message-modified nil)
+         (run-hooks 'wl-summary-buffer-message-saved-hook))
        (when (wl-summary-mark-modified-p)
          (or path
              (setq path (elmo-msgdb-expand-path
@@ -1016,13 +1021,14 @@ q       Goto folder mode.
          (elmo-msgdb-mark-save
           path
           (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
-;;       (elmo-folder-set-info-hashtb
-;;        (elmo-string wl-summary-buffer-folder-name)
-;;        nil nil
-;;        0
-;;        (+ wl-summary-buffer-new-count wl-summary-buffer-unread-count))
+;;       (elmo-folder-set-info-hashtb
+;;        (elmo-string wl-summary-buffer-folder-name)
+;;        nil nil
+;;        0
+;;        (+ wl-summary-buffer-new-count wl-summary-buffer-unread-count))
 ;;       (setq wl-folder-info-alist-modified t)
-         (setq wl-summary-buffer-mark-modified nil))))))
+         (setq wl-summary-buffer-mark-modified nil)
+         (run-hooks 'wl-summary-buffer-mark-saved-hook))))))
 
 (defsubst wl-summary-cleanup-temp-marks (&optional sticky)
   (if (or wl-summary-buffer-refile-list
@@ -1054,8 +1060,9 @@ q Goto folder mode.
     ;; save the current summary buffer view.
     (if (and wl-summary-cache-use
             (or (wl-summary-message-modified-p)
-                (wl-summary-mark-modified-p)))
-       (wl-summary-save-view-cache sticky))
+                (wl-summary-mark-modified-p)
+                (wl-summary-thread-modified-p)))
+       (wl-summary-save-view-cache))
     ;; save msgdb ...
     (wl-summary-msgdb-save)))
 
@@ -1073,61 +1080,78 @@ q       Goto folder mode.
        summary-win
        message-buf message-win
        folder-buf folder-win)
-    (wl-summary-cleanup-temp-marks sticky)
-    (unwind-protect
-       ;; save summary status
-       (progn
-         (wl-summary-save-status sticky)
-         ;(wl-summary-msgdb-save)
-         (if wl-use-scoring
-             (wl-score-save)))
-      ;; for sticky summary
-      (wl-delete-all-overlays)
-      (setq wl-summary-buffer-disp-msg nil)
-      ;; delete message window if displayed.
-      (if (setq message-buf (get-buffer wl-message-buf-name))
-         (if (setq message-win (get-buffer-window message-buf))
-             (delete-window message-win)))
-      (if (setq folder-buf (get-buffer wl-folder-buffer-name))
-         (if (setq folder-win (get-buffer-window folder-buf))
-             ;; folder win is already displayed.
-             (select-window folder-win)
-           ;; folder win is not displayed.
-           (switch-to-buffer folder-buf))
-       ;; currently no folder buffer
-       (wl-folder))
-      (and wl-folder-move-cur-folder
-          wl-folder-buffer-cur-point
-          (goto-char wl-folder-buffer-cur-point))
-      (setq wl-folder-buffer-cur-path nil)
-      (setq wl-folder-buffer-cur-entity-id nil)
-      (wl-delete-all-overlays)
-      (if wl-summary-exit-next-move
-         (wl-folder-next-unsync t)
-       (beginning-of-line))
-      (if (setq summary-win (get-buffer-window summary-buf))
-         (delete-window summary-win))
-      (if (or force-exit
-             (not sticky))
+    (if wl-summary-buffer-exit-func
+       (funcall wl-summary-buffer-exit-func)
+      (wl-summary-cleanup-temp-marks sticky)
+      (unwind-protect
+         ;; save summary status
          (progn
-           (set-buffer summary-buf)
-           (and (get-buffer wl-message-buf-name)
-                (kill-buffer wl-message-buf-name))
-           ;; kill buffers of mime-view-caesar
-           (wl-kill-buffers
-            (format "^%s-([0-9 ]+)$" (regexp-quote wl-message-buf-name)))
-           (kill-buffer summary-buf)))
-      (run-hooks 'wl-summary-exit-hook))))
+           (wl-summary-save-status sticky)
+           (elmo-commit wl-summary-buffer-folder-name)
+           (if wl-use-scoring
+               (wl-score-save)))
+       ;; for sticky summary
+       (wl-delete-all-overlays)
+       (setq wl-summary-buffer-disp-msg nil)
+       (elmo-kill-buffer wl-summary-search-buf-name)
+       ;; delete message window if displayed.
+       (if (setq message-buf (get-buffer wl-message-buf-name))
+           (if (setq message-win (get-buffer-window message-buf))
+               (delete-window message-win)))
+       (if (setq folder-buf (get-buffer wl-folder-buffer-name))
+           (if (setq folder-win (get-buffer-window folder-buf))
+               ;; folder win is already displayed.
+               (select-window folder-win)
+             ;; folder win is not displayed.
+             (switch-to-buffer folder-buf))
+         ;; currently no folder buffer
+         (wl-folder))
+       (and wl-folder-move-cur-folder
+            wl-folder-buffer-cur-point
+            (goto-char wl-folder-buffer-cur-point))
+       (setq wl-folder-buffer-cur-path nil)
+       (setq wl-folder-buffer-cur-entity-id nil)
+       (wl-delete-all-overlays)
+       (if wl-summary-exit-next-move
+           (wl-folder-next-unsync t)
+         (beginning-of-line))
+       (if (setq summary-win (get-buffer-window summary-buf))
+           (delete-window summary-win))
+       (if (or force-exit
+               (not sticky))
+           (progn
+             (set-buffer summary-buf)
+             (and (get-buffer wl-message-buf-name)
+                  (kill-buffer wl-message-buf-name))
+             ;; kill buffers of mime-view-caesar
+             (wl-kill-buffers
+              (format "^%s-([0-9 ]+)$" (regexp-quote wl-message-buf-name)))
+             (kill-buffer summary-buf)))
+       (run-hooks 'wl-summary-exit-hook)))))
 
 (defun wl-summary-sync-force-update (&optional unset-cursor)
   (interactive)
   (let ((msgdb-dir (elmo-msgdb-expand-path wl-summary-buffer-folder-name))
+       (type (elmo-folder-get-type wl-summary-buffer-folder-name))
        ret-val seen-list)
     (unwind-protect
        (progn
-         (setq seen-list (elmo-msgdb-seen-load msgdb-dir))
+         (if wl-summary-buffer-persistent
+             (setq seen-list (elmo-msgdb-seen-load msgdb-dir)))
          (setq ret-val (wl-summary-sync-update3 seen-list unset-cursor))
-         (elmo-msgdb-seen-save msgdb-dir nil))
+         (if wl-summary-buffer-persistent
+             (progn
+               (if (and (eq type 'imap4)
+                        (not (elmo-folder-plugged-p
+                              wl-summary-buffer-folder-name)))
+                   (let* ((msgdb wl-summary-buffer-msgdb)
+                          (number-alist (elmo-msgdb-get-number-alist msgdb)))
+                     (elmo-mark-as-read wl-summary-buffer-folder-name
+                                        (mapcar 
+                                         (lambda (msgid)
+                                           (car (rassoc msgid number-alist)))
+                                         seen-list) msgdb)))
+               (elmo-msgdb-seen-save msgdb-dir nil))))
       (set-buffer (current-buffer)))
     (if (interactive-p)
        (message "%s" ret-val))
@@ -1160,7 +1184,7 @@ q Goto folder mode.
           (setq wl-thread-entity-hashtb (elmo-make-hash
                                          (* (length (elmo-msgdb-get-number-alist
                                                      wl-summary-buffer-msgdb)) 2)))
-          (setq wl-summary-buffer-msgdb '(nil nil nil nil))
+          (setq wl-summary-buffer-msgdb (elmo-msgdb-clear)) ;;'(nil nil nil nil))
           (setq wl-thread-entity-list nil)
           (setq wl-thread-entities nil)
           (setq wl-summary-buffer-target-mark-list nil)
@@ -1168,6 +1192,7 @@ q Goto folder mode.
           (setq wl-summary-buffer-copy-list nil)
           (setq wl-summary-buffer-delete-list nil)
           (wl-summary-buffer-number-column-detect nil)
+          (elmo-clear-killed folder)
           (setq mes (wl-summary-sync-update3 seen-list unset-cursor))
           (elmo-msgdb-seen-save msgdb-dir nil) ; delete all seen.
           (if mes (message "%s" mes)))
@@ -1308,7 +1333,7 @@ Optional argument ADDR-STR is used as a target address if specified."
        ;; i'd like to update summary-buffer, but...
        ;;(wl-summary-rescan)
        (run-hooks 'wl-summary-edit-addresses-hook)))))
-  
+
 (defun wl-summary-incorporate (&optional arg)
   "Check and prefetch all uncached messages.
 If optional argument is non-nil, checking is omitted."
@@ -1319,7 +1344,7 @@ If optional argument is non-nil, checking is omitted."
   (wl-summary-prefetch-region (point-min) (point-max)
                              wl-summary-incorporate-marks))
 
-(defun wl-summary-prefetch-msg (number)
+(defun wl-summary-prefetch-msg (number &optional arg)
   "Returns status-mark. if skipped, returns nil."
   ;; prefetching procedure.
   (save-excursion
@@ -1337,86 +1362,88 @@ If optional argument is non-nil, checking is omitted."
                            (or (null wl-prefetch-threshold)
                                (< size wl-prefetch-threshold))))
           mark new-mark)
-      (unwind-protect
-         (progn
-           (when (and size (not force-read) wl-prefetch-confirm)
-             (setq force-read
-                   (save-restriction
-                     (widen)
-                     (y-or-n-p
-                      (format
-                       "Message from %s has %d bytes. Prefetch it?"
-                       (concat
-                        "[ "
-                        (save-match-data
-                          (wl-set-string-width
-                           wl-from-width
-                           (wl-summary-from-func-internal
-                            (eword-decode-string
-                             (elmo-delete-char
-                              ?\"
-                              (or
-                               (elmo-msgdb-overview-entity-get-from ov)
-                               "??")))))) " ]")
-                       size))))
-             (message "")); flush.
-           (setq mark (cadr (assq number mark-alist)))
-            (if force-read
-             (save-excursion
-               (save-match-data
-                 (if (and (null (elmo-folder-plugged-p
-                                 wl-summary-buffer-folder-name))
-                          elmo-enable-disconnected-operation)
-                     (progn ;; append-queue for offline
-                       (elmo-dop-prefetch-msgs
-                        wl-summary-buffer-folder-name (list number))
-                       (setq new-mark
-                             (cond
-                              ((string= mark
-                                        wl-summary-unread-uncached-mark)
-                               wl-summary-unread-cached-mark)
-                              ((string= mark wl-summary-new-mark)
-                               (setq wl-summary-buffer-new-count
-                                     (- wl-summary-buffer-new-count 1))
-                               (setq wl-summary-buffer-unread-count
-                                     (+ wl-summary-buffer-unread-count 1))
-                               wl-summary-unread-cached-mark)
-                              ((or (null mark)
-                                   (string= mark wl-summary-read-uncached-mark))
-                               (setq wl-summary-buffer-unread-count
-                                     (+ wl-summary-buffer-unread-count 1))
-                               wl-summary-unread-cached-mark)
-                              (t mark))))
-                   ;; online
-                   (elmo-prefetch-msg wl-summary-buffer-folder-name
-                                      number
-                                      (wl-message-get-original-buffer)
-                                      msgdb)
-                   (setq new-mark
-                         (cond
-                          ((string= mark
-                                    wl-summary-unread-uncached-mark)
-                           wl-summary-unread-cached-mark)
-                          ((string= mark wl-summary-new-mark)
-                           (setq wl-summary-buffer-new-count
-                                 (- wl-summary-buffer-new-count 1))
-                           (setq wl-summary-buffer-unread-count
-                                 (+ wl-summary-buffer-unread-count 1))
-                           wl-summary-unread-cached-mark)
-                          ((string= mark wl-summary-read-uncached-mark)
-                           nil)
-                          (t mark))))
-                 (setq mark-alist (elmo-msgdb-mark-set
-                                   mark-alist number new-mark))
-                 (or new-mark (setq new-mark " "))
-                 (elmo-msgdb-set-mark-alist msgdb mark-alist)
-                 (wl-summary-set-mark-modified)
-                 (wl-summary-update-modeline)
-                 (wl-folder-update-unread
-                  wl-summary-buffer-folder-name
-                  (+ wl-summary-buffer-unread-count
-                     wl-summary-buffer-new-count)))
-               new-mark)))))))
+      (if (or arg
+             (null (elmo-cache-exists-p message-id)))
+         (unwind-protect
+             (progn
+               (when (and size (not force-read) wl-prefetch-confirm)
+                 (setq force-read
+                       (save-restriction
+                         (widen)
+                         (y-or-n-p
+                          (format
+                           "Message from %s has %d bytes. Prefetch it?"
+                           (concat
+                            "[ "
+                            (save-match-data
+                              (wl-set-string-width
+                               wl-from-width
+                               (wl-summary-from-func-internal
+                                (eword-decode-string
+                                 (elmo-delete-char
+                                  ?\"
+                                  (or
+                                   (elmo-msgdb-overview-entity-get-from ov)
+                                   "??")))))) " ]")
+                           size))))
+                 (message ""))         ; flush.
+               (setq mark (cadr (assq number mark-alist)))
+               (if force-read
+                   (save-excursion
+                     (save-match-data
+                       (if (and (null (elmo-folder-plugged-p
+                                       wl-summary-buffer-folder-name))
+                                elmo-enable-disconnected-operation)
+                           (progn;; append-queue for offline
+                             (elmo-dop-prefetch-msgs
+                              wl-summary-buffer-folder-name (list number))
+                             (setq new-mark
+                                   (cond
+                                    ((string= mark
+                                              wl-summary-unread-uncached-mark)
+                                     wl-summary-unread-cached-mark)
+                                    ((string= mark wl-summary-new-mark)
+                                     (setq wl-summary-buffer-new-count
+                                           (- wl-summary-buffer-new-count 1))
+                                     (setq wl-summary-buffer-unread-count
+                                           (+ wl-summary-buffer-unread-count 1))
+                                     wl-summary-unread-cached-mark)
+                                    ((or (null mark)
+                                         (string= mark wl-summary-read-uncached-mark))
+                                     (setq wl-summary-buffer-unread-count
+                                           (+ wl-summary-buffer-unread-count 1))
+                                     wl-summary-unread-cached-mark)
+                                    (t mark))))
+                         ;; online
+                         (elmo-prefetch-msg wl-summary-buffer-folder-name
+                                            number
+                                            (wl-message-get-original-buffer)
+                                            msgdb)
+                         (setq new-mark
+                               (cond
+                                ((string= mark
+                                          wl-summary-unread-uncached-mark)
+                                 wl-summary-unread-cached-mark)
+                                ((string= mark wl-summary-new-mark)
+                                 (setq wl-summary-buffer-new-count
+                                       (- wl-summary-buffer-new-count 1))
+                                 (setq wl-summary-buffer-unread-count
+                                       (+ wl-summary-buffer-unread-count 1))
+                                 wl-summary-unread-cached-mark)
+                                ((string= mark wl-summary-read-uncached-mark)
+                                 nil)
+                                (t mark))))
+                       (setq mark-alist (elmo-msgdb-mark-set
+                                         mark-alist number new-mark))
+                       (or new-mark (setq new-mark " "))
+                       (elmo-msgdb-set-mark-alist msgdb mark-alist)
+                       (wl-summary-set-mark-modified)
+                       (wl-summary-update-modeline)
+                       (wl-folder-update-unread
+                        wl-summary-buffer-folder-name
+                        (+ wl-summary-buffer-unread-count
+                           wl-summary-buffer-new-count)))
+                     new-mark))))))))
 
 ;(defvar wl-summary-message-uncached-marks
 ;  (list wl-summary-new-mark
@@ -1487,9 +1514,9 @@ If optional argument is non-nil, checking is omitted."
        (message "Prefetched %d/%d message(s)" count length)
        (cons count length)))))
 
-(defun wl-summary-prefetch ()
+(defun wl-summary-prefetch (&optional arg)
   "Prefetch current message."
-  (interactive)
+  (interactive "P")
   (save-excursion
     (save-match-data
       (beginning-of-line)
@@ -1499,7 +1526,7 @@ If optional argument is non-nil, checking is omitted."
              (buffer-read-only nil)
              mark)
          (setq mark (wl-summary-prefetch-msg
-                     (string-to-int (wl-match-buffer 1))))
+                     (string-to-int (wl-match-buffer 1)) arg))
          (when mark
            (delete-region (match-beginning 2)
                           (match-end 2))
@@ -1521,27 +1548,28 @@ If optional argument is non-nil, checking is omitted."
        (delete-region (match-beginning 1) (match-end 1))
        (insert " ")))))
 
-(defun wl-summary-delete-copy-marks-on-buffer (cpys)
-  (mapcar (function
-          (lambda (x)
-            (wl-summary-unmark x)))
-         cpys))
+(defun wl-summary-delete-marks-on-buffer (marks)
+  (while marks
+    (wl-summary-unmark (pop marks))))
+
+(defun wl-summary-delete-copy-marks-on-buffer (copies)
+  (wl-summary-delete-marks-on-buffer copies))
 
 (defun wl-summary-delete-all-refile-marks ()
-  (mapcar (function
-          (lambda (x)
-            (wl-summary-unmark (car x)))) wl-summary-buffer-refile-list))
+  (let ((marks wl-summary-buffer-refile-list))
+    (while marks
+      (wl-summary-unmark (car (pop marks))))))
 
 (defun wl-summary-delete-all-copy-marks ()
-  (mapcar (function
-          (lambda (x)
-            (wl-summary-unmark (car x)))) wl-summary-buffer-copy-list))
+  (let ((marks wl-summary-buffer-copy-list))
+    (while marks
+      (wl-summary-unmark (car (pop marks))))))
+
 (defun wl-summary-delete-all-delete-marks ()
-  (mapcar 'wl-summary-unmark wl-summary-buffer-delete-list))
+  (wl-summary-delete-marks-on-buffer wl-summary-buffer-delete-list))
 
 (defun wl-summary-delete-all-target-marks ()
-  (mapcar 'wl-summary-unmark wl-summary-buffer-target-mark-list))
+  (wl-summary-delete-marks-on-buffer wl-summary-buffer-target-mark-list))
 
 (defun wl-summary-delete-all-temp-marks-on-buffer (&optional sticky)
   ;; for summary view cache saving.
@@ -1593,7 +1621,7 @@ If optional argument is non-nil, checking is omitted."
                  (wl-summary-mark-as-read t) ; mark itself.
                  (setq children (wl-thread-get-children-msgs number))
                  (while children
-                   (wl-thread-msg-mark-as-read (car children))
+                   (wl-summary-mark-as-read t nil nil (car children))
                    (setq children (cdr children))))
                (forward-line 1))))
        (while (not (eobp))
@@ -1624,7 +1652,7 @@ If optional argument is non-nil, checking is omitted."
                  (setq children
                        (delq number (wl-thread-get-children-msgs number)))
                  (while children
-                   (wl-thread-msg-mark-as-unread (car children))
+                   (wl-summary-mark-as-unread (car children))
                    (setq children (cdr children))))
                (forward-line 1))))
        (while (not (eobp))
@@ -1760,7 +1788,7 @@ If optional argument is non-nil, checking is omitted."
            (if wl-summary-highlight
                (wl-highlight-summary-current-line nil nil t))
            (set-buffer-modified-p nil)))))))
-  
+
 (defun wl-summary-resume-cache-status ()
   "Resume the cache status of all messages in the current folder."
   (interactive)
@@ -1831,11 +1859,12 @@ If optional argument is non-nil, checking is omitted."
              (delete-region (match-beginning 1) (match-end 1))
              (insert (or smark " "))))
        (wl-highlight-summary-current-line smark)
-       (setq i (+ i 1))
-       (setq percent (/ (* i 100) count))
-       (elmo-display-progress
-        'wl-summary-resume-marks-and-highlight "Resuming all marks..."
-        percent)
+       (when (> count elmo-display-progress-threshold)
+         (setq i (+ i 1))
+         (setq percent (/ (* i 100) count))
+         (elmo-display-progress
+          'wl-summary-resume-marks-and-highlight "Resuming all marks..."
+          percent))
        (forward-line 1)))
     (message "Resuming all marks...done.")))
 
@@ -1863,11 +1892,12 @@ If optional argument is non-nil, checking is omitted."
                      (delete-region (match-beginning 1) (match-end 1))
                      (insert (or (cadr entity)
                                  " ")))))))
-       (setq i (+ i 1))
-       (setq percent (/ (* i 100) count))
-       (elmo-display-progress
-        'wl-summary-resume-marks "Resuming all marks..."
-        percent)
+       (when (> count elmo-display-progress-threshold)
+         (setq i (+ i 1))
+         (setq percent (/ (* i 100) count))
+         (elmo-display-progress
+          'wl-summary-resume-marks "Resuming all marks..."
+          percent))
        (setq mark-alist (cdr mark-alist)))
       (message "Resuming all marks...done."))))
 
@@ -1880,14 +1910,15 @@ If optional argument is non-nil, checking is omitted."
          (len (length msgs))
          (i 0)
          update-list)
+      (elmo-kill-buffer wl-summary-search-buf-name)
       (while msgs
        (if (eq wl-summary-buffer-view 'thread)
            (progn
+             ;; don't use wl-append(nconc), because list is broken. ...why?
              (setq update-list
-                   (wl-append update-list
-                              (wl-thread-delete-message (car msgs))))
-             (setq update-list (and update-list
-                                    (delete (car msgs) update-list))))
+                   (append update-list
+                           (wl-thread-delete-message (car msgs))))
+             (setq update-list (delq (car msgs) update-list)))
          (goto-char (point-min))
          (if (re-search-forward (format "^ *%d[^0-9]\\([^0-9]\\).*$"
                                         (car msgs)) nil t)
@@ -1895,19 +1926,18 @@ If optional argument is non-nil, checking is omitted."
                (delete-region (match-beginning 0) (match-end 0))
                (delete-char 1) ; delete '\n'
                )))
-       (when deleting-info
+       (when (and deleting-info
+                  (> len elmo-display-progress-threshold))
          (setq i (1+ i))
-         (and (zerop (% i 10))
-              (elmo-display-progress
-               'wl-summary-delete-messages-on-buffer "Deleting..."
-               (/ (* i 100) len))))
+         (if (or (zerop (% i 5)) (= i len))
+             (elmo-display-progress
+              'wl-summary-delete-messages-on-buffer "Deleting..."
+              (/ (* i 100) len))))
        (setq msgs (cdr msgs)))
-      (when deleting-info
-       (elmo-display-progress
-        'wl-summary-delete-messages-on-buffer "Deleting..." 100))
-      (if (eq wl-summary-buffer-view 'thread)
-         (wl-thread-update-line-msgs (elmo-uniq-list update-list)))
-      (wl-thread-cleanup-symbols msgs2)
+      (when (eq wl-summary-buffer-view 'thread)
+       (wl-thread-update-line-msgs (elmo-uniq-list update-list)
+                                   (unless deleting-info 'no-msg))
+       (wl-thread-cleanup-symbols msgs2))
       (wl-summary-count-unread
        (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
       (wl-summary-update-modeline)
@@ -1993,7 +2023,7 @@ If optional argument is non-nil, checking is omitted."
          (setq delete-list (delete (car dlist) delete-list)))
       (setq dlist (cdr dlist)))
     delete-list))
-  
+
 (defun wl-summary-get-append-message-func ()
   (if (eq wl-summary-buffer-view 'thread)
       'wl-summary-insert-thread-entity
@@ -2023,9 +2053,10 @@ If optional argument is non-nil, checking is omitted."
   (interactive)
   (let ((plugged (elmo-folder-plugged-p wl-summary-buffer-folder-name))
        (last-progress 0)
+       (i 0)
        mark-alist unread-marks msgs mark importants unreads
        importants-in-db unreads-in-db has-imap4 diff diffs
-       mes num-ma ma-length progress)
+       mes num-ma progress)
     ;; synchronize marks.
     (when (not (eq (elmo-folder-get-type
                    wl-summary-buffer-folder-name)
@@ -2036,23 +2067,15 @@ If optional argument is non-nil, checking is omitted."
                               wl-summary-new-mark)
            mark-alist (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb)
             num-ma (length mark-alist)
-           ma-length num-ma
            importants (elmo-list-folder-important
                        wl-summary-buffer-folder-name
-                       (elmo-msgdb-get-overview wl-summary-buffer-msgdb))
-           has-imap4 (elmo-folder-contains-type
-                      wl-summary-buffer-folder-name 'imap4)
-           unreads (if (and has-imap4 plugged)
-                       (elmo-list-folder-unread
-                        wl-summary-buffer-folder-name
-                        mark-alist unread-marks)))
+                       (elmo-msgdb-get-number-alist wl-summary-buffer-msgdb))
+           unreads (elmo-list-folder-unread
+                    wl-summary-buffer-folder-name
+                    (elmo-msgdb-get-number-alist wl-summary-buffer-msgdb)
+                    (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb)
+                    unread-marks))
       (while mark-alist
-       (setq progress (/ (* (- num-ma ma-length) 100) num-ma))
-       (if (not (eq progress last-progress))
-           (elmo-display-progress 'wl-summary-sync-marks
-                                  "Updating marks..."
-                                  progress))
-       (setq last-progress progress)
        (if (string= (cadr (car mark-alist))
                     wl-summary-important-mark)
            (setq importants-in-db (cons (car (car mark-alist))
@@ -2060,11 +2083,15 @@ If optional argument is non-nil, checking is omitted."
          (if (member (cadr (car mark-alist)) unread-marks)
              (setq unreads-in-db (cons (car (car mark-alist))
                                        unreads-in-db))))
-       (setq mark-alist (cdr mark-alist)
-             ma-length (1- ma-length)))
-      (elmo-display-progress 'wl-summary-sync-marks
-                            "Updating marks..."
-                            100)
+       (setq mark-alist (cdr mark-alist))
+       (when (> num-ma elmo-display-progress-threshold)
+         (setq i (1+ i)
+               progress (/ (* i 100) num-ma))
+         (if (not (eq progress last-progress))
+             (elmo-display-progress 'wl-summary-sync-marks
+                                    "Updating marks..."
+                                    progress))
+         (setq last-progress progress)))
       (setq diff (elmo-list-diff importants importants-in-db))
       (setq diffs (cadr diff)) ; important-deletes
       (setq mes (format "Updated (-%d" (length diffs)))
@@ -2078,18 +2105,17 @@ If optional argument is non-nil, checking is omitted."
       (while diffs
        (wl-summary-mark-as-important (car diffs) " " 'no-server)
        (setq diffs (cdr diffs)))
-      (when (and has-imap4 plugged)
-       (setq diff (elmo-list-diff unreads unreads-in-db))
-       (setq diffs (cadr diff))
-       (setq mes (concat mes (format "(-%d" (length diffs))))
-       (while diffs
-         (wl-summary-mark-as-read t 'no-server nil (car diffs) 'no-cache)
-         (setq diffs (cdr diffs)))
-       (setq diffs (car diff)) ; unread-appends
-       (setq mes (concat mes (format "/+%d) unread mark(s)." (length diffs))))
-       (while diffs
-         (wl-summary-mark-as-unread (car diffs) 'no-server 'no-modeline)
-         (setq diffs (cdr diffs))))
+      (setq diff (elmo-list-diff unreads unreads-in-db))
+      (setq diffs (cadr diff))
+      (setq mes (concat mes (format "(-%d" (length diffs))))
+      (while diffs
+       (wl-summary-mark-as-read t 'no-server nil (car diffs))
+       (setq diffs (cdr diffs)))
+      (setq diffs (car diff)) ; unread-appends
+      (setq mes (concat mes (format "/+%d) unread mark(s)." (length diffs))))
+      (while diffs
+       (wl-summary-mark-as-unread (car diffs) 'no-server 'no-modeline)
+       (setq diffs (cdr diffs)))
       (if (interactive-p) (message mes)))))
 
 (defun wl-summary-confirm-appends (appends)
@@ -2105,8 +2131,10 @@ If optional argument is non-nil, checking is omitted."
                  (setq in (read-from-minibuffer "Update number: "
                                                 (int-to-string in))
                        in (string-to-int in))
+                 (if (< len in)
+                     (throw 'end len))
                  (if (y-or-n-p (format "%d messages are disappeared. OK?"
-                                       (- len in)))
+                                       (max (- len in) 0)))
                      (throw 'end in))))
              (nthcdr (max (- len in) 0) appends))
          appends))
@@ -2127,14 +2155,14 @@ If optional argument is non-nil, checking is omitted."
         (elmo-mime-charset wl-summary-buffer-mime-charset)
         (inhibit-read-only t)
         (buffer-read-only nil)
-        diff append-list delete-list
-        i percent num result
+        diff initial-append-list append-list delete-list has-nntp
+        i num result
         gc-message
         in-folder
         in-db curp
         overview-append
         entity ret-val crossed crossed2 sync-all
-        top-num update-top-list mark
+        update-thread update-top-list mark
         expunged msgs unreads importants)
     ;(setq seen-list nil) ;for debug.
     (fset 'wl-summary-append-message-func-internal
@@ -2143,19 +2171,25 @@ If optional argument is non-nil, checking is omitted."
     (setq seen-list
          (wl-summary-flush-pending-append-operations seen-list))
     (goto-char (point-max))
+    (wl-folder-confirm-existence folder 'force)
     (message "Checking folder diff...")
+    (elmo-commit folder)
     (setq in-folder (elmo-list-folder folder))
     (setq in-db (sort (mapcar 'car number-alist) '<))
     (when (or (eq msgdb nil) ; trick for unplugged...
-             (equal msgdb '(nil nil nil nil)))
+             (and (null overview)
+                  (null number-alist)
+                  (null mark-alist)))
       (setq sync-all t)
       (wl-summary-set-message-modified)
       (wl-summary-set-mark-modified)
       (erase-buffer))
-    (setq diff (if (eq (elmo-folder-get-type folder) 'multi)
-                  (elmo-multi-list-bigger-diff in-folder in-db)
-                (elmo-list-bigger-diff in-folder in-db)))
-    (setq append-list (car diff))
+    (if (not elmo-use-killed-list)
+       (setq diff (if (eq (elmo-folder-get-type folder) 'multi)
+                      (elmo-multi-list-bigger-diff in-folder in-db)
+                    (elmo-list-bigger-diff in-folder in-db)))
+      (setq diff (elmo-list-diff in-folder in-db)))
+    (setq initial-append-list (car diff))
     (setq delete-list (cadr diff))
     (message "Checking folder diff...done.")
     ;; Don't delete important-marked msgs other than 'internal.
@@ -2163,16 +2197,15 @@ If optional argument is non-nil, checking is omitted."
       (setq delete-list
            (wl-summary-delete-important-msgs-from-list delete-list
                                                        mark-alist)))
-    (if (and (elmo-folder-contains-type folder 'nntp)
+    (if (and has-nntp
             (elmo-nntp-max-number-precedes-list-active-p))
        ;; XXX this does not work correctly in rare case.
        (setq delete-list
-             (wl-summary-delete-canceled-msgs-from-list delete-list
-                                                        msgdb)))
+             (wl-summary-delete-canceled-msgs-from-list delete-list msgdb)))
     (if (or (equal diff '(nil nil))
            (equal diff '(nil))
            (and (eq (length delete-list) 0)
-                (eq (length append-list) 0)))
+                (eq (length initial-append-list) 0)))
        (progn
          ;; For max-number update...
          (if (and (elmo-folder-contains-type folder 'nntp)
@@ -2195,7 +2228,12 @@ If optional argument is non-nil, checking is omitted."
        wl-summary-new-mark
        wl-summary-unread-uncached-mark)
       ;; Confirm appended message number.
-      (setq append-list (wl-summary-confirm-appends append-list))
+      (setq append-list (wl-summary-confirm-appends initial-append-list))
+      (when (and elmo-use-killed-list
+                (not (eq (length initial-append-list)
+                         (length append-list)))
+                (setq diff (elmo-list-diff initial-append-list append-list)))
+       (elmo-msgdb-append-to-killed-list folder (car diff)))
       (setq num (length append-list))
       (if append-list
          (progn
@@ -2215,7 +2253,7 @@ If optional argument is non-nil, checking is omitted."
              (setq result (cdr crossed))
              (setq crossed (car crossed)))
            (setq overview-append (car result))
-           (setq msgdb (elmo-msgdb-append msgdb result))
+           (setq msgdb (elmo-msgdb-append msgdb result t))
            ;; set these value for append-message-func
            (setq overview (elmo-msgdb-get-overview msgdb))
            (setq number-alist (elmo-msgdb-get-number-alist msgdb))
@@ -2223,31 +2261,43 @@ If optional argument is non-nil, checking is omitted."
            ;; (setq location (elmo-msgdb-get-location msgdb))
            (setq curp overview-append)
            (setq num (length curp))
+           (setq wl-summary-delayed-update nil)
+           (elmo-kill-buffer wl-summary-search-buf-name)
            (while curp
              (setq entity (car curp))
-             (setq top-num
-                   (wl-summary-append-message-func-internal
-                    entity overview mark-alist
-                    (not sync-all)))
-             (when top-num
-               (wl-append update-top-list (list top-num)))
+             (when (setq update-thread
+                         (wl-summary-append-message-func-internal
+                          entity overview mark-alist
+                          (not sync-all)))
+               (wl-append update-top-list update-thread))
              (if elmo-use-database
                  (elmo-database-msgid-put
                   (car entity) folder
                   (elmo-msgdb-overview-entity-get-number entity)))
              (setq curp (cdr curp))
-             (setq i (+ i 1))
-             (setq percent (/ (* i 100) num))
-             (elmo-display-progress
-              'wl-summary-sync-update3 "Updating thread..."
-              percent))
-           (setq update-top-list
-                 (elmo-uniq-list update-top-list))
+             (when (> num elmo-display-progress-threshold)
+               (setq i (+ i 1))
+               (if (or (zerop (% i 5)) (= i num))
+                   (elmo-display-progress
+                    'wl-summary-sync-update3 "Updating thread..."
+                    (/ (* i 100) num)))))
+           (when wl-summary-delayed-update
+             (while wl-summary-delayed-update
+               (message "Parent (%d) of message %d is no entity"
+                        (caar wl-summary-delayed-update)
+                        (elmo-msgdb-overview-entity-get-number
+                         (cdar wl-summary-delayed-update)))
+               (when (setq update-thread
+                           (wl-summary-append-message-func-internal
+                            (cdar wl-summary-delayed-update)
+                            overview mark-alist (not sync-all) t))
+                 (wl-append update-top-list update-thread))
+               (setq wl-summary-delayed-update
+                     (cdr wl-summary-delayed-update))))
            (when (and (eq wl-summary-buffer-view 'thread)
-                      update-top-list )
-             (message "Updating indent...")
-             (wl-thread-update-indent-string-thread update-top-list)
-             (message "Updating indent...done."))
+                      update-top-list)
+             (wl-thread-update-indent-string-thread
+              (elmo-uniq-list update-top-list)))
            (message "Updating thread...done.")
            ;;(set-buffer cur-buf)
            ))
@@ -2255,6 +2305,7 @@ If optional argument is non-nil, checking is omitted."
       (wl-summary-set-mark-modified)
       (setq wl-summary-buffer-msgdb msgdb)
       (when (and sync-all (eq wl-summary-buffer-view 'thread))
+       (elmo-kill-buffer wl-summary-search-buf-name)
        (message "Inserting thread...")
        (setq wl-thread-entity-cur 0)
        (wl-thread-insert-top)
@@ -2274,11 +2325,11 @@ If optional argument is non-nil, checking is omitted."
                                (and sync-all
                                     (wl-summary-rescore-msgs number-alist))
                                sync-all)
-      (setq expunged (wl-summary-score-update-all-lines))
-      (if expunged
-         (setq ret-val (concat ret-val
-                               (format " (%d expunged)"
-                                       (length expunged))))))
+      (when (and wl-summary-scored
+                (setq expunged (wl-summary-score-update-all-lines)))
+       (setq ret-val (concat ret-val
+                             (format " (%d expunged)"
+                                     (length expunged))))))
     ;; crosspost
     (setq crossed2 (wl-summary-update-crosspost))
     (if (or crossed crossed2)
@@ -2298,6 +2349,7 @@ If optional argument is non-nil, checking is omitted."
                                                 msgdb))
                                               (length in-folder)))
     (wl-summary-update-modeline)
+    (wl-summary-buffer-number-column-detect t)
     ;;
     (unless unset-cursor
       (goto-char (point-min))
@@ -2377,13 +2429,15 @@ If optional argument is non-nil, checking is omitted."
       (message "Hilighting...")
       (setq i 0)
       (while msgs
-       (setq i (+ i 1))
-       (elmo-display-progress
-        'wl-summary-highlight-msgs "Highlighting..."
-        (/ (* i 100) len))
        (if (wl-summary-jump-to-msg (car msgs))
            (wl-highlight-summary-current-line))
-       (setq msgs (cdr msgs)))
+       (setq msgs (cdr msgs))
+       (when (> len elmo-display-progress-threshold)
+         (setq i (+ i 1))
+         (if (or (zerop (% i 5)) (= i len))
+             (elmo-display-progress
+              'wl-summary-highlight-msgs "Highlighting..."
+              (/ (* i 100) len)))))
       (message "Highlighting...done."))))
 
 (defun wl-summary-message-number ()
@@ -2524,8 +2578,9 @@ If optional argument is non-nil, checking is omitted."
       (get-buffer (wl-summary-sticky-buffer-name fld))
     (not (string= wl-summary-buffer-name (buffer-name)))))
 
-(defmacro wl-summary-always-sticky-folder-p (fld)
-  (` (wl-string-match-member (, fld) wl-summary-always-sticky-folder-list)))
+(defun wl-summary-always-sticky-folder-p (fld)
+  (or (eq t wl-summary-always-sticky-folder-list)
+      (wl-string-match-member fld wl-summary-always-sticky-folder-list)))
 
 (defun wl-summary-stick (&optional force)
   "Make current summary buffer sticky."
@@ -2557,7 +2612,8 @@ If optional argument is non-nil, checking is omitted."
                   wl-summary-buffer-number-column
                   wl-summary-buffer-number-regexp
                   wl-summary-buffer-message-modified
-                  wl-summary-buffer-mark-modified)
+                  wl-summary-buffer-mark-modified
+                  wl-summary-buffer-thread-modified)
                 (and (eq wl-summary-buffer-view 'thread)
                      '(wl-thread-entity-hashtb
                        wl-thread-entities
@@ -2573,25 +2629,19 @@ If optional argument is non-nil, checking is omitted."
                      '(wl-current-score-file
                        wl-score-alist)))))
     (set-buffer buf)
-    (wl-summary-buffer-set-folder folder)
     (wl-summary-mode)
+    (wl-summary-buffer-set-folder folder)
     (let ((buffer-read-only nil))
       (insert-buffer cur-buf))
     (set-buffer-modified-p nil)
-    (mapcar
-     (function
-      (lambda (var)
-       (set var (save-excursion
-                  (set-buffer cur-buf)
-                  (symbol-value var)))))
-     copy-variables)
+    (while copy-variables
+      (set (car copy-variables)
+          (save-excursion
+            (set-buffer cur-buf)
+            (symbol-value (car copy-variables))))
+      (setq copy-variables (cdr copy-variables)))
     (switch-to-buffer buf)
     (kill-buffer cur-buf)
-    (setq mode-line-buffer-identification
-         (format "Wanderlust: %s"
-                 (if (memq 'modeline wl-use-folder-petname)
-                     (wl-folder-get-petname folder)
-                   folder)))
     (wl-summary-count-unread
      (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
     (wl-summary-update-modeline)
@@ -2635,7 +2685,7 @@ If optional argument is non-nil, checking is omitted."
     (if (not disp)
        (setq wl-summary-buffer-disp-msg nil))
     (when (and (not disp)
-              (setq mes-win (wl-message-buffer-window)))
+              (setq mes-win (wl-message-buffer-window)))
       (delete-window mes-win)
       (run-hooks 'wl-summary-toggle-disp-off-hook))))
 
@@ -2669,9 +2719,9 @@ If optional argument is non-nil, checking is omitted."
          (if other-window
              (delete-other-windows))
          (set-buffer buf)
-         (wl-summary-buffer-set-folder fld)
          (unless (eq major-mode 'wl-summary-mode)
            (wl-summary-mode))
+         (wl-summary-buffer-set-folder fld)
          (setq wl-summary-buffer-disp-msg nil)
          (setq wl-summary-buffer-last-displayed-msg nil)
          (setq wl-summary-buffer-current-msg nil)
@@ -2679,12 +2729,7 @@ If optional argument is non-nil, checking is omitted."
                (inhibit-read-only t)
                (buffer-read-only nil))
            (erase-buffer)
-           (setq mode-line-buffer-identification
-                 (format "Wanderlust: %s"
-                         (if (memq 'modeline wl-use-folder-petname)
-                             (wl-folder-get-petname fld)
-                           fld)))
-             ;; resume summary cache
+           ;; resume summary cache
            (if wl-summary-cache-use
                (let* ((dir (elmo-msgdb-expand-path fld))
                       (cache (expand-file-name wl-summary-cache-file dir))
@@ -2809,7 +2854,7 @@ If optional argument is non-nil, checking is omitted."
 
 (defun wl-summary-goto-bottom-of-current-thread ()
   (if (re-search-forward (concat "^" wl-summary-buffer-number-regexp
-                                "..../..\(.*\)..:.. \\[") nil t)
+                                "..../..\(.*\)..:.. [[<]") nil t)
       ()
     (goto-char (point-max))))
 
@@ -2850,7 +2895,7 @@ If optional argument is non-nil, checking is omitted."
     (error (ding)
           (message "Error in wl-summary-line-inserted-hook"))))
 
-(defun wl-summary-insert-summary (entity database mark-alist dummy)
+(defun wl-summary-insert-summary (entity database mark-alist dummy &optional dummy)
   (let ((overview-entity entity)
        summary-line msg)
     (setq msg (elmo-msgdb-overview-entity-get-number entity))
@@ -2872,43 +2917,142 @@ If optional argument is non-nil, checking is omitted."
   (string= (wl-summary-subject-filter-func-internal subject1)
           (wl-summary-subject-filter-func-internal subject2)))
 
-(defun wl-summary-insert-thread-entity (entity overview mark-alist update)
-  (let* ((this-id (elmo-msgdb-overview-entity-get-id entity))
-        (parent-entity
-         (elmo-msgdb-overview-get-parent-entity entity overview));; temp
-        ;;(parent-id (elmo-msgdb-overview-entity-get-id parent-entity))
-        (parent-number (elmo-msgdb-overview-entity-get-number parent-entity))
-        ;;(case-fold-search t)
-        ;;overview2 cur-entity
-        msg)
-    ;; Search parent by subject.
-;     (when (and (null parent-number)
-;             (string-match wl-summary-search-parent-by-subject-regexp
-;                           (elmo-msgdb-overview-entity-get-subject
-;                            entity)))
-;       (setq overview2 overview)
-;       (while overview2
-;      (setq cur-entity (car overview2))
-;      (when (wl-summary-subject-equal
-;             (or (elmo-msgdb-overview-entity-get-subject cur-entity)
-;                 "")
-;             (or (elmo-msgdb-overview-entity-get-subject entity)
-;                 ""))
-;        (setq parent-number (elmo-msgdb-overview-entity-get-number
-;                             cur-entity))
-;        (setq overview2 nil))
-;      (setq overview2 (cdr overview2))))
-    (if (and parent-number
-            wl-summary-divide-thread-when-subject-changed
-            (not (wl-summary-subject-equal
-                  (or (elmo-msgdb-overview-entity-get-subject
-                       entity) "")
-                  (or (elmo-msgdb-overview-entity-get-subject
-                       parent-entity) ""))))
-       (setq parent-number nil))
-    (setq msg (elmo-msgdb-overview-entity-get-number entity))
-    (wl-thread-insert-message entity overview mark-alist
-                             msg parent-number update)))
+(defmacro wl-summary-put-alike (alike)
+  (` (elmo-set-hash-val (format "#%d" (wl-count-lines))
+                       (, alike)
+                       wl-summary-alike-hashtb)))
+
+(defmacro wl-summary-get-alike ()
+  (` (elmo-get-hash-val (format "#%d" (wl-count-lines))
+                       wl-summary-alike-hashtb)))
+
+(defun wl-summary-insert-headers (overview func mime-decode)
+  (let (ov this last alike)
+    (buffer-disable-undo (current-buffer))
+    (make-local-variable 'wl-summary-alike-hashtb)
+    (setq wl-summary-alike-hashtb (elmo-make-hash (* (length overview) 2)))
+    (when mime-decode
+      (elmo-set-buffer-multibyte default-enable-multibyte-characters))
+    (while (setq ov (pop overview))
+      (setq this (funcall func ov))
+      (and this (setq this (std11-unfold-string this)))
+      (if (equal last this)
+         (wl-append alike (list ov))
+       (when last
+         (wl-summary-put-alike alike)
+         (insert last ?\n))
+       (setq alike (list ov)
+             last this)))
+    (when last
+      (wl-summary-put-alike alike)
+      (insert last ?\n))
+    (when mime-decode
+      (decode-mime-charset-region (point-min) (point-max)
+                                 elmo-mime-charset)
+      (when (eq mime-decode 'mime)
+       (eword-decode-region (point-min) (point-max))))
+    (run-hooks 'wl-summary-insert-headers-hook)))
+
+(defun wl-summary-search-by-subject (entity overview)
+  (let ((buf (get-buffer-create wl-summary-search-buf-name))
+       (folder-name wl-summary-buffer-folder-name)
+       match founds found-entity)
+    (save-excursion
+      (set-buffer buf)
+      (let ((case-fold-search t))
+       (when (or (not (string= wl-summary-buffer-folder-name folder-name))
+                 (zerop (buffer-size)))
+         (setq wl-summary-buffer-folder-name folder-name)
+         (wl-summary-insert-headers
+          overview
+          (function
+           (lambda (x)
+             (wl-summary-subject-filter-func-internal
+              (elmo-msgdb-overview-entity-get-subject-no-decode x))))
+          t))
+       (setq match (wl-summary-subject-filter-func-internal
+                    (elmo-msgdb-overview-entity-get-subject entity)))
+       (if (string= match "")
+           (setq match "\n"))
+       (goto-char (point-max))
+       (while (and (not founds)
+                   (not (= (point) (point-min)))
+                   (search-backward match nil t))
+         ;; check exactly match
+         (when (and (bolp)
+                    (= (point-at-eol)
+                       (match-end 0)))
+           (setq found-entity (wl-summary-get-alike))
+           (if (and found-entity
+                    ;; Is founded entity myself or children?
+                    (not (string=
+                          (elmo-msgdb-overview-entity-get-id entity)
+                          (elmo-msgdb-overview-entity-get-id (car found-entity))))
+                    (not (wl-thread-descendant-p
+                          (elmo-msgdb-overview-entity-get-number entity)
+                          (elmo-msgdb-overview-entity-get-number (car found-entity)))))
+               ;; return matching entity
+               (setq founds found-entity))))
+       (if founds
+           (car founds))))))
+
+(defun wl-summary-insert-thread-entity (entity overview mark-alist update
+                                              &optional force-insert)
+  (let (update-list entity-stack)
+    (while entity
+      (let* ((this-id (elmo-msgdb-overview-entity-get-id entity))
+            (parent-entity
+             (elmo-msgdb-overview-get-parent-entity entity overview));; temp
+            ;;(parent-id (elmo-msgdb-overview-entity-get-id parent-entity))
+            (parent-number (elmo-msgdb-overview-entity-get-number parent-entity))
+            (case-fold-search t)
+            msg overview2 cur-entity linked retval delayed-entity)
+       (setq msg (elmo-msgdb-overview-entity-get-number entity))
+       (if (and parent-number
+                (not (wl-thread-get-entity parent-number))
+                (not force-insert))
+           ;; parent is exists in overview, but not exists in wl-thread-entities
+           (progn
+             (wl-append wl-summary-delayed-update
+                        (list (cons parent-number entity)))
+             (setq entity nil)) ;; exit loop
+         ;; Search parent by subject.
+         (when (and (null parent-number)
+                    wl-summary-search-parent-by-subject-regexp
+                    (string-match wl-summary-search-parent-by-subject-regexp
+                                  (elmo-msgdb-overview-entity-get-subject entity)))
+           (let ((found (wl-summary-search-by-subject entity overview)))
+             (when (and found
+                        (not (member found wl-summary-delayed-update)))
+               (setq parent-entity found)
+               (setq parent-number
+                     (elmo-msgdb-overview-entity-get-number parent-entity))
+               (setq linked t))))
+         ;; If subject is change, divide thread.
+         (if (and parent-number
+                  wl-summary-divide-thread-when-subject-changed
+                  (not (wl-summary-subject-equal
+                        (or (elmo-msgdb-overview-entity-get-subject
+                             entity) "")
+                        (or (elmo-msgdb-overview-entity-get-subject
+                             parent-entity) ""))))
+             (setq parent-number nil))
+         ;;
+         (setq retval
+               (wl-thread-insert-message entity overview mark-alist
+                                         msg parent-number update linked))
+         (and retval
+              (wl-append update-list (list retval)))
+         (setq entity nil) ; exit loop
+         (while (setq delayed-entity (assq msg wl-summary-delayed-update))
+           (setq wl-summary-delayed-update
+                 (delete delayed-entity wl-summary-delayed-update))
+           ;; update delayed message
+           (wl-append entity-stack (list (cdr delayed-entity)))))
+       (if (and (not entity)
+                entity-stack)
+           (setq entity (pop entity-stack)))))
+    update-list))
 
 (defun wl-summary-update-thread (entity
                                 overview
@@ -2931,12 +3075,12 @@ If optional argument is non-nil, checking is omitted."
                       parent-number (current-buffer)) -1))
       (setq depth (+ 1 depth))
       (wl-thread-goto-bottom-of-sub-thread)))
-    (if (and (elmo-msgdb-overview-entity-get-number entity))
+    (if (and (setq msg (elmo-msgdb-overview-entity-get-number entity)))
        (if (setq summary-line
                  (wl-summary-overview-create-summary-line
-                  (elmo-msgdb-overview-entity-get-number entity)
-                  entity parent-entity depth mark-alist nil nil
-                  thr-entity))
+                  msg entity parent-entity depth mark-alist
+                  (wl-thread-maybe-get-children-num msg)
+                  nil thr-entity))
            (let ((inhibit-read-only t)
                  (buffer-read-only nil))
              (wl-summary-insert-line summary-line))))))
@@ -2991,8 +3135,9 @@ If optional argument is non-nil, checking is omitted."
                                 wl-summary-unread-uncached-mark))))
            ;; server side mark
            (unless no-server-update
-             (elmo-mark-as-unread folder (list number)
-                                  msgdb))
+             (unless (elmo-mark-as-unread folder (list number)
+                                          msgdb)
+               (error "Setting mark failed")))
            (when visible
              (delete-region (match-beginning 2) (match-end 2))
              (insert new-mark))
@@ -3125,22 +3270,27 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
     (wl-summary-exec-subr (wl-summary-mark-collect "o" beg end)
                          (wl-summary-mark-collect "D" beg end)
                          (wl-summary-mark-collect "O" beg end))))
-  
-(defun wl-summary-exec-subr (msgs dels cpys)
-  (save-excursion
-    (let* ((del-fld (wl-summary-get-delete-folder
-                    wl-summary-buffer-folder-name))
-          (start (point))
-          dst tmp msg msgs2 cpys2
-          msg-dst dst-msgs len
-          refile-failures
-          copy-failures
-          succeeds result executed)
-      (if (not (or msgs dels cpys))
-         (message "No marks")
+
+(defun wl-summary-exec-subr (moves dels copies)
+  (if (not (or moves dels copies))
+      (message "No marks")
+    (save-excursion
+      (let ((del-fld (wl-summary-get-delete-folder
+                     wl-summary-buffer-folder-name))
+           (start (point))
+           (unread-marks (list wl-summary-unread-cached-mark
+                               wl-summary-unread-uncached-mark
+                               wl-summary-new-mark))
+           (refiles (append moves dels))
+           (refile-executed 0)
+           (refile-failures 0)
+           (copy-executed 0)
+           (copy-failures 0)
+           (copy-len (length copies))
+           refile-len
+           dst-msgs                    ; loop counter
+           result)
        (message "Executing ...")
-       (setq msgs (append msgs dels))
-       (setq msgs2 msgs)
        (while dels
          (when (not (assq (car dels) wl-summary-buffer-refile-list))
            (wl-append wl-summary-buffer-refile-list
@@ -3148,21 +3298,12 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
            (setq wl-summary-buffer-delete-list
                  (delete (car dels) wl-summary-buffer-delete-list)))
          (setq dels (cdr dels)))
-       (setq len (length msgs2))
        ;; begin refile...
-       (while msgs
-         (setq msg (car msgs))
-         (setq msgs (cdr msgs))
-         (setq msg-dst (assq msg wl-summary-buffer-refile-list))
-         (setq dst (cdr msg-dst))
-         (if dst
-             (if (setq tmp (assoc dst dst-msgs))
-                 (setq dst-msgs (cons (append tmp (list msg))
-                                        (delete tmp dst-msgs)))
-               (setq dst-msgs (cons (list dst msg) dst-msgs)))))
-       (setq refile-failures 0)
-       (goto-char start) ; avoid moving cursor to the bottom line.
-       (setq executed 0)
+       (setq refile-len (length refiles))
+       (setq dst-msgs
+             (wl-inverse-alist refiles wl-summary-buffer-refile-list))
+       (goto-char start)               ; avoid moving cursor to
+                                       ; the bottom line.
        (while dst-msgs
          ;;(elmo-msgdb-add-msgs-to-seen-list
          ;; (car (car dst-msgs)) ;dst-folder
@@ -3176,83 +3317,59 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                                           (cdr (car dst-msgs))
                                           (car (car dst-msgs))
                                           wl-summary-buffer-msgdb
-                                          len executed (cdr dst-msgs)
+                                          refile-len
+                                          refile-executed
+                                          (not (null (cdr dst-msgs)))
                                           nil ; no-delete
                                           nil ; same-number
-                                          (list wl-summary-unread-cached-mark
-                                                wl-summary-unread-uncached-mark
-                                                wl-summary-new-mark)))
+                                          unread-marks))
            (error nil))
-         (if result ; succeeded.
+         (if result                    ; succeeded.
              (progn
                ;; update buffer.
-               (wl-summary-delete-messages-on-buffer
-                (cdr (car dst-msgs)))
+               (wl-summary-delete-messages-on-buffer (cdr (car dst-msgs)))
                ;; update refile-alist.
-               (mapcar
-                (function
-                 (lambda (x)
-                   (setq wl-summary-buffer-refile-list
-                         (delq (assq x wl-summary-buffer-refile-list)
-                               wl-summary-buffer-refile-list))))
-                (cdr (car dst-msgs))))
+               (setq wl-summary-buffer-refile-list
+                     (wl-delete-associations (cdr (car dst-msgs))
+                                            wl-summary-buffer-refile-list)))
            (setq refile-failures
                  (+ refile-failures (length (cdr (car dst-msgs))))))
-         (setq executed (+ executed (length (cdr (car dst-msgs)))))
+         (setq refile-executed (+ refile-executed (length (cdr (car dst-msgs)))))
          (setq dst-msgs (cdr dst-msgs)))
        ;; end refile
        ;; begin cOpy...
-       (setq cpys2 cpys)
-       (setq len (length cpys2))
-       (while cpys
-         (setq msg (car cpys))
-         (setq cpys (cdr cpys))
-         (setq msg-dst (assq msg wl-summary-buffer-copy-list))
-         (setq dst (cdr msg-dst))
-         (if dst
-             (if (setq tmp (assoc dst dst-msgs))
-                 (setq dst-msgs (cons (append tmp (list msg))
-                                      (delete tmp dst-msgs)))
-               (setq dst-msgs (cons (list dst msg) dst-msgs)))))
-       (setq copy-failures 0)
-       (setq executed 0)
+       (setq dst-msgs (wl-inverse-alist copies wl-summary-buffer-copy-list))
        (while dst-msgs
          ;;(elmo-msgdb-add-msgs-to-seen-list
-         ;;(car (car dst-msgs)) ;dst-folder
-         ;;(cdr (car dst-msgs)) ;msgs
-         ;;wl-summary-buffer-msgdb
-         ;;(concat wl-summary-important-mark
-         ;;wl-summary-read-uncached-mark))
+         ;; (car (car dst-msgs)) ;dst-folder
+         ;; (cdr (car dst-msgs)) ;msgs
+         ;; wl-summary-buffer-msgdb
+         ;; (concat wl-summary-important-mark
+         ;;  wl-summary-read-uncached-mark))
          (setq result nil)
          (condition-case nil
              (setq result (elmo-move-msgs wl-summary-buffer-folder-name
                                           (cdr (car dst-msgs))
                                           (car (car dst-msgs))
                                           wl-summary-buffer-msgdb
-                                          len executed
-                                          (cdr dst-msgs)
+                                          copy-len
+                                          copy-executed
+                                          (not (null (cdr dst-msgs)))
                                           t ; t is no-delete (copy)
                                           nil ; same number
-                                          (list
-                                           wl-summary-unread-cached-mark
-                                           wl-summary-unread-uncached-mark
-                                           wl-summary-new-mark)))
+                                          unread-marks))
            (error nil))
-         (if result ; succeeded.
+         (if result                    ; succeeded.
              (progn
                ;; update buffer.
                (wl-summary-delete-copy-marks-on-buffer (cdr (car dst-msgs)))
                ;; update copy-alist
-               (mapcar
-                (function
-                 (lambda (x)
-                   (setq wl-summary-buffer-copy-list
-                         (delq (assq x wl-summary-buffer-copy-list)
-                               wl-summary-buffer-copy-list))))
-                (cdr (car dst-msgs))))
+               (setq wl-summary-buffer-copy-list
+                     (wl-delete-associations (cdr (car dst-msgs))
+                                             wl-summary-buffer-copy-list)))
            (setq copy-failures
                  (+ copy-failures (length (cdr (car dst-msgs))))))
-         (setq executed (+ executed (length (cdr (car dst-msgs)))))
+         (setq copy-executed (+ copy-executed (length (cdr (car dst-msgs)))))
          (setq dst-msgs (cdr dst-msgs)))
        ;; end cOpy
        (wl-summary-folder-info-update)
@@ -3287,7 +3404,9 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
            (string= fld ""))
        (setq fld default))
     (unless no-create
-      (wl-folder-confirm-existence fld ignore-error))
+      (if ignore-error
+         (ignore-errors (wl-folder-confirm-existence fld))
+       (wl-folder-confirm-existence fld)))
     fld))
 
 (defun wl-summary-print-destination (msg-num folder)
@@ -3345,15 +3464,15 @@ See `wl-refile-policy-alist' for more details."
               (call-interactively 'wl-summary-copy)
             (wl-summary-copy dst number)))
          (t
-          (wl-summary-refile-subr "refile" (interactive-p) dst number)))))
+          (wl-summary-refile-subr 'refile (interactive-p) dst number)))))
 
 (defun wl-summary-copy (&optional dst number)
-  "Put refile mark on current line message.
+  "Put copy mark on current line message.
 If optional argument DST is specified, put mark without asking
 destination folder.
 If optional argument NUMBER is specified, mark message specified by NUMBER."
   (interactive)
-  (wl-summary-refile-subr "copy" (interactive-p) dst number))
+  (wl-summary-refile-subr 'copy (interactive-p) dst number))
 
 (defun wl-summary-refile-subr (copy-or-refile interactive &optional dst number)
   (interactive)
@@ -3364,9 +3483,8 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                                (elmo-msgdb-get-number-alist
                                 wl-summary-buffer-msgdb)))))
         (entity (and msg-num
-                     (elmo-msgdb-overview-get-entity-by-number
-                      (elmo-msgdb-get-overview wl-summary-buffer-msgdb)
-                      msg-num)))
+                     (elmo-msgdb-overview-get-entity
+                      msg-num wl-summary-buffer-msgdb)))
         (variable
          (intern (format "wl-summary-buffer-%s-list" copy-or-refile)))
         folder mark already tmp-folder)
@@ -3391,18 +3509,18 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                                 (format "for %s" copy-or-refile)))))
       ;; Cache folder hack by okada@opaopa.org
       (if (and (eq (car (elmo-folder-get-spec folder)) 'cache)
-              (not (string= folder
+              (not (string= folder
                             (setq tmp-folder
                                   (concat "'cache/"
                                           (elmo-cache-get-path-subr
                                            (elmo-msgid-to-cache msgid)))))))
-         (progn
-           (setq folder tmp-folder)
-           (message "Force refile to %s." folder)))
+         (progn
+           (setq folder tmp-folder)
+           (message "Force refile to %s." folder)))
       (if (string= folder wl-summary-buffer-folder-name)
          (error "Same folder"))
       (if (and
-          (not (elmo-folder-plugged-p folder))
+          (not (elmo-folder-plugged-p wl-summary-buffer-folder-name))
           (or (null msgid)
               (not (elmo-cache-exists-p msgid))))
          (error "Unplugged (no cache or msgid)"))
@@ -3410,7 +3528,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
              (string= folder wl-draft-folder))
          (error "Don't %s messages to %s" copy-or-refile folder))
       ;; learn for refile.
-      (if (string= "refile" copy-or-refile)
+      (if (eq copy-or-refile 'refile)
          (wl-refile-learn entity folder))
       (wl-summary-unmark msg-num)
       (set variable (append
@@ -3418,7 +3536,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                     (list (cons msg-num folder))))
       (when (or interactive
                (eq number buffer-num))
-       (wl-summary-mark-line (if (string= "refile" copy-or-refile)
+       (wl-summary-mark-line (if (eq copy-or-refile 'refile)
                                  "o" "O"))
        ;; print refile destination
        (wl-summary-print-destination msg-num folder))
@@ -3474,8 +3592,8 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                                                             mark-alist))
                   (setq dst
                         (wl-refile-guess-by-rule
-                         (elmo-msgdb-overview-get-entity-by-number
-                          overview number)))
+                         (elmo-msgdb-overview-get-entity
+                          number wl-summary-buffer-msgdb)))
                   (not (equal dst spec)))
          (when (not (member dst checked-dsts))
            (wl-folder-confirm-existence dst)
@@ -3485,25 +3603,25 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
          (message "Marking...%d message(s)." count))
        (if (eq wl-summary-buffer-view 'thread)
            ;; process invisible children.
-           (if (not (wl-thread-entity-get-opened
-                     (setq thr-entity (wl-thread-get-entity number))))
-               (mapcar
-                (function
-                 (lambda (x)
-                   (when (and (setq dst
-                                    (wl-refile-guess-by-rule
-                                     (elmo-msgdb-overview-get-entity-by-number
-                                      overview x)))
-                              (not (equal dst spec)))
-                     (if (wl-summary-refile dst x)
-                         (incf count))
-                     (message "Marking...%d message(s)." count))))
-                (elmo-delete-if
-                 (function (lambda (x)
-                             (wl-summary-no-auto-refile-message-p
-                              x
-                              mark-alist)))
-                 (wl-thread-entity-get-descendant thr-entity)))))
+           (unless (wl-thread-entity-get-opened
+                    (setq thr-entity (wl-thread-get-entity number)))
+             (let ((messages
+                    (elmo-delete-if
+                     (function
+                      (lambda (x)
+                        (wl-summary-no-auto-refile-message-p
+                         x mark-alist)))
+                     (wl-thread-entity-get-descendant thr-entity))))
+               (while messages
+                 (when (and (setq dst
+                                  (wl-refile-guess-by-rule
+                                   (elmo-msgdb-overview-get-entity
+                                    (car messages) wl-summary-buffer-msgdb)))
+                            (not (equal dst spec)))
+                   (if (wl-summary-refile dst (car messages))
+                       (incf count))
+                   (message "Marking...%d message(s)." count))
+                 (setq messages (cdr messages))))))
        (forward-line))
       (if (eq count 0)
          (message "No message was marked.")
@@ -3595,7 +3713,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
   "Put copy mark on messages in the region specified by BEG and END."
   (interactive "r")
   (wl-summary-refile-region-subr "refile" beg end))
-  
+
 (defun wl-summary-copy-region (beg end)
   "Put copy mark on messages in the region specified by BEG and END."
   (interactive "r")
@@ -3607,36 +3725,34 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
       (goto-char beg)
       ;; guess by first msg
       (let* ((msgid (cdr (assq (wl-summary-message-number)
-                               (elmo-msgdb-get-number-alist
-                                wl-summary-buffer-msgdb))))
+                              (elmo-msgdb-get-number-alist
+                               wl-summary-buffer-msgdb))))
             (function (intern (format "wl-summary-%s" copy-or-refile)))
             (entity (assoc msgid (elmo-msgdb-get-overview
                                   wl-summary-buffer-msgdb)))
             folder)
-       (if entity
-           (setq folder (wl-summary-read-folder (wl-refile-guess entity)
-                                                (format "for %s"
+       (if entity
+           (setq folder (wl-summary-read-folder (wl-refile-guess entity)
+                                                (format "for %s"
                                                         copy-or-refile))))
-       (narrow-to-region beg end)
-       (if (eq wl-summary-buffer-view 'thread)
-           (progn
-             (while (not (eobp))
-               (let* ((number (wl-summary-message-number))
-                      (entity (wl-thread-get-entity number))
-                      children)
-                 (if (wl-thread-entity-get-opened entity)
-                     ;; opened...refile line.
-                     (funcall function folder number)
-                   ;; closed
-                   (mapcar
-                    (function
-                     (lambda (x)
-                       (funcall function folder x)))
-                    (wl-thread-get-children-msgs number)))
-                 (forward-line 1))))
-         (while (not (eobp))
-           (funcall function folder (wl-summary-message-number))
-           (forward-line 1)))))))
+       (narrow-to-region beg end)
+       (if (eq wl-summary-buffer-view 'thread)
+           (progn
+             (while (not (eobp))
+               (let* ((number (wl-summary-message-number))
+                      (entity (wl-thread-get-entity number))
+                      children)
+                 (if (wl-thread-entity-get-opened entity)
+                     ;; opened...refile line.
+                     (funcall function folder number)
+                   ;; closed
+                   (setq children (wl-thread-get-children-msgs number))
+                   (while children
+                     (funcall function folder (pop children))))
+                 (forward-line 1))))
+         (while (not (eobp))
+           (funcall function folder (wl-summary-message-number))
+           (forward-line 1)))))))
 
 (defun wl-summary-unmark-region (beg end)
   (interactive "r")
@@ -3653,8 +3769,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                    ;; opened...unmark line.
                    (wl-summary-unmark)
                  ;; closed
-                 (mapcar
-                  'wl-summary-unmark
+                 (wl-summary-delete-marks-on-buffer
                   (wl-thread-get-children-msgs number))))
              (forward-line 1)))
        (while (not (eobp))
@@ -3671,14 +3786,15 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
            (while (not (eobp))
              (let* ((number (wl-summary-message-number))
                     (entity (wl-thread-get-entity number))
-                    (wl-summary-move-direction-downward t))
+                    (wl-summary-move-direction-downward t)
+                    children)
                (if (wl-thread-entity-get-opened entity)
                    ;; opened...delete line.
                    (funcall function number)
                  ;; closed
-                 (mapcar
-                  function
-                  (wl-thread-get-children-msgs number)))
+                 (setq children (wl-thread-get-children-msgs number))
+                 (while children
+                   (funcall function (pop children))))
                (forward-line 1))))
        (while (not (eobp))
          (funcall function (wl-summary-message-number))
@@ -3749,93 +3865,24 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
 
 (defun wl-summary-pick (&optional from-list delete-marks)
   (interactive)
-  (save-excursion
-    (let* ((completion-ignore-case t)
-          (field (completing-read
-                  (format "Field name (%s): " wl-summary-pick-field-default)
-                  (mapcar 'list
-                          (append '("From" "Subject" "Date"
-                                    "To" "Cc" "Body" "Since" "Before")
-                                  elmo-msgdb-extra-fields))))
-          (field (if (string= field "")
-                     (setq field wl-summary-pick-field-default)
-                   field))
-          (value (if (string-match field "Since\\|Before")
-                     (completing-read "Value: "
-                                      (mapcar (function
-                                               (lambda (x)
-                                                 (list (format "%s" (car x)))))
-                                              elmo-date-descriptions))
-                   (read-from-minibuffer "Value: ")))
-          (overview (elmo-msgdb-get-overview wl-summary-buffer-msgdb))
-          (number-alist (elmo-msgdb-get-number-alist wl-summary-buffer-msgdb))
-          (elmo-search-mime-charset wl-search-mime-charset)
-          server-side-search
-          result get-func sum)
-      (if delete-marks
-         (let ((mlist wl-summary-buffer-target-mark-list))
-           (while mlist
-             (when (wl-summary-jump-to-msg (car mlist))
-               (wl-summary-unmark))
-             (setq mlist (cdr mlist)))
-           (setq wl-summary-buffer-target-mark-list nil)))
-      (setq field (downcase field))
-      (cond
-       ((string-match field "from")
-       (setq get-func 'elmo-msgdb-overview-entity-get-from))
-       ((string-match field "subject")
-       (setq get-func 'elmo-msgdb-overview-entity-get-subject))
-       ((string-match field "date")
-       (setq get-func 'elmo-msgdb-overview-entity-get-date))
-       ((string-match field "to")
-       (setq get-func 'elmo-msgdb-overview-entity-get-to))
-       ((string-match field "cc")
-       (setq get-func 'elmo-msgdb-overview-entity-get-cc))
-       ((string-match field "since")
-       (setq server-side-search (vector 'date "since" value)))
-       ((string-match field "before")
-       (setq server-side-search (vector 'date "before" value)))
-       ((string-match field "body")
-       (setq server-side-search (vector 'match "body" value)))
-       ((member field elmo-msgdb-extra-fields)
-       (setq get-func
-             (lambda (entity)
-               (elmo-msgdb-overview-entity-get-extra-field entity field))))
-       (t
-       (error "Pick by %s is not supported" field)))
-      (unwind-protect
-         (if server-side-search
-             (progn
-               (message "Searching...")
-               (let ((elmo-mime-charset wl-summary-buffer-mime-charset))
-                 (setq result (elmo-search wl-summary-buffer-folder-name
-                                           (list server-side-search))))
-               (if from-list
-                   (setq result (elmo-list-filter from-list result)))
-               (message "%d message(s) are picked." (length result)))
-           (setq sum 0)
-           (message "Searching...")
-           (while overview
-             (when (and (string-match value
-                                      (or
-                                       (funcall get-func (car overview))
-                                       ""))
-                        (or (not from-list)
-                            (memq
-                             (elmo-msgdb-overview-entity-get-number
-                              (car overview)) from-list)))
-               (setq result
-                     (append result
-                             (list
-                              (elmo-msgdb-overview-entity-get-number
-                               (car overview)))))
-               (message "Picked %d message(s)." (setq sum (+ sum 1))))
-             (setq overview (cdr overview)))
-           (message "%d message(s) are picked." sum))
-       (if (null result)
-           (message "No message was picked.")
-         (wl-summary-target-mark-msgs result))))))
-  
+  (let ((result (elmo-msgdb-search 
+                wl-summary-buffer-folder-name
+                (elmo-read-search-condition wl-summary-pick-field-default)
+                wl-summary-buffer-msgdb)))
+    (if delete-marks
+      (let ((mlist wl-summary-buffer-target-mark-list))
+       (while mlist
+         (when (wl-summary-jump-to-msg (car mlist))
+           (wl-summary-unmark))
+         (setq mlist (cdr mlist)))
+       (setq wl-summary-buffer-target-mark-list nil)))
+    (if from-list
+       (setq result (elmo-list-filter from-list result)))
+    (message "%d message(s) are picked." (length result))
+    (if (null result)
+       (message "No message was picked.")
+      (wl-summary-target-mark-msgs result))))
+
 (defun wl-summary-unvirtual ()
   "Exit from current virtual folder."
   (interactive)
@@ -3851,22 +3898,12 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
   (interactive "P")
   (if arg
       (wl-summary-unvirtual)
-    (let* ((completion-ignore-case t)
-          (field (completing-read (format "Field name (%s): "
-                                          wl-summary-pick-field-default)
-                                  '(("From" . "From")
-                                    ("Subject" . "Subject")
-                                    ("To" . "To")
-                                    ("Cc" . "Cc")
-                                    ("Body" . "Body")
-                                    ("Since" . "Since")
-                                    ("Before" . "Before"))))
-          (value (read-from-minibuffer "Value: ")))
-      (if (string= field "")
-         (setq field wl-summary-pick-field-default))
-      (wl-summary-goto-folder-subr (concat "/" (downcase field) "=" value "/"
-                                          wl-summary-buffer-folder-name)
-                                  'update nil nil t))))
+    (wl-summary-goto-folder-subr (concat "/"
+                                        (elmo-read-search-condition
+                                         wl-summary-pick-field-default)
+                                        "/"
+                                        wl-summary-buffer-folder-name)
+                                'update nil nil t)))
 
 (defun wl-summary-delete-all-temp-marks ()
   (interactive)
@@ -3881,7 +3918,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
     (setq wl-summary-buffer-delete-list nil)
     (setq wl-summary-buffer-refile-list nil)
     (setq wl-summary-buffer-copy-list nil)))
-    
+
 (defun wl-summary-delete-mark (number)
   "Delete temporary mark of the message specified by NUMBER."
   (cond
@@ -4047,7 +4084,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                    (delq number wl-summary-buffer-target-mark-list)))))
       (setq mlist wl-summary-buffer-target-mark-list)
       (while mlist
-       (wl-thread-msg-mark-as-read (car mlist))
+       (wl-summary-mark-as-read t nil nil (car mlist))
        (setq wl-summary-buffer-target-mark-list
              (delq (car mlist) wl-summary-buffer-target-mark-list))
        (setq mlist (cdr mlist)))
@@ -4077,7 +4114,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
       (setq mlist wl-summary-buffer-target-mark-list)
       (while mlist
        (wl-summary-mark-as-unread (car mlist))
-       (wl-thread-msg-mark-as-unread (car mlist))
+       ;; (wl-thread-msg-mark-as-unread (car mlist))
        (setq wl-summary-buffer-target-mark-list
              (delq (car mlist) wl-summary-buffer-target-mark-list))
        (setq mlist (cdr mlist)))
@@ -4141,7 +4178,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                                          leave-server-side-mark-untouched
                                          displayed
                                          number
-                                         no-cache)
+                                         cached)
   (interactive)
   (save-excursion
     (let* (eol
@@ -4152,7 +4189,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
           (mark-alist (elmo-msgdb-get-mark-alist msgdb))
           ;;(number-alist (elmo-msgdb-get-number-alist msgdb))
           (case-fold-search nil)
-          mark unread visible uncached new-mark)
+          mark stat visible uncached new-mark marked)
       (if number
          (progn
            (setq visible (wl-summary-jump-to-msg number))
@@ -4171,50 +4208,59 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
            (when mark
              (cond
               ((string= mark wl-summary-new-mark) ; N
-               (setq wl-summary-buffer-new-count
-                     (- wl-summary-buffer-new-count 1))
-               (setq uncached t)
-               (setq unread t))
+               (setq stat 'new)
+               (setq uncached t))
               ((string= mark wl-summary-unread-uncached-mark) ; U
-               (setq wl-summary-buffer-unread-count
-                     (- wl-summary-buffer-unread-count 1))
-               (setq uncached t)
-               (setq unread t))
+               (setq stat 'unread)
+               (setq uncached t))
               ((string= mark wl-summary-unread-cached-mark)  ; !
-               (setq wl-summary-buffer-unread-count
-                     (- wl-summary-buffer-unread-count 1))
-               (setq unread t))
+               (setq stat 'unread))
               (t
                ;; no need to mark server.
-               (setq leave-server-side-mark-untouched t)))
-             (wl-summary-update-modeline)
-             (wl-folder-update-unread
-              folder
-              (+ wl-summary-buffer-unread-count
-                 wl-summary-buffer-new-count)))
+               (setq leave-server-side-mark-untouched t))))
            (setq number (or number (string-to-int (wl-match-buffer 1))))
            ;; set server side mark...
-           (setq new-mark (if (and uncached no-cache)
+           (setq new-mark (if (and uncached
+                                   (if (elmo-use-cache-p folder number)
+                                       (not (elmo-folder-local-p folder)))
+                                   (not cached))
                               wl-summary-read-uncached-mark
                             nil))
            (if (not leave-server-side-mark-untouched)
-               (elmo-mark-as-read folder
-                                  (list number) msgdb))
-           (when visible
-             (goto-char (match-end 2))
-             (delete-region (match-beginning 2) (match-end 2))
-             (insert (or new-mark " ")))
-           (setq mark-alist
-                 (elmo-msgdb-mark-set mark-alist number new-mark))
-           (elmo-msgdb-set-mark-alist msgdb mark-alist)
-           (wl-summary-set-mark-modified)
-           (if (and visible wl-summary-highlight)
-               (wl-highlight-summary-current-line nil nil t))
-           (if (not notcrosses)
-               (wl-summary-set-crosspost nil (and wl-summary-buffer-disp-msg
-                                                   (interactive-p))))))
+               (setq marked (elmo-mark-as-read folder
+                                               (list number) msgdb)))
+           (if (or leave-server-side-mark-untouched
+                   marked)
+               (progn
+                 (cond ((eq stat 'unread)
+                        (setq wl-summary-buffer-unread-count
+                              (1- wl-summary-buffer-unread-count)))
+                       ((eq stat 'new)
+                        (setq wl-summary-buffer-new-count
+                              (1- wl-summary-buffer-new-count))))
+                 (wl-summary-update-modeline)
+                 (wl-folder-update-unread
+                  folder
+                  (+ wl-summary-buffer-unread-count
+                     wl-summary-buffer-new-count))
+                 (when (or stat cached)
+                   (when visible
+                     (goto-char (match-end 2))
+                     (delete-region (match-beginning 2) (match-end 2))
+                     (insert (or new-mark " ")))
+                   (setq mark-alist
+                         (elmo-msgdb-mark-set mark-alist number new-mark))
+                   (elmo-msgdb-set-mark-alist msgdb mark-alist)
+                   (wl-summary-set-mark-modified))
+                 (if (and visible wl-summary-highlight)
+                     (wl-highlight-summary-current-line nil nil t))
+                 (if (not notcrosses)
+                     (wl-summary-set-crosspost nil
+                                               (and wl-summary-buffer-disp-msg
+                                                    (interactive-p)))))
+             (if mark (message "Warning: Changing mark failed.")))))
       (set-buffer-modified-p nil)
-      (if unread
+      (if stat
          (run-hooks 'wl-summary-unread-message-hook))
       number ;return value
       )))
@@ -4324,9 +4370,11 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
        mark line
        (elmo-lang wl-summary-buffer-weekday-name-lang)
        (children-num (if children-num (int-to-string children-num)))
-       (thr-str ""))
-    (if thr-entity
-       (setq thr-str (wl-thread-make-indent-string thr-entity)))
+       (thr-str "")
+       linked)
+    (when thr-entity
+      (setq thr-str (wl-thread-make-indent-string thr-entity))
+      (setq linked (wl-thread-entity-get-linked thr-entity)))
     (if (string= thr-str "")
        (setq no-parent t)) ; no parent
     (if (and wl-summary-width
@@ -4368,15 +4416,23 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                         (wl-summary-format-date
                          (elmo-msgdb-overview-entity-get-date entity))
                         (if thr-str thr-str "")))
-          (format "[%s ] %s"
+          (format (if linked
+                      "<%s > %s"
+                    "[%s ] %s")
                   (if children-num
                       (concat "+" children-num ": " from)
                     (concat " " from))
-                  (if (or no-parent
-                          (null parent-subject)
-                          (not (wl-summary-subject-equal
-                                subject parent-subject)))
-                      (wl-summary-subject-func-internal subject) ""))))
+                  (progn
+                    (setq subject
+                          (if (or no-parent
+                                  (null parent-subject)
+                                  (not (wl-summary-subject-equal
+                                        subject parent-subject)))
+                              (wl-summary-subject-func-internal subject) ""))
+                    (if (and (not wl-summary-width)
+                             wl-subject-length-limit)
+                        (truncate-string subject wl-subject-length-limit)
+                      subject)))))
     (if wl-summary-width (setq line
                               (wl-set-string-width
                                (- wl-summary-width 1) line)))
@@ -4390,6 +4446,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
 (defsubst wl-summary-buffer-number-column-detect (update)
   (let (end)
     (save-excursion
+      (goto-char (point-min))
       (setq wl-summary-buffer-number-column
            (or
             (if (and update
@@ -4401,7 +4458,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
             wl-summary-default-number-column))
       (setq wl-summary-buffer-number-regexp
            (wl-repeat-string "." wl-summary-buffer-number-column)))))
-       
+
 (defsubst wl-summary-proc-wday (wday-str year month mday)
   (save-match-data
     (if (string-match "\\([A-Z][a-z][a-z]\\).*" wday-str)
@@ -4459,7 +4516,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
 
 ;;
 ;; Goto unread or important
-;; 
+;;
 (defun wl-summary-cursor-up (&optional hereto)
   (interactive "P")
   (if (and (not wl-summary-buffer-target-mark-list)
@@ -4510,7 +4567,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
        (beginning-of-line)
        (throw 'done nil)))))
 
-(defun wl-summary-save-view-cache (&optional keep-current-buffer)
+(defun wl-summary-save-view-cache ()
   (save-excursion
     (let* ((dir (elmo-msgdb-expand-path wl-summary-buffer-folder-name))
           (cache (expand-file-name wl-summary-cache-file dir))
@@ -4518,8 +4575,8 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
           ;;(coding-system-for-write wl-cs-cache)
           ;;(output-coding-system wl-cs-cache)
           (save-view wl-summary-buffer-view)
-          (tmp-buffer(get-buffer-create " *wl-summary-save-view-cache*"))
-          charset)
+          (tmp-buffer (get-buffer-create " *wl-summary-save-view-cache*"))
+          (charset wl-summary-buffer-mime-charset))
       (if (file-directory-p dir)
          (); ok.
        (if (file-exists-p dir)
@@ -4530,27 +4587,16 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
       (unwind-protect
          (progn
            (when (file-writable-p cache)
-             (if keep-current-buffer
-                 (progn
-                   (save-excursion
-                     (set-buffer tmp-buffer)
-                     (erase-buffer))
-                   (setq charset wl-summary-buffer-mime-charset)
-                   (copy-to-buffer tmp-buffer (point-min) (point-max))
-                   (save-excursion
-                     (set-buffer tmp-buffer)
-                     (widen)
-                     (encode-mime-charset-region
-                      (point-min) (point-max) charset)
-                     (as-binary-output-file
-                      (write-region (point-min)
-                                    (point-max) cache nil 'no-msg))))
-               (let (buffer-read-only)
-                 (widen)
-                 (encode-mime-charset-region (point-min) (point-max)
-                                             wl-summary-buffer-mime-charset)
-                 (as-binary-output-file
-                  (write-region (point-min) (point-max) cache nil 'no-msg)))))
+             (copy-to-buffer tmp-buffer (point-min) (point-max))
+             (with-current-buffer tmp-buffer
+               (widen)
+               (encode-mime-charset-region
+                (point-min) (point-max) charset)
+               (as-binary-output-file
+                (write-region (point-min)
+                              (point-max) cache nil 'no-msg))
+               (write-region (point-min) (point-max) cache nil
+                             'no-msg)))
            (when (file-writable-p view) ; 'thread or 'sequence
              (save-excursion
                (set-buffer tmp-buffer)
@@ -4673,7 +4719,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
              (select-window (get-buffer-window cur-buf))))
          )))))
   (run-hooks 'wl-summary-toggle-disp-folder-hook))
-  
+
 (defun wl-summary-toggle-disp-msg (&optional arg)
   (interactive)
   (let (fld-buf fld-win
@@ -4741,7 +4787,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
 (defun wl-summary-prev-page ()
   (interactive)
   (wl-message-prev-page))
-  
+
 (defsubst wl-summary-no-mime-p (folder)
   (wl-string-match-member folder wl-summary-no-mime-folder-list))
 
@@ -4855,17 +4901,17 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
          t)
       ;; for XEmacs!
       (if (and elmo-use-database
-              (setq errmsg
-                    (format
+              (setq errmsg
+                    (format
                      "No message with id \"%s\" in the database." msgid))
-              (setq otherfld (elmo-database-msgid-get msgid)))
+              (setq otherfld (elmo-database-msgid-get msgid)))
          (if (cdr (wl-summary-jump-to-msg-internal
                    (car otherfld) (nth 1 otherfld) 'no-sync))
              t ; succeed.
            ;; Back to original.
            (wl-summary-jump-to-msg-internal
             wl-summary-buffer-folder-name original 'no-sync))
-       (cond ((eq wl-summary-search-via-nntp 'confirm)
+       (cond ((eq wl-summary-search-via-nntp 'confirm)
               (message "Search message in nntp server \"%s\" <y/n/s(elect)>?"
                        elmo-default-nntp-server)
               (setq schar (read-char))
@@ -4879,40 +4925,41 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
                      (message errmsg)
                      nil)))
              (wl-summary-search-via-nntp
-              (wl-summary-jump-to-msg-by-message-id-via-nntp msgid))
-             (t
-              (message errmsg)
-              nil))))))
+              (wl-summary-jump-to-msg-by-message-id-via-nntp msgid))
+             (t
+              (message errmsg)
+              nil))))))
 
 (defun wl-summary-jump-to-msg-by-message-id-via-nntp (&optional id server-spec)
   (interactive)
   (let* ((msgid (elmo-string (or id (read-from-minibuffer "Message-ID: "))))
-        newsgroups folder ret
-        user server port ssl spec)
+        newsgroups folder ret
+        user server port type spec)
     (if server-spec
        (if (string-match "^-" server-spec)
            (setq spec (elmo-nntp-get-spec server-spec)
                  user (nth 2 spec)
                  server (nth 3 spec)
                  port (nth 4 spec)
-                 ssl (nth 5 spec))
+                 type (nth 5 spec))
          (setq server server-spec)))
     (when (setq ret (elmo-nntp-get-newsgroup-by-msgid
                     msgid
                     (or server elmo-default-nntp-server)
                     (or user elmo-default-nntp-user)
                     (or port elmo-default-nntp-port)
-                    (or ssl elmo-default-nntp-ssl)))
+                    (or type elmo-default-nntp-stream-type)))
       (setq newsgroups (wl-parse-newsgroups ret))
       (setq folder (concat "-" (car newsgroups)
-                          (elmo-nntp-folder-postfix user server port ssl)))
+                          (elmo-nntp-folder-postfix user server port type)))
       (catch 'found
        (while newsgroups
          (if (wl-folder-entity-exists-p (car newsgroups)
                                         wl-folder-newsgroups-hashtb)
              (throw 'found
                     (setq folder (concat "-" (car newsgroups)
-                                         (elmo-nntp-folder-postfix user server port ssl)))))
+                                         (elmo-nntp-folder-postfix
+                                          user server port type)))))
          (setq newsgroups (cdr newsgroups)))))
     (if ret
        (wl-summary-jump-to-msg-internal folder nil 'update msgid)
@@ -4923,19 +4970,19 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
 (defun wl-summary-jump-to-msg-internal (folder msg scan-type &optional msgid)
   (let (wl-auto-select-first entity)
     (if (or (string= folder wl-summary-buffer-folder-name)
-           (y-or-n-p
-            (format
-             "Message was found in the folder \"%s\". Jump to it? "
-             folder)))
-       (progn
-         (unwind-protect
-             (wl-summary-goto-folder-subr
-              folder scan-type nil nil t)
-           (if msgid
-               (setq msg
-                     (car (rassoc msgid
-                                  (elmo-msgdb-get-number-alist
-                                   wl-summary-buffer-msgdb)))))
+           (y-or-n-p
+            (format
+             "Message was found in the folder \"%s\". Jump to it? "
+             folder)))
+       (progn
+         (unwind-protect
+             (wl-summary-goto-folder-subr
+              folder scan-type nil nil t)
+           (if msgid
+               (setq msg
+                     (car (rassoc msgid
+                                  (elmo-msgdb-get-number-alist
+                                   wl-summary-buffer-msgdb)))))
            (setq entity (wl-folder-search-entity-by-name folder
                                                          wl-folder-entity
                                                          'folder))
@@ -4949,45 +4996,70 @@ If optional argument NUMBER is specified, mark message specified by NUMBER."
 
 (defun wl-summary-jump-to-parent-message (arg)
   (interactive "P")
-  (if (null (wl-summary-message-number))
-      (message "No message.")
-    (let ((cur-buf (current-buffer))
-         (regexp "\\(<[^<>]*>\\)[ \t]*$")
-         (i -1) ;; xxx
-         msg-id ref-list ref irt)
-      (wl-summary-set-message-buffer-or-redisplay)
-      (set-buffer (wl-message-get-original-buffer))
-      (message "Searching parent message...")
-      (setq ref (std11-field-body "References")
-           irt (std11-field-body "In-Reply-To"))
-      (cond
-       ((and arg (not (numberp arg)) ref (not (string= ref ""))
-            (string-match regexp ref))
-       ;; The first message of the thread.
-       (setq msg-id (wl-match-string 1 ref)))
-       ;; "In-Reply-To:" has only one msg-id.
-       ((and irt (not (string= irt ""))
-            (string-match regexp irt))
-       (setq msg-id (wl-match-string 1 irt)))
-       ((and (or (null arg) (numberp arg)) ref (not (string= ref ""))
-            (string-match regexp ref))
-       ;; "^" searching parent, "C-u 2 ^" looking for grandparent.
-       (while (string-match regexp ref)
-         (setq ref-list
-               (append (list
-                        (wl-match-string 1 ref))
-                       ref-list))
-         (setq ref (substring ref (match-end 0)))
-         (setq i (1+ i)))
-       (setq msg-id
-             (if (null arg) (nth 0 ref-list) ;; previous
-               (if (<= arg i) (nth (1- arg) ref-list)
-                 (nth i ref-list))))))
+  (let ((cur-buf (current-buffer))
+       (number (wl-summary-message-number))
+       (regexp "\\(<[^<>]*>\\)[ \t]*$")
+       (i -1) ;; xxx
+       msg-id msg-num ref-list ref irt)
+    (if (null number)
+       (message "No message.")
+      (when (eq wl-summary-buffer-view 'thread)
+       (cond ((and arg (not (numberp arg)))
+              (setq msg-num
+                    (wl-thread-entity-get-number
+                     (wl-thread-entity-get-top-entity
+                      (wl-thread-get-entity number)))))
+             ((and arg (numberp arg))
+              (setq i 0)
+              (setq msg-num number)
+              (while (< i arg)
+                (setq msg-num
+                      (wl-thread-entity-get-number
+                       (wl-thread-entity-get-parent-entity
+                        (wl-thread-get-entity msg-num))))
+                (setq i (1+ i))))
+             (t (setq msg-num
+                      (wl-thread-entity-get-number
+                       (wl-thread-entity-get-parent-entity
+                        (wl-thread-get-entity number)))))))
+      (when (null msg-num)
+       (wl-summary-set-message-buffer-or-redisplay)
+       (set-buffer (wl-message-get-original-buffer))
+       (message "Searching parent message...")
+       (setq ref (std11-field-body "References")
+             irt (std11-field-body "In-Reply-To"))
+       (cond
+        ((and arg (not (numberp arg)) ref (not (string= ref ""))
+              (string-match regexp ref))
+         ;; The first message of the thread.
+         (setq msg-id (wl-match-string 1 ref)))
+        ;; "In-Reply-To:" has only one msg-id.
+        ((and (null arg) irt (not (string= irt ""))
+              (string-match regexp irt))
+         (setq msg-id (wl-match-string 1 irt)))
+        ((and (or (null arg) (numberp arg)) ref (not (string= ref ""))
+              (string-match regexp ref))
+         ;; "^" searching parent, "C-u 2 ^" looking for grandparent.
+         (while (string-match regexp ref)
+           (setq ref-list
+                 (append (list
+                          (wl-match-string 1 ref))
+                         ref-list))
+           (setq ref (substring ref (match-end 0)))
+           (setq i (1+ i)))
+         (setq msg-id
+               (if (null arg) (nth 0 ref-list) ;; previous
+                 (if (<= arg i) (nth (1- arg) ref-list)
+                   (nth i ref-list)))))))
       (set-buffer cur-buf)
-      (cond ((null msg-id)
+      (cond ((and (null msg-id) (null msg-num))
             (message "No parent message!")
             nil)
-           ((wl-summary-jump-to-msg-by-message-id msg-id)
+           ((and msg-id (wl-summary-jump-to-msg-by-message-id msg-id))
+            (wl-summary-redisplay)
+            (message "Searching parent message...done.")
+            t)
+           ((and msg-num (wl-summary-jump-to-msg msg-num))
             (wl-summary-redisplay)
             (message "Searching parent message...done.")
             t)
@@ -5024,7 +5096,7 @@ Reply to author if invoked with argument."
   "Write a new draft from Summary."
   (interactive)
   (wl-draft nil nil nil nil nil
-           nil nil nil nil nil (current-buffer))
+           nil nil nil nil nil nil (current-buffer))
   (run-hooks 'wl-mail-setup-hook)
   (mail-position-on-field "To"))
 
@@ -5144,7 +5216,8 @@ Reply to author if invoked with argument."
          (if wl-summary-buffer-disp-msg
              (wl-summary-redisplay)))
       (if (or interactive (interactive-p))
-         (progn
+         (if wl-summary-buffer-prev-folder-func
+             (funcall wl-summary-buffer-prev-folder-func)
            (when wl-auto-select-next
              (setq next-entity (wl-summary-get-prev-folder))
              (if next-entity
@@ -5182,7 +5255,8 @@ Reply to author if invoked with argument."
        (if wl-summary-buffer-disp-msg
            (wl-summary-redisplay))
       (if (or interactive (interactive-p))
-         (progn
+         (if wl-summary-buffer-next-folder-func
+             (funcall wl-summary-buffer-next-folder-func)
            (when wl-auto-select-next
              (setq next-entity (wl-summary-get-next-folder))
              (if next-entity
@@ -5202,20 +5276,22 @@ Reply to author if invoked with argument."
          (wl-summary-redisplay))
     (if (or interactive
            (interactive-p))
-       (let (next-entity finfo)
-         (when wl-auto-select-next
-           (progn
-             (setq next-entity (wl-summary-get-prev-unread-folder))
-             (if next-entity
-                 (setq finfo (wl-folder-get-entity-info next-entity)))))
-         (if (and skip-no-unread
-                  (eq wl-auto-select-next 'skip-no-unread))
-             (wl-summary-next-folder-or-exit next-entity t)
-           (wl-ask-folder
-            '(lambda () (wl-summary-next-folder-or-exit next-entity t))
-            (format
-             "No more unread messages. Type SPC to go to %s."
-             (wl-summary-entity-info-msg next-entity finfo))))))))
+       (if wl-summary-buffer-prev-folder-func
+           (funcall wl-summary-buffer-prev-folder-func)
+         (let (next-entity finfo)
+           (when wl-auto-select-next
+             (progn
+               (setq next-entity (wl-summary-get-prev-unread-folder))
+               (if next-entity
+                   (setq finfo (wl-folder-get-entity-info next-entity)))))
+           (if (and skip-no-unread
+                    (eq wl-auto-select-next 'skip-no-unread))
+               (wl-summary-next-folder-or-exit next-entity t)
+             (wl-ask-folder
+              '(lambda () (wl-summary-next-folder-or-exit next-entity t))
+              (format
+               "No more unread messages. Type SPC to go to %s."
+               (wl-summary-entity-info-msg next-entity finfo)))))))))
 
 (defun wl-summary-get-prev-folder ()
   (let ((folder-buf (get-buffer wl-folder-buffer-name))
@@ -5258,19 +5334,21 @@ Reply to author if invoked with argument."
          (wl-summary-redisplay))
     (if (or interactive
            (interactive-p))
-       (let (next-entity finfo)
-         (when wl-auto-select-next
-           (setq next-entity (wl-summary-get-next-unread-folder))
+       (if wl-summary-buffer-next-folder-func
+           (funcall wl-summary-buffer-next-folder-func)
+         (let (next-entity finfo)
+           (when wl-auto-select-next
+             (setq next-entity (wl-summary-get-next-unread-folder)))
            (if next-entity
-               (setq finfo (wl-folder-get-entity-info next-entity))))
-         (if (and skip-no-unread
-                  (eq wl-auto-select-next 'skip-no-unread))
-             (wl-summary-next-folder-or-exit next-entity)
-           (wl-ask-folder
-            '(lambda () (wl-summary-next-folder-or-exit next-entity))
-            (format
-             "No more unread messages. Type SPC to go to %s."
-             (wl-summary-entity-info-msg next-entity finfo))))))))
+               (setq finfo (wl-folder-get-entity-info next-entity)))
+           (if (and skip-no-unread
+                    (eq wl-auto-select-next 'skip-no-unread))
+               (wl-summary-next-folder-or-exit next-entity)
+             (wl-ask-folder
+              '(lambda () (wl-summary-next-folder-or-exit next-entity))
+              (format
+               "No more unread messages. Type SPC to go to %s."
+               (wl-summary-entity-info-msg next-entity finfo)))))))))
 
 (defun wl-summary-goto-last-displayed-msg ()
   (interactive)
@@ -5325,14 +5403,23 @@ Reply to author if invoked with argument."
                                       (if wl-message-cache-used
                                           nil
                                         ;; plugged, then leave server-mark.
-                                        (if (elmo-folder-plugged-p
-                                             wl-summary-buffer-folder-name)
+                                        (if (and
+                                             (not
+                                              (elmo-folder-local-p
+                                               wl-summary-buffer-folder-name))
+                                             (elmo-folder-plugged-p
+                                              wl-summary-buffer-folder-name))
                                             'leave))
-                                      t) ;; displayed
+                                      t ; displayed
+                                      nil
+                                      'cached ; cached by reading.
+                                      )
            )
          (setq wl-summary-buffer-current-msg num)
-         (if wl-summary-recenter
-             (recenter (/ (- (window-height) 2) 2)))
+         (when wl-summary-recenter
+           (recenter (/ (- (window-height) 2) 2))
+           (if (not wl-summary-width)
+               (wl-horizontal-recenter)))
          (wl-highlight-summary-displaying)
          (wl-cache-prefetch-next fld num (current-buffer))
          (run-hooks 'wl-summary-redisplay-hook))
@@ -5349,12 +5436,16 @@ Reply to author if invoked with argument."
     (if num
        (progn
          (setq wl-summary-buffer-disp-msg t)
+         (setq wl-summary-buffer-last-displayed-msg
+               wl-summary-buffer-current-msg)
          (setq wl-current-summary-buffer (current-buffer))
          (wl-normal-message-redisplay fld num 'no-mime msgdb)
          (wl-summary-mark-as-read nil nil t)
          (setq wl-summary-buffer-current-msg num)
-         (if wl-summary-recenter
-             (recenter (/ (- (window-height) 2) 2)))
+         (when wl-summary-recenter
+           (recenter (/ (- (window-height) 2) 2))
+           (if (not wl-summary-width)
+               (wl-horizontal-recenter)))
          (wl-highlight-summary-displaying)
          (run-hooks 'wl-summary-redisplay-hook))
       (message "No message to display.")
@@ -5371,11 +5462,21 @@ Reply to author if invoked with argument."
         (wl-message-redisplay-func wl-summary-buffer-message-redisplay-func))
     (if num
        (progn
+         (setq wl-summary-buffer-disp-msg t)
+         (setq wl-summary-buffer-last-displayed-msg
+               wl-summary-buffer-current-msg)
+         (setq wl-current-summary-buffer (current-buffer))
          (if (wl-message-redisplay fld num 'all-header msgdb); t if displayed.
              (wl-summary-mark-as-read nil nil t))
+         (setq wl-summary-buffer-current-msg num)
+         (when wl-summary-recenter
+           (recenter (/ (- (window-height) 2) 2))
+           (if (not wl-summary-width)
+               (wl-horizontal-recenter)))
+         (wl-highlight-summary-displaying)
          (run-hooks 'wl-summary-redisplay-hook))
       (message "No message to display."))))
-        
+
 (defun wl-summary-jump-to-current-message ()
   (interactive)
   (let (message-buf message-win)
@@ -5434,11 +5535,11 @@ Reply to author if invoked with argument."
   "Supersede current message."
   (interactive)
   (let ((summary-buf (current-buffer))
-       (mmelmo-force-fetch-entire-message t)
-       message-buf from)
+       (mmelmo-force-fetch-entire-message t)
+       message-buf from)
     (wl-summary-set-message-buffer-or-redisplay)
     (if (setq message-buf (wl-message-get-original-buffer))
-       (set-buffer message-buf))
+       (set-buffer message-buf))
     (unless (wl-message-news-p)
       (error "This is not a news article; supersedes is impossible"))
     (save-excursion
@@ -5447,16 +5548,16 @@ Reply to author if invoked with argument."
       (unless (wl-address-user-mail-address-p
               (wl-address-header-extract-address
                (car (wl-parse-addresses from))))
-       (error "This article is not yours"))
+       (error "This article is not yours"))
       (let* ((message-id (std11-field-body "message-id"))
-            (followup-to (std11-field-body "followup-to"))
-            (mail-default-headers
-             (concat mail-default-headers
-                     "Supersedes: " message-id "\n"
-                     (and followup-to
-                          (concat "Followup-To: " followup-to "\n")))))
-       (set-buffer (wl-message-get-original-buffer))
-       (wl-draft-edit-string (buffer-substring (point-min) (point-max)))))))
+            (followup-to (std11-field-body "followup-to"))
+            (mail-default-headers
+             (concat mail-default-headers
+                     "Supersedes: " message-id "\n"
+                     (and followup-to
+                          (concat "Followup-To: " followup-to "\n")))))
+       (set-buffer (wl-message-get-original-buffer))
+       (wl-draft-edit-string (buffer-substring (point-min) (point-max)))))))
 
 (defun wl-summary-save (&optional arg wl-save-dir)
   (interactive)
@@ -5474,7 +5575,7 @@ Reply to author if invoked with argument."
                         (null (file-exists-p filename))))
              (setq filename
                    (read-file-name "Save to file: " filename)))
-                                
+
          (wl-summary-set-message-buffer-or-redisplay)
          (set-buffer (wl-message-get-original-buffer))
          (if (and (null arg) (file-exists-p filename))
@@ -5594,7 +5695,7 @@ Reply to author if invoked with argument."
                    (funcall wl-ps-print-buffer-func filename))
                (kill-buffer buffer)))))
       (message ""))))
-  
+
 (if (featurep 'ps-print) ; ps-print is available.
     (fset 'wl-summary-print-message 'wl-summary-print-message-with-ps-print))
 
@@ -5676,7 +5777,7 @@ Reply to author if invoked with argument."
                (setq crossed (1+ crossed)))
            (if (wl-summary-jump-to-msg num)
                (wl-summary-mark-as-read t);; opened
-             (wl-thread-msg-mark-as-read num)));; closed
+             (wl-summary-mark-as-read t nil nil num)));; closed
          ;; delete if message does't exists.
          (elmo-crosspost-message-delete (caar alist) ngs)
          (setq wl-crosspost-alist-modified t))
@@ -5712,7 +5813,8 @@ Reply to author if invoked with argument."
   (setq wl-summary-buffer-msgdb
        (elmo-pack-number
         wl-summary-buffer-folder-name wl-summary-buffer-msgdb arg))
-  (wl-summary-rescan))
+  (let (wl-use-scoring)
+    (wl-summary-rescan)))
 
 (defun wl-summary-target-mark-uudecode ()
   (interactive)
@@ -5732,9 +5834,11 @@ Reply to author if invoked with argument."
        (set-buffer (setq orig-buf (wl-message-get-original-buffer)))
        (goto-char (point-min))
        (cond ((= i 1) ; first
-              (setq filename (wl-message-uu-substring
-                              orig-buf tmp-buf t
-                              (= i k))))
+              (if (setq filename (wl-message-uu-substring
+                                  orig-buf tmp-buf t
+                                  (= i k)))
+                  nil
+                (error "Can't find begin line.")))
              ((< i k)
               (wl-message-uu-substring orig-buf tmp-buf))
              (t ; last
@@ -5898,23 +6002,28 @@ Reply to author if invoked with argument."
                  (if wl-cache-prefetch-debug
                      (message "Reading %d... done" msg))))))))))
 
-(defun wl-summary-set-parent ()
-  "Set current message's parent interactively."
+(defun wl-summary-save-current-message ()
+  "Save current message for `wl-summary-yank-saved-message'."
   (interactive)
-  (let ((number (wl-summary-message-number))
-       (parent (read-from-minibuffer "Parent Message (No.): "))
-       buffer-read-only)
-    (when number
-      (wl-thread-delete-message number t)
-      (wl-thread-insert-message
-       (elmo-msgdb-overview-get-entity-by-number
-       (elmo-msgdb-get-overview wl-summary-buffer-msgdb)
-       number)
-       (elmo-msgdb-get-overview wl-summary-buffer-msgdb)
-       (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb)
-       number
-       (string-to-int parent) t))))
-
-(provide 'wl-summary)
+  (let ((number (wl-summary-message-number)))
+    (setq wl-summary-buffer-saved-message number)
+    (and number (message "No: %s is saved." number))))
+
+(defun wl-summary-yank-saved-message ()
+  "Set current message as a parent of the saved message."
+  (interactive)
+  (if wl-summary-buffer-saved-message
+      (let ((number (wl-summary-message-number)))
+       (if (eq wl-summary-buffer-saved-message number)
+           (message "Cannot set itself as a parent.")
+         (save-excursion
+           (wl-thread-jump-to-msg wl-summary-buffer-saved-message)
+           (wl-thread-set-parent number)
+           (wl-summary-set-thread-modified))
+         (setq  wl-summary-buffer-saved-message nil)))
+    (message "There's no saved message.")))
+
+(require 'product)
+(product-provide (provide 'wl-summary) (require 'wl-version))
 
 ;;; wl-summary.el ends here
index 7bb8349..bb47963 100644 (file)
@@ -188,6 +188,7 @@ Enterring WL-Template mode calls the value of `wl-template-mode-hook'."
          (insert mail-header-separator "\n"))
       (wl-draft-config-exec-sub template))))
 
-(provide 'wl-template)
+(require 'product)
+(product-provide (provide 'wl-template) (require 'wl-version))
 
 ;;; wl-template.el ends here
index 492b2a1..fe42c74 100644 (file)
 (defvar wl-thread-entity-hashtb nil)  ; obarray
 (defvar wl-thread-indent-regexp nil)
 
-(mapcar
- (function make-variable-buffer-local)
- (list 'wl-thread-entity-hashtb
-       'wl-thread-entities     ; -> ".wl-thread-entity"
-       'wl-thread-entity-list  ; -> ".wl-thread-entity-list"
-       'wl-thread-entity-cur
-       'wl-thread-indent-regexp))
+(make-variable-buffer-local 'wl-thread-entity-hashtb)
+(make-variable-buffer-local 'wl-thread-entities)     ; ".wl-thread-entity"
+(make-variable-buffer-local 'wl-thread-entity-list)  ; ".wl-thread-entity-list"
+(make-variable-buffer-local 'wl-thread-entity-cur)
+(make-variable-buffer-local 'wl-thread-indent-regexp)
 
 ;;; global flag
 (defvar wl-thread-insert-force-opened nil)
     (message "Resuming thread structure...")
     ;; set obarray value.
     (setq wl-thread-entity-hashtb (elmo-make-hash (* (length entities) 2)))
-    (mapcar
-     '(lambda (x)
-       (elmo-set-hash-val (format "#%d" (car x))
-                         x
-                         wl-thread-entity-hashtb))
-     entities)
     ;; set buffer local variables.
     (setq wl-thread-entities entities)
     (setq wl-thread-entity-list top-list)
+    (while entities
+      (elmo-set-hash-val (format "#%d" (car (car entities))) (car entities)
+                        wl-thread-entity-hashtb)
+      (setq entities (cdr entities)))
     (message "Resuming thread structure...done.")))
 
 (defun wl-thread-save-entity (dir)
   (nth 2 entity))
 (defsubst wl-thread-entity-get-parent (entity)
   (nth 3 entity))
+(defsubst wl-thread-entity-get-linked (entity)
+  (nth 4 entity))
 
-(defsubst wl-thread-create-entity (num parent &optional opened)
-  (list num (or opened wl-thread-insert-opened) nil parent))
+(defsubst wl-thread-create-entity (num parent &optional opened linked)
+  (list num (or opened wl-thread-insert-opened) nil parent linked))
 
 (defsubst wl-thread-get-entity (num)
   (and num
-       (boundp (intern (format "#%d" num) wl-thread-entity-hashtb))
        (elmo-get-hash-val (format "#%d" num) wl-thread-entity-hashtb)))
 
 (defsubst wl-thread-entity-set-parent (entity parent)
 (defsubst wl-thread-entity-set-children (entity children)
   (setcar (cddr entity) children))
 
+(defsubst wl-thread-entity-set-linked (entity linked)
+  (if (cddddr entity)
+      (setcar (cddddr entity) linked)
+    (nconc entity (list linked)))
+  entity)
+
+(defsubst wl-thread-reparent-children (children parent)
+  (while children
+    (wl-thread-entity-set-parent
+     (wl-thread-get-entity (car children)) parent)
+    (wl-thread-entity-set-linked
+     (wl-thread-get-entity (car children)) t)
+    (setq children (cdr children))))
+
 (defsubst wl-thread-entity-insert-as-top (entity)
   (when (and entity
             (car entity))
-    (setq wl-thread-entity-list (append wl-thread-entity-list
-                                       (list (car entity))))
+    (wl-append wl-thread-entity-list (list (car entity)))
     (setq wl-thread-entities (cons entity wl-thread-entities))
     (elmo-set-hash-val (format "#%d" (car entity)) entity
                       wl-thread-entity-hashtb)))
@@ -331,6 +341,11 @@ ENTITY is returned."
            (setq msgs (wl-pop msgs-stack)))))
       (setq entity (wl-thread-get-entity (car msgs)))))))
 
+(defun wl-thread-entity-get-nearly-older-brother (entity &optional parent)
+  (let ((brothers (wl-thread-entity-get-older-brothers entity parent)))
+    (when brothers
+      (car (last brothers)))))
+
 (defun wl-thread-entity-get-older-brothers (entity &optional parent)
   (let* ((parent (or parent
                     (wl-thread-entity-get-parent-entity entity)))
@@ -339,13 +354,12 @@ ENTITY is returned."
     (if parent
        brothers
       (setq brothers wl-thread-entity-list))
-    (catch 'done
-      (while brothers
-       (if (not (eq (wl-thread-entity-get-number entity)
-                    (car brothers)))
-           (wl-append ret-val (list (car brothers)))
-         (throw 'done ret-val))
-       (setq brothers (cdr brothers))))))
+    (while (and brothers
+               (not (eq (wl-thread-entity-get-number entity)
+                        (car brothers))))
+      (wl-append ret-val (list (car brothers)))
+      (setq brothers (cdr brothers)))
+    ret-val))
 
 (defun wl-thread-entity-get-younger-brothers (entity &optional parent)
   (let* ((parent (or parent
@@ -358,7 +372,7 @@ ENTITY is returned."
       (cdr (memq (car entity) wl-thread-entity-list)))))
 
 (defun wl-thread-entity-check-prev-mark-from-older-brother (entity prev-marks)
-  (let* (older-brother parent)
+  (let* (older-brother)
   (catch 'done
     (while entity
       (setq older-brother
@@ -543,15 +557,14 @@ the closed parent will be opened."
                 (wl-thread-entity-get-children (wl-thread-get-entity
                                                 (car entities))))
        (wl-summary-jump-to-msg (car entities))
-       (wl-thread-open-close)
+       (wl-thread-open-close))
+      (when (> len elmo-display-progress-threshold)
        (setq cur (1+ cur))
-       (elmo-display-progress
-        'wl-thread-close-all "Closing all threads..."
-        (/ (* cur 100) len)))
+       (if (or (zerop (% cur 5)) (= cur len))
+           (elmo-display-progress
+            'wl-thread-close-all "Closing all threads..."
+            (/ (* cur 100) len))))
       (setq entities (cdr entities))))
-  (elmo-display-progress 'wl-thread-close-all
-                        "Closing all threads..."
-                        100)
   (message "Closing all threads...done.")
   (goto-char (point-max)))
 
@@ -567,10 +580,12 @@ the closed parent will be opened."
                                             (car entities))))
          (wl-thread-entity-force-open (wl-thread-get-entity
                                        (car entities))))
-      (setq cur (1+ cur))
-      (elmo-display-progress
-       'wl-thread-open-all "Opening all threads..."
-       (/ (* cur 100) len))
+      (when (> len elmo-display-progress-threshold)
+       (setq cur (1+ cur))
+       (if (or (zerop (% cur 5)) (= cur len))
+           (elmo-display-progress
+            'wl-thread-open-all "Opening all threads..."
+            (/ (* cur 100) len))))
       (setq entities (cdr entities))))
   (message "Opening all threads...done.")
   (goto-char (point-max)))
@@ -633,58 +648,60 @@ the closed parent will be opened."
                     (cdr next-marks)))
              marked)))))
 
-(defun wl-thread-update-line-msgs (msgs)
-  (wl-delete-all-overlays)
-  (while msgs
-    (setq msgs
-         (wl-thread-update-line-on-buffer (car msgs) nil msgs))))
-
-(defsubst wl-thread-update-line-on-buffer-sub (entity &optional msg parent-msg)
-  (let ((number-alist (elmo-msgdb-get-number-alist wl-summary-buffer-msgdb))
-       (overview (elmo-msgdb-get-overview wl-summary-buffer-msgdb))
-       (mark-alist (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
-       (buffer-read-only nil)
-       (inhibit-read-only t)
-       ;;(parent-msg parent-msg)
-       overview-entity
-       temp-mark
-       children-num
-       summary-line)
-    (if (memq msg wl-summary-buffer-delete-list)
-       (setq temp-mark "D"))
-    (if (memq msg wl-summary-buffer-target-mark-list)
-       (setq temp-mark "*"))
-    (if (assq msg wl-summary-buffer-refile-list)
-       (setq temp-mark "o"))
-    (if (assq msg wl-summary-buffer-copy-list)
-       (setq temp-mark "O"))
-    (unless temp-mark
-      (setq temp-mark (wl-summary-get-score-mark msg)))
-    ;(setq parent-entity (wl-thread-entity-get-parent-entity entity))
-    (unless parent-msg
-      (setq parent-msg (wl-thread-entity-get-parent entity)))
-    ;;(setq children (wl-thread-entity-get-children entity))
-    (setq children-num (wl-thread-entity-get-children-num entity))
-    (setq overview-entity
-         (elmo-msgdb-search-overview-entity msg
-                                            number-alist overview))
-    ;;(wl-delete-all-overlays)
-    (when overview-entity
-      (setq summary-line
-           (wl-summary-overview-create-summary-line
-            msg
-            overview-entity
-            (assoc                     ; parent-entity
-             (cdr (assq parent-msg
-                        number-alist)) overview)
-            nil
-            mark-alist
-            (if wl-thread-insert-force-opened
-                nil
-              (if (not (wl-thread-entity-get-opened entity))
-                  (or children-num)))
-            temp-mark entity))
-      (wl-summary-insert-line summary-line))))
+(defsubst wl-thread-maybe-get-children-num (msg)
+  (let ((entity (wl-thread-get-entity msg)))
+    (if (not (wl-thread-entity-get-opened entity))
+       (wl-thread-entity-get-children-num entity))))
+
+(defsubst wl-thread-update-line-on-buffer-sub (entity msg &optional parent-msg)
+  (let* ((entity (or entity (wl-thread-get-entity msg)))
+        (parent-msg (or parent-msg (wl-thread-entity-get-parent entity)))
+        (overview (elmo-msgdb-get-overview wl-summary-buffer-msgdb))
+        (mark-alist (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
+        (buffer-read-only nil)
+        (inhibit-read-only t)
+        overview-entity temp-mark summary-line invisible-top)
+    (if (wl-thread-delete-line-from-buffer msg)
+       (progn
+         (if (memq msg wl-summary-buffer-delete-list)
+             (setq temp-mark "D"))
+         (if (memq msg wl-summary-buffer-target-mark-list)
+             (setq temp-mark "*"))
+         (if (assq msg wl-summary-buffer-refile-list)
+             (setq temp-mark "o"))
+         (if (assq msg wl-summary-buffer-copy-list)
+             (setq temp-mark "O"))
+         (unless temp-mark
+           (setq temp-mark (wl-summary-get-score-mark msg)))
+         (when (setq overview-entity
+                     (elmo-msgdb-overview-get-entity
+                      msg wl-summary-buffer-msgdb))
+           (setq summary-line
+                 (wl-summary-overview-create-summary-line
+                  msg
+                  overview-entity
+                  (elmo-msgdb-overview-get-entity
+                   parent-msg wl-summary-buffer-msgdb)
+                  nil
+                  mark-alist
+                  (if wl-thread-insert-force-opened
+                      nil
+                    (wl-thread-maybe-get-children-num msg))
+                  temp-mark entity))
+           (wl-summary-insert-line summary-line)))
+      ;; insert thread (moving thread)
+      (if (not (setq invisible-top
+                    (wl-thread-entity-parent-invisible-p entity)))
+         (wl-summary-update-thread
+          (elmo-msgdb-overview-get-entity msg wl-summary-buffer-msgdb)
+          overview
+          mark-alist
+          entity
+          (and parent-msg
+               (elmo-msgdb-overview-get-entity
+                parent-msg wl-summary-buffer-msgdb)))
+       ;; currently invisible.. update closed line.
+       (wl-thread-update-children-number invisible-top)))))
 
 (defun wl-thread-update-line-on-buffer (&optional msg parent-msg updates)
   (interactive)
@@ -693,27 +710,49 @@ the closed parent will be opened."
    (while msgs
     (setq msg (wl-pop msgs))
     (setq updates (and updates (delete msg updates)))
-    (when (wl-thread-delete-line-from-buffer msg)
-      (setq entity (wl-thread-get-entity msg))
-      (wl-thread-update-line-on-buffer-sub entity msg parent-msg)
-      ;;
-      (setq children (wl-thread-entity-get-children entity))
-      (if children
-         ;; update children
-         (when (wl-thread-entity-get-opened entity)
-           (wl-push msgs msgs-stack)
-           (setq parent-msg msg
-                 msgs children))
-       (unless msgs
-         (while (and (null msgs) msgs-stack)
-           (setq msgs (wl-pop msgs-stack)))
-         (when msgs
-           (setq parent-msg
-                 (wl-thread-entity-get-number
-                  (wl-thread-entity-get-parent-entity
-                   (wl-thread-get-entity (car msgs))))))))))
+    (setq entity (wl-thread-get-entity msg))
+    (wl-thread-update-line-on-buffer-sub entity msg parent-msg)
+    ;;
+    (setq children (wl-thread-entity-get-children entity))
+    (if children
+       ;; update children
+       (when (wl-thread-entity-get-opened entity)
+         (wl-push msgs msgs-stack)
+         (setq parent-msg msg
+               msgs children))
+      (unless msgs
+       (while (and (null msgs) msgs-stack)
+         (setq msgs (wl-pop msgs-stack)))
+       (when msgs
+         (setq parent-msg
+               (wl-thread-entity-get-number
+                (wl-thread-entity-get-parent-entity
+                 (wl-thread-get-entity (car msgs)))))))))
    updates))
 
+(defun wl-thread-update-line-msgs (msgs &optional no-msg)
+  (wl-delete-all-overlays)
+  (let ((i 0)
+       (updates msgs)
+       len)
+;;     (while msgs
+;;       (setq updates
+;;         (append updates
+;;                 (wl-thread-get-children-msgs (car msgs))))
+;;       (setq msgs (cdr msgs)))
+;;     (setq updates (elmo-uniq-list updates))
+    (setq len (length updates))
+    (while updates
+      (wl-thread-update-line-on-buffer-sub nil (car updates))
+      (setq updates (cdr updates))
+      (when (and (not no-msg)
+                (> len elmo-display-progress-threshold))
+       (setq i (1+ i))
+       (if (or (zerop (% i 5)) (= i len))
+           (elmo-display-progress
+            'wl-thread-update-line-msgs "Updating deleted thread..."
+            (/ (* i 100) len)))))))
+
 (defun wl-thread-delete-line-from-buffer (msg)
   "Simply delete msg line."
   (let (beg)
@@ -726,25 +765,40 @@ the closed parent will be opened."
       nil)))
 
 (defun wl-thread-cleanup-symbols (msgs)
-  (let (sym)
+  (let (entity)
     (while msgs
-      ;; free symbol.
-      (when (boundp (setq sym (intern (format "#%d" (car msgs))
-                                     wl-thread-entity-hashtb)))
+      (when (setq entity (wl-thread-get-entity (car msgs)))
        ;; delete entity.
-       (setq wl-thread-entities
-             (delq (wl-thread-get-entity (car msgs))
-                   wl-thread-entities))
-       (makunbound sym))
+       (setq wl-thread-entities (delq entity wl-thread-entities))
+       ;; free symbol.
+       (elmo-clear-hash-val (format "#%d" (car msgs))
+                            wl-thread-entity-hashtb))
       (setq msgs (cdr msgs)))))
 
-(defun wl-thread-delete-message (msg &optional update)
+(defun wl-thread-get-exist-children (msg)
+  (let ((msgs (list msg))
+       msgs-stack children
+       entity ret-val)
+    (while msgs
+      (setq children (wl-thread-entity-get-children
+                     (setq entity (wl-thread-get-entity (car msgs)))))
+      (when (elmo-msgdb-overview-get-entity (car msgs) wl-summary-buffer-msgdb)
+       (wl-append ret-val (list (car msgs)))
+       (setq children nil))
+      (setq msgs (cdr msgs))
+      (if (null children)
+         (while (and (null msgs) msgs-stack)
+           (setq msgs (wl-pop msgs-stack)))
+       (wl-push msgs msgs-stack)
+       (setq msgs children)))
+    ret-val))
+
+(defun wl-thread-delete-message (msg &optional deep update)
   "Delete MSG from entity and buffer."
   (save-excursion
     (let* ((entity (wl-thread-get-entity msg))
-          children children2
-          older-brothers younger-brothers ;;brothers
-          parent num)
+          children older-brothers younger-brothers top-child ;;grandchildren
+          top-entity parent update-msgs beg invisible-top)
       (when entity
        (setq parent (wl-thread-entity-get-parent-entity entity))
        (if parent
@@ -755,84 +809,119 @@ the closed parent will be opened."
                                    entity parent))
              (setq younger-brothers (wl-thread-entity-get-younger-brothers
                                      entity parent))
-             ;; 
-             (setq children (wl-thread-entity-get-children entity))
-             (mapcar '(lambda (x)
-                       (wl-thread-entity-set-parent
-                        (wl-thread-get-entity x)
-                        (wl-thread-entity-get-number parent)))
-                     children)
+             ;;
+             (unless deep
+               (setq children (wl-thread-entity-get-children entity))
+               (wl-thread-reparent-children
+                children (wl-thread-entity-get-number parent))
+               (setq update-msgs
+                     (apply (function nconc)
+                            update-msgs
+                            (mapcar
+                             (function
+                              (lambda (message)
+                                (wl-thread-get-children-msgs message t)))
+                             children))))
+             (wl-thread-entity-set-children
+              parent (append older-brothers children younger-brothers))
+             ;; If chidren and younger-brothers not exists,
+             ;; update nearly older brother.
+             (when (and older-brothers
+                        (not younger-brothers)
+                        (not children))
+               (wl-append
+                update-msgs
+                (wl-thread-get-children-msgs (car (last older-brothers))))))
+
+         ;; top...oldest child becomes top.
+         (unless deep
+           (setq children (wl-thread-entity-get-children entity))
+           (when children
+             (setq top-child (car children)
+                   children (cdr children))
+             (setq top-entity (wl-thread-get-entity top-child))
+             (wl-thread-entity-set-parent top-entity nil)
+             (wl-thread-entity-set-linked top-entity nil)
+             (wl-append update-msgs
+                        (wl-thread-get-children-msgs top-child t)))
+           (when children
              (wl-thread-entity-set-children
-              parent
+              top-entity
               (append
-               (append
-                older-brothers
-                children)
-               younger-brothers)))
-         ;; top...children becomes top.
-         (mapcar '(lambda (x)
-                   (wl-thread-entity-set-parent (wl-thread-get-entity x)
-                                                nil))
-                 (setq children (wl-thread-entity-get-children entity)))
+               (wl-thread-entity-get-children top-entity)
+               children))
+             (wl-thread-reparent-children children top-child)
+             (wl-append update-msgs children)))
          ;; delete myself from top list.
          (setq older-brothers (wl-thread-entity-get-older-brothers
                                entity nil))
          (setq younger-brothers (wl-thread-entity-get-younger-brothers
                                  entity nil))
          (setq wl-thread-entity-list
-               (append (append older-brothers children)
+               (append (append older-brothers
+                               (and top-child (list top-child)))
                        younger-brothers))))
-      
-      ;; delete myself from buffer.
-      (unless (wl-thread-delete-line-from-buffer msg)
-       ;; jump to suitable point.
-       ;; just upon the oldest younger-brother of my top.
-       (let ((younger-bros (wl-thread-entity-get-younger-brothers
-                            (wl-thread-entity-get-top-entity entity)
-                            nil)))
-         (if younger-bros
-             (wl-summary-jump-to-msg (car younger-bros))
-           (goto-char (point-max)))) ; no younger brothers.
-       )
-      ;; insert children if thread is closed.
-      (when (not (wl-thread-entity-get-opened entity))
-       (setq children2 children)
-       (while children2
-         (wl-thread-insert-entity 0 ; no mean now...
-                                  (wl-thread-get-entity
-                                   (car children2))
-                                  entity nil)
-         (setq children2 (cdr children2))))
+
+      (if deep
+         ;; delete thread on buffer
+         (when (wl-summary-jump-to-msg msg)
+           (setq beg (point))
+           (wl-thread-goto-bottom-of-sub-thread)
+           (delete-region beg (point)))
+       ;; delete myself from buffer.
+       (unless (wl-thread-delete-line-from-buffer msg)
+         ;; jump to suitable point.
+         ;; just upon the oldest younger-brother of my top.
+         (setq invisible-top
+               (car (wl-thread-entity-parent-invisible-p entity)))
+         (if invisible-top
+             (progn
+               (wl-append update-msgs (list invisible-top))
+               (wl-summary-jump-to-msg invisible-top))
+           (goto-char (point-max))))
+
+       ;; insert children if thread is closed or delete top.
+       (when (or top-child
+                 (not (wl-thread-entity-get-opened entity)))
+         (let* (next-top insert-msgs ent e grandchildren)
+           (if top-child
+               (progn
+                 (setq insert-msgs (wl-thread-get-exist-children top-child))
+                 (setq next-top (car insert-msgs))
+                 (setq ent (wl-thread-get-entity next-top))
+                 (when (and
+                        (wl-thread-entity-get-opened entity) ;; open
+                        (not (wl-thread-entity-get-opened ent)) ;; close
+                        (setq grandchildren
+                              (wl-thread-entity-get-children ent))
+                        (wl-summary-jump-to-msg next-top))
+                   (forward-line 1)
+                   (setq insert-msgs (append (cdr insert-msgs) grandchildren)))
+                 (when top-entity (wl-thread-entity-set-opened top-entity t))
+                 (when ent (wl-thread-entity-set-opened ent t)))
+             (when (not invisible-top)
+               (setq insert-msgs (wl-thread-get-exist-children msg))
+               ;; First msg always opened, because first msg maybe becomes top.
+               (if (setq ent (wl-thread-get-entity (car insert-msgs)))
+                   (wl-thread-entity-set-opened ent t))))
+           ;; insert children
+           (while insert-msgs
+             ;; if no exists in summary, insert entity.
+             (when (and (car insert-msgs)
+                        (not (wl-summary-jump-to-msg (car insert-msgs))))
+               (setq ent (wl-thread-get-entity (car insert-msgs)))
+               (wl-thread-insert-entity 0 ; no mean now...
+                                        ent entity nil))
+             (setq insert-msgs (cdr insert-msgs))))))
       (if update
          ;; modify buffer.
-         (progn
-           (if parent
-               ;; update parent on buffer.
-               (progn
-                 (setq num (wl-thread-entity-get-number parent))
-                 (when num
-                   (wl-thread-update-line-on-buffer num)))
-             ;; update children lines on buffer.
-             (mapcar '(lambda (x)
-                       (wl-thread-update-line-on-buffer
-                        x
-                        (wl-thread-entity-get-number parent)))
-                     children)))
+         (while update-msgs
+           (wl-thread-update-line-on-buffer-sub nil (pop update-msgs)))
        ;; don't update buffer
-       (if parent
-           ;; return parent number
-           (list (wl-thread-entity-get-number parent))
-         children))
-       ;; update the indent string
-;          (wl-summary-goto-top-of-current-thread)
-;          (setq beg (point))
-;          (wl-thread-goto-bottom-of-sub-thread)
-;          (wl-thread-update-indent-string-region beg (point)))
-      )))
-  
+       update-msgs)))) ; return value
+
 (defun wl-thread-insert-message (overview-entity overview mark-alist
-                                msg parent-msg &optional update)
+                                msg parent-msg &optional update linked)
   "Insert MSG to the entity.
 When optional argument UPDATE is non-nil,
 Message is inserted to the summary buffer."
@@ -846,7 +935,7 @@ Message is inserted to the summary buffer."
        ;; insert as children.
        (wl-thread-entity-insert-as-children
         parent
-        (setq child-entity (wl-thread-create-entity msg (nth 0 parent))))
+        (setq child-entity (wl-thread-create-entity msg (nth 0 parent) nil linked)))
       ;; insert as top message.
       (wl-thread-entity-insert-as-top
        (wl-thread-create-entity msg nil)))
@@ -860,11 +949,14 @@ Message is inserted to the summary buffer."
               overview
               mark-alist
               child-entity
-              (elmo-msgdb-overview-get-entity-by-number overview parent-msg))
+              (elmo-msgdb-overview-get-entity
+               parent-msg wl-summary-buffer-msgdb))
              (when parent
                ;; use thread structure.
-               (wl-thread-entity-get-number
-                (wl-thread-entity-get-top-entity parent)))); return value;
+               (wl-thread-entity-get-nearly-older-brother
+                child-entity parent))) ; return value
+;;             (wl-thread-entity-get-number
+;;              (wl-thread-entity-get-top-entity parent)))) ; return value;
 ;;           (setq beg (point))
 ;;           (wl-thread-goto-bottom-of-sub-thread)
 ;;           (wl-thread-update-indent-string-region beg (point)))
@@ -872,13 +964,28 @@ Message is inserted to the summary buffer."
          (wl-thread-update-children-number invisible-top)
          nil))))
 
+(defun wl-thread-get-parent-list (msgs)
+  (let* ((msgs2 msgs)
+        myself)
+    (while msgs2
+      (setq myself (car msgs2)
+           msgs2 (cdr msgs2))
+      (while (not (eq myself (car msgs2)))
+       (if (wl-thread-descendant-p myself (car msgs2))
+           (setq msgs (delq (car msgs2) msgs)))
+       (setq msgs2 (or (cdr msgs2) msgs)))
+      (setq msgs2 (cdr msgs2)))
+    msgs))
+
 (defun wl-thread-update-indent-string-thread (top-list)
-  (let (beg)
+  (let ((top-list (wl-thread-get-parent-list top-list))
+       beg)
     (while top-list
-      (wl-summary-jump-to-msg (car top-list))
-      (setq beg (point))
-      (wl-thread-goto-bottom-of-sub-thread)
-      (wl-thread-update-indent-string-region beg (point))
+      (when (car top-list)
+       (wl-summary-jump-to-msg (car top-list))
+       (setq beg (point))
+       (wl-thread-goto-bottom-of-sub-thread)
+       (wl-thread-update-indent-string-region beg (point)))
       (setq top-list (cdr top-list)))))
 
 (defun wl-thread-update-children-number (entity)
@@ -892,7 +999,7 @@ Message is inserted to the summary buffer."
        ((looking-at (concat "^" wl-summary-buffer-number-regexp
                            "..../..\(.*\)..:.. ["
                            wl-thread-indent-regexp
-                           "]*\\[\\+\\([0-9]+\\):"))
+                           "]*[[<]\\+\\([0-9]+\\):"))
        (delete-region (match-beginning 1)(match-end 1))
        (goto-char (match-beginning 1))
        (setq str (format "%s" (wl-thread-entity-get-children-num entity)))
@@ -902,7 +1009,7 @@ Message is inserted to the summary buffer."
        ((looking-at (concat "^" wl-summary-buffer-number-regexp
                            "..../..\(.*\)..:.. ["
                            wl-thread-indent-regexp
-                           "]*\\["))
+                           "]*[[<]"))
        (goto-char (match-end 0))
        (setq beg (current-column))
        (setq from-end (save-excursion
@@ -942,51 +1049,6 @@ Message is inserted to the summary buffer."
   (interactive "P")
   (wl-thread-call-region-func 'wl-summary-prefetch-region arg))
 
-(defun wl-thread-msg-mark-as-read (msg)
-  "Set mark as read for invisible MSG. Modeline is not changed."
-  (let* ((msgdb wl-summary-buffer-msgdb)
-        (mark-alist (elmo-msgdb-get-mark-alist msgdb))
-        cur-mark)
-    (setq cur-mark (cadr (assq msg mark-alist)))
-    (cond ((or (string= cur-mark wl-summary-new-mark)
-              (string= cur-mark wl-summary-unread-uncached-mark))
-          ;; N,U -> u or " "
-          (setq mark-alist
-                (elmo-msgdb-mark-set mark-alist
-                                     msg
-                                     (if (elmo-use-cache-p
-                                          wl-summary-buffer-folder-name
-                                          msg)
-                                         wl-summary-read-uncached-mark)))
-          (elmo-msgdb-set-mark-alist msgdb mark-alist)
-          (wl-summary-set-mark-modified))
-         ((string= cur-mark wl-summary-unread-cached-mark)
-          ;; "!" -> " "
-          (setq mark-alist (elmo-msgdb-mark-set mark-alist msg nil))
-          (elmo-msgdb-set-mark-alist msgdb mark-alist)
-          (wl-summary-set-mark-modified)))))
-
-(defun wl-thread-msg-mark-as-unread (msg)
-  "Set mark as unread for invisible MSG. Modeline is not changed."
-  (let* ((msgdb wl-summary-buffer-msgdb)
-        (mark-alist (elmo-msgdb-get-mark-alist msgdb))
-        cur-mark)
-    (setq cur-mark (cadr (assq msg mark-alist)))
-    (cond ((string= cur-mark wl-summary-read-uncached-mark)
-          ;; u -> U
-          (setq mark-alist
-                (elmo-msgdb-mark-set mark-alist
-                                     msg
-                                     wl-summary-unread-uncached-mark))
-          (elmo-msgdb-set-mark-alist msgdb mark-alist)
-          (wl-summary-set-mark-modified))
-         ((null cur-mark)
-          ;; " " -> "!"
-          (setq mark-alist (elmo-msgdb-mark-set mark-alist msg
-                                     wl-summary-unread-cached-mark))
-          (elmo-msgdb-set-mark-alist msgdb mark-alist)
-          (wl-summary-set-mark-modified)))))
-
 (defun wl-thread-msg-mark-as-important (msg)
   "Set mark as important for invisible MSG. Modeline is not changed."
   (let* ((msgdb wl-summary-buffer-msgdb)
@@ -1086,22 +1148,20 @@ Message is inserted to the summary buffer."
        (wl-thread-get-entity (car elist))
        nil
        len)
-      (setq cur (1+ cur))
-      (elmo-display-progress
-       'wl-thread-insert-top "Inserting thread..."
-       (/ (* cur 100) len))
-      (setq elist (cdr elist)))))
+      (setq elist (cdr elist))
+      (when (> len elmo-display-progress-threshold)
+       (setq cur (1+ cur))
+       (if (or (zerop (% cur 2)) (= cur len))
+           (elmo-display-progress
+            'wl-thread-insert-top "Inserting thread..."
+            (/ (* cur 100) len)))))))
 
 (defsubst wl-thread-insert-entity-sub (indent entity parent-entity all)
-  (let ((number-alist (elmo-msgdb-get-number-alist wl-summary-buffer-msgdb))
-       (overview (elmo-msgdb-get-overview wl-summary-buffer-msgdb))
-       (mark-alist (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
+  (let ((mark-alist (elmo-msgdb-get-mark-alist wl-summary-buffer-msgdb))
        msg-num
        overview-entity
        temp-mark
-       children-num
-       summary-line
-       score)
+       summary-line)
     (when (setq msg-num (wl-thread-entity-get-number entity))
       (unless all ; all...means no temp-mark.
        (cond ((memq msg-num wl-summary-buffer-delete-list)
@@ -1114,25 +1174,22 @@ Message is inserted to the summary buffer."
               (setq temp-mark "O"))))
       (unless temp-mark
        (setq temp-mark (wl-summary-get-score-mark msg-num)))
-      (setq children-num (wl-thread-entity-get-children-num entity))
       (setq overview-entity
-           (elmo-msgdb-search-overview-entity
-            (nth 0 entity) number-alist overview))
+           (elmo-msgdb-overview-get-entity
+            (nth 0 entity) wl-summary-buffer-msgdb))
       ;;(wl-delete-all-overlays)
       (when overview-entity
        (setq summary-line
              (wl-summary-overview-create-summary-line
               msg-num
               overview-entity
-              (assoc  ; parent-entity
-               (cdr (assq (nth 0 parent-entity)
-                          number-alist)) overview)
+              (elmo-msgdb-overview-get-entity
+               (nth 0 parent-entity) wl-summary-buffer-msgdb)
               (1+ indent)
               mark-alist
               (if wl-thread-insert-force-opened
                   nil
-                (if (not (wl-thread-entity-get-opened entity))
-                    (or children-num)))
+                (wl-thread-maybe-get-children-num msg-num))
               temp-mark entity))
        (wl-summary-insert-line summary-line)))))
 
@@ -1219,14 +1276,17 @@ Message is inserted to the summary buffer."
                  (wl-summary-print-destination (car pair) (cdr pair))))
            (forward-line 1))))))
 
-(defsubst wl-thread-get-children-msgs (msg)
+(defsubst wl-thread-get-children-msgs (msg &optional visible-only)
   (let ((msgs (list msg))
        msgs-stack children
-       ret-val)
+       entity ret-val)
     (while msgs
       (wl-append ret-val (list (car msgs)))
       (setq children (wl-thread-entity-get-children
-                     (wl-thread-get-entity (car msgs))))
+                     (setq entity (wl-thread-get-entity (car msgs)))))
+      (if (and visible-only
+              (not (wl-thread-entity-get-opened entity)))
+         (setq children nil))
       (setq msgs (cdr msgs))
       (if (null children)
          (while (and (null msgs) msgs-stack)
@@ -1317,7 +1377,7 @@ Message is inserted to the summary buffer."
            (wl-thread-insert-force-opened
             (or wl-thread-insert-force-opened
                 force-open))
-           msg entity beg depth parent)
+           msg entity parent)
        (setq msg (wl-summary-message-number))
        (setq entity (wl-thread-get-entity msg))
        (if (wl-thread-entity-get-opened entity)
@@ -1406,7 +1466,7 @@ Message is inserted to the summary buffer."
       (when (looking-at (concat "^ *\\([0-9]+\\)"
                                "..../..\(.*\)..:.. \\("
                                wl-highlight-thread-indent-string-regexp
-                               "\\)\\["))
+                               "\\)[[<]"))
        (goto-char (match-beginning 2))
        (delete-region (match-beginning 2)
                       (match-end 2))
@@ -1424,6 +1484,52 @@ Message is inserted to the summary buffer."
        (if wl-summary-highlight
            (wl-highlight-summary-current-line))))))
 
-(provide 'wl-thread)
+(defun wl-thread-set-parent (&optional parent-number)
+  "Set current message's parent interactively."
+  (interactive)
+  (let ((number (wl-summary-message-number))
+       (dst-parent (if (interactive-p)
+                       (read-from-minibuffer "Parent Message (No.): ")))
+       entity dst-parent-entity src-parent children
+       update-msgs
+       buffer-read-only)
+    (if (string= dst-parent "")
+       (setq dst-parent nil)
+      (if (interactive-p)
+         (setq dst-parent (string-to-int dst-parent))
+       (setq dst-parent parent-number)))
+    (if (and dst-parent
+            (memq dst-parent (wl-thread-get-children-msgs number)))
+       (error "Parent is children or myself"))
+    (setq entity (wl-thread-get-entity number))
+    (when (and number entity)
+      ;; delete thread
+      (setq update-msgs (wl-thread-delete-message number 'deep))
+      ;; insert as child at new parent
+      (setq dst-parent-entity (wl-thread-get-entity dst-parent))
+      (if dst-parent-entity
+         (progn
+           (if (setq children
+                     (wl-thread-entity-get-children dst-parent-entity))
+               (wl-append update-msgs
+                          (wl-thread-get-children-msgs
+                           (car (last children)) t)))
+           (wl-thread-entity-set-children
+            dst-parent-entity
+            (append children (list number)))
+           (wl-thread-entity-set-linked entity t))
+       ;; insert as top
+       (wl-append wl-thread-entity-list (list number))
+       (wl-thread-entity-set-linked entity nil))
+
+      ;; update my thread
+      (wl-append update-msgs (wl-thread-get-children-msgs number t))
+      (setq update-msgs (elmo-uniq-list update-msgs))
+      (wl-thread-entity-set-parent entity dst-parent)
+      ;; update thread on buffer
+      (wl-thread-update-line-msgs update-msgs t))))
+
+(require 'product)
+(product-provide (provide 'wl-thread) (require 'wl-version))
 
 ;;; wl-thread.el ends here
index 2444b60..2b0ff82 100644 (file)
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
-(provide 'wl-util)
+(require 'product)
+(product-provide (provide 'wl-util) (require 'wl-version))
 (eval-when-compile
-  (provide 'elmo-util))
-
-(condition-case ()
-    (require 'tm-edit)
-  (error))
-(condition-case ()
-    (require 'pp)
-  (error))
+  (require 'elmo-util))
+
+(condition-case nil (require 'tm-edit) (error nil))
+(condition-case nil (require 'pp) (error nil))
+
 (eval-when-compile
-  (mapcar
-   (function
-    (lambda (symbol)
-      (unless (boundp symbol)
-       (set (make-local-variable symbol) nil))))
-   '(mule-version
-     nemacs-version
-     emacs-beta-version
-     xemacs-codename
-     mime-edit-insert-user-agent-field
-     mime-edit-user-agent-value
-     mime-editor/version
-     mime-editor/codename))
   (require 'time-stamp)
-  (defun-maybe read-event ())
-  (defun-maybe next-command-event ())
-  (defun-maybe event-to-character (a))
-  (defun-maybe key-press-event-p (a))
-  (defun-maybe button-press-event-p (a))
-  (defun-maybe set-process-kanji-code (a b))
-  (defun-maybe set-process-coding-system (a b c))
-  (defun-maybe dispatch-event (a)))
+  (defalias-maybe 'read-event 'ignore)
+  (defalias-maybe 'next-command-event 'ignore)
+  (defalias-maybe 'event-to-character 'ignore)
+  (defalias-maybe 'key-press-event-p 'ignore)
+  (defalias-maybe 'button-press-event-p 'ignore)
+  (defalias-maybe 'set-process-kanji-code 'ignore)
+  (defalias-maybe 'set-process-coding-system 'ignore)
+  (defalias-maybe 'dispatch-event 'ignore))
 
 (defalias 'wl-set-work-buf 'elmo-set-work-buf)
 (make-obsolete 'wl-set-work-buf 'elmo-set-work-buf)
@@ -157,120 +142,6 @@ If HACK-ADDRESSES is t, then the strings are considered to be mail addresses,
        (nreverse list)) ; jwz: fixed order
      )))
 
-(defun wl-version (&optional with-codename)
-  (format "%s %s%s" wl-appname wl-version
-         (if with-codename
-             (format " - \"%s\"" wl-codename) "")))
-
-(defun wl-version-show ()
-  (interactive)
-  (message "%s" (wl-version t)))
-
-;; from gnus
-(defun wl-extended-emacs-version (&optional with-codename)
-  "Stringified Emacs version"
-  (interactive)
-  (cond
-   ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
-    (concat "Emacs " (wl-match-string 1 emacs-version)
-           (and (boundp 'mule-version)(concat "/Mule " mule-version))))
-   ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
-                 emacs-version)
-    (concat (wl-match-string 1 emacs-version)
-           (format " %d.%d" emacs-major-version emacs-minor-version)
-           (if (and (boundp 'emacs-beta-version)
-                    emacs-beta-version)
-               (format "b%d" emacs-beta-version))
-           (if with-codename
-               (if (boundp 'xemacs-codename)
-                   (concat " - \"" xemacs-codename "\"")))))
-   (t emacs-version)))
-
-(defun wl-extended-emacs-version2 (&optional delimiter with-codename)
-  "Stringified Emacs version"
-  (interactive)
-  (cond
-   ((and (boundp 'mule-version)
-        mule-version
-        (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
-    (format "Mule%s%s@%d.%d%s"
-           (or delimiter " ")
-           (wl-match-string 1 mule-version)
-           emacs-major-version
-           emacs-minor-version
-           (if with-codename
-               (wl-match-string 2 mule-version)
-             "")))
-   ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
-    (if (boundp 'nemacs-version)
-       (concat "Nemacs" (or delimiter " ")
-               nemacs-version
-               "@"
-               (substring emacs-version
-                          (match-beginning 1)
-                          (match-end 1)))
-      (concat "Emacs" (or delimiter " ")
-             (wl-match-string 1 emacs-version))))
-   ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
-                 emacs-version)
-    (concat (wl-match-string 1 emacs-version)
-           (or delimiter " ")
-           (format "%d.%d" emacs-major-version emacs-minor-version)
-           (if (and (boundp 'emacs-beta-version)
-                    emacs-beta-version)
-               (format "b%d" emacs-beta-version))
-           (if (and with-codename
-                    (boundp 'xemacs-codename)
-                    xemacs-codename)
-               (format " (%s)" xemacs-codename))))
-   (t emacs-version)))
-
-(defun wl-extended-emacs-version3 (&optional delimiter with-codename)
-  "Stringified Emacs version"
-  (interactive)
-  (cond
-   ((and (boundp 'mule-version)
-        mule-version
-        (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
-    (format "Emacs%s%d.%d Mule%s%s%s"
-           (or delimiter " ")
-           emacs-major-version
-           emacs-minor-version
-           (or delimiter " ")
-           (wl-match-string 1 mule-version)
-           (if with-codename
-               (wl-match-string 2 mule-version)
-             "")))
-   ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
-    (if (boundp 'nemacs-version)
-       (let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
-                                      ("3.3.1" . " (HINAMATSURI)")
-                                      ("3.2.3" . " (YUMENO-AWAYUKI)"))))
-         (format "Emacs%s%s Nemacs%s%s%s"
-                 (or delimiter " ")
-                 (wl-match-string 1 emacs-version)
-                 (or delimiter " ")
-                 nemacs-version
-                 (or (and with-codename
-                          (cdr (assoc nemacs-version
-                                      nemacs-codename-assoc)))
-                     "")))
-      (concat "Emacs" (or delimiter " ")
-             (wl-match-string 1 emacs-version))))
-   ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
-                 emacs-version)
-    (concat (wl-match-string 1 emacs-version)
-           (or delimiter " ")
-           (format "%d.%d" emacs-major-version emacs-minor-version)
-           (if (and (boundp 'emacs-beta-version)
-                    emacs-beta-version)
-               (format "b%d" emacs-beta-version))
-           (if (and with-codename
-                    (boundp 'xemacs-codename)
-                    xemacs-codename)
-               (format " (%s)" xemacs-codename))))
-   (t emacs-version)))
-
 (defun wl-append-element (list element)
   (if element
       (append list (list element))
@@ -295,7 +166,7 @@ If HACK-ADDRESSES is t, then the strings are considered to be mail addresses,
               (event-to-character event))
          event)))
 
-(if running-xemacs
+(if wl-on-xemacs
     (fset 'wl-read-event-char 'wl-xmas-read-event-char))
 
 (defmacro wl-push (v l)
@@ -362,68 +233,38 @@ If HACK-ADDRESSES is t, then the strings are considered to be mail addresses,
       (format "%dK" result))
      (t (format "%dB" result)))))
 
-(defun wl-generate-user-agent-string ()
-  "A candidate of wl-generate-mailer-string-func.
-Insert User-Agent field instead of X-Mailer field."
-  (let ((mime-user-agent (and (boundp 'mime-edit-insert-user-agent-field)
-                             mime-edit-insert-user-agent-field
-                             mime-edit-user-agent-value)))
-    (if mime-user-agent
-       (concat "User-Agent: "
-               wl-appname "/" wl-version
-               " (" wl-codename ") "
-               mime-user-agent)
-      (if (and (boundp 'mime-editor/version)
-              mime-editor/version)
-         (concat "User-Agent: "
-                 wl-appname "/" wl-version
-                 " (" wl-codename ") "
-                 "tm/" mime-editor/version
-                 (if (and (boundp 'mime-editor/codename)
-                          mime-editor/codename)
-                     (concat " (" mime-editor/codename ")"))
-                 (if (and (boundp 'mime-library-product)
-                          mime-library-product)
-                     (concat " " (aref mime-library-product 0)
-                             "/"
-                             (mapconcat 'int-to-string
-                                        (aref mime-library-product 1)
-                                        ".")
-                             " (" (aref mime-library-product 2) ")"))
-                 (condition-case nil
-                     (progn
-                       (require 'apel-ver)
-                       (concat " " (apel-version)))
-                   (file-error nil))
-                 " " (wl-extended-emacs-version3 "/" t))
-       (concat "User-Agent: " wl-appname "/" wl-version " (" wl-codename ") "
-               (wl-extended-emacs-version3 "/" t))))))
-
-(defun wl-make-modeline-subr ()
-  (let* ((duplicated (copy-sequence mode-line-format))
-        (cur-entry duplicated)
-        return-modeline)
-    (if (memq 'wl-plug-state-indicator mode-line-format)
-       duplicated
-      (catch 'done
-       (while cur-entry
-         (if (or (and (symbolp (car cur-entry))
-                      (eq 'mode-line-buffer-identification
-                             (car cur-entry)))
-                 (and (consp (car cur-entry))
-                      (or
-                       (eq 'modeline-buffer-identification
-                              (car (car cur-entry)))
-                       (eq 'modeline-buffer-identification
-                              (cdr (car cur-entry))))))
-             (progn
-               (setq return-modeline (append return-modeline
-                                             (list 'wl-plug-state-indicator)
-                                             cur-entry))
-               (throw 'done return-modeline))
-           (setq return-modeline (append return-modeline
-                                         (list (car cur-entry)))))
-         (setq cur-entry (cdr cur-entry)))))))
+(defun wl-mode-line-buffer-identification (&optional id)
+  (let ((priorities '(biff plug title)))
+    (let ((items (reverse wl-mode-line-display-priority-list))
+         item)
+      (while items
+       (setq item (car items)
+             items (cdr items))
+       (unless (memq item '(biff plug))
+         (setq item 'title))
+       (setq priorities (cons item (delq item priorities)))))
+    (let (priority result)
+      (while priorities
+       (setq priority (car priorities)
+             priorities (cdr priorities))
+       (cond
+        ((eq 'biff priority)
+         (when wl-biff-check-folder-list
+           (setq result (append result '((wl-modeline-biff-status
+                                          wl-modeline-biff-state-on
+                                          wl-modeline-biff-state-off))))))
+        ((eq 'plug priority)
+         (when wl-show-plug-status-on-modeline
+           (setq result (append result '((wl-modeline-plug-status
+                                          wl-modeline-plug-state-on
+                                          wl-modeline-plug-state-off))))))
+        (t
+         (setq result (append result (or id '("Wanderlust: %12b")))))))
+      (prog1
+         (setq mode-line-buffer-identification (if (stringp (car result))
+                                                   result
+                                                 (cons "" result)))
+       (force-mode-line-update t)))))
 
 (defalias 'wl-display-error 'elmo-display-error)
 (make-obsolete 'wl-display-error 'elmo-display-error)
@@ -483,7 +324,7 @@ Insert User-Agent field instead of X-Mailer field."
 
 (defun wl-parse-newsgroups (string &optional subscribe-only)
   (let* ((nglist (wl-parse string "[ \t\f\r\n,]*\\([^ \t\f\r\n,]+\\)"))
-        spec ret-val)
+        ret-val)
     (if (not subscribe-only)
        nglist
       (while nglist
@@ -499,7 +340,7 @@ Insert User-Agent field instead of X-Mailer field."
   (if (fboundp 'region-exists-p)
       (defmacro wl-region-exists-p ()
        (list 'region-exists-p))))
-  
+
 (if (not (fboundp 'overlays-in))
     (defun overlays-in (beg end)
       "Return a list of the overlays that overlap the region BEG ... END.
@@ -552,12 +393,42 @@ or between BEG and END."
              (list (list item value))))))
 
 (defun wl-delete-alist (key alist)
-  "Delete all entries in ALIST that have a key eq to KEY."
+  "Delete by side effect any entries specified with KEY from ALIST.
+Return the modified ALIST.  Key comparison is done with `assq'.
+Write `(setq foo (wl-delete-alist key foo))' to be sure of changing
+the value of `foo'."
   (let (entry)
     (while (setq entry (assq key alist))
       (setq alist (delq entry alist)))
     alist))
 
+(defun wl-delete-associations (keys alist)
+  "Delete by side effect any entries specified with KEYS from ALIST.
+Return the modified ALIST.  KEYS must be a list of keys for ALIST.
+Deletion is done with `wl-delete-alist'.
+Write `(setq foo (wl-delete-associations keys foo))' to be sure of
+changing the value of `foo'."
+  (while keys
+    (setq alist (wl-delete-alist (car keys) alist))
+    (setq keys (cdr keys)))
+  alist)
+
+(defun wl-inverse-alist (keys alist)
+  "Inverse ALIST, copying.  Return an association list represents
+the inverse mapping of ALIST, from objects to KEYS.
+The objects mapped (cdrs of elements of the ALIST) are shared."
+  (let (x y tmp result)
+    (while keys
+      (setq x (car keys))
+      (setq y (cdr (assq x alist)))
+      (if y
+         (if (setq tmp (assoc y result))
+             (setq result (cons (append tmp (list x))
+                                (delete tmp result)))
+           (setq result (cons (list y x) result))))
+      (setq keys (cdr keys)))
+    result))
+
 (eval-when-compile
   (require 'static))
 (static-unless (fboundp 'pp)
@@ -633,11 +504,11 @@ that `read' can handle, whenever this is possible."
 (defsubst wl-get-date-iso8601 (date)
   (or (get-text-property 0 'wl-date date)
       (let* ((d1 (timezone-fix-time date nil nil))
-            (time (format "%04d%02d%02dT%02d%02d%02d"
-                          (aref d1 0) (aref d1 1) (aref d1 2)
-                          (aref d1 3) (aref d1 4) (aref d1 5))))
-       (put-text-property 0 1 'wl-date time date)
-       time)))
+            (time (format "%04d%02d%02dT%02d%02d%02d"
+                          (aref d1 0) (aref d1 1) (aref d1 2)
+                          (aref d1 3) (aref d1 4) (aref d1 5))))
+       (put-text-property 0 1 'wl-date time date)
+       time)))
 
 (defun wl-make-date-string ()
   (let ((s (current-time-string)))
@@ -645,13 +516,13 @@ that `read' can handle, whenever this is possible."
                  s)
     (concat (wl-match-string 1 s) ", "
            (timezone-make-date-arpa-standard s (current-time-zone)))))
+
 (defun wl-date-iso8601 (date)
   "Convert the DATE to YYMMDDTHHMMSS."
   (condition-case ()
       (wl-get-date-iso8601 date)
     (error "")))
+
 (defun wl-day-number (date)
   (let ((dat (mapcar '(lambda (s) (and s (string-to-int s)) )
                     (timezone-parse-date date))))
@@ -709,17 +580,17 @@ that `read' can handle, whenever this is possible."
                    (and (get-buffer x)
                         (kill-buffer x)))))
             (buffer-list))))
+
 (defun wl-sendlog-time ()
   (static-if (fboundp 'format-time-string)
       (format-time-string "%Y/%m/%d %T")
     (let ((date (current-time-string)))
       (format "%s/%02d/%02d %s"
-             (substring date -4)
-             (cdr (assoc (upcase (substring date 4 7))
+             (substring date -4)
+             (cdr (assoc (upcase (substring date 4 7))
                          timezone-months-assoc))
-             (string-to-int (substring date 8 10))
-             (substring date 11 19)))))
+             (string-to-int (substring date 8 10))
+             (substring date 11 19)))))
 
 (defun wl-collect-summary ()
   (let (result)
@@ -812,8 +683,197 @@ that `read' can handle, whenever this is possible."
 (defun wl-local-load-profile ()
   (message "Initializing ...")
   (load wl-init-file 'noerror 'nomessage))
-  
+
 (defun wl-load-profile ()
   (funcall wl-load-profile-func))
 
+;;;
+
+(defmacro wl-count-lines ()
+  (` (save-excursion
+       (beginning-of-line)
+       (count-lines 1 (point)))))
+
+(defun wl-horizontal-recenter ()
+  "Recenter the current buffer horizontally."
+  (beginning-of-line)
+  (re-search-forward "[[<]" (point-at-eol) t)
+  (if (< (current-column) (/ (window-width) 2))
+      (set-window-hscroll (get-buffer-window (current-buffer) t) 0)
+    (let* ((orig (point))
+          (end (window-end (get-buffer-window (current-buffer) t)))
+          (max 0))
+      (when end
+       ;; Find the longest line currently displayed in the window.
+       (goto-char (window-start))
+       (while (and (not (eobp))
+                   (< (point) end))
+         (end-of-line)
+         (setq max (max max (current-column)))
+         (forward-line 1))
+       (goto-char orig)
+       ;; Scroll horizontally to center (sort of) the point.
+       (if (> max (window-width))
+           (set-window-hscroll
+            (get-buffer-window (current-buffer) t)
+            (min (- (current-column) (/ (window-width) 3))
+                 (+ 2 (- max (window-width)))))
+         (set-window-hscroll (get-buffer-window (current-buffer) t) 0))
+       max))))
+
+;; Biff
+(static-cond
+ (wl-on-xemacs
+  (defvar wl-biff-timer-name "wl-biff")
+
+  (defun wl-biff-stop ()
+    (when (get-itimer wl-biff-timer-name)
+      (delete-itimer wl-biff-timer-name)))
+
+  (defun wl-biff-start ()
+    (wl-biff-stop)
+    (when wl-biff-check-folder-list
+      (wl-biff-check-folders)
+      (start-itimer wl-biff-timer-name 'wl-biff-check-folders
+                   wl-biff-check-interval wl-biff-check-interval))))
+
+ ((condition-case nil (require 'timer) (error nil));; FSFmacs 19+
+
+  (defun wl-biff-stop ()
+    (put 'wl-biff 'timer nil))
+
+  (defun wl-biff-start ()
+    (require 'timer)
+    (when wl-biff-check-folder-list
+      (wl-biff-check-folders)
+      (put 'wl-biff 'timer (run-at-time
+                           (timer-next-integral-multiple-of-time
+                            (current-time) wl-biff-check-interval)
+                           wl-biff-check-interval
+                           'wl-biff-event-handler))))
+
+  (defun-maybe timer-next-integral-multiple-of-time (time secs)
+    "Yield the next value after TIME that is an integral multiple of SECS.
+More precisely, the next value, after TIME, that is an integral multiple
+of SECS seconds since the epoch.  SECS may be a fraction.
+This function is imported from Emacs 20.7."
+    (let ((time-base (ash 1 16)))
+      (if (fboundp 'atan)
+         ;; Use floating point, taking care to not lose precision.
+         (let* ((float-time-base (float time-base))
+                (million 1000000.0)
+                (time-usec (+ (* million
+                                 (+ (* float-time-base (nth 0 time))
+                                    (nth 1 time)))
+                              (nth 2 time)))
+                (secs-usec (* million secs))
+                (mod-usec (mod time-usec secs-usec))
+                (next-usec (+ (- time-usec mod-usec) secs-usec))
+                (time-base-million (* float-time-base million)))
+           (list (floor next-usec time-base-million)
+                 (floor (mod next-usec time-base-million) million)
+                 (floor (mod next-usec million))))
+       ;; Floating point is not supported.
+       ;; Use integer arithmetic, avoiding overflow if possible.
+       (let* ((mod-sec (mod (+ (* (mod time-base secs)
+                                  (mod (nth 0 time) secs))
+                               (nth 1 time))
+                            secs))
+              (next-1-sec (+ (- (nth 1 time) mod-sec) secs)))
+         (list (+ (nth 0 time) (floor next-1-sec time-base))
+               (mod next-1-sec time-base)
+               0)))))
+
+  (defun wl-biff-event-handler ()
+    ;; PAKURing from FSF:time.el
+    (wl-biff-check-folders)
+    ;; Do redisplay right now, if no input pending.
+    (sit-for 0)
+    (let* ((current (current-time))
+          (timer (get 'wl-biff 'timer))
+          ;; Compute the time when this timer will run again, next.
+          (next-time (timer-relative-time
+                      (list (aref timer 1) (aref timer 2) (aref timer 3))
+                      (* 5 (aref timer 4)) 0)))
+      ;; If the activation time is far in the past,
+      ;; skip executions until we reach a time in the future.
+      ;; This avoids a long pause if Emacs has been suspended for hours.
+      (or (> (nth 0 next-time) (nth 0 current))
+         (and (= (nth 0 next-time) (nth 0 current))
+              (> (nth 1 next-time) (nth 1 current)))
+         (and (= (nth 0 next-time) (nth 0 current))
+              (= (nth 1 next-time) (nth 1 current))
+              (> (nth 2 next-time) (nth 2 current)))
+         (progn
+           (timer-set-time timer (timer-next-integral-multiple-of-time
+                                  current wl-biff-check-interval)
+                           wl-biff-check-interval)
+           (timer-activate timer))))))
+ (t
+  (fset 'wl-biff-stop 'ignore)
+  (fset 'wl-biff-start 'ignore)))
+
+(defsubst wl-biff-notify (new-mails notify-minibuf)
+  (setq wl-modeline-biff-status (> new-mails 0))
+  (force-mode-line-update t)
+  (when notify-minibuf
+    (cond ((zerop new-mails) (message "No mail."))
+         ((eq 1 new-mails) (message "You have a new mail."))
+         (t (message "You have %d new mails." new-mails)))))
+
+;; Internal variable.
+(defvar wl-biff-check-folders-running nil)
+
+(defun wl-biff-check-folders ()
+  (interactive)
+  (if wl-biff-check-folders-running
+      (when (interactive-p)
+       (message "Biff process is running."))
+    (setq wl-biff-check-folders-running t)
+    (when (interactive-p)
+      (message "Checking new mails..."))
+    (let ((new-mails 0)
+         (flist (or wl-biff-check-folder-list (list wl-default-folder)))
+         (elmo-network-session-name-prefix "BIFF-")
+         folder)
+      (if (eq (length flist) 1)
+         (wl-biff-check-folder-async (car flist) (interactive-p))
+       (unwind-protect
+           (while flist
+             (setq folder (car flist)
+                   flist (cdr flist))
+             (when (elmo-folder-plugged-p folder)
+               (setq new-mails
+                     (+ new-mails
+                        (nth 0 (wl-folder-check-one-entity folder))))))
+         (setq wl-biff-check-folders-running nil)
+         (wl-biff-notify new-mails (interactive-p)))))))
+
+(defun wl-biff-check-folder-async-callback (diff data)
+  (if (nth 1 data)
+      (with-current-buffer (nth 1 data)
+       (wl-folder-entity-hashtb-set wl-folder-entity-hashtb (nth 0 data)
+                                    (list (car diff) 0 (cdr diff))
+                                    (current-buffer))))
+  (setq wl-folder-info-alist-modified t)
+  (setq wl-biff-check-folders-running nil)
+  (sit-for 0)
+  (wl-biff-notify (car diff) (nth 2 data)))
+
+(defun wl-biff-check-folder-async (folder notify-minibuf)
+  (when (elmo-folder-plugged-p folder)
+    (if (and (eq (elmo-folder-get-type folder) 'imap4)
+            (wl-folder-use-server-diff-p folder))
+       ;; Check asynchronously only when IMAP4 and use server diff.
+       (progn
+         (setq elmo-folder-diff-async-callback
+               'wl-biff-check-folder-async-callback)
+         (setq elmo-folder-diff-async-callback-data
+               (list folder (get-buffer wl-folder-buffer-name)
+                     notify-minibuf))
+         (elmo-folder-diff-async folder))
+      (wl-biff-notify (car (wl-folder-check-one-entity folder))
+                     notify-minibuf)
+      (setq wl-biff-check-folders-running nil))))
+
 ;;; wl-util.el ends here
index 760a15d..ba71247 100644 (file)
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
 (require 'elmo-vars)
 
 (if (module-installed-p 'custom)
     (require 'custom))
 
-(defconst wl-appname  "Wanderlust")
-(defconst wl-version  elmo-version) ; equals to ELMO version.
-(defconst wl-codename "Raspberry Beret")
-
 ;;; Customizable Variables
 
 (defgroup wl nil
   :group 'wl)
 
 ;;; Emacsen
-(defconst wl-on-emacs20 (> emacs-major-version 19))
-
 (defconst wl-on-xemacs (featurep 'xemacs))
 
+(defconst wl-on-emacs21 (and (not wl-on-xemacs)
+                            (>= emacs-major-version 21)))
+
 (defconst wl-on-nemacs (fboundp 'nemacs-version))
 
 (defconst wl-on-mule (featurep 'mule))
 
 (defconst wl-on-mule3
-  (and wl-on-mule (or wl-on-xemacs wl-on-emacs20)))
+  (and wl-on-mule (or wl-on-xemacs
+                     (> emacs-major-version 19))))
 
 (require 'elmo-vars)
 
@@ -153,8 +151,12 @@ If you don't have multiple e-mail addresses, you don't have to set this."
   :group 'wl)
 
 (defcustom wl-icon-dir (if (fboundp 'locate-data-directory)
-                          (locate-data-directory "wl"))
-  "*Icon directory (XEmacs)."
+                          (locate-data-directory "wl")
+                        (let ((icons (expand-file-name "wl/icons/"
+                                                       data-directory)))
+                          (if (file-directory-p icons)
+                              icons)))
+  "*Icon directory (XEmacs or Emacs 21)."
   :type '(choice (const :tag "none" nil)
                 string)
   :group 'wl)
@@ -174,11 +176,11 @@ If you don't have multiple e-mail addresses, you don't have to set this."
   :type 'function
   :group 'wl-summary)
 
-;(defcustom wl-summary-search-parent-by-subject-regexp "^[ \t]*\\(\\[[^:]+[,: ][0-9]+\\]\\)?[ \t]*re"
-;   "*If message does not have in-reply-to field nor references field and
-; subject matches this regexp, search parent message by subject matching."
-;   :type 'string
-;   :group 'wl-summary)
+(defcustom wl-summary-search-parent-by-subject-regexp "^[ \t]*\\(\\[[^:]+[,: ][0-9]+\\]\\)?[ \t]*re[\\^[: ]"
+  "*If message does not have in-reply-to field nor references field and
+ subject matches this regexp, search parent message by subject matching."
+  :type 'string
+  :group 'wl-summary)
 
 (defcustom wl-summary-update-confirm-threshold 500
   "*Confirm updating summary if message number is larger than this value."
@@ -252,12 +254,18 @@ If nil, wl-from is used."
                 string)
   :group 'wl)
 
+(defcustom wl-draft-add-references t
+  "*If non-nil, message-id of the cited message is inserted to the
+references field of the current draft."
+  :type 'boolean
+  :group 'wl)
+
 (defcustom wl-smtp-connection-type nil
   "*SMTP connection type.
 If nil, default smtp connection type is used."
   :type '(choice (const :tag "default" nil)
-                (const :tag "Use STARTTLS" starttls)
-                symbol)
+                (const :tag "Use STARTTLS" starttls)
+                symbol)
   :group 'wl)
 
 (defcustom wl-smtp-posting-user nil
@@ -312,9 +320,9 @@ If nil, elmo-default-pop3-port is used."
                 integer string)
   :group 'wl)
 
-(defcustom wl-pop-before-smtp-ssl nil
-  "*Non-nil forces using SSL by default for POP-before-SMTP.
-If nil, elmo-default-pop3-ssl is used."
+(defcustom wl-pop-before-smtp-stream-type nil
+  "*Stream type for POP-before-SMTP.
+If nil, elmo-default-pop3-stream-type is used."
   :type 'boolean
   :group 'wl)
 
@@ -345,9 +353,9 @@ If nil, elmo-default-nntp-port is used."
   :type '(choice (const :tag "none" nil)
                 integer string)
   :group 'wl)
-(defcustom wl-nntp-posting-ssl nil
-  "*Non-nil forces using SSL to post news.
-If nil, elmo-default-nntp-ssl is used."
+(defcustom wl-nntp-posting-stream-type nil
+  "*Stream type for posting Netnews.
+If nil, elmo-default-nntp-stream-type is used."
   :type 'boolean
   :group 'wl)
 
@@ -387,7 +395,9 @@ when `wl-prefetch-confirm' is non-nil."
 
 ;;;; Hooks
 (defvar wl-folder-mode-hook nil
-  "A hook called when wanderlust folder mode is started.")
+  "A hook called when wanderlust folder mode is started.  This hook may
+contain the functions `wl-folder-init-icons' and `wl-setup-folder' for
+reasons of system internal to accord facilities for the Emacs variants.")
 (defvar wl-summary-toggle-disp-on-hook nil
   "A hook called when message is toggled.")
 (defvar wl-summary-toggle-disp-off-hook nil
@@ -399,7 +409,10 @@ when `wl-prefetch-confirm' is non-nil."
 (defvar wl-summary-toggle-disp-folder-message-resumed-hook nil
   "A hook called when message window is resumed when folder is toggled.")
 (defvar wl-summary-mode-hook nil
-  "A hook called when summary mode is started.")
+  "A hook called when summary mode is started.  This hook may contain
+the function `wl-setup-summary' for reasons of system internal to
+accord facilities for the Emacs variants.")
+
 (defvar wl-summary-prepared-pre-hook nil
   "A hook called before the summary buffer has been generated.")
 (defvar wl-summary-prepared-hook nil
@@ -410,6 +423,10 @@ when `wl-prefetch-confirm' is non-nil."
   "A hook called when unread message is displayed.")
 (defvar wl-summary-edit-addresses-hook nil
   "A hook called when address book is edited.")
+(defvar wl-summary-buffer-message-saved-hook nil
+  "A hook called when msgdb is saved.")
+(defvar wl-summary-buffer-mark-saved-hook nil
+  "A hook called when mark is saved.")
 (defvar wl-summary-divide-thread-when-subject-changed nil
   "Divide thread when subject is changed.")
 (defvar wl-init-hook nil
@@ -464,6 +481,8 @@ when `wl-prefetch-confirm' is non-nil."
   "A hook called when archived.")
 (defvar wl-summary-line-inserted-hook nil
   "A hook called when summary line is inserted.")
+(defvar wl-summary-insert-headers-hook nil
+  "A hook called when insert header for search header.")
 (defvar wl-thread-update-children-number-hook nil
   "A hook called when children number is updated.")
 (defvar wl-folder-update-access-group-hook nil
@@ -477,7 +496,10 @@ when `wl-prefetch-confirm' is non-nil."
 (defvar wl-score-mode-hook nil
   "A hook called when score mode is started.")
 (defvar wl-make-plugged-hook nil
-  "A hook called when make plugged alist.")
+  "A hook called when make plugged alist.  This hook may contain the
+functions `wl-plugged-init-icons' and `wl-biff-init-icons' for reasons
+of system internal to accord facilities for the Emacs variants.")
+
 (defvar wl-plugged-exit-hook nil
   "A hook called when exit plugged mode.")
 
@@ -508,6 +530,8 @@ Prepared candidates are 'wl-draft-send-mail-with-smtp,
     ("From" . (("From") nil nil)))
   "Alist of cons cell of
 ('field-name' .  ('fields for To' 'fields for Cc' 'fields for Newsgroups'))
+'field-name' is a string.
+'fields for ***' is a list of strings.
 If car of each cons cell exists in original message,
 cdr of each cons cell is used for draft message.
 Default is for 'reply-to-author'."
@@ -517,7 +541,7 @@ Default is for 'reply-to-author'."
                             (repeat :tag "Fields For Cc" string)
                             (repeat :tag "Fields For Newsgroups" string))))
   :group 'wl-draft)
-  
+
 (defcustom wl-draft-reply-without-argument-list
   '(("Followup-To" . (nil nil ("Followup-To")))
     ("Mail-Followup-To" . (("Mail-Followup-To") nil ("Newsgroups")))
@@ -536,6 +560,42 @@ Default is for 'reply-to-all'."
                             (repeat :tag "Fields For Newsgroups" string))))
   :group 'wl-draft)
 
+(defcustom wl-draft-reply-myself-with-argument-list
+  '(("Followup-To" . (("To") ("Cc") ("Followup-To")))
+    ("Newsgroups" . (("To") ("Cc") ("Newsgroups")))
+    ("From" . (("To") ("Cc") nil)))
+  "Alist of cons cell of
+('field-name' .  ('fields for To' 'fields for Cc' 'fields for Newsgroups'))
+'field-name' is a string.
+'fields for ***' is a list of strings.
+If car of each cons cell exists in original message,
+cdr of each cons cell is used for draft message.
+Default is for 'reply-to-me'."
+  :type '(repeat (cons (choice (string :tag "Field Name")
+                              (repeat (string :tag "Field Name")))
+                      (list (repeat :tag "Fields For To" string)
+                            (repeat :tag "Fields For Cc" string)
+                            (repeat :tag "Fields For Newsgroups" string))))
+  :group 'wl-draft)
+
+(defcustom wl-draft-reply-myself-without-argument-list
+  '(("Followup-To" . (("To") ("Cc") ("Followup-To")))
+    ("Newsgroups" . (("To") ("Cc") ("Newsgroups")))
+    ("From" . (("To") ("Cc") nil)))
+  "Alist of cons cell of
+('field-name' .  ('fields for To' 'fields for Cc' 'fields for Newsgroups'))
+'field-name' is a string.
+'fields for ***' is a list of strings.
+If car of each cons cell exists in original message,
+cdr of each cons cell is used for draft message.
+Default is for 'followup-to-me'."
+  :type '(repeat (cons (choice (string :tag "Field Name")
+                              (repeat (string :tag "Field Name")))
+                      (list (repeat :tag "Fields For To" string)
+                            (repeat :tag "Fields For Cc" string)
+                            (repeat :tag "Fields For Newsgroups" string))))
+  :group 'wl-draft)
+
 (defcustom wl-draft-always-delete-myself nil
   "*Always delete myself from reciepient if non-nil."
   :type 'boolean
@@ -556,7 +616,12 @@ Default is for 'reply-to-all'."
   :type 'boolean
   :group 'wl-draft)
 
-;;;; 
+(defcustom wl-draft-remove-group-list-contents t
+  "*If non-nil, remove group list contents in `wl-draft-send-mail-with-smtp'"
+  :type 'boolean
+  :group 'wl-draft)
+
+;;;;
 (defcustom wl-init-file "~/.wl"
   "*User customization setting file."
   :type 'file
@@ -577,6 +642,27 @@ Default is for 'reply-to-all'."
   :type 'file
   :group 'wl)
 
+(defcustom wl-ldap-server "localhost"
+  "*LDAP server."
+  :type '(string :tag "Server")
+  :group 'wl)
+
+(defcustom wl-ldap-port nil
+  "*LDAP port."
+  :type '(choice (const :tag "Default port" nil)
+                integer)
+  :group 'wl)
+
+(defcustom wl-ldap-base "c=US"
+  "*LDAP base."
+  :type '(string :tag "Base")
+  :group 'wl)
+
+(defcustom wl-use-ldap nil
+  "*If non-nil, use LDAP for address completion."
+  :type 'boolean
+  :group 'wl)
+
 (defcustom wl-folder-info-save t
   "If non-nil, save elmo-folder-info-alist."
   :type 'boolean
@@ -641,8 +727,8 @@ This variable is local to the summary buffers."
                 integer)
   :group 'wl-score)
 
-(defcustom wl-summary-temp-above nil
-  "*Mark all messages with a score above this variable as temp.
+(defcustom wl-summary-target-above nil
+  "*Mark all messages with a score above this variable as target.
 This variable is local to the summary buffers."
   :type '(choice (const :tag "off" nil)
                 integer)
@@ -832,6 +918,12 @@ ex.
   :group 'wl-draft
   :group 'wl-pref)
 
+(defcustom wl-draft-use-cache t
+  "*If non-nil, sending message is cached."
+  :type 'boolean
+  :group 'wl-draft
+  :group 'wl-pref)
+
 (defcustom wl-auto-flush-queue t
   "*If non-nil, sending queue is flushed when network status is toggled."
   :type 'boolean
@@ -845,9 +937,13 @@ ex.
   :group 'wl-draft)
 
 (defcustom wl-draft-queue-save-variables
-  '(wl-envelope-from
-    wl-smtp-posting-server smtp-service
-    wl-nntp-posting-server elmo-default-nntp-port)
+  '(wl-envelope-from wl-from
+    wl-smtp-posting-server wl-smtp-posting-user wl-smtp-posting-port
+    wl-smtp-authenticate-type wl-smtp-connection-type 
+    wl-pop-before-smtp-server wl-pop-before-smtp-user wl-pop-before-smtp-port
+    wl-pop-before-smtp-stream-type wl-pop-before-smtp-authenticate-type
+    wl-nntp-posting-server wl-nntp-posting-server
+    wl-nntp-posting-user wl-nntp-posting-port wl-nntp-posting-stream-type)
   "*Saving variables in queue info."
   :type '(repeat (sexp :tag "Variable"))
   :group 'wl-draft)
@@ -1007,6 +1103,18 @@ Set this if (system-name) does not return FQDN."
   :type '(repeat (string :tag "Field Regexp"))
   :group 'wl-pref)
 
+(defcustom wl-message-ignored-field-list nil
+  "All fields that match this list will be hidden in message buffer.
+Each elements are regexp of field-name."
+  :type '(repeat (string :tag "Field Regexp"))
+  :group 'wl-pref)
+
+(defcustom wl-message-visible-field-list nil
+  "All fields that match this list will be displayed in message buffer.
+Each elements are regexp of field-name."
+  :type '(repeat (string :tag "Field Regexp"))
+  :group 'wl-pref)
+
 (defcustom wl-folder-window-width 20
   "*Width of folder window."
   :type 'integer
@@ -1030,6 +1138,12 @@ Set this if (system-name) does not return FQDN."
   :group 'wl-draft
   :group 'wl-pref)
 
+(defcustom wl-draft-reply-use-address-with-full-name t
+  "*Use address with full-name in the draft of replied message."
+  :type 'boolean
+  :group 'wl-pref
+  :group 'wl-draft)
+
 (defcustom wl-folder-many-unsync-threshold 70
   "*Folders which contains messages more than this number are highlighted
 with wl-highlight-folder-many-face."
@@ -1088,12 +1202,13 @@ with wl-highlight-folder-many-face."
   "*Default field for pick."
   :type '(radio (const "From")
                (const "Subject")
-               (const "Date")
                (const "To")
                (const "Cc")
                (const "Body")
                (const "Since")
                (const "Before")
+               (const "Last")
+               (const "First")
                (string :tag "Other"))
   :group 'wl-summary)
 
@@ -1103,6 +1218,12 @@ with wl-highlight-folder-many-face."
   :group 'wl-summary
   :group 'wl-pref)
 
+(defcustom wl-subject-length-limit 35
+  "*Subject width in summary."
+  :type 'integer
+  :group 'wl-summary
+  :group 'wl-pref)
+
 (defcustom wl-mime-charset (if wl-on-nemacs
                               'iso-2022-jp
                             'x-ctext)
@@ -1211,8 +1332,9 @@ e.x.
   :group 'wl-pref)
 
 (defcustom wl-strict-diff-folders nil
-  "Folders in this list are checked its unsync message number strictly."
-  :type '(repeat (string :tag "Folder"))
+  "List of regexps matching folders of which Wanderlust seriously counts unsync messages."
+  :type '(choice (const :tag "Off" nil)
+                (repeat (regexp :tag "Folder Regexp")))
   :group 'wl-folder)
 
 (defcustom wl-folder-use-server-diff t
@@ -1252,6 +1374,61 @@ Each elements are regexp of folder name."
   :type '(repeat (regexp :tag "Folder Regexp"))
   :group 'wl-folder)
 
+(defcustom wl-show-plug-status-on-modeline t
+  "If it is non-nil, show plugged status in modeline."
+  :type 'boolean
+  :group 'wl-highlight)
+
+(defcustom wl-plug-state-indicator-on  " [ON] "
+  "String used to show plugged status ON."
+  :type 'string
+  :group 'wl-highlight)
+
+(defcustom wl-plug-state-indicator-off " [--] "
+  "String used to show plugged status OFF."
+  :type 'string
+  :group 'wl-highlight)
+
+(defcustom wl-biff-check-folder-list nil
+  "All folders that match this list are automatically checked
+every intervals specified by wl-biff-check-interval. "
+  :type '(repeat (regexp :tag "Folder Regexp"))
+  :group 'wl-highlight)
+
+(defcustom wl-biff-check-interval 40
+  "Number of seconds between updates of new mails in the mode line."
+  :type 'integer
+  :group 'wl-highlight)
+
+(defcustom wl-biff-state-indicator-on "[\e$B")\e(B]"
+  "String used to show biff status ON."
+  :type 'string
+  :group 'wl-highlight)
+
+(defcustom wl-biff-state-indicator-off "[\e$B!>\e(B]"
+  "String used to show biff status OFF."
+  :type 'string
+  :group 'wl-highlight)
+
+(defcustom wl-mode-line-display-priority-list '(biff plug title)
+  "Displaying order of items to be shown in modeline.  The first item will
+be placed in the leftmost.  The significant items are `biff' and `plug';
+otherwise, e.g. `title', corresponds to the things except for the biff
+staus nor the plugged status.  The default order is '(biff plug title)
+even if the value of this option is set to nil.  Here are some samples:
+
+;; Plugged status first:
+\(setq wl-mode-line-display-priority-list '(plug))
+
+;; Biff status, Title of Wanderlust, Plugged status:
+\(setq wl-mode-line-display-priority-list '(biff title plug))
+
+"
+  :type '(repeat (radio (const :format "%v " biff)
+                       (const :format "%v " plug)
+                       (sexp :tag "Other" :value title)))
+  :group 'wl-highlight)
+
 (defcustom wl-interactive-send nil
   "*If non-nil, require your confirmation when sending draft message."
   :type 'boolean
@@ -1330,7 +1507,9 @@ e.x.
 (defcustom wl-summary-always-sticky-folder-list nil
   "All folders that match this list has sticky summary.
 Each elements are regexp of folder name."
-  :type '(repeat (regexp :tag "Folder Regexp"))
+  :type '(radio (const :tag "none" nil)
+               (const :tag "all" t)
+               (repeat (regexp :tag "Folder Regexp")))
   :group 'wl-pref)
 
 (defcustom wl-no-save-folder-list '("^/.*$")
@@ -1345,11 +1524,6 @@ Each elements are regexp of folder name."
   :type '(repeat (regexp :tag "Folder Regexp"))
   :group 'wl-pref)
 
-(defcustom wl-search-mime-charset 'iso-2022-jp
-  "*MIME Charset for searching message."
-  :type 'symbol
-  :group 'wl-pref)
-
 (defcustom wl-folder-mime-charset-alist
   '(("^-alt\\.chinese" . big5)
     ("^-relcom\\." . koi8-r)
@@ -1403,8 +1577,7 @@ e.x.
   :group 'wl-pref)
 
 (defcustom wl-folder-sync-range-alist
-  (list (cons "^&.*$" "all")
-       (cons (concat "^" (regexp-quote wl-draft-folder) "$\\|^"
+  (list (cons (concat "^" (regexp-quote wl-draft-folder) "$\\|^"
                      (regexp-quote wl-queue-folder) "$")
              "all"))
   "*Default sync range alist. If no matches, `wl-default-sync-range' is used."
@@ -1594,6 +1767,20 @@ ex.
   :type 'boolean
   :group 'wl-folder)
 
+(defcustom wl-fldmgr-make-filter-default "Body"
+  "*Default filter key while making filter on Folder."
+  :type '(radio (const "From")
+               (const "Subject")
+               (const "To")
+               (const "Cc")
+               (const "Body")
+               (const "Since")
+               (const "Before")
+               (const "Last")
+               (const "First")
+               (string :tag "Other"))
+  :group 'wl-folder)
+
 ;;; For Expire and Archive
 
 (defcustom wl-expire-alist nil
@@ -1749,7 +1936,7 @@ list  : reserved specified permanent marks."
   "*If the summary is larger than this lines, don't highlight it."
   :type 'integer
   :group 'wl-highlight)
+
 ;; highilght about draft and message
 (defcustom wl-highlight-body-too t
   "*In addition to header, highlight the body too. if non nil."
@@ -1764,6 +1951,22 @@ list  : reserved specified permanent marks."
   :type '(repeat (cons regexp face))
   :group 'wl-highlight)
 
+(defcustom wl-highlight-message-header-button-alist
+  (` (("^\\(References\\|Message-Id\\|In-Reply-To\\):" "<[^>]+>"
+       0 wl-message-button-refer-article  0)
+      ("^[^:]+:" "\\(<\\(url: \\)?news:\\([^>\n ]*\\)>\\)"
+       1 wl-message-button-refer-article 3)))
+  "Alist of headers and regexps to match buttons in message headers."
+  :type '(repeat
+         (list (regexp :tag "Header")
+               regexp
+               (integer :tag "Button")
+               (function :tag "Callback")
+               (repeat :tag "Data"
+                       :inline t
+                       (integer :tag "Regexp group"))))
+  :group 'wl-highlight)
+
 (defcustom wl-highlight-citation-prefix-regexp
   "^[>|:} ]*[>|:}]\\([^ \n>]*>\\)?\\|^[^ <\n>]*>"
   "All lines that match this regexp will be highlighted with
@@ -1790,22 +1993,22 @@ the `wl-highlight-message-headers' face."
 
 (defcustom wl-highlight-citation-header-regexp
   (concat "In article.*$\\|In message.*$\\|In the message.*$\\|"
-         "^At[^\n]+\n[^\n]+wrote:\n\\|"
-         "^.*\\(writes\\|wrote\\|said\\):\n")
+         "^At[^\n]+\n[^\n]+wrote:\n\\|"
+         "^.*\\(writes\\|wrote\\|said\\):\n")
   "*The pattern to match the prolog of a cited block.
 Text in the body of a message which matches this will be displayed in
 the `wl-highlight-message-headers' face."
-   :type 'regexp
-   :group 'wl-highlight)
+  :type 'regexp
+  :group 'wl-highlight)
 
 (defcustom wl-highlight-max-message-size 10000
   "*If the message body is larger than this many chars, don't highlight it.
 This is to prevent us from wasting time trying to fontify things like
 uuencoded files and large digests.  If this is nil, all messages will
 be highlighted."
-    :type 'integer
-    :group 'wl-highlight)
-  
+  :type 'integer
+  :group 'wl-highlight)
+
 ;; highilght about signature (of draft and message)
 (defcustom wl-highlight-signature-separator
   '("\n--+\n" "\n\n--+.*\n*\\'")
@@ -1822,23 +2025,28 @@ This variable can also be a regex. "
   "*If the signature is larger than this chars, don't treat it as a signature."
   :type 'integer
   :group 'wl-highlight)
-  
+
 ;; highilght about mouse
-(defcustom wl-use-highlight-mouse-line (and wl-on-xemacs window-system)
+(defcustom wl-use-highlight-mouse-line (and window-system
+                                           (>= emacs-major-version 19))
   "*Highlight mouse line, if non nil."
   :type 'boolean
   :group 'wl-highlight)
+
 ;; highilght about folder
 (defcustom wl-highlight-folder-with-icon
-  (and (featurep 'xemacs)
-       (featurep 'xpm))
-  "*Highlight folder with icon(XEmacs)."
+  (or (and (featurep 'xemacs)
+          (featurep 'xpm))
+      wl-on-emacs21)
+  "*Highlight folder with icon(XEmacs or Emacs 21)."
   :type 'boolean
   :group 'wl-highlight)
-(defcustom wl-highlight-group-folder-by-numbers t
-  "*Highlight group folder by numbers."
-  :type 'boolean
+(defcustom wl-highlight-folder-by-numbers t
+  "Highlight folder lines by numbers.  If it is a number, only numbers
+will be highlighted."
+  :type '(choice (const :tag "whole line" t)
+                (const :tag "only numbers" 1)
+                (const :tag "don't highlight" nil))
   :group 'wl-highlight)
 
 (defcustom wl-highlight-signature-search-func 'wl-highlight-signature-search
@@ -1858,12 +2066,18 @@ This variable can also be a regex. "
   :group 'wl-pref)
 
 (defcustom wl-demo-display-logo (or (and (featurep 'xemacs)
-                                        (featurep 'xpm))
+                                        (if (featurep 'xpm)
+                                            'xpm 'xbm))
                                    (and (module-installed-p 'image)
-                                        (image-type-available-p 'xpm))
-                                   (module-installed-p 'bitmap))
-  "If non-nil, display image (or bitmap) logo in th Wanderlust opening demo."
-  :type 'boolean
+                                        (if (image-type-available-p 'xpm)
+                                            'xpm 'xbm))
+                                   (and (module-installed-p 'bitmap)
+                                        'xbm))
+  "If non-nil, show graphic logo in the startup screen.  You can set it to
+a symbol `xbm' to limit the image format to XBM even if XPM can be shown."
+  :type '(radio (const :tag "OFF" nil)
+               (const :tag "XBM (possibly BITMAP-MULE)" xbm)
+               (sexp :format "ON  (any format)" :value t))
   :group 'wl-pref)
 
 ;;; Internal variables
@@ -1874,11 +2088,13 @@ This variable can also be a regex. "
 (defvar wl-unplugged-hook nil)
 (defvar wl-plugged t)
 
-(defvar wl-plug-state-indicator-on  " [ON] ")
-(defvar wl-plug-state-indicator-off " [--] ")
-(defvar wl-plug-state-indicator wl-plug-state-indicator-on)
-
-(defvar wl-show-plug-status-on-modeline t)
+;; Internal variables used to modeline identifiers.
+(defvar wl-modeline-plug-status nil)
+(defvar wl-modeline-plug-state-on wl-plug-state-indicator-on)
+(defvar wl-modeline-plug-state-off wl-plug-state-indicator-off)
+(defvar wl-modeline-biff-status nil)
+(defvar wl-modeline-biff-state-on wl-biff-state-indicator-on)
+(defvar wl-modeline-biff-state-off wl-biff-state-indicator-off)
 
 ;; Advanced thread view.
 (defvar wl-thread-indent-level 1
@@ -1894,7 +2110,7 @@ This variable can also be a regex. "
 (defvar wl-thread-space-str                "\e$B!!\e(B"
   "*A string for thread branch line. It should contain one character.")
 
-(defvar wl-highlight-thread-indent-string-regexp "[^\\[]*"
+(defvar wl-highlight-thread-indent-string-regexp "[^[<]*"
   "* A regexp string for thread indent...for highlight.")
 
 ;; folder icons. filename relative to wl-icon-dir
@@ -1936,6 +2152,10 @@ This variable can also be a regex. "
   "*Icon file for plugged state.")
 (defvar wl-unplugged-icon "unplugged.xpm"
   "*Icon file for unplugged state.")
+(defvar wl-biff-mail-icon "letter.xpm"
+  "*Icon file for mail existed state.")
+(defvar wl-biff-nomail-icon "no-letter.xpm"
+  "*Icon file for no mail existed state.")
 (defvar wl-prog-uudecode "uudecode"
   "*uudecode program name")
 (defvar wl-prog-uudecode-arg '("-p") ;; outout is stdout.
@@ -1952,6 +2172,8 @@ This variable can also be a regex. "
 (make-obsolete-variable 'wl-draft-prepared-config-alist 'wl-draft-config-alist)
 (defvar wl-score-files-directory wl-score-files-dir)
 (make-obsolete-variable 'wl-score-files-directory 'wl-score-files-dir)
+(defvar wl-summary-temp-above wl-summary-target-above)
+(make-obsolete-variable 'wl-summary-temp-above 'wl-summary-target-above)
 
 ;; plug
 (defvar wl-plugged-plug-on "ON")
@@ -1961,6 +2183,7 @@ This variable can also be a regex. "
 (defvar wl-plugged-port-indent 4)
 (defvar wl-plugged-queue-status-column 25)
 
-(provide 'wl-vars)
+(require 'product)
+(product-provide (provide 'wl-vars) (require 'wl-version))
 
 ;;; wl-vars.el ends here
diff --git a/wl/wl-version.el b/wl/wl-version.el
new file mode 100644 (file)
index 0000000..911aeb1
--- /dev/null
@@ -0,0 +1,230 @@
+;;; wl-version.el -- Version information for Wanderlust.
+
+;; Copyright 2000 Yuuichi Teranishi <teranisi@gohome.org>
+
+;; Author: Yuuichi Teranishi <teranisi@gohome.org>
+;; Keywords: mail, net news
+
+;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
+
+;; 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 'product)
+(provide 'wl-version)
+
+(product-provide 'wl-version
+  (product-define
+   "Wanderlust" nil
+   (eval-when-compile
+     (require 'elmo-version)
+     (product-version (product-find 'elmo-version))) ; equals to ELMO version.
+   "Roam"))
+
+;; set version-string
+(if (fboundp 'product-version-as-string)
+    (product-version-as-string 'wl-version)
+  (product-string-1 'wl-version))
+
+;; require wl-util after product-provide.
+(eval-when-compile (require 'wl-util)) ; wl-match-string
+
+;; compile warning
+(defvar mule-version)
+(defvar nemacs-version)
+(defvar emacs-beta-version)
+(defvar xemacs-codename)
+(defvar mime-edit-insert-user-agent-field)
+(defvar mime-edit-user-agent-value)
+(defvar mime-editor/version)
+(defvar mime-editor/codename)
+
+(defun wl-version (&optional with-codename)
+  "Return Wanderlust version.  If WITH-CODENAME is non-nil, add codename."
+  (product-string-1 'wl-version with-codename))
+
+(defun wl-version-show (&optional arg)
+  "Print Wanderlust version.
+If ARG insert string at point."
+  (interactive "P")
+  (if arg
+      (insert (message "%s" (wl-version t)))
+    (message "%s" (wl-version t))))
+
+(defun wl-generate-user-agent-string ()
+  "A candidate of wl-generate-mailer-string-func.
+Insert User-Agent field instead of X-Mailer field."
+  (let ((mime-user-agent (and (boundp 'mime-edit-insert-user-agent-field)
+                             mime-edit-insert-user-agent-field
+                             mime-edit-user-agent-value)))
+    (if mime-user-agent
+       (concat "User-Agent: "
+               (product-string-verbose 'wl-version) " "
+               mime-user-agent)
+      (if (and (boundp 'mime-editor/version)
+              mime-editor/version)
+         (concat "User-Agent: "
+                 (product-string-verbose 'wl-version) " "
+                 "tm/" mime-editor/version
+                 (if (and (boundp 'mime-editor/codename)
+                          mime-editor/codename)
+                     (concat " (" mime-editor/codename ")"))
+                 (if (and (boundp 'mime-library-product)
+                          mime-library-product)
+                     (concat " " (aref mime-library-product 0)
+                             "/"
+                             (mapconcat 'int-to-string
+                                        (aref mime-library-product 1)
+                                        ".")
+                             " (" (aref mime-library-product 2) ")"))
+                 (condition-case nil
+                     (progn
+                       (require 'apel-ver)
+                       (concat " " (apel-version)))
+                   (file-error nil))
+                 " " (wl-extended-emacs-version3 "/" t))
+       ;; Don't use product-string-verbose for short User-Agent field.
+       (concat "User-Agent: " (product-string-1 'wl-version t) " "
+               (wl-extended-emacs-version3 "/" t))))))
+
+;; from gnus
+(defun wl-extended-emacs-version (&optional with-codename)
+  "Stringified Emacs version"
+  (interactive)
+  (cond
+   ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
+    (concat "Emacs " (wl-match-string 1 emacs-version)
+           (and (boundp 'mule-version)(concat "/Mule " mule-version))))
+   ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
+                 emacs-version)
+    (concat (wl-match-string 1 emacs-version)
+           (format " %d.%d" emacs-major-version emacs-minor-version)
+           (if (and (boundp 'emacs-beta-version)
+                    emacs-beta-version)
+               (format "b%d" emacs-beta-version))
+           (if with-codename
+               (if (boundp 'xemacs-codename)
+                   (concat " - \"" xemacs-codename "\"")))))
+   (t emacs-version)))
+
+(defun wl-extended-emacs-version2 (&optional delimiter with-codename)
+  "Stringified Emacs version"
+  (interactive)
+  (cond
+   ((and (boundp 'mule-version)
+        mule-version
+        (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
+    (format "Mule%s%s@%d.%d%s"
+           (or delimiter " ")
+           (wl-match-string 1 mule-version)
+           emacs-major-version
+           emacs-minor-version
+           (if with-codename
+               (wl-match-string 2 mule-version)
+             "")))
+   ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
+    (if (boundp 'nemacs-version)
+       (concat "Nemacs" (or delimiter " ")
+               nemacs-version
+               "@"
+               (substring emacs-version
+                          (match-beginning 1)
+                          (match-end 1)))
+      (concat "Emacs" (or delimiter " ")
+             (wl-match-string 1 emacs-version))))
+   ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
+                 emacs-version)
+    (concat (wl-match-string 1 emacs-version)
+           (or delimiter " ")
+           (format "%d.%d" emacs-major-version emacs-minor-version)
+           (if (and (boundp 'emacs-beta-version)
+                    emacs-beta-version)
+               (format "b%d" emacs-beta-version))
+           (if (and with-codename
+                    (boundp 'xemacs-codename)
+                    xemacs-codename)
+               (format " (%s)" xemacs-codename))))
+   (t emacs-version)))
+
+(defun wl-extended-emacs-version3 (&optional delimiter with-codename)
+  "Stringified Emacs version"
+  (interactive)
+  (cond
+   ((and (boundp 'mule-version)
+        mule-version
+        (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
+    (format "Emacs%s%d.%d Mule%s%s%s"
+           (or delimiter " ")
+           emacs-major-version
+           emacs-minor-version
+           (or delimiter " ")
+           (wl-match-string 1 mule-version)
+           (if with-codename
+               (wl-match-string 2 mule-version)
+             "")))
+   ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
+    (if (boundp 'nemacs-version)
+       (let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
+                                      ("3.3.1" . " (HINAMATSURI)")
+                                      ("3.2.3" . " (YUMENO-AWAYUKI)"))))
+         (format "Emacs%s%s Nemacs%s%s%s"
+                 (or delimiter " ")
+                 (wl-match-string 1 emacs-version)
+                 (or delimiter " ")
+                 nemacs-version
+                 (or (and with-codename
+                          (cdr (assoc nemacs-version
+                                      nemacs-codename-assoc)))
+                     "")))
+      (concat "Emacs" (or delimiter " ")
+             (wl-match-string 1 emacs-version))))
+   ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
+                 emacs-version)
+    (concat (wl-match-string 1 emacs-version)
+           (or delimiter " ")
+           (format "%d.%d" emacs-major-version emacs-minor-version)
+           (if (and (boundp 'emacs-beta-version)
+                    emacs-beta-version)
+               (format "b%d" emacs-beta-version))
+           (if (and with-codename
+                    (boundp 'xemacs-codename)
+                    xemacs-codename)
+               (format " (%s)" xemacs-codename))))
+   (t emacs-version)))
+
+
+;; for backward compatibility
+(defconst wl-appname (product-name (product-find 'wl-version)))
+(make-obsolete-variable
+ 'wl-appname
+ "use (product-name (product-find 'wl-version)) insteaed.")
+
+(defconst wl-version (product-version-string (product-find 'wl-version)))
+(make-obsolete-variable
+ 'wl-version
+ "use (product-version-string (product-find 'wl-version)) instead.")
+
+(defconst wl-codename (product-code-name (product-find 'wl-version)))
+(make-obsolete-variable
+ 'wl-codename
+ "use (product-code-name (product-find 'wl-version)) instead.")
+
+;; wl-version.el ends here
index c6bb705..51d037d 100644 (file)
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
 (eval-when-compile
   (require 'wl-folder)
   (require 'wl-draft)
   (require 'wl-message)
   (require 'wl-highlight)
-  (defvar-maybe wl-draft-mode-map (make-sparse-keymap)))
+  (defvar-maybe wl-draft-mode-map (make-sparse-keymap))
+  (defalias-maybe 'toolbar-make-button-list 'ignore))
 
-(defun wl-xmas-setup-toolbar (bar)
-  (let ((dir wl-icon-dir)
-       icon up down disabled name)
-    (when dir
-      (while bar
-       (setq icon (aref (car bar) 0)
-             name (symbol-name icon)
-             bar (cdr bar))
-       (when (not (boundp icon))
-         (setq up (concat dir elmo-path-sep name "-up.xpm"))
-         (setq down (concat dir elmo-path-sep name "-down.xpm"))
-         (setq disabled (concat dir elmo-path-sep name "-disabled.xpm"))
-         (if (not (file-exists-p up))
-             (setq bar nil
-                   dir nil)
-           (set icon (toolbar-make-button-list
-                      up (and (file-exists-p down) down)
-                      (and (file-exists-p disabled) disabled)))))))
-    dir))
+(add-hook 'wl-folder-mode-hook 'wl-setup-folder)
+(add-hook 'wl-folder-mode-hook 'wl-folder-init-icons)
+
+(add-hook 'wl-make-plugged-hook 'wl-biff-init-icons)
+(add-hook 'wl-make-plugged-hook 'wl-plugged-init-icons)
+
+(add-hook 'wl-summary-mode-hook 'wl-setup-summary)
 
 (defvar wl-use-toolbar (if (featurep 'toolbar) 'default-toolbar nil))
 (defvar wl-plugged-glyph nil)
 (defvar wl-unplugged-glyph nil)
+(defvar wl-biff-mail-glyph nil)
+(defvar wl-biff-nomail-glyph nil)
 
 (defvar wl-folder-toolbar
   '([wl-folder-jump-to-current-entity
@@ -70,8 +61,8 @@
      wl-folder-prev-entity t "Previous Folder"]
     [wl-folder-check-current-entity
      wl-folder-check-current-entity t "Check Current Folder"]
-;    [wl-draft
-;     wl-draft t "Write a New Message"]
+    ;;[wl-draft
+    ;; wl-draft t "Write a New Message"]
     [wl-folder-sync-current-entity
      wl-folder-sync-current-entity t "Sync Current Folder"]
     [wl-draft
     )
   "The Message buffer toolbar.")
 
-(defalias 'wl-draft-insert-signature 'insert-signature) ;; for draft toolbar.
+(defalias 'wl-draft-insert-signature 'insert-signature);; for draft toolbar.
 
 (defvar wl-draft-toolbar
   '([wl-draft-send-from-toolbar
     )
   "The Draft buffer toolbar.")
 
-(defun wl-xmas-setup-folder-toolbar ()
-  (and wl-use-toolbar
-       (wl-xmas-setup-toolbar wl-folder-toolbar)
-       (set-specifier (symbol-value wl-use-toolbar)
-                     (cons (current-buffer) wl-folder-toolbar))))
-
-(defun wl-xmas-setup-summary-toolbar ()
-  (and wl-use-toolbar
-       (wl-xmas-setup-toolbar wl-summary-toolbar)
-       (set-specifier (symbol-value wl-use-toolbar)
-                     (cons (current-buffer) wl-summary-toolbar))))
-
-(defun wl-xmas-setup-message-toolbar ()
-  (and wl-use-toolbar
-       (wl-xmas-setup-toolbar wl-message-toolbar)
-       (set-specifier (symbol-value wl-use-toolbar)
-                     (cons (current-buffer) wl-message-toolbar))))
-
-(defun wl-xmas-setup-draft-toolbar ()
-  (and wl-use-toolbar
-       (wl-xmas-setup-toolbar wl-draft-toolbar)
-       (set-specifier (symbol-value wl-use-toolbar)
-                     (cons (current-buffer) wl-draft-toolbar))))
-
-;; XEmacs implementations.
+(defun wl-xmas-setup-toolbar (bar)
+  (let ((dir wl-icon-dir)
+       icon up down disabled name)
+    (when dir
+      (while bar
+       (setq icon (aref (car bar) 0)
+             name (symbol-name icon)
+             bar (cdr bar))
+       (unless (boundp icon)
+         (setq up (expand-file-name (concat name "-up.xpm") dir)
+               down (expand-file-name (concat name "-down.xpm") dir)
+               disabled (expand-file-name (concat name "-disabled.xpm") dir))
+         (if (file-exists-p up)
+             (set icon (toolbar-make-button-list
+                        up (and (file-exists-p down) down)
+                        (and (file-exists-p disabled) disabled)))
+           (setq bar nil
+                 dir nil)))))
+    dir))
+
+(defun wl-xmas-make-icon-glyph (icon-string icon-file
+                                           &optional locale tag-set)
+  (let ((glyph (make-glyph (vector 'string :data icon-string))))
+    (when wl-highlight-folder-with-icon
+      (set-glyph-image glyph
+                      (vector 'xpm :file (expand-file-name
+                                          icon-file wl-icon-dir))
+                      locale tag-set 'prepend))
+    glyph))
+
+(eval-when-compile
+  (defsubst wl-xmas-setup-folder-toolbar ()
+    (and wl-use-toolbar
+        (wl-xmas-setup-toolbar wl-folder-toolbar)
+        (set-specifier (symbol-value wl-use-toolbar)
+                       (cons (current-buffer) wl-folder-toolbar))))
+
+  (defsubst wl-xmas-setup-summary-toolbar ()
+    (and wl-use-toolbar
+        (wl-xmas-setup-toolbar wl-summary-toolbar)
+        (set-specifier (symbol-value wl-use-toolbar)
+                       (cons (current-buffer) wl-summary-toolbar))))
+
+  (defsubst wl-xmas-setup-message-toolbar ()
+    (and wl-use-toolbar
+        (wl-xmas-setup-toolbar wl-message-toolbar)
+        (set-specifier (symbol-value wl-use-toolbar)
+                       (cons (current-buffer) wl-message-toolbar))))
+
+  (defsubst wl-xmas-setup-draft-toolbar ()
+    (and wl-use-toolbar
+        (wl-xmas-setup-toolbar wl-draft-toolbar)
+        (set-specifier (symbol-value wl-use-toolbar)
+                       (cons (current-buffer) wl-draft-toolbar)))))
+
+(defvar wl-folder-toggle-icon-list
+  '((wl-folder-opened-glyph       . wl-opened-group-folder-icon)
+    (wl-folder-closed-glyph       . wl-closed-group-folder-icon)))
+
+(eval-when-compile
+  (defsubst wl-xmas-highlight-folder-group-line (glyph text-face numbers)
+    (let ((start (match-beginning 1))
+         (end (match-end 1)))
+      (let (extent)
+       (while (and (setq extent (extent-at start nil nil extent 'at))
+                   (not (and (eq start (extent-start-position extent))
+                             (eq end (extent-end-position extent))
+                             (extent-end-glyph extent)))))
+       (unless extent
+         (setq extent (make-extent start end)))
+       (set-extent-properties extent `(end-open t start-closed t invisible t))
+       (set-extent-end-glyph
+        extent
+        (or (get glyph 'glyph)
+            (put glyph 'glyph
+                 (wl-xmas-make-icon-glyph
+                  (buffer-substring-no-properties start end)
+                  (symbol-value
+                   (cdr (assq glyph wl-folder-toggle-icon-list))))))))
+      (let ((inhibit-read-only t))
+       (when wl-use-highlight-mouse-line
+         (put-text-property start (point-at-eol) 'mouse-face 'highlight))
+       (setq start end
+             end (point-at-eol))
+       (if (and wl-highlight-folder-by-numbers
+                numbers (nth 0 numbers) (nth 1 numbers)
+                (re-search-forward "[0-9-]+/[0-9-]+/[0-9-]+" end t))
+           (let* ((unsync (nth 0 numbers))
+                  (unread (nth 1 numbers))
+                  (face (cond ((and unsync (zerop unsync))
+                               (if (and unread (zerop unread))
+                                   'wl-highlight-folder-zero-face
+                                 'wl-highlight-folder-unread-face))
+                              ((and unsync
+                                    (>= unsync
+                                        wl-folder-many-unsync-threshold))
+                               'wl-highlight-folder-many-face)
+                              (t
+                               'wl-highlight-folder-few-face))))
+             (if (numberp wl-highlight-folder-by-numbers)
+                 (progn
+                   (put-text-property start (match-beginning 0)
+                                      'face text-face)
+                   (put-text-property (match-beginning 0) (point) 'face face))
+               (put-text-property start end 'face face)))
+         (put-text-property start end 'face text-face))))))
+
 (defun wl-highlight-folder-current-line (&optional numbers)
   (interactive)
   (save-excursion
-    (let ((highlights (list "opened" "closed"))
-         (inhibit-read-only t)
-         (fld-name (wl-folder-get-folder-name-by-id
-                    (get-text-property (point) 'wl-folder-entity-id)))
-         fregexp fsymbol bol eol matched type extent num type glyph)
-      (setq eol (progn (end-of-line) (point))
-           bol (progn (beginning-of-line) (point)))
-      (when (and fld-name (looking-at "[ \t]+\\([^ \t]+\\)"))
-       (if (and (setq extent (extent-at (match-beginning 1) nil nil nil 'at))
-                (extent-begin-glyph extent))
-           (delete-extent extent))
-       (setq extent (make-extent (match-beginning 1) (match-beginning 1)))
-       (cond
-        ((string= fld-name wl-trash-folder) ;; set trash folder icon
-         (setq num (nth 2 numbers)) ;; number of messages
-         (set-extent-begin-glyph extent
-                                 (if (or (null num)
-                                         (eq num 0))
-                                     wl-folder-trash-empty-glyph
-                                   wl-folder-trash-glyph)))
-        ((string= fld-name wl-draft-folder) ;; set draft folder icon
-         (set-extent-begin-glyph extent wl-folder-draft-glyph))
-        ((string= fld-name wl-queue-folder)
-         (set-extent-begin-glyph extent wl-folder-queue-glyph))
-        ((and (setq type (elmo-folder-get-type fld-name))
-              (or numbers ;; XXX dirty...!!
-                  (not (assoc fld-name wl-folder-group-alist))))
-         ;; not group folder.
-         (set-extent-begin-glyph extent
-                                 (symbol-value
-                                  (intern (format "wl-folder-%s-glyph"
-                                                  type)))))))
-      (when (and numbers (nth 0 numbers) (nth 1 numbers))
-       (setq fsymbol
-             (let ((unsync (nth 0 numbers))
-                   (unread (nth 1 numbers)))
-               (cond ((and unsync (eq unsync 0))
-                      (if (and unread (> unread 0))
-                          'wl-highlight-folder-unread-face
-                        'wl-highlight-folder-zero-face))
-                     ((and unsync
-                           (>= unsync wl-folder-many-unsync-threshold))
-                      'wl-highlight-folder-many-face)
-                     (t
-                      'wl-highlight-folder-few-face))))
-       (put-text-property bol eol 'face nil)
-       (put-text-property bol eol 'face fsymbol)
-       (setq matched t))
-      (while highlights
-       (setq fregexp (symbol-value
-                      (intern (format "wl-highlight-folder-%s-regexp"
-                                      (car highlights)))))
-       (if (not wl-highlight-group-folder-by-numbers)
-           (setq fsymbol (intern (format "wl-highlight-folder-%s-face"
-                                         (car highlights)))))
-       (when (looking-at fregexp)
-         (setq extent (make-extent (match-beginning 1) (match-end 1))
-               glyph (intern (format "wl-folder-%s-glyph"
-                                     (car highlights))))
-         (if (null (symbol-value glyph))
-             (set glyph (wl-xmas-make-icon-glyph
-                         (extent-string extent)
-                         (symbol-value
-                          (cdr (assq glyph wl-folder-toggle-icon-list))))))
-         (setq glyph (symbol-value glyph))
-         (set-extent-property extent 'end-open t)
-         (set-extent-property extent 'start-closed t)
-         (set-extent-property extent 'invisible t)
-         (set-extent-end-glyph extent glyph)
-         (put-text-property bol eol 'face nil)
-         (put-text-property bol eol 'face fsymbol)
-         (setq matched t highlights nil))
-       (setq highlights (cdr highlights)))
-      (when (not matched)
-       (put-text-property bol eol 'face nil)
-       (if (looking-at (format "^[ ]*\\(%s\\|%s\\)"
-                               wl-folder-unsubscribe-mark
-                               wl-folder-removed-mark))
-           (put-text-property bol eol 'face
-                              'wl-highlight-folder-killed-face)
-         (put-text-property bol eol 'face
-                            'wl-highlight-folder-unknown-face)))
-      (if wl-use-highlight-mouse-line
-         (wl-highlight-folder-mouse-line))
-      (if (and (featurep 'dragdrop) wl-use-dnd)
-         (wl-dnd-set-drop-target bol eol)))))
+    (beginning-of-line)
+    (let (fld-name)
+      (cond
+       (;; opened folder group
+       (looking-at wl-highlight-folder-opened-regexp)
+       (wl-xmas-highlight-folder-group-line 'wl-folder-opened-glyph
+                                            'wl-highlight-folder-opened-face
+                                            numbers))
+       (;; closed folder group
+       (looking-at wl-highlight-folder-closed-regexp)
+       (wl-xmas-highlight-folder-group-line 'wl-folder-closed-glyph
+                                            'wl-highlight-folder-closed-face
+                                            numbers))
+       (;; basic folder
+       (and (setq fld-name (wl-folder-get-folder-name-by-id
+                            (get-text-property (point) 'wl-folder-entity-id)))
+            (looking-at "[ \t]+\\([^ \t]+\\)"))
+       (let ((start (match-beginning 1)))
+         (let (extent)
+           (while (and (setq extent (extent-at start nil nil extent 'at))
+                       (not (and (eq start (extent-start-position extent))
+                                 (eq start (extent-end-position extent))
+                                 (extent-begin-glyph extent)))))
+           (unless extent
+             (setq extent (make-extent start start)))
+           (let (type)
+             (set-extent-begin-glyph
+              extent
+              (cond
+               ((string= fld-name wl-trash-folder);; trash folder
+                (let ((num (nth 2 numbers)));; number of messages
+                  (get (if (or (not num) (zerop num))
+                           'wl-folder-trash-empty-glyph
+                         'wl-folder-trash-glyph)
+                       'glyph)))
+               ((string= fld-name wl-draft-folder);; draft folder
+                (get 'wl-folder-draft-glyph 'glyph))
+               ((string= fld-name wl-queue-folder);; queue folder
+                (get 'wl-folder-queue-glyph 'glyph))
+               (;; and one of many other folders
+                (setq type (elmo-folder-get-type fld-name))
+                (get (intern (format "wl-folder-%s-glyph" type)) 'glyph))))))
+         (let ((end (point-at-eol)))
+           (when wl-use-highlight-mouse-line
+             (put-text-property start end 'mouse-face 'highlight))
+           (let ((text-face
+                  (if (looking-at (format "^[ \t]*\\(%s\\|%s\\)"
+                                          wl-folder-unsubscribe-mark
+                                          wl-folder-removed-mark))
+                      'wl-highlight-folder-killed-face
+                    'wl-highlight-folder-unknown-face)))
+             (if (and wl-highlight-folder-by-numbers
+                      numbers (nth 0 numbers) (nth 1 numbers)
+                      (re-search-forward "[0-9-]+/[0-9-]+/[0-9-]+" end t))
+                 (let* ((unsync (nth 0 numbers))
+                        (unread (nth 1 numbers))
+                        (face (cond
+                               ((and unsync (zerop unsync))
+                                (if (and unread (zerop unread))
+                                    'wl-highlight-folder-zero-face
+                                  'wl-highlight-folder-unread-face))
+                               ((and unsync
+                                     (>= unsync
+                                         wl-folder-many-unsync-threshold))
+                                'wl-highlight-folder-many-face)
+                               (t
+                                'wl-highlight-folder-few-face))))
+                   (if (numberp wl-highlight-folder-by-numbers)
+                       (progn
+                         (put-text-property start (match-beginning 0)
+                                            'face text-face)
+                         (put-text-property (match-beginning 0)
+                                            (match-end 0)
+                                            'face face))
+                     ;; Remove previous face.
+                     (put-text-property start (match-end 0) 'face nil)
+                     (put-text-property start (match-end 0) 'face face)))
+               (put-text-property start end 'face text-face))))))))))
 
 (defun wl-highlight-plugged-current-line ()
   (interactive)
       (beginning-of-line)
       (when (looking-at "[ \t]*\\(\\[\\([^]]+\\)\\]\\)")
        (setq switch (elmo-match-buffer 2))
-       (if (and (setq extent (extent-at (match-end 1) nil nil nil 'at))
-                (extent-end-glyph extent))
-           (delete-extent extent))
+       (when (and (setq extent (extent-at (match-end 1) nil nil nil 'at))
+                  (extent-end-glyph extent))
+         (delete-extent extent))
        (setq extent (make-extent (match-beginning 1) (match-end 1)))
        (set-extent-property extent 'end-open t)
        (set-extent-property extent 'start-closed t)
        (len (length string))
        type)
     (if (string= folder wl-queue-folder)
-       (put-text-property 0 len 'begin-glyph wl-folder-queue-glyph string)
+       (put-text-property 0 len 'begin-glyph
+                          (get 'wl-folder-queue-glyph 'glyph)
+                          string)
       (if (setq type (elmo-folder-get-type folder))
          (put-text-property 0 len
                             'begin-glyph
-                            (symbol-value
-                             (intern (format "wl-folder-%s-glyph" type)))
+                            (get (intern (format "wl-folder-%s-glyph" type))
+                                 'glyph)
                             string)))
     string))
 
     (wl-folder-queue-glyph        . wl-queue-folder-icon)
     (wl-folder-trash-glyph        . wl-trash-folder-icon)))
 
-(defvar wl-folder-toggle-icon-list
-  '((wl-folder-opened-glyph       . wl-opened-group-folder-icon)
-    (wl-folder-closed-glyph       . wl-closed-group-folder-icon)))
-
-(defun wl-xmas-make-icon-glyph (icon-string icon-file &optional locale tag-set)
-  (let ((glyph (make-glyph (vector 'string :data icon-string))))
-    (if wl-highlight-folder-with-icon
-       (set-glyph-image glyph
-                        (vector 'xpm :file (expand-file-name
-                                            icon-file wl-icon-dir))
-                        locale tag-set 'prepend))
-    glyph))
-
 (defun wl-folder-init-icons ()
-  (mapcar
-   (lambda (x)
-     (if (null (symbol-value (car x)))
-        (set (car x) (wl-xmas-make-icon-glyph "" (symbol-value (cdr x))))))
-   wl-folder-internal-icon-list))
+  (dolist (icon wl-folder-internal-icon-list)
+    (unless (get (car icon) 'glyph)
+      (put (car icon) 'glyph
+          (wl-xmas-make-icon-glyph "" (symbol-value (cdr icon)))))))
 
 (defun wl-plugged-init-icons ()
-  (if (null wl-plugged-glyph)
-      (setq wl-plugged-glyph
-           (wl-xmas-make-icon-glyph
-            (concat "[" wl-plugged-plug-on "]")
-            wl-plugged-icon)))
-  (if (null wl-unplugged-glyph)
-      (setq wl-unplugged-glyph
-           (wl-xmas-make-icon-glyph
-            (concat "[" wl-plugged-plug-off "]")
-            wl-unplugged-icon))))
-
-(defun wl-make-modeline ()
-  "Make modeline for Wanderlust"
-  (wl-plugged-init-icons)
-  (let ((extent (make-extent nil nil))
-       (toggle-keymap (make-sparse-keymap)))
-    (define-key toggle-keymap 'button2 (make-modeline-command-wrapper
-                                       'wl-toggle-plugged))
-    (set-extent-keymap extent toggle-keymap)
-    (set-extent-property extent 'help-echo "button2 toggles plugged status")
-    (setq wl-plug-state-indicator-on (cons extent wl-plugged-glyph))
-    (setq wl-plug-state-indicator-off (cons extent wl-unplugged-glyph))
-    (setq wl-plug-state-indicator (if wl-plugged
-                                     wl-plug-state-indicator-on
-                                   wl-plug-state-indicator-off)))
-  (wl-make-modeline-subr))
+  (unless wl-plugged-glyph
+    (setq wl-plugged-glyph (wl-xmas-make-icon-glyph
+                           wl-plug-state-indicator-on wl-plugged-icon)
+         wl-unplugged-glyph (wl-xmas-make-icon-glyph
+                             wl-plug-state-indicator-off wl-unplugged-icon))
+    (let ((extent (make-extent nil nil)))
+      (let ((keymap (make-sparse-keymap)))
+       (define-key keymap 'button2
+         (make-modeline-command-wrapper 'wl-toggle-plugged))
+       (set-extent-keymap extent keymap)
+       (set-extent-property extent 'help-echo
+                            "button2 toggles plugged status"))
+      (setq wl-modeline-plug-state-on (cons extent wl-plugged-glyph)
+           wl-modeline-plug-state-off (cons extent wl-unplugged-glyph)))))
+
+(defun wl-biff-init-icons ()
+  (unless wl-biff-mail-glyph
+    (setq wl-biff-mail-glyph (wl-xmas-make-icon-glyph
+                             wl-biff-state-indicator-on
+                             wl-biff-mail-icon)
+         wl-biff-nomail-glyph (wl-xmas-make-icon-glyph
+                               wl-biff-state-indicator-off
+                               wl-biff-nomail-icon))
+    (let ((extent (make-extent nil nil)))
+      (let ((keymap (make-sparse-keymap)))
+       (define-key keymap 'button2
+         (make-modeline-command-wrapper 'wl-biff-check-folders))
+       (set-extent-keymap extent keymap)
+       (set-extent-property extent 'help-echo "button2 checks new mails"))
+      (setq wl-modeline-biff-state-on (cons extent wl-biff-mail-glyph)
+           wl-modeline-biff-state-off (cons extent wl-biff-nomail-glyph)))))
 
 (defun wl-make-date-string ()
   (let ((s (current-time-string)))
     (concat (wl-match-string 1 s) ", "
            (timezone-make-date-arpa-standard s (current-time-zone)))))
 
-
-(defun wl-xmas-setup-folder ()
+(defun wl-setup-folder ()
   (and (featurep 'scrollbar)
        (set-specifier scrollbar-height (cons (current-buffer) 0)))
   (wl-xmas-setup-folder-toolbar))
 
-(defun wl-xmas-setup-summary ()
+(defvar dragdrop-drop-functions)
+
+(defun wl-setup-summary ()
   (make-local-variable 'dragdrop-drop-functions)
   (setq dragdrop-drop-functions '((wl-dnd-default-drop-message t t)))
   (and (featurep 'scrollbar)
   (local-set-key 'button4 'wl-message-wheel-down)
   (local-set-key 'button5 'wl-message-wheel-up)
   (local-set-key [(shift button4)] 'wl-message-wheel-down)
-  (local-set-key [(shift button5)] 'wl-message-wheel-up))
+  (local-set-key [(shift button5)] 'wl-message-wheel-up)
+  (set-keymap-parent wl-message-button-map (current-local-map))
+  (define-key wl-message-button-map 'button2
+    'wl-message-button-dispatcher))
 
 (defun wl-message-wheel-up (event)
   (interactive "e")
       (select-window (event-window event))
       (set-buffer cur-buf)
       (setq proceed (wl-message-next-page)))
-    (if proceed
-       (if (memq 'shift (event-modifiers event))
-           (wl-summary-down t)
-         (wl-summary-next t)))))
+    (when proceed
+      (if (memq 'shift (event-modifiers event))
+         (wl-summary-down t)
+       (wl-summary-next t)))))
 
 (defun wl-message-wheel-down (event)
   (interactive "e")
       (select-window (event-window event))
       (set-buffer cur-buf)
       (setq proceed (wl-message-prev-page)))
-    (if proceed
-       (if (memq 'shift (event-modifiers event))
-           (wl-summary-up t)
-         (wl-summary-prev t)))))
+    (when proceed
+      (if (memq 'shift (event-modifiers event))
+         (wl-summary-up t)
+       (wl-summary-prev t)))))
 
 (defun wl-draft-overload-menubar ()
-  (add-menu-item '("Mail") "Send, Keep Editing"
-                'wl-draft-send t "Send Mail")
-  (add-menu-item '("Mail") "Send Message"
-                'wl-draft-send-and-exit t "Send and Exit")
-  (delete-menu-item '("Mail" "Send Mail"))
-  (delete-menu-item '("Mail" "Send and Exit"))
-  )
+  (when (featurep 'menubar)
+    (add-menu-item '("Mail") "Send, Keep Editing"
+                  'wl-draft-send t "Send Mail")
+    (add-menu-item '("Mail") "Send Message"
+                  'wl-draft-send-and-exit t "Send and Exit")
+    (delete-menu-item '("Mail" "Send Mail"))
+    (delete-menu-item '("Mail" "Send and Exit"))))
 
 (defun wl-draft-mode-setup ()
   (require 'derived)
@@ -447,16 +509,14 @@ Special commands:
   (define-key wl-draft-mode-map "\C-xk"    'wl-draft-mimic-kill-buffer))
 
 (defun wl-draft-overload-functions ()
-  (setq mode-line-buffer-identification
-       (format "Wanderlust: %s" (buffer-name)))
-  (local-set-key "\C-c\C-s" 'wl-draft-send) ; override
+  (wl-mode-line-buffer-identification)
+  (local-set-key "\C-c\C-s" 'wl-draft-send);; override
   (wl-xmas-setup-draft-toolbar)
-  (wl-draft-overload-menubar)
-  (when wl-show-plug-status-on-modeline
-    (setq mode-line-format (wl-make-modeline))))
+  (wl-draft-overload-menubar))
 
 (defalias 'wl-defface 'defface)
 
-(provide 'wl-xmas)
+(require 'product)
+(product-provide (provide 'wl-xmas) (require 'wl-version))
 
 ;;; wl-xmas.el ends here
index 319e52f..1a3566b 100644 (file)
--- a/wl/wl.el
+++ b/wl/wl.el
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
 (require 'elmo2)
 ;; from x-face.el
 
 (require 'wl-vars)
 (require 'wl-util)
+(require 'wl-version)
 
-(if wl-on-xemacs
-    (require 'wl-xmas)
-  (if wl-on-nemacs
-      (require 'wl-nemacs)
-    (require 'wl-mule)))
+(cond (wl-on-xemacs
+       (require 'wl-xmas))
+      (wl-on-emacs21
+       (require 'wl-e21))
+      (wl-on-nemacs
+       (require 'wl-nemacs))
+      (t
+       (require 'wl-mule)))
 
 (provide 'wl) ; circular dependency
 (require 'wl-folder)
   (when make-alist
     (wl-make-plugged-alist))
   ;; Plug status.
-  (setq elmo-plugged (setq wl-plugged (elmo-plugged-p)))
-  (setq wl-plug-state-indicator
-       (if wl-plugged
-           wl-plug-state-indicator-on
-         wl-plug-state-indicator-off))
+  (setq elmo-plugged (setq wl-plugged (elmo-plugged-p))
+       wl-modeline-plug-status wl-plugged)
   (if wl-plugged
-      (wl-toggle-plugged t 'flush))
-  (force-mode-line-update t))
+      (wl-toggle-plugged t 'flush)))
 
 (defun wl-toggle-plugged (&optional arg queue-flush-only)
   (interactive)
       (setq wl-plugged nil))
      (t (setq wl-plugged (null wl-plugged))))
     (elmo-set-plugged wl-plugged))
-  (setq elmo-plugged wl-plugged)
+  (setq elmo-plugged wl-plugged
+       wl-modeline-plug-status wl-plugged)
   (save-excursion
-    (mapcar
-     (function
-      (lambda (x)
-       (set-buffer x)
+    (let ((summaries (wl-collect-summary)))
+      (while summaries
+       (set-buffer (pop summaries))
        (wl-summary-msgdb-save)
        ;; msgdb is saved, but cache is not saved yet.
-       (wl-summary-set-message-modified)))
-     (wl-collect-summary)))
+       (wl-summary-set-message-modified))))
+  (setq wl-biff-check-folders-running nil)
   (if wl-plugged
       (progn
        ;; flush queue!!
-       (setq wl-plug-state-indicator wl-plug-state-indicator-on)
        (elmo-dop-queue-flush)
        (if (and wl-draft-enable-queuing
                 wl-auto-flush-queue)
                  (wl-summary-flush-pending-append-operations seen-list))
            (elmo-msgdb-seen-save msgdb-dir seen-list)))
        (run-hooks 'wl-plugged-hook))
-    (setq wl-plug-state-indicator wl-plug-state-indicator-off)
     (run-hooks 'wl-unplugged-hook))
   (force-mode-line-update t))
 
   '(("Queuing" . wl-draft-enable-queuing)
     ("AutoFlushQueue" . wl-auto-flush-queue)
     ("DisconnectedOperation" . elmo-enable-disconnected-operation)))
+
 (defvar wl-plugged-buf-name "Plugged")
 (defvar wl-plugged-mode-map nil)
 (defvar wl-plugged-alist nil)
 (defvar wl-plugged-dop-queue-alist nil)
 (defvar wl-plugged-alist-modified nil)
 
-(defvar wl-plugged-glyph nil)
-(defvar wl-unplugged-glyph nil)
-
 (defvar wl-plugged-mode-menu-spec
   '("Plugged"
     ["Toggle plugged" wl-plugged-toggle t]
@@ -209,8 +204,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
   (setq major-mode 'wl-plugged-mode)
   (setq mode-name "Plugged")
   (easy-menu-add wl-plugged-mode-menu)
-  (when wl-show-plug-status-on-modeline
-    (setq mode-line-format (wl-make-modeline)))
+  (wl-mode-line-buffer-identification)
   (setq wl-plugged-switch wl-plugged)
   (setq wl-plugged-alist-modified nil)
   (setq buffer-read-only t)
@@ -514,13 +508,10 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
            (elmo-set-plugged plugged nil nil nil alist)))
          ;; redraw
          (wl-plugged-redrawing wl-plugged-alist)
-         ;; change wl-plug-state-indicator
+         ;; show plugged status in modeline
          (let ((elmo-plugged wl-plugged-switch))
-           (setq wl-plugged-switch (elmo-plugged-p))
-           (setq wl-plug-state-indicator
-                 (if wl-plugged-switch
-                     wl-plug-state-indicator-on
-                   wl-plug-state-indicator-off))
+           (setq wl-plugged-switch (elmo-plugged-p)
+                 wl-modeline-plug-status wl-plugged-switch)
            (force-mode-line-update t))))))
     (setq wl-plugged-alist-modified t)
     (goto-char cur-point)))
@@ -538,11 +529,8 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
     (wl-plugged-redrawing wl-plugged-alist)
     (goto-char cur-point)
     (setq wl-plugged-alist-modified t)
-    ;; change wl-plug-state-indicator
-    (setq wl-plug-state-indicator
-         (if wl-plugged-switch
-             wl-plug-state-indicator-on
-           wl-plug-state-indicator-off))
+    ;; show plugged status in modeline
+    (setq wl-modeline-plug-status wl-plugged-switch)
     (force-mode-line-update t)))
 
 (defun wl-plugged-exit ()
@@ -617,20 +605,15 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
   (let (summary-buf)
     (save-excursion
       (let ((summaries (wl-collect-summary)))
-       (mapcar
-        (function
-         (lambda (x)
-           (set-buffer x)
-           (unless keep-summary
-             (wl-summary-cleanup-temp-marks))
-           (wl-summary-save-status keep-summary)
-           (unless keep-summary
-             (kill-buffer x))))
-        summaries))))
-  (wl-refile-alist-save
-   wl-refile-alist-file-name wl-refile-alist)
-  (wl-refile-alist-save
-   wl-refile-msgid-alist-file-name wl-refile-msgid-alist)
+       (while summaries
+         (set-buffer (car summaries))
+         (unless keep-summary
+           (wl-summary-cleanup-temp-marks))
+         (wl-summary-save-status keep-summary)
+         (unless keep-summary
+           (kill-buffer (car summaries)))
+         (setq summaries (cdr summaries))))))
+  (wl-refile-alist-save)
   (wl-folder-info-save)
   (and (featurep 'wl-fldmgr) (wl-fldmgr-exit))
   (wl-crosspost-alist-save)
@@ -641,6 +624,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
   (when (or (not wl-interactive-exit)
            (y-or-n-p "Quit Wanderlust?"))
     (elmo-quit)
+    (wl-biff-stop)
     (run-hooks 'wl-exit-hook)
     (wl-save-status)
     (wl-folder-cleanup-variables)
@@ -651,7 +635,8 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
                        (list (format "%s\\(:.*\\)?"
                                      (default-value 'wl-message-buf-name))
                              wl-original-buf-name
-                             wl-folder-buffer-name)
+                             wl-folder-buffer-name
+                             wl-plugged-buf-name)
                        "\\|")))
     (elmo-buffer-cache-clean-up)
     (if (fboundp 'mmelmo-cleanup-entity-buffers)
@@ -711,10 +696,16 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
     (error "Please set `wl-from'"))
   (unless (string-match "[^.]\\.[^.]" (or wl-message-id-domain
                                          (if wl-local-domain
-                                             (concat (system-name)
+                                             (concat (system-name)
                                                      "." wl-local-domain)
-                                           (system-name))))
+                                           (system-name))))
     (error "Please set `wl-local-domain' to get valid FQDN"))
+  (if (string-match "@" (or wl-message-id-domain
+                           (if wl-local-domain
+                               (concat (system-name)
+                                       "." wl-local-domain)
+                             (system-name))))
+      (error "Please remove `@' from `wl-message-id-domain'"))
   (when (not no-check-folder)
     (if (not (eq (elmo-folder-get-type wl-draft-folder) 'localdir))
        (error "%s is not allowed for draft folder" wl-draft-folder))
@@ -751,13 +742,18 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
   "Start Wanderlust -- Yet Another Message Interface On Emacsen.
 If prefix argument is specified, folder checkings are skipped."
   (interactive "P")
-  (unless wl-init
-    (wl-load-profile))
+  (or wl-init (wl-load-profile))
   (unwind-protect
       (wl-init arg)
-    (let ((make (wl-folder arg)))
-      (wl-plugged-init make)))
-  (run-hooks 'wl-hook))
+    (wl-plugged-init (wl-folder arg))
+    (sit-for 0))
+  (unwind-protect
+      (unless arg 
+       (run-hooks 'wl-auto-check-folder-pre-hook)
+       (wl-folder-auto-check)
+       (run-hooks 'wl-auto-check-folder-hook))
+    (unless arg (wl-biff-start))
+    (run-hooks 'wl-hook)))
 
 ;; Define some autoload functions WL might use.
 (eval-and-compile
@@ -806,7 +802,8 @@ If prefix argument is specified, folder checkings are skipped."
 
 ;; for backward compatibility
 (defalias 'wl-summary-from-func-petname 'wl-summary-default-from)
-(provide 'wl)
+
+(require 'product)
+(product-provide (provide 'wl) (require 'wl-version))
 
 ;;; wl.el ends here