From d9e613d8c4841bd56a057163810d8b77487bf8a9 Mon Sep 17 00:00:00 2001 From: teranisi Date: Sun, 6 Feb 2005 09:28:18 +0000 Subject: [PATCH] Synch up with main trunk. --- ChangeLog | 10 ++ Makefile | 27 +++++ WL-MK | 9 ++ doc/version.tex | 2 +- doc/version.texi | 2 +- doc/wl-ja.texi | 62 +++++++----- doc/wl.texi | 68 +++++++------ elmo/ChangeLog | 185 +++++++++++++++++++++++++++++++++++ elmo/elmo-archive.el | 2 + elmo/elmo-cache.el | 11 ++- elmo/elmo-dop.el | 3 +- elmo/elmo-file.el | 2 + elmo/elmo-filter.el | 22 +++-- elmo/elmo-flag.el | 28 ++++-- elmo/elmo-imap4.el | 90 ++++++++--------- elmo/elmo-maildir.el | 5 +- elmo/elmo-mime.el | 208 ++++++++++++++++++++------------------- elmo/elmo-multi.el | 27 +++-- elmo/elmo-net.el | 37 +++++-- elmo/elmo-nmz.el | 2 + elmo/elmo-nntp.el | 8 +- elmo/elmo-pipe.el | 28 ++++-- elmo/elmo-sendlog.el | 11 ++- elmo/elmo-shimbun.el | 16 +-- elmo/elmo-spam.el | 5 +- elmo/elmo-split.el | 2 +- elmo/elmo-util.el | 82 ++-------------- elmo/elmo-version.el | 2 +- elmo/elmo.el | 247 ++++++++++++++++++++++------------------------ elmo/mmimap.el | 2 +- wl/ChangeLog | 150 ++++++++++++++++++++++++++++ wl/wl-action.el | 15 ++- wl/wl-draft.el | 19 ++-- wl/wl-fldmgr.el | 2 +- wl/wl-folder.el | 4 +- wl/wl-message.el | 146 +++++++++++++-------------- wl/wl-mime.el | 177 ++++++++++++++++++++------------- wl/wl-news.el.in | 25 ++--- wl/wl-summary.el | 265 ++++++++++++++++++++++++++++++-------------------- wl/wl-thread.el | 28 ++---- wl/wl-util.el | 80 +++++++++++++-- wl/wl-vars.el | 29 ++++-- wl/wl-version.el | 2 +- 43 files changed, 1357 insertions(+), 790 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f3cf38..ba8ff5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-01-23 Hiroya Murata + + * Makefile (compile-strict): New target. + + * WL-MK (wl-examine-modules): New function. + +2005-01-01 TAKAHASHI Kaoru + + * README, README.ja: Update stable branch. + 2004-12-24 Yuuichi Teranishi * 2.12.0 - "Your Wildest Dreams" diff --git a/Makefile b/Makefile index 309b404..e2fd851 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,33 @@ update-version: $(EMACS) $(FLAGS) -l WL-MK -f update-version \ $(LISPDIR) $(PIXMAPDIR) +compile-strict: clean-elc + @args="$(FLAGS)";\ + args="$$args -L elmo -L wl";\ + echo "=============================================";\ + echo "Compiling the 1st stage-----without elc files";\ + echo "=============================================";\ + for i in `$(EMACS) $(FLAGS) -l WL-MK -f wl-examine-modules 2>/dev/null`;\ + do\ + j=`echo $$i| sed 's/elc$$/el/g'`;\ + echo "$(EMACS) ARGS -f batch-byte-compile $$j";\ + $(EMACS) $$args -f batch-byte-compile $$j;\ + mv $$i $$j"x";\ + done;\ + for i in `echo elmo/*.elx wl/*.elx utils/*.elx`; do\ + j=`echo $$i| sed 's/elx$$/elc/g'`;\ + mv $$i $$j;\ + done;\ + echo "==============================================";\ + echo "Compiling the 2nd stage-----with all elc files";\ + echo "==============================================";\ + for i in `$(EMACS) $(FLAGS) -l WL-MK -f wl-examine-modules 2>/dev/null`;\ + do\ + j=`echo $$i| sed 's/elc$$/el/g'`;\ + echo "$(EMACS) ARGS -f batch-byte-compile $$j";\ + $(EMACS) $$args -f batch-byte-compile $$j;\ + done + install-elc: $(EMACS) $(FLAGS) -l WL-MK -f install-wl-package \ $(LISPDIR) $(PIXMAPDIR) diff --git a/WL-MK b/WL-MK index 19c9c38..c2befaf 100644 --- a/WL-MK +++ b/WL-MK @@ -234,6 +234,15 @@ objs)) +(defun wl-examine-modules () + "Examine wl modules should be byte-compile'd." + (config-wl-package-subr) + (make-wl-news) + (dolist (module modules-alist) + (dolist (filename (cdr module)) + (princ (format "%s/%s.elc " (car module) filename))))) + + (defun compile-wl-package () (config-wl-package) (make-wl-news) diff --git a/doc/version.tex b/doc/version.tex index 92a3423..5c3c620 100644 --- a/doc/version.tex +++ b/doc/version.tex @@ -1 +1 @@ -\def\versionnumber{2.12.0} +\def\versionnumber{2.12.1} diff --git a/doc/version.texi b/doc/version.texi index 13d67f1..8a5d583 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1 +1 @@ -@set VERSION 2.12.0 +@set VERSION 2.12.1 diff --git a/doc/wl-ja.texi b/doc/wl-ja.texi index c95d460..6af906b 100644 --- a/doc/wl-ja.texi +++ b/doc/wl-ja.texi @@ -696,7 +696,7 @@ Wanderlust $B$O(B ELMO $B$N%$%s%?%U%'!<%9$rMxMQ$7$F$$$k$?$a!"(BELMO $B%b%8% $B%P!<%8%g%s(B @value{VERSION} $B8=:_!"MQ0U$5$l$F$$$k%U%)%k%@$O!"(BIMAP, NNTP, LocalDir(MH), Maildir, News Spool, Archive, POP, Shimbun, Namazu, Multi, -Filter, Pipe, Internal, File $B$N(B 14 $B$r;XDj$7$^$9!#(B -@node File Folder, , Internal Folder, Folders +@node File Folder, Access Folder, Internal Folder, Folders @section $B%U%!%$%k%U%)%k%@(B @cindex File Folder @@ -1795,6 +1796,29 @@ file:/etc -> @file{/etc} @end example +@node Access Folder, , File Folder, Folders +@section $B%"%/%;%9%U%)%k%@(B +@cindex Access Folder + +$B;XDj$5$l$?%U%)%k%@$NG[2<$N%5%V%U%)%k%@$r2>A[E*$K0l$D$N%U%)%k%@$H$7$F07$((B +$B$k$h$&$K$9$k%U%)%k%@$G$9!#%5%V%U%)%k%@$NA}8:$O<+F0E*$KH?1G$5$l$^$9!#(B + +$B=q<0(B: + +@example +@samp{access:} @var{$B%k!<%H%U%)%k%@(B} +@end example + +$BNc(B: + +@example +@group +access:%INBOX -> %INBOX $B0J2<$N(B IMAP $B$N%a!<%k%\%C%/%9$NA4$F(B +access:'cache -> $BA4$F$N(B 'cache $B%U%)%k%@(B +@end group +@end example + + @node Folder, Summary, Folders, Top @chapter $B%U%)%k%@%b!<%I(B @cindex Folder @@ -2819,22 +2843,12 @@ prefix argument $B$D$-$G(B @kbd{/} $B$r2!$9$H!"A4$F$N;R%9%l%C%I$r3+$-$^$9!#( @table @code @item wl-message-buffer-prefetch-folder-type-list @vindex wl-message-buffer-prefetch-folder-type-list -$B=i4|@_Dj$O(B @code{t}$B!#$3$N>l9g!"A4$F$N%U%)%k%@$G@hFI$_5!G=$,M-8z$K$J$j$^(B -$B$9!#FCDj$N%U%)%k%@l9g$K$@$1@hFI$_5!G=$rM-8z$K$7$?$$>l9g$K$O!"%U%)(B -$B%k%@l9g(B) - -@lisp -@group -(setq wl-message-buffer-prefetch-folder-type-list - '(nntp imap4)) -@end group -@end lisp - -$B$3$N>l9g!"$b$7(B localdir $B$H(B IMAP $B%U%)%k%@$,:.:_$7$?%^%k%A%U%)%k%@$G$O(B -IMAP $B$N%a%C%;!<%8$@$1$,@hFI$_$NBP>]$H$J$j$^$9!#$3$NJQ?t$O(B -@code{wl-message-buffer-prefetch-folder-list} $B$h$j$bM%@h$5$l$^$9!#(B +$B=i4|@_Dj$O(B @code{'(imap4 nntp)}$B!#@hFI$_5!G=$rM-8z$K$7$?$$%U%)%k%@%?%$%W(B +$B$N%7%s%\%k%j%9%H$r;XDj$7$^$9!#=i4|@_Dj$G$O!"(BIMAP4 $B$H(BNNTP $B%U%)%k%@$G@hFI(B +$B$_5!G=$,M-8z$K$J$j$^$9!#$b$7(B localdir $B$H(B IMAP $B%U%)%k%@$,:.:_$7$?%^%k%A%U%)(B +$B%k%@$G$O(B IMAP $B$N%a%C%;!<%8$@$1$,@hFI$_$NBP>]$H$J$j$^$9!#$3$NJQ?t$O(B +@code{wl-message-buffer-prefetch-folder-list} $B$h$j$bM%@h$5$l$^$9!#$9$Y$F(B +$B$N%U%)%k%@$G@hFI$_5!G=$rM-8z$K$7$?$$>l9g$K$O!"(Bt $B$r;XDj$7$^$9!#(B @item wl-message-buffer-prefetch-folder-list @vindex wl-message-buffer-prefetch-folder-list @@ -2843,11 +2857,11 @@ IMAP $B$N%a%C%;!<%8$@$1$,@hFI$_$NBP>]$H$J$j$^$9!#$3$NJQ?t$O(B @item wl-message-buffer-prefetch-depth @vindex wl-message-buffer-prefetch-depth -$B=i4|@_Dj$O(B 3$B!#@hFI$_5!G=$9$k%a%C%;!<%8$N?t!#(B +$B=i4|@_Dj$O(B 1$B!#@hFI$_5!G=$9$k%a%C%;!<%8$N?t!#(B @item wl-message-buffer-prefetch-idle-time @vindex wl-message-buffer-prefetch-idle-time -$B=i4|@_Dj$O(B 0.2 ($BC10L(B:$BIC(B)$B!#@hFI$_5!G=$9$k;~4V4V3V!#(B +$B=i4|@_Dj$O(B 1 ($BC10L(B:$BIC(B)$B!#@hFI$_5!G=$9$k;~4V4V3V!#(B @item wl-message-buffer-prefetch-threshold @vindex wl-message-buffer-prefetch-threshold @@ -4072,12 +4086,6 @@ Non-nil $B$J$i%5%^%j$N(B From $BItJ,$K$"$@L>$rI=<($7$^$9!#(B $B=i4|@_Dj$O(B @code{t}$B!#(B Non-nil $B$J$i!"(B@samp{^L} $B$G2~%Z!<%8$7$F%a%C%;!<%8$rI=<($7$^$9!#(B -@item wl-message-window-size -@vindex wl-message-window-size -$B=i4|@_Dj$O(B '(1 . 4)$B!#(B -$B%5%^%j$rI=<($9$k%&%#%s%I%&$H%a%C%;!<%8K\BN$rI=<($9$k%&%#%s%I%&$NHf$r(B -cons $B$G;XDj$7$^$9!#(Bcar:cdr $B$,(B $B%5%^%j(B:$B%a%C%;!<%8(B $B$G$9!#(B - @item wl-summary-from-function @vindex wl-summary-from-function $B%5%^%j$N:9=P?MI=<($N@07A$K;H$&4X?t$r;XDj$7$^$9!#(B @@ -7340,7 +7348,7 @@ spam $B%a!<%k$G$"$k$3$H$r<($9%X%C%@$N@55,I=8=$r;XDj$7$^$9!#(B @end table -@node Regular Expressions Header Matching, , SpamAssassin, Spam Filter Processors +@node Regular Expressions Header Matching, , SpamOracle, Spam Filter Processors @subsection Regular Expressions Header Matching @cindex Regular Expressions Header Matching diff --git a/doc/wl.texi b/doc/wl.texi index e0ccad5..5db681c 100644 --- a/doc/wl.texi +++ b/doc/wl.texi @@ -671,9 +671,10 @@ This chapter describes the folder types which Wanderlust is able to handle. Wanderlust uses ELMO as it's interface, so you can use every folder types supported by ELMO. -As of version @value{VERSION}, 14 types of folders are predefined. These +As of version @value{VERSION}, 15 types of folders are predefined. These are IMAP, NNTP, LocalDir(MH), Maildir, News Spool, Archive, POP, -Shimbun, Namazu, Multi, Filter, Pipe, Internal and File folder types. +Shimbun, Namazu, Multi, Filter, Pipe, File, Access and Internal folder +types. @menu * IMAP Folder:: @samp{%} -- IMAP folder @@ -690,6 +691,7 @@ Shimbun, Namazu, Multi, Filter, Pipe, Internal and File folder types. * Pipe Folder:: @samp{|} -- Pipe folder * Internal Folder:: @samp{'} -- Internal folder * File Folder:: -- File folder +* Access Folder:: -- Access folder @end menu @@ -1747,7 +1749,7 @@ the name of the subdirectories of the cache directory (@file{~/.elmo/cache}). -@node File Folder, , Internal Folder, Folders +@node File Folder, Access Folder, Internal Folder, Folders @section File folder @cindex File Folder @@ -1770,6 +1772,31 @@ file:/etc -> @file{/etc} @end example +@node Access Folder, , File Folder, Folders +@section Access folder +@cindex Access Folder + +A folder to access virtual folder which collects messages from a root +folder and subfolders of one. The add and remove of the subfolder is +automatically reflected. + + +Format: + +@example +@samp{access:} @var{root-folder} +@end example + +Example: + +@example +@group +access:%INBOX -> All subfolders of IMAP mailbox "inbox". +access:'cache -> All of 'cache folder +@end group +@end example + + @node Folder, Summary, Folders, Top @chapter Folder mode @cindex Folder @@ -2816,22 +2843,13 @@ variables. @table @code @item wl-message-buffer-prefetch-folder-type-list @vindex wl-message-buffer-prefetch-folder-type-list -The initial setting is @code{t}. In this case, prefetch messages in all -folders. -If it is a list of folder types, it specifies the folder types in which -message prefetching is enabled. -Following is an example (prefetch messages in nntp and imap4 folders) - -@lisp -@group -(setq wl-message-buffer-prefetch-folder-type-list - '(nntp imap4)) -@end group -@end lisp - -In this case, multi folder that contains localdir and imap4 prefetches -only imap4 messages. This variable precedes the value of +The initial setting is @code{'(imap4 nntp)}. If it is a list of folder +types, it specifies the folder types in which message prefetching is +enabled. In initial setting, messages are prefetch only in the nntp and +imap4 folders. In this case, multi folder that contains localdir and +imap4 prefetches only imap4 messages. This variable precedes the value of @code{wl-message-buffer-prefetch-folder-list}. +To prefetch messages in all folder types, specify @code{t}. @item wl-message-buffer-prefetch-folder-list @vindex wl-message-buffer-prefetch-folder-list @@ -2840,11 +2858,11 @@ A list of regexp of folders to enable message prefetching. @item wl-message-buffer-prefetch-depth @vindex wl-message-buffer-prefetch-depth -The initial setting is 3. The number of messages for automatical prefetch. +The initial setting is 1. The number of messages for automatical prefetch. @item wl-message-buffer-prefetch-idle-time @vindex wl-message-buffer-prefetch-idle-time -The initial setting is 0.2 (in seconds). The period of automatical prefetch. +The initial setting is 1 (in seconds). The period of automatical prefetch. @item wl-message-buffer-prefetch-threshold @vindex wl-message-buffer-prefetch-threshold @@ -4082,12 +4100,6 @@ If non-nil, sender part displays nickname. The initial setting is @code{t}. If non-nil, message is split as pages by @samp{^L}. -@item wl-message-window-size -@vindex wl-message-window-size -The initial setting is '(1 . 4). -A cons cell to specify the rate of summary and message window. -car:cdr corresponds summary:message. - @item wl-summary-from-function @vindex wl-summary-from-function Format function to display sender in summary. @@ -4445,7 +4457,7 @@ message number will be changed. @table @code @item wl-message-window-size @vindex wl-message-window-size -Initial setting is @code{'(1 . 4)}. It is a cons cell and the ratio of +Initial setting is @code{(1 . 4)}. It is a cons cell and the ratio of its car and cdr value corresponds to the ratio of Summary and Message windows. @@ -7393,7 +7405,7 @@ when you change the @code{spam_header} parameter in the config file. @end table -@node Regular Expressions Header Matching, , SpamAssassin, Spam Filter Processors +@node Regular Expressions Header Matching, , SpamOracle, Spam Filter Processors @subsection Regular Expressions Header Matching @cindex Regular Expressions Header Matching diff --git a/elmo/ChangeLog b/elmo/ChangeLog index e727637..054316b 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,13 +1,198 @@ +2005-02-06 Hiroya Murata + + * elmo-nntp.el (elmo-nntp-server-command-index): Add entry `xhdr'. + +2005-02-01 Hiroya Murata + + * elmo-flag.el (elmo-flag-valid-p): Simplify. + (elmo-folder-list-subfolders): Copy `elmo-global-flags'. + (elmo-folder-delete): Update `elmo-global-flag-folder-alist'. + +2005-01-30 TAKAHASHI Kaoru + + * elmo-util.el (elmo-passwd-alist-load, elmo-passwd-alist-save): + Use `with-temp-buffer'. + +2005-01-30 Hiroya Murata + + * elmo-flag.el (elmo-folder-initialize): Fixed the last change. + + * elmo-util.el (elmo-read-search-condition): Eliminate (renamed to + `wl-read-search-condition'). + (elmo-read-search-condition-internal): Likewise. + + * elmo-flag.el (elmo-flag-char-regexp): New constant. + (elmo-flag-valid-p): New function. + (elmo-folder-initialize): Check flag name is valid. + +2005-01-26 Yuuichi Teranishi + + * elmo-imap4.el (elmo-folder-list-subfolders): Use root mailbox without + delimiter to obtain root mailbox itself. + +2005-01-25 Tetsurou Okazaki + + * elmo-net.el (elmo-network-session-idle-timeout): Fix customization + type mismatch. + +2005-01-24 Yuuichi Teranishi + + * elmo-mime.el (elmo-mime-entity-display): Bind elmo-message-displaying + as t. + +2005-01-23 Hiroya Murata + + * elmo-shimbun.el (toplevel): Require cl at compile. + + * elmo-nntp.el (toplevel): Ditto. + + * elmo-nmz.el (toplevel): Ditto. + + * elmo-multi.el (toplevel): Ditto. + + * elmo-file.el (toplevel): Ditto. + + * elmo-dop.el (toplevel): Ditto. + + * elmo-archive.el (toplevel): Likewise elmo and cl (at compile). + +2005-01-20 Yuuichi Teranishi + + * mmimap.el (mmimap-make-mime-entity): Set children's top node number + as nil. + + * elmo.el (elmo-message-fetch): Return t even when the output buffer + size of elmo-message-fetch-internal is 0 byte. + +2005-01-14 Hiroya Murata + + * elmo-maildir.el (elmo-map-message-fetch): Fixed last change. + 2005-01-13 Yoichi NAKAYAMA * elmo-shimbun.el (elmo-folder-plugged-p): Treat "@" as always plugged. +2005-01-13 Hiroya Murata + + * elmo-maildir.el (elmo-map-message-fetch): Call + `elmo-map-folder-set-flag'. + + * elmo.el (elmo-message-fetch-with-cache-process): Abolish. + (elmo-message-fetch): Merge from + `elmo-message-fetch-with-cache-process'. + + * elmo-sendlog.el (elmo-message-fetch-with-cache-process): Abolish. + (elmo-message-fetch): Define. + + * elmo-nntp.el (elmo-message-fetch): Renamed from + `elmo-message-fetch-with-cache-process'. + + * elmo-cache.el (elmo-message-fetch-with-cache-process): Abolish. + (elmo-message-fetch): Define. + + * elmo-util.el (elmo-condition-parse-primitive): Downcase + search-key. + + * elmo-shimbun.el (shimbun-mua-search-id): Use + `elmo-message-entity' instead of `elmo-msgdb-message-entity'. + (elmo-shimbun-folder-shimbun-header): Ditto. + (elmo-shimbun-get-headers): Ditto. + (elmo-shimbun-update-overview): Ditto. + + * elmo-pipe.el (elmo-folder-detach-messages): Define. + + * elmo-net.el (elmo-folder-list-messages-unplugged): Use + `elmo-folder-list-messages' instead of `elmo-msgdb-list-messages'. + +2005-01-13 Yuuichi Teranishi + + * elmo.el (elmo-message-fetch): Unset unread flag on server when + message is cached. + (elmo-message-fetch-string): Fixed argument. + +2005-01-11 Hiroya Murata + + * elmo.el (elmo-message-fetch): Removed argument `outbuf' and + exchange order of arguments `section' and `unread'. + (elmo-message-encache): Follow the API change. + (elmo-message-match-condition): Ditto. + (elmo-generic-folder-append-messages): Ditto. + (elmo-message-fetch-string): New function. + + * elmo-split.el (elmo-split-subr): Ditto. + + * elmo-spam.el (elmo-spam-message-fetch): Ditto. + + * elmo-pipe.el (elmo-message-fetch): Ditto. + + * elmo-multi.el (elmo-message-fetch): Ditto. + + * elmo-mime.el (elmo-message-mime-entity): Ditto. + + * elmo-flag.el (elmo-global-flag-set-internal): Ditto. + + * elmo-filter.el (elmo-message-fetch): Ditto. + + * elmo-dop.el (elmo-folder-append-buffer-dop-delayed): Ditto. + + * elmo-imap4.el (mime-imap-location-section-body): Use + `elmo-message-fetch-string' instead of `elmo-message-fetch' and + follow the API change. + +2005-01-08 Yuuichi Teranishi + + * elmo-net.el (elmo-network-session-idle-timeout): New option. + (elmo-network-session): New attribute `last-accessed'. + (elmo-network-get-session): Discard network cache if elapsed time + since last-accessed is larger than elmo-network-session-idle-timeout. + +2005-01-07 Hiroya Murata + + * elmo.el (elmo-find-fetch-strategy): Removed argument `entity' + and added `number', `require-entireness'. + (elmo-find-fetch-strategy): Rewrite. + (elmo-message-fetch): Unset `unread' flag when argument unread is + non-nil. + + * elmo-spam.el (elmo-spam-message-fetch): Follow the API change. + + * elmo-multi.el (elmo-find-fetch-strategy): Ditto. + (elmo-message-fetch): Notify event `flag-changed'. + + * elmo-pipe.el: Likewise. + + * elmo-mime.el (elmo-mime-entity): New class. + (elmo-mime-entity-display-p): New generic function. + (elmo-mime-entity-display): Ditto. + (elmo-mime-entity-display-as-is): Ditto. + (mime-elmo-buffer-entity, mime-elmo-imap-entity): Inherit + elmo-mime-entity. + (elmo-make-mime-message-location): Removed. + (elmo-mime-message-display): Ditto. + (elmo-mime-display-as-is): Ditto. + (elmo-message-mime-entity): New function. + + * elmo-imap4.el (elmo-find-fetch-strategy): Rewrite. + + * elmo-filter.el (elmo-find-fetch-strategy): Follow the API + change. + (elmo-message-fetch): Re-count flagged message number and notify + event `flag-changed'. + + * elmo-version.el (elmo-version): Up to 2.13.1. + 2005-01-02 Hiroya Murata * elmo-filter.el (elmo-message-field): Define. (elmo-message-set-field): Ditto. +2004-12-25 Hiroya Murata + + * elmo.el (elmo-message-set-cached): Call + `elmo-folder-notify-event' with cache-changed. + (elmo-event-handler-cache-changed): New generic function. + 2004-12-24 Yuuichi Teranishi * 2.12.0 is released. diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index d18cae1..8437532 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -33,7 +33,9 @@ ;;; Code: ;; +(eval-when-compile (require 'cl)) +(require 'elmo) (require 'elmo-msgdb) (require 'emu) (require 'std11) diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index ce178a5..7a81949 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -138,10 +138,15 @@ (elmo-cache-folder-directory-internal folder)))) t) -(luna-define-method elmo-message-fetch-with-cache-process - ((folder elmo-cache-folder) number strategy &optional section unseen) +(luna-define-method elmo-message-fetch + ((folder elmo-cache-folder) number strategy &optional unseen section) ;; disbable cache process - (elmo-message-fetch-internal folder number strategy section unseen)) + (erase-buffer) + (when (elmo-message-fetch-internal folder number strategy section unseen) + (when (and (not unseen) + (elmo-message-flagged-p folder number 'unread)) + (elmo-message-unset-flag folder number 'unread)) + t)) (luna-define-method elmo-map-message-fetch ((folder elmo-cache-folder) location strategy diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index 4841182..fcd6015 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -28,6 +28,7 @@ ;;; Code: ;; +(eval-when-compile (require 'cl)) (require 'elmo) (require 'elmo-vars) @@ -327,7 +328,7 @@ FOLDER is the folder structure." (with-temp-buffer (when (elmo-message-fetch spool-folder number (elmo-make-fetch-strategy 'entire) - nil (current-buffer) 'unread) + 'unread) (setq flags (or (elmo-message-flags-for-append folder (* -1 number)) (cond ((listp flag) flag) diff --git a/elmo/elmo-file.el b/elmo/elmo-file.el index fd8e6b6..169d55e 100644 --- a/elmo/elmo-file.el +++ b/elmo/elmo-file.el @@ -28,6 +28,8 @@ ;;; Code: ;; +(eval-when-compile (require 'cl)) + (require 'elmo) (require 'elmo-map) (require 'mime-edit) diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 2fbcc9d..7eb00be 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -146,11 +146,14 @@ (luna-define-method elmo-folder-newsgroups ((folder elmo-filter-folder)) (elmo-folder-newsgroups (elmo-filter-folder-target-internal folder))) -(luna-define-method elmo-find-fetch-strategy - ((folder elmo-filter-folder) entity &optional ignore-cache) +(luna-define-method elmo-find-fetch-strategy ((folder elmo-filter-folder) + number + &optional + ignore-cache + require-entireness) (elmo-find-fetch-strategy (elmo-filter-folder-target-internal folder) - entity ignore-cache)) + number ignore-cache require-entireness)) (luna-define-method elmo-folder-get-primitive-list ((folder elmo-filter-folder)) @@ -177,10 +180,15 @@ (luna-define-method elmo-message-fetch ((folder elmo-filter-folder) number strategy - &optional section outbuf unseen) - (elmo-message-fetch - (elmo-filter-folder-target-internal folder) - number strategy section outbuf unseen)) + &optional unseen section) + (unless unseen + (elmo-filter-folder-countup-message-flags folder (list number) -1)) + (when (elmo-message-fetch (elmo-filter-folder-target-internal folder) + number strategy unseen section) + (unless unseen + (elmo-filter-folder-countup-message-flags folder (list number)) + (elmo-folder-notify-event folder 'flag-changed (list number))) + t)) (luna-define-method elmo-folder-delete-messages ((folder elmo-filter-folder) numbers) diff --git a/elmo/elmo-flag.el b/elmo/elmo-flag.el index 4061dd2..c3ae100 100644 --- a/elmo/elmo-flag.el +++ b/elmo/elmo-flag.el @@ -44,6 +44,14 @@ "Internal variable to hold global-flag-folder structures.") (eval-and-compile + (defconst elmo-flag-char-regexp "]!#$&'+,./0-9:;<=>?@A-Z[^_`a-z|}~-")) + +(defun elmo-flag-valid-p (flag) + (string-match (eval-when-compile + (concat "^[" elmo-flag-char-regexp "]+$")) + (if (stringp flag) flag (symbol-name flag)))) + +(eval-and-compile (luna-define-class elmo-flag-folder (elmo-localdir-folder) (flag minfo minfo-hash max-number)) (luna-define-internal-accessors 'elmo-flag-folder)) @@ -51,8 +59,14 @@ (luna-define-method elmo-folder-initialize ((folder elmo-flag-folder) name) - (if (string-match "flag/\\([a-z]+\\)" name) - (setq name (match-string 1 name)) + (unless (string-match (eval-when-compile + (concat "^flag\\(/\\([" + elmo-flag-char-regexp + "]+\\)\\)?$")) + name) + (error "Error in folder name `%s'" (elmo-folder-name-internal folder))) + (if (match-beginning 1) + (setq name (match-string 2 name)) (setq name (symbol-name (car elmo-global-flags))) (elmo-folder-set-name-internal folder @@ -128,7 +142,7 @@ (elmo-uniq-list (append (mapcar 'intern (delete ".." (delete "." (directory-files dir)))) - elmo-global-flags))))) + (copy-sequence elmo-global-flags)))))) (defun elmo-flag-folder-delete-message (folder number &optional keep-referrer) @@ -330,9 +344,8 @@ NUMBER is the message number." (elmo-copy-file (elmo-file-cache-path cache) new-file) (when (and folder number) - (elmo-message-fetch folder number (elmo-make-fetch-strategy - 'entire) - nil (current-buffer)) + (elmo-message-fetch folder number + (elmo-make-fetch-strategy 'entire)) (write-region-as-binary (point-min) (point-max) new-file nil 'no-msg)))) (elmo-flag-folder-set-minfo-internal @@ -468,6 +481,9 @@ If optional IGNORE-PRESERVED is non-nil, preserved flags (let ((flag (elmo-flag-folder-flag-internal folder))) (when (luna-call-next-method) (setq elmo-global-flags (delq flag elmo-global-flags)) + (setq elmo-global-flag-folder-alist + (delq (assq flag elmo-global-flag-folder-alist) + elmo-global-flag-folder-alist)) t))) (require 'product) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index fbb0815..cc1d40a 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -448,16 +448,15 @@ If response is not `OK' response, causes error with IMAP response text." (mime-elmo-imap-location-folder-internal location) (mime-elmo-imap-location-number-internal location) (mime-elmo-imap-location-strategy-internal location) - section - (current-buffer) - 'unseen) + 'unseen + section) (buffer-string)) - (elmo-message-fetch + (elmo-message-fetch-string (mime-elmo-imap-location-folder-internal location) (mime-elmo-imap-location-number-internal location) (mime-elmo-imap-location-strategy-internal location) - section - nil 'unseen))) + 'unseen + section))) (luna-define-method mime-imap-location-bodystructure @@ -1967,6 +1966,7 @@ Return nil if no complete line has arrived." (delim (or (cdr namespace-assoc) elmo-imap4-default-hierarchy-delimiter)) ;; Append delimiter when root with namespace. + (root-nodelim root) (root (if (and namespace-assoc (match-end 1) (string= (substring root (match-end 1)) @@ -1985,7 +1985,8 @@ Return nil if no complete line has arrived." (elmo-imap4-response-get-selectable-mailbox-list (elmo-imap4-send-command-wait session - (list "list \"\" " (elmo-imap4-mailbox root))))))) + (list "list \"\" " (elmo-imap4-mailbox + root-nodelim))))))) (when (or (not (string= (elmo-net-folder-user-internal folder) elmo-imap4-default-user)) (not (eq (elmo-net-folder-auth-internal folder) @@ -2536,52 +2537,41 @@ If optional argument REMOVE is non-nil, remove FLAG." ;; elmo-folder-open-internal: do nothing. -(luna-define-method elmo-find-fetch-strategy - ((folder elmo-imap4-folder) entity &optional ignore-cache) - (let ((number (elmo-message-entity-number entity)) - cache-file size message-id) - (setq size (elmo-message-entity-field entity 'size)) - (setq message-id (elmo-message-entity-field entity 'message-id)) - (setq cache-file (elmo-file-cache-get message-id)) - (if (or ignore-cache - (null (elmo-file-cache-status cache-file))) - (if (and elmo-message-fetch-threshold - (integerp size) - (>= size elmo-message-fetch-threshold) - (or (not elmo-message-fetch-confirm) - (not (prog1 (y-or-n-p +(luna-define-method elmo-find-fetch-strategy ((folder elmo-imap4-folder) number + &optional + ignore-cache + require-entireness) + (let ((entity (elmo-message-entity folder number))) + (if (null entity) + (elmo-make-fetch-strategy 'entire) + (let* ((size (elmo-message-entity-field entity 'size)) + (message-id (elmo-message-entity-field entity 'message-id)) + (cache-file (elmo-file-cache-get message-id)) + (use-cache (and (not ignore-cache) + (elmo-message-use-cache-p folder number) + (if require-entireness + (eq (elmo-file-cache-status cache-file) + 'entire) + (elmo-file-cache-status cache-file))))) + (elmo-make-fetch-strategy + (if use-cache + (elmo-file-cache-status cache-file) + (if (and (not require-entireness) + elmo-message-fetch-threshold + (integerp size) + (>= size elmo-message-fetch-threshold) + (or (not elmo-message-fetch-confirm) + (not (prog1 + (y-or-n-p (format "Fetch entire message at once? (%dbytes)" size)) - (message ""))))) - ;; Fetch message as imap message. - (elmo-make-fetch-strategy 'section - nil - (elmo-message-use-cache-p - folder number) - (elmo-file-cache-path - cache-file)) - ;; Don't use existing cache and fetch entire message at once. - (elmo-make-fetch-strategy 'entire nil - (elmo-message-use-cache-p - folder number) - (elmo-file-cache-path cache-file))) - ;; Cache found and use it. - (if (not ignore-cache) - (if (eq (elmo-file-cache-status cache-file) 'section) - ;; Fetch message with imap message. - (elmo-make-fetch-strategy 'section - t - (elmo-message-use-cache-p - folder number) - (elmo-file-cache-path - cache-file)) - (elmo-make-fetch-strategy 'entire - t - (elmo-message-use-cache-p - folder number) - (elmo-file-cache-path - cache-file))))))) + (message ""))))) + 'section + 'entire)) + use-cache + (elmo-message-use-cache-p folder number) + (elmo-file-cache-path cache-file)))))) (luna-define-method elmo-folder-create-plugged ((folder elmo-imap4-folder)) (elmo-imap4-send-command-wait diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index fd41839..4fb0dd0 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -496,7 +496,10 @@ file name for maildir directories." &optional section unseen) (let ((file (elmo-maildir-message-file-name folder location))) (when (file-exists-p file) - (insert-file-contents-as-binary file)))) + (insert-file-contents-as-binary file) + (unless unseen + (elmo-map-folder-set-flag folder (list location) 'read)) + t))) (luna-define-method elmo-folder-exists-p ((folder elmo-maildir-folder)) (let ((basedir (elmo-maildir-folder-directory-internal folder))) diff --git a/elmo/elmo-mime.el b/elmo/elmo-mime.el index 6ff192f..9bc4b23 100644 --- a/elmo/elmo-mime.el +++ b/elmo/elmo-mime.el @@ -33,9 +33,57 @@ (require 'mmimap) (require 'mime-view) +;; MIME-Entity (eval-and-compile - (luna-define-class mime-elmo-buffer-entity (mime-buffer-entity) ()) - (luna-define-class mime-elmo-imap-entity (mime-imap-entity) ())) + (luna-define-class elmo-mime-entity)) + +(luna-define-generic elmo-mime-entity-display-p (entity mime-mode) + "Return non-nil if ENTITY is able to display with MIME-MODE. + +MIME-MODE is a symbol which is one of the following: + `mime' (Can display each MIME part) + `as-is' (Can display raw message)") + +(luna-define-generic elmo-mime-entity-display (entity preview-buffer + &optional + original-major-mode + keymap) + "Display MIME message ENTITY. +PREVIEW-BUFFER is a view buffer. +Optional argument ORIGINAL-MAJOR-MODE is major-mode of representation +buffer of ENTITY. If it is nil, current `major-mode' is used. +If optional argument KEYMAP is specified, +use for keymap of representation buffer.") + +(luna-define-generic elmo-mime-entity-display-as-is (entity + preview-buffer + &optional + original-major-mode + keymap) + "Display MIME message ENTITY as is. +PREVIEW-BUFFER is a view buffer. +Optional argument ORIGINAL-MAJOR-MODE is major-mode of representation +buffer of ENTITY. If it is nil, current `major-mode' is used. +If optional argument KEYMAP is specified, +use for keymap of representation buffer.") + +(luna-define-method elmo-mime-entity-display ((entity elmo-mime-entity) + preview-buffer + &optional + original-major-mode + keymap) + (let ((elmo-message-displaying t)) + (mime-display-message entity + preview-buffer + nil + keymap + original-major-mode))) + +(eval-and-compile + (luna-define-class mime-elmo-buffer-entity (mime-buffer-entity + elmo-mime-entity)) + (luna-define-class mime-elmo-imap-entity (mime-imap-entity + elmo-mime-entity))) ;; Provide backend (provide 'mmelmo-imap) @@ -184,103 +232,65 @@ value is used." elmo-message-sorted-field-list) (run-hooks 'elmo-message-header-inserted-hook)) -(defun elmo-make-mime-message-location (folder number strategy rawbuf unread) -;; Return the MIME message location structure. -;; FOLDER is the ELMO folder structure. -;; NUMBER is the number of the message in the FOLDER. -;; STRATEGY is the message fetching strategy. -;; RAWBUF is the output buffer for original message. -;; If second optional argument UNREAD is non-nil, message is not marked -;; as read. - (if (and strategy - (eq (elmo-fetch-strategy-entireness strategy) 'section)) - (luna-make-entity - 'mime-elmo-imap-location - :folder folder - :number number - :rawbuf rawbuf - :strategy strategy) - (with-current-buffer rawbuf - (let (buffer-read-only) - (erase-buffer) - (if strategy - (elmo-message-fetch folder number strategy - nil (current-buffer) - unread)))) - rawbuf)) - -(defun elmo-mime-message-display (folder number viewbuf rawbuf original-mode - &optional ignore-cache unread keymap) - "Display MIME message. -A message in the FOLDER with NUMBER is displayed on the VIEWBUF using RAWBUF. -VIEWBUF is a view buffer and RAWBUF is a raw buffer. -ORIGINAL is the major mode of RAWBUF. -If optional argument IGNORE-CACHE is specified, existing cache is ignored. -If second optional argument UNREAD is specified, message is displayed but -keep it as unread. -Return non-nil if not entire message was fetched." - (let (mime-display-header-hook ; Do nothing. - (elmo-message-displaying t) - entity strategy) - (unless (zerop (elmo-folder-length folder)) - (setq entity (elmo-message-entity folder number))) - (setq strategy (if entity (elmo-find-fetch-strategy folder entity - ignore-cache) - (elmo-make-fetch-strategy 'entire))) - (mime-display-message - (mime-open-entity - (if (and strategy - (eq (elmo-fetch-strategy-entireness strategy) 'section)) - 'elmo-imap - 'elmo-buffer) - (elmo-make-mime-message-location - folder number strategy rawbuf unread)) - viewbuf nil keymap - original-mode) - (if strategy - (or (elmo-fetch-strategy-use-cache strategy) - (eq (elmo-fetch-strategy-entireness strategy) - 'section))))) - -(defun elmo-mime-display-as-is (folder number viewbuf rawbuf original-mode - &optional ignore-cache unread keymap) - "Display MIME message. -A message in the FOLDER with NUMBER is displayed on the VIEWBUF using RAWBUF. -VIEWBUF is a view buffer and RAWBUF is a raw buffer. -ORIGINAL is the major mode of RAWBUF. -If optional argument IGNORE-CACHE is specified, existing cache is ignored. -If second optional argument UNREAD is specified, message is displayed but -keep it as unread. -Return non-nil if cache is used." - (let (mime-display-header-hook ; Do nothing. - (elmo-message-displaying t) - entity cache-file cache-used) - (unless (zerop (elmo-folder-length folder)) - (setq entity (elmo-message-entity folder number))) - (when entity - (setq cache-file - (elmo-file-cache-get - (elmo-message-entity-field entity 'message-id))) - ;; Required to be an entire cache. - (unless (eq (elmo-file-cache-status cache-file) 'entire) - (setq ignore-cache t))) - (elmo-mime-display-as-is-internal - (mime-open-entity - 'elmo-buffer - (elmo-make-mime-message-location - folder number - (elmo-make-fetch-strategy 'entire - (unless ignore-cache - (setq - cache-used - (and cache-file - (elmo-file-cache-status cache-file)))) - (elmo-message-use-cache-p folder number) - (and cache-file - (elmo-file-cache-path cache-file))) - rawbuf unread)) - viewbuf nil keymap original-mode) - cache-used)) +;; mime-elmo-buffer-entity +(luna-define-method elmo-mime-entity-display-p + ((entity mime-elmo-buffer-entity) mime-mode) + ;; always return t. + t) + +(luna-define-method elmo-mime-entity-display-as-is ((entity + mime-elmo-buffer-entity) + preview-buffer + &optional + original-major-mode + keymap) + (elmo-mime-display-as-is-internal entity + preview-buffer + nil + keymap + original-major-mode)) + +;; mime-elmo-imap-entity +(luna-define-method elmo-mime-entity-display-p + ((entity mime-elmo-imap-entity) mime-mode) + (not (eq mime-mode 'as-is))) + +(luna-define-method elmo-mime-entity-display-as-is ((entity + mime-elmo-imap-entity) + preview-buffer + &optional + original-major-mode + keymap) + (error "Don't support this method.")) + + +(defun elmo-message-mime-entity (folder number rawbuf + &optional + ignore-cache unread entire) + "Return the mime-entity structure of the message in the FOLDER with NUMBER. +RAWBUF is the output buffer for original message. +If optional argument IGNORE-CACHE is non-nil, existing cache is ignored. +If second optional argument UNREAD is non-nil, +keep status of the message as unread. +If third optional argument ENTIRE is non-nil, fetch entire message at once." + (let ((strategy (elmo-find-fetch-strategy folder number + ignore-cache + entire))) + (cond ((null strategy) nil) + ((eq (elmo-fetch-strategy-entireness strategy) 'section) + (mime-open-entity + 'elmo-imap + (luna-make-entity 'mime-elmo-imap-location + :folder folder + :number number + :rawbuf rawbuf + :strategy strategy))) + (t + (with-current-buffer rawbuf + (let (buffer-read-only) + (erase-buffer) + (elmo-message-fetch folder number strategy unread))) + (mime-open-entity 'elmo-buffer rawbuf))))) ;; Replacement of mime-display-message. (defun elmo-mime-display-as-is-internal (message diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index 5903b1c..ccc899c 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -28,6 +28,7 @@ ;;; Code: ;; +(eval-when-compile (require 'cl)) (require 'elmo) (require 'luna) @@ -145,14 +146,16 @@ (let ((pair (elmo-multi-real-folder-number folder number))) (elmo-message-set-cached (car pair) (cdr pair) cached))) -(luna-define-method elmo-find-fetch-strategy - ((folder elmo-multi-folder) entity &optional ignore-cache) - (let ((pair (elmo-multi-real-folder-number - folder - (elmo-message-entity-number entity)))) - (elmo-find-fetch-strategy - (car pair) - (elmo-message-entity (car pair) (cdr pair)) ignore-cache))) +(luna-define-method elmo-find-fetch-strategy ((folder elmo-multi-folder) + number + &optional + ignore-cache + require-entireness) + (let ((pair (elmo-multi-real-folder-number folder number))) + (elmo-find-fetch-strategy (car pair) + (cdr pair) + ignore-cache + require-entireness))) (luna-define-method elmo-message-number ((folder elmo-multi-folder) message-id) @@ -241,9 +244,13 @@ (luna-define-method elmo-message-fetch ((folder elmo-multi-folder) number strategy - &optional section outbuf unseen) + &optional unseen section) (let ((pair (elmo-multi-real-folder-number folder number))) - (elmo-message-fetch (car pair) (cdr pair) strategy section outbuf unseen))) + (when (elmo-message-fetch (car pair) (cdr pair) + strategy unseen section) + (unless unseen + (elmo-folder-notify-event folder 'flag-changed (list number))) + t))) (luna-define-method elmo-folder-delete-messages ((folder elmo-multi-folder) numbers) diff --git a/elmo/elmo-net.el b/elmo/elmo-net.el index 480fa7a..28d0620 100644 --- a/elmo/elmo-net.el +++ b/elmo/elmo-net.el @@ -56,6 +56,14 @@ (defvar sasl-mechanisms) +(defcustom elmo-network-session-idle-timeout nil + "Idle timeout of the network cache. Specified in seconds. +If elapsed time since last access is larger than this value, +cached session is not reused. +If nil, network cache is reused." + :type '(choice number (const nil)) + :group 'elmo) + ;;; Code: ;; (eval-and-compile @@ -66,7 +74,8 @@ auth stream-type process - greeting)) + greeting + last-accessed)) (luna-define-internal-accessors 'elmo-network-session)) (luna-define-generic elmo-network-initialize-session (session) @@ -166,16 +175,26 @@ if making session failed, returns nil." (setq pair (assoc (setq key (elmo-network-session-cache-key name folder)) elmo-network-session-cache)) (when (and pair - (not (memq (process-status - (elmo-network-session-process-internal - (cdr pair))) - '(open run)))) + (or (not (memq (process-status + (elmo-network-session-process-internal + (cdr pair))) + '(open run))) + (and elmo-network-session-idle-timeout + (elmo-network-session-last-accessed-internal + (cdr pair)) + (elmo-time-expire + (elmo-network-session-last-accessed-internal + (cdr pair)) + elmo-network-session-idle-timeout)))) (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. + (progn + (elmo-network-session-set-last-accessed-internal + (cdr pair) (current-time)) + (cdr pair)) ; connection cache exists. (unless if-exists (setq session (elmo-network-open-session @@ -211,7 +230,9 @@ Returns a process object. if making session failed, returns nil." :auth auth :stream-type stream-type :process nil - :greeting nil)) + :greeting nil + :last-accessed (current-time) + )) (buffer (format " *%s session for %s@%s:%d%s" name user @@ -396,7 +417,7 @@ Returned value is searched from `elmo-network-stream-type-alist'." (elmo-delete-if (lambda (number) (memq number deleting)) ;; current number-list. - (elmo-msgdb-list-messages (elmo-folder-msgdb folder))) + (elmo-folder-list-messages folder nil 'in-msgdb)) ;; append appending messages (mapcar (lambda (x) (* -1 x)) (elmo-dop-spool-folder-list-messages folder)))) diff --git a/elmo/elmo-nmz.el b/elmo/elmo-nmz.el index e8718c4..765829d 100644 --- a/elmo/elmo-nmz.el +++ b/elmo/elmo-nmz.el @@ -28,6 +28,8 @@ ;;; Code: ;; +(eval-when-compile (require 'cl)) + (require 'elmo) (require 'elmo-map) (require 'mime-edit) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index e472fdc..894e571 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -32,6 +32,7 @@ ;;; Code: ;; +(eval-when-compile (require 'cl)) (require 'elmo-vars) (require 'elmo-util) @@ -176,7 +177,8 @@ Don't cache if nil.") (defconst elmo-nntp-server-command-index '((xover . 0) (listgroup . 1) - (list-active . 2))) + (list-active . 2) + (xhdr . 3))) (defmacro elmo-nntp-get-server-command (session) (` (assoc (cons (elmo-network-session-server-internal (, session)) @@ -959,8 +961,8 @@ Don't cache if nil.") (with-current-buffer (elmo-network-session-buffer session) (std11-field-body "Newsgroups"))))) -(luna-define-method elmo-message-fetch-with-cache-process :around - ((folder elmo-nntp-folder) number strategy &optional section unread) +(luna-define-method elmo-message-fetch :around + ((folder elmo-nntp-folder) number strategy &optional unread section) (when (luna-call-next-method) (elmo-nntp-setup-crosspost-buffer folder number) (unless unread diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index d7e90dd..a62eaf6 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -78,9 +78,12 @@ (luna-define-method elmo-message-fetch ((folder elmo-pipe-folder) number strategy - &optional section outbuf unseen) - (elmo-message-fetch (elmo-pipe-folder-dst-internal folder) - number strategy section outbuf unseen)) + &optional unseen section) + (when (elmo-message-fetch (elmo-pipe-folder-dst-internal folder) + number strategy unseen section) + (unless unseen + (elmo-folder-notify-event folder 'flag-changed (list number))) + t)) (luna-define-method elmo-folder-clear :after ((folder elmo-pipe-folder) &optional keep-killed) @@ -92,6 +95,11 @@ (elmo-folder-delete-messages (elmo-pipe-folder-dst-internal folder) numbers)) +(luna-define-method elmo-folder-detach-messages ((folder elmo-pipe-folder) + numbers) + (elmo-folder-detach-messages (elmo-pipe-folder-dst-internal folder) + numbers)) + (defvar elmo-pipe-drained-hook nil "A hook called when the pipe is flushed.") (defsubst elmo-pipe-folder-list-target-messages (src &optional ignore-list) @@ -357,13 +365,15 @@ (elmo-message-set-cached (elmo-pipe-folder-dst-internal folder) number cached)) -(luna-define-method elmo-find-fetch-strategy - ((folder elmo-pipe-folder) entity &optional ignore-cache) +(luna-define-method elmo-find-fetch-strategy ((folder elmo-pipe-folder) + number + &optional + ignore-cache + require-entireness) (elmo-find-fetch-strategy (elmo-pipe-folder-dst-internal folder) - (elmo-message-entity - (elmo-pipe-folder-dst-internal folder) - (elmo-message-entity-number entity)) - ignore-cache)) + number + ignore-cache + require-entireness)) (luna-define-method elmo-message-number ((folder elmo-pipe-folder) message-id) diff --git a/elmo/elmo-sendlog.el b/elmo/elmo-sendlog.el index f0ce85b..4187f7f 100644 --- a/elmo/elmo-sendlog.el +++ b/elmo/elmo-sendlog.el @@ -111,10 +111,15 @@ (message "Creating msgdb...done") new-msgdb)) -(luna-define-method elmo-message-fetch-with-cache-process - ((folder elmo-sendlog-folder) number strategy &optional section unseen) +(luna-define-method elmo-message-fetch + ((folder elmo-sendlog-folder) number strategy &optional unseen section) ;; disbable cache process - (elmo-message-fetch-internal folder number strategy section unseen)) + (erase-buffer) + (when (elmo-message-fetch-internal folder number strategy section unseen) + (when (and (not unseen) + (elmo-message-flagged-p folder number 'unread)) + (elmo-message-unset-flag folder number 'unread)) + t)) (luna-define-method elmo-map-message-fetch ((folder elmo-sendlog-folder) location strategy diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index fe75944..982e3c7 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -34,6 +34,7 @@ (require 'shimbun) (eval-when-compile + (require 'cl) (defun-maybe shimbun-servers-list ())) (defcustom elmo-shimbun-check-interval 60 @@ -94,9 +95,7 @@ If it is the symbol `all', update overview for all shimbun folders." (luna-define-internal-accessors 'shimbun-elmo-mua)) (luna-define-method shimbun-mua-search-id ((mua shimbun-elmo-mua) id) - (elmo-msgdb-message-entity (elmo-folder-msgdb - (shimbun-elmo-mua-folder-internal mua)) - id)) + (elmo-message-entity (shimbun-elmo-mua-folder-internal mua) id)) (eval-and-compile (luna-define-class elmo-shimbun-folder @@ -121,9 +120,7 @@ If it is the symbol `all', update overview for all shimbun folders." (defsubst elmo-shimbun-folder-shimbun-header (folder location) (let ((hash (elmo-shimbun-folder-header-hash-internal folder))) (or (and hash (elmo-get-hash-val location hash)) - (let ((entity (elmo-msgdb-message-entity - (elmo-folder-msgdb folder) - location)) + (let ((entity (elmo-message-entity folder location)) (elmo-hash-minimum-size 63) header) (when entity @@ -200,9 +197,7 @@ If it is the symbol `all', update overview for all shimbun folders." (delq nil (mapcar (lambda (x) - (unless (elmo-msgdb-message-entity - (elmo-folder-msgdb folder) - (shimbun-header-id x)) + (unless (elmo-message-entity folder (shimbun-header-id x)) x)) ;; This takes much time. (shimbun-headers @@ -380,8 +375,7 @@ If it is the symbol `all', update overview for all shimbun folders." nil) (defsubst elmo-shimbun-update-overview (folder shimbun-id header) - (let ((entity (elmo-msgdb-message-entity (elmo-folder-msgdb folder) - shimbun-id)) + (let ((entity (elmo-message-entity folder shimbun-id)) (message-id (shimbun-header-id header)) references) (unless (string= shimbun-id message-id) diff --git a/elmo/elmo-spam.el b/elmo/elmo-spam.el index 683d443..350f99e 100644 --- a/elmo/elmo-spam.el +++ b/elmo/elmo-spam.el @@ -124,9 +124,8 @@ If optional argument RESTORE is non-nil, unregister from spam list.") (let (elmo-message-fetch-threshold) (elmo-message-fetch folder number - (elmo-find-fetch-strategy folder - (elmo-message-entity folder number)) - nil (current-buffer) 'unread))) + (elmo-find-fetch-strategy folder number nil 'entire) + 'unread))) ;; generic implement (luna-define-method elmo-spam-message-spam-p ((processor elsp-generic) diff --git a/elmo/elmo-split.el b/elmo/elmo-split.el index 3eafd55..28bebd2 100644 --- a/elmo/elmo-split.el +++ b/elmo/elmo-split.el @@ -334,7 +334,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)." (when (ignore-errors (elmo-message-fetch folder msg (elmo-make-fetch-strategy 'entire) - nil (current-buffer) 'unread)) + 'unread)) (run-hooks 'elmo-split-fetch-hook) (setq elmo-split-message-entity (mime-parse-buffer)) (setq flags (elmo-message-flags-for-append folder msg)) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index fb9d44f..3a5e66d 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -139,61 +139,6 @@ File content is encoded with MIME-CHARSET." (defconst elmo-condition-atom-regexp "[^/ \")|&]*") -(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" "Flag" - "From" "Subject" "To" "Cc" "Body" - "Since" "Before" "ToCc" - "!From" "!Subject" "!To" "!Cc" "!Body" - "!Since" "!Before" "!ToCc") - elmo-msgdb-extra-fields)))) - value) - (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) - (let ((default (format-time-string "%Y-%m-%d"))) - (setq value (completing-read - (format "Value for '%s' [%s]: " field default) - (mapcar (function - (lambda (x) - (list (format "%s" (car x))))) - elmo-date-descriptions))) - (concat (downcase field) ":" - (if (equal value "") default value)))) - ((string= field "Flag") - (setq value (completing-read - (format "Value for '%s': " field) - (mapcar 'list - '("unread" "important" "answered" "digest" "any")))) - (unless (string-match (concat "^" elmo-condition-atom-regexp "$") - value) - (setq value (prin1-to-string value))) - (concat (downcase field) ":" value)) - (t - (setq value (read-from-minibuffer (format "Value for '%s': " field))) - (unless (string-match (concat "^" elmo-condition-atom-regexp "$") - value) - (setq value (prin1-to-string value))) - (concat (downcase field) ":" value))))) - (defsubst elmo-condition-parse-error () (error "Syntax error in '%s'" (buffer-string))) @@ -247,7 +192,7 @@ Return value is a cons cell of (STRUCTURE . REST)" (goto-char (match-end 0)) (let ((search-key (vector (if (match-beginning 1) 'unmatch 'match) - (elmo-match-buffer 2) + (downcase (elmo-match-buffer 2)) (elmo-condition-parse-search-value)))) ;; syntax sugar. (if (string= (aref search-key 1) "tocc") @@ -419,23 +364,18 @@ Return value is a cons cell of (STRUCTURE . REST)" (defvar elmo-passwd-alist nil) (defun elmo-passwd-alist-load () - (save-excursion + (with-temp-buffer (let ((filename (expand-file-name elmo-passwd-alist-file-name elmo-msgdb-directory)) - (tmp-buffer (get-buffer-create " *elmo-passwd-alist-tmp*")) insert-file-contents-pre-hook ; To avoid autoconv-xmas... insert-file-contents-post-hook ret-val) (if (not (file-readable-p filename)) () - (set-buffer tmp-buffer) (insert-file-contents filename) - (setq ret-val - (condition-case nil - (read (current-buffer)) - (error nil nil)))) - (kill-buffer tmp-buffer) - ret-val))) + (condition-case nil + (read (current-buffer)) + (error nil nil)))))) (defun elmo-passwd-alist-clear () "Clear password cache." @@ -448,15 +388,12 @@ Return value is a cons cell of (STRUCTURE . REST)" (defun elmo-passwd-alist-save () "Save password into file." (interactive) - (save-excursion + (with-temp-buffer (let ((filename (expand-file-name elmo-passwd-alist-file-name elmo-msgdb-directory)) - (tmp-buffer (get-buffer-create " *elmo-passwd-alist-tmp*")) print-length print-level) - (set-buffer tmp-buffer) - (erase-buffer) - (prin1 elmo-passwd-alist tmp-buffer) - (princ "\n" tmp-buffer) + (prin1 elmo-passwd-alist (current-buffer)) + (princ "\n" (current-buffer)) ;;; (if (and (file-exists-p filename) ;;; (not (equal 384 (file-modes filename)))) ;;; (error "%s is not safe.chmod 600 %s!" filename filename)) @@ -465,8 +402,7 @@ Return value is a cons cell of (STRUCTURE . REST)" (write-region (point-min) (point-max) filename nil 'no-msg) (set-file-modes filename 384)) - (message "%s is not writable." filename)) - (kill-buffer tmp-buffer)))) + (message "%s is not writable." filename))))) (defun elmo-get-passwd (key) "Get password from password pool." diff --git a/elmo/elmo-version.el b/elmo/elmo-version.el index 2bb2522..3a138ae 100644 --- a/elmo/elmo-version.el +++ b/elmo/elmo-version.el @@ -40,7 +40,7 @@ ;; product-define in the first place (product-provide 'elmo-version ;; Don't forget to check `wl-version.el' and Info. - (product-define "ELMO" nil '(2 12 0))) + (product-define "ELMO" nil '(2 12 1))) ;; set version-string (product-version-as-string 'elmo-version) diff --git a/elmo/elmo.el b/elmo/elmo.el index 131e50a..58f65b6 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -504,86 +504,89 @@ NUMBER is a message number to test." (t (memq flag cur-flags))))) -(luna-define-generic elmo-find-fetch-strategy - (folder entity &optional ignore-cache) -;; Returns the message fetching strategy suitable for the message. -;; FOLDER is the ELMO folder structure. -;; ENTITY is the overview entity of the message in the folder. -;; If optional argument IGNORE-CACHE is non-nil, cache is ignored. -;; Returned value is a elmo-fetch-strategy object. -;; If return value is nil, message should not be nil. - ) +(luna-define-generic elmo-find-fetch-strategy (folder number + &optional + ignore-cache + require-entireness) + "Return the message fetching strategy suitable for the message with NUMBER. +FOLDER is the ELMO folder structure. +If optional argument IGNORE-CACHE is non-nil, existing cache is ignored. +If second optional argument REQUIRE-ENTIRENESS is non-nil, +ensure that entireness of the returned strategy is entire. +Returned value is a elmo-fetch-strategy object. +If return value is nil, message should not be nil.") (defmacro elmo-make-fetch-strategy (entireness &optional use-cache save-cache cache-path) -;; Make elmo-message-fetching strategy. -;; ENTIRENESS is 'entire or 'section. -;; 'entire means fetch message entirely at once. -;; 'section means fetch message section by section. -;; If optional USE-CACHE is non-nil, existing cache is used and otherwise, -;; existing cache is thrown away. -;; If SAVE-CACHE is non-nil, fetched message is saved. -;; CACHE-PATH is the cache path to be used as a message cache file. - (` (vector (, entireness) - (, use-cache) (, save-cache) (, cache-path)))) + "Make elmo-message-fetching strategy. +ENTIRENESS is 'entire or 'section. +'entire means fetch message entirely at once. +'section means fetch message section by section. +If optional USE-CACHE is non-nil, existing cache is used and otherwise, +existing cache is thrown away. +If SAVE-CACHE is non-nil, fetched message is saved. +CACHE-PATH is the cache path to be used as a message cache file." + `(vector ,entireness ,use-cache ,save-cache ,cache-path)) (defmacro elmo-fetch-strategy-entireness (strategy) - ;; Return entireness of STRATEGY. - (` (aref (, strategy) 0))) + "Return entireness of STRATEGY." + `(aref ,strategy 0)) (defmacro elmo-fetch-strategy-use-cache (strategy) - ;; Return use-cache of STRATEGY. - (` (aref (, strategy) 1))) + "Return use-cache of STRATEGY." + `(aref ,strategy 1)) (defmacro elmo-fetch-strategy-save-cache (strategy) - ;; Return save-cache of STRATEGY. - (` (aref (, strategy) 2))) + "Return save-cache of STRATEGY." + `(aref ,strategy 2)) (defmacro elmo-fetch-strategy-cache-path (strategy) - ;; Return cache-path of STRATEGY. - (` (aref (, strategy) 3))) - -(luna-define-method elmo-find-fetch-strategy - ((folder elmo-folder) entity &optional ignore-cache) - (let (cache-file size message-id number) - (setq size (elmo-message-entity-field entity 'size)) - (setq message-id (elmo-message-entity-field entity 'message-id)) - (setq number (elmo-message-entity-number entity)) - (setq cache-file (elmo-file-cache-get message-id)) - (setq ignore-cache (or ignore-cache - (null (elmo-message-use-cache-p folder number)))) - (if (or ignore-cache - (null (elmo-file-cache-status cache-file))) - ;; No cache or ignore-cache. - (if (and (not (elmo-folder-local-p folder)) - elmo-message-fetch-threshold - (integerp size) - (>= size elmo-message-fetch-threshold) - (or (not elmo-message-fetch-confirm) - (not (prog1 (y-or-n-p - (format "Fetch entire message(%dbytes)? " - size)) - (message ""))))) - ;; Don't fetch message at all. - nil - ;; Don't use existing cache and fetch entire message at once. - (elmo-make-fetch-strategy - 'entire nil - (elmo-message-use-cache-p folder number) - (elmo-file-cache-path cache-file))) - ;; Cache exists. - (if (not ignore-cache) - (elmo-make-fetch-strategy - 'entire - ;; ...But ignore current section cache and re-fetch - ;; if section cache. - (not (eq (elmo-file-cache-status cache-file) 'section)) - ;; Save cache. - (elmo-message-use-cache-p folder number) - (elmo-file-cache-path cache-file)))))) + "Return cache-path of STRATEGY." + `(aref ,strategy 3)) + +(luna-define-method elmo-find-fetch-strategy ((folder elmo-folder) number + &optional + ignore-cache + require-entireness) + (let ((entity (elmo-message-entity folder number))) + (if (null entity) + (elmo-make-fetch-strategy 'entire) + (let* ((size (elmo-message-entity-field entity 'size)) + (message-id (elmo-message-entity-field entity 'message-id)) + (cache-file (elmo-file-cache-get message-id)) + (use-cache (elmo-message-use-cache-p folder number))) + (if (and (not ignore-cache) + use-cache + (eq (elmo-file-cache-status cache-file) 'entire)) + ;; Cache exists and use it. + (elmo-make-fetch-strategy + 'entire + t ; Use cache. + use-cache ; Save cache. + (elmo-file-cache-path cache-file)) + ;; No cache or ignore-cache. + (if (and (not (elmo-folder-local-p folder)) + (not require-entireness) + elmo-message-fetch-threshold + (integerp size) + (>= size elmo-message-fetch-threshold) + (or (not elmo-message-fetch-confirm) + (not (prog1 + (y-or-n-p + (format "Fetch entire message(%dbytes)? " + size)) + (message ""))))) + ;; Don't fetch message at all. + nil + ;; Don't use existing cache and fetch entire message at once. + (elmo-make-fetch-strategy + 'entire + nil ; Don't use cache. + use-cache ; Save cache. + (elmo-file-cache-path cache-file)))))))) (luna-define-method elmo-folder-list-messages-internal ((folder elmo-folder) &optional visible-only) @@ -602,15 +605,16 @@ If READ is non-nil, message is flaged as read.") (luna-define-method elmo-message-encache ((folder elmo-folder) number &optional read) (let (path) - (elmo-message-fetch - folder number - (elmo-make-fetch-strategy 'entire - nil ;use-cache - t ;save-cache - (setq path (elmo-file-cache-get-path - (elmo-message-field - folder number 'message-id)))) - nil nil (not read)) + (with-temp-buffer + (elmo-message-fetch + folder number + (elmo-make-fetch-strategy 'entire + nil ;use-cache + t ;save-cache + (setq path (elmo-file-cache-get-path + (elmo-message-field + folder number 'message-id)))) + (not read))) path)) (luna-define-generic elmo-message-fetch-bodystructure (folder number strategy) @@ -618,32 +622,15 @@ If READ is non-nil, message is flaged as read.") (luna-define-generic elmo-message-fetch (folder number strategy &optional - section - outbuf - unread) - "Fetch a message and return as a string. -FOLDER is the ELMO folder structure. -NUMBER is the number of the message in the FOLDER. -STRATEGY is the message fetching strategy. -If optional argument SECTION is specified, only the SECTION of the message -is fetched (if possible). -If second optional argument OUTBUF is specified, fetched message is -inserted to the buffer and returns t if fetch was ended successfully. -If third optional argument UNREAD is non-nil, message is not flaged as read. -Returns non-nil if fetching was succeed.") - -(luna-define-generic elmo-message-fetch-with-cache-process (folder - number strategy - &optional - section - unread) - "Fetch a message into current buffer with cache process. + unread + section) + "Fetch a message into current buffer. FOLDER is the ELMO folder structure. NUMBER is the number of the message in the FOLDER. STRATEGY is the message fetching strategy. -If optional argument SECTION is specified, only the SECTION of the message -is fetched (if possible). -If second optional argument UNREAD is non-nil, message is not flaged as read. +If optional argument UNREAD is non-nil, message is not flaged as read. +If second optional argument SECTION is specified, only the +SECTION of the message is fetched (if possible). Returns non-nil if fetching was succeed.") (luna-define-generic elmo-message-fetch-internal (folder number strategy @@ -836,7 +823,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-FLAG-ALIST).") (and cache t) nil cache-path) - nil (current-buffer) t) + 'unread) (set-buffer-multibyte default-enable-multibyte-characters) (decode-coding-region (point-min) (point-max) elmo-mime-display-as-is-coding-system) @@ -1073,7 +1060,6 @@ If optional argument IF-EXISTS is nil, load on demand. 'entire t nil (elmo-file-cache-path cache))) (error "Unplugged"))) - nil (current-buffer) 'unread) (> (buffer-size) 0) (elmo-folder-append-buffer @@ -1167,7 +1153,8 @@ If CACHED is t, message is set as cached.") number cached) (if cached (elmo-msgdb-set-flag (elmo-folder-msgdb folder) number 'cached) - (elmo-msgdb-unset-flag (elmo-folder-msgdb folder) number 'cached))) + (elmo-msgdb-unset-flag (elmo-folder-msgdb folder) number 'cached)) + (elmo-folder-notify-event folder 'cache-changed number)) (defun elmo-message-copy-entity (entity) (elmo-msgdb-copy-message-entity (elmo-message-entity-handler entity) @@ -1402,26 +1389,20 @@ If Optional LOCAL is non-nil, don't update server flag." number strategy) nil) +(defun elmo-message-fetch-string (folder number strategy + &optional + unread + section) + (with-temp-buffer + (when (elmo-message-fetch folder number strategy unread section) + (buffer-string)))) + (luna-define-method elmo-message-fetch ((folder elmo-folder) number strategy &optional - section - outbuf - unread) - (if outbuf - (with-current-buffer outbuf - (erase-buffer) - (elmo-message-fetch-with-cache-process folder number - strategy section unread)) - (with-temp-buffer - (elmo-message-fetch-with-cache-process folder number - strategy section unread) - (buffer-string)))) - -(luna-define-method elmo-message-fetch-with-cache-process ((folder elmo-folder) - number strategy - &optional - section unread) + unread + section) + (erase-buffer) (let ((cache-path (elmo-fetch-strategy-cache-path strategy)) (method-priorities (cond ((eq (elmo-fetch-strategy-use-cache strategy) 'maybe) @@ -1430,28 +1411,33 @@ If Optional LOCAL is non-nil, don't update server flag." '(cache entity)) (t '(entity)))) - result err) + result err updated-server-flag) (while (and method-priorities - (null result)) + (not result)) (setq result (case (car method-priorities) (cache (elmo-file-cache-load cache-path section)) (entity - (when (and (condition-case error - (elmo-message-fetch-internal folder number - strategy - section - unread) - (error (setq err error) nil)) - (> (buffer-size) 0)) + (when (condition-case error + (elmo-message-fetch-internal folder number + strategy + section + unread) + (error (setq err error) nil)) + (setq updated-server-flag t) (when (and (elmo-fetch-strategy-save-cache strategy) cache-path) (elmo-file-cache-save cache-path section)) t))) method-priorities (cdr method-priorities))) - (or result - (and err (signal (car err) (cdr err)))))) + (if result + (when (and (not unread) + (elmo-message-flagged-p folder number 'unread)) + (elmo-message-unset-flag folder number 'unread updated-server-flag)) + (when err + (signal (car err) (cdr err)))) + result)) (defun elmo-folder-kill-messages-range (folder beg end) (elmo-folder-set-killed-list-internal @@ -1669,6 +1655,9 @@ Return a hashtable for newsgroups." (luna-define-generic elmo-event-handler-flag-changed (handler numbers) "Notify flag of the messages with NUMBERS is changed.") +(luna-define-generic elmo-event-handler-cache-changed (handler number) + "Called when cache status of the message with NUMBER is changed.") + (defun elmo-folder-add-handler (folder handler) (unless (memq handler (elmo-folder-handlers-internal folder)) (elmo-folder-set-handlers-internal diff --git a/elmo/mmimap.el b/elmo/mmimap.el index f0e33a2..a7f0e16 100644 --- a/elmo/mmimap.el +++ b/elmo/mmimap.el @@ -148,7 +148,7 @@ CLASS, LOCATION, NODE-ID, PARENT are set to the returned entity." entity (list (mmimap-make-mime-entity (nth 8 bodystructure) class - location node-id 0 + location node-id nil entity)))) entity)))) diff --git a/wl/ChangeLog b/wl/ChangeLog index e099570..36dbd32 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,8 +1,131 @@ +2005-02-01 Tetsurou Okazaki + + * wl-thread.el (wl-thread-entity-get-descendant): Change `defsubst' + to `defun'. Use `nconc' instead of `append' to collect descendant + message numbers. + +2005-01-30 TAKAHASHI Kaoru + + * wl-thread.el (wl-thread-save-top-list) + (wl-thread-save-entities): Use `with-temp-buffer'. + * wl-news.el.in (wl-news-previous-version-load): + (wl-news-previous-version-save): Ditto. + * wl-summary.el (wl-summary-load-file-object) + (wl-summary-save-view-cache): Ditto. + +2005-01-30 Hiroya Murata + + * wl-util.el (toplevel): Require 'elmo-flag'. + (wl-read-search-condition): New function (Renamed from + `elmo-read-search-condition'). + (wl-read-search-condition-internal): Likewise. + + * wl-summary.el (wl-summary-decide-flag): Cause error if flag is + invalid. + (wl-summary-pick): Use `wl-read-search-condition' instead of + `elmo-read-search-condition'. + (wl-summary-virtual): Ditto. + + * wl-folder.el (wl-folder-virtual): Ditto. + (wl-folder-pick): Ditto. + + * wl-fldmgr.el (wl-fldmgr-make-filter): Ditto. + +2005-01-28 Hiroya Murata + + * wl-summary.el (wl-summary-reedit): Call + `wl-summary-message-string' with argument `use-cache' as `'maybe'. + +2005-01-23 Hiroya Murata + + * wl-mime.el (toplevel): Require wl-vars. + + * wl-message.el (toplevel): Require cl at compile. + + * wl-draft.el (toplevel): Require elmo. + +2005-01-20 Yoichi NAKAYAMA + + * wl-message.el (wl-message-buffer-prefetch): Count is a number + and do nothing when it is not positive. + (wl-message-buffer-prefetch-next): Ditto. + +2005-01-19 Yoichi NAKAYAMA + + * wl-summary.el (wl-summary-goto-folder-subr): Avoid error for + `wl-message-buffer-prefetch-depth' is nil though it is illegal. + (wl-summary-redisplay-internal): Ditto. + + * wl-summary.el (wl-summary-goto-folder-subr): Protect current + message (the condition is borrowed from `wl-check-variables-2'). + (wl-summary-redisplay-internal): Ditto. + +2005-01-17 Hiroya Murata + + * wl-mime.el (wl-draft-nntp-attribute): New function. + (wl-draft-attribute-nntp-posting-server): Use it. + (wl-draft-attribute-nntp-posting-port): Ditto. + + * wl-mime.el (wl-draft-preview-attributes-list): New function. + (wl-draft-show-attributes-buffer): Ditto. + (wl-draft-hide-attributes-buffer): Ditto. + (wl-draft-attribute-newsgroups): Ditto. + (wl-draft-attribute-nntp-posting-server): Ditto. + (wl-draft-attribute-nntp-posting-port): Ditto. + (wl-draft-preview-message): Use there functions. + + * wl-vars.el (wl-draft-preview-attributes-list): Change default + value. + +2005-01-11 Hiroya Murata + + * wl-draft.el (wl-draft-insert-get-message): Follow the API change. + (wl-draft-reedit): Ditto. + (wl-draft-queue-flush): Ditto. + + * wl-mime.el (wl-message-request-partial): Ditto. + (wl-message-delete-current-part): Use `elmo-message-fetch-string' + instead of `elmo-message-fetch'. + + * wl-action.el (wl-summary-exec-action-resend-subr): Ditto. + + * wl-summary.el (wl-summary-message-string): Ditto. + +2005-01-07 Hiroya Murata + + * wl-util.el (wl-current-message-buffer): Follow the API change. + + * wl-summary.el (wl-summary-redisplay-internal): Call + `wl-summary-mark-as-read' with 2nd argument as nil and update + unread count instead of persistent mark. + + * wl-message.el (wl-message-buffer-mime-entity): New buffer local + variable. + (wl-message-redisplay): Follow the API change. + (wl-message-buffer-display): Managed mime-entity directly and + return preview buffer only. + (wl-message-display-internal): Rewrite. + (wl-message-buffer-prefetch-subr): Not save return value of + `wl-message-buffer-display'. + + * Version number is increased to 2.13.1. + 2005-01-05 Hiroya Murata * wl-addrmgr.el (wl-addrmgr-pickup-entry-list): Call 'elmo-multiple-fields-body-list' with boundary specified. +2005-01-05 Yoichi NAKAYAMA + + * wl-vars.el (wl-summary-resend-use-cache): New variable. + * wl-action.el (wl-summary-exec-action-resend-subr): Use file + cache if `wl-summary-resend-use-cache' is non-nil. + +2005-01-02 Yoichi NAKAYAMA + + * wl-vars.el (wl-pop-before-smtp-stream-type): Fix range. + (wl-nntp-posting-stream-type): Ditto. + 2005-01-01 TAKAHASHI Kaoru * wl-demo.el (wl-demo-copyright-notice): Add 2005. @@ -12,6 +135,33 @@ * wl-util.el (wl-save-drafts): Avoid error on redisplaying message. +2004-12-25 Hiroya Murata + + * wl-summary.el (wl-summary-buffer-unsync-mark-number-list): + Abolish. + (wl-summary-buffer-persistent-mark-version): New internal + variable. + (wl-summary-update-mark-and-highlight-window): Check by + wl-summary-persistent-mark-invalid-p. + (wl-summary-update-status-marks): Ditto. + (elmo-event-handler-flag-changed): Rewrite. + (elmo-event-handler-cache-changed): Define. + (wl-summary-prefetch-msg): Does not update persistent mark here. + (wl-summary-delete-cache): Ditto. + (wl-summary-resume-cache-status): Ditto. + (wl-summary-jump-to-msg): Add arguments `beg' and `end'. + (wl-summary-persistent-mark-invalid-p): New function. + (wl-summary-validate-persistent-mark): Ditto. + (wl-summary-validate-persistent-mark-string): Ditto. + (wl-summary-invalidate-persistent-mark): Ditto. + (wl-summary-update-persistent-mark): Call + `wl-summary-validate-persistent-mark'. + (wl-summary-create-line): Call + `wl-summary-validate-persistent-mark-string'. + + * wl-message.el (wl-message-buffer-prefetch-subr): Set cache + status as t if cache used. + 2004-12-24 Yuuichi Teranishi * 2.12.0 is released. diff --git a/wl/wl-action.el b/wl/wl-action.el index 0d213cd..1a79a25 100644 --- a/wl/wl-action.el +++ b/wl/wl-action.el @@ -587,11 +587,16 @@ Return number if put mark succeed" (let ((beg (point))) ;; Insert the message to be resent. (insert - (with-temp-buffer - (elmo-message-fetch folder number - (elmo-make-fetch-strategy 'entire) - nil (current-buffer) 'unread) - (buffer-string))) + ;; elmo-message-fetch is erace current buffer before fetch message + (elmo-message-fetch-string folder number + (if wl-summary-resend-use-cache + (elmo-make-fetch-strategy + 'entire 'maybe nil + (elmo-file-cache-get-path + (elmo-message-field + folder number 'message-id))) + (elmo-make-fetch-strategy 'entire)) + 'unread)) (goto-char (point-min)) (search-forward "\n\n") (forward-char -1) diff --git a/wl/wl-draft.el b/wl/wl-draft.el index ce725e6..a2dd943 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -30,7 +30,7 @@ ;;; Code: ;; - +(require 'elmo) (require 'sendmail) (require 'wl-template) (require 'emu) @@ -674,11 +674,12 @@ Reply to author if WITH-ARG is non-nil." wl-draft-cite-function) (unwind-protect (progn - (elmo-message-fetch (wl-folder-get-elmo-folder fld) - number - ;; No cache. - (elmo-make-fetch-strategy 'entire) - nil mail-reply-buffer) + (with-current-buffer mail-reply-buffer + (erase-buffer) + (elmo-message-fetch (wl-folder-get-elmo-folder fld) + number + ;; No cache. + (elmo-make-fetch-strategy 'entire))) (wl-draft-yank-from-mail-reply-buffer nil)) (kill-buffer mail-reply-buffer)))) @@ -1983,8 +1984,7 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed" (switch-to-buffer-other-frame buffer) (switch-to-buffer buffer)) (set-buffer buffer) - (elmo-message-fetch draft-folder number (elmo-make-fetch-strategy 'entire) - nil (current-buffer)) + (elmo-message-fetch draft-folder number (elmo-make-fetch-strategy 'entire)) (elmo-delete-cr-buffer) (let ((mime-edit-again-ignored-field-regexp "^\\(Content-.*\\|Mime-Version\\):")) @@ -2362,8 +2362,7 @@ Automatically applied in draft sending time." (wl-draft-queue-info-operation (car msgs) 'load) (elmo-message-fetch queue-folder (car msgs) - (elmo-make-fetch-strategy 'entire) - nil (current-buffer)) + (elmo-make-fetch-strategy 'entire)) (condition-case err (setq failure (funcall wl-draft-queue-flush-send-function diff --git a/wl/wl-fldmgr.el b/wl/wl-fldmgr.el index b84d9ed..821e144 100644 --- a/wl/wl-fldmgr.el +++ b/wl/wl-fldmgr.el @@ -1040,7 +1040,7 @@ return value is diffs '(-new -unread -all)." (setq entity (nth 4 tmp))) (unless entity (error "No folder")) (wl-fldmgr-add (concat "/" - (elmo-read-search-condition + (wl-read-search-condition wl-fldmgr-make-filter-default) "/" entity)))))) diff --git a/wl/wl-folder.el b/wl/wl-folder.el index 4e53bb8..835715d 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -2926,7 +2926,7 @@ Call `wl-summary-write-current-folder' with current folder name." (unless entity (error "No folder")) (wl-folder-goto-folder-subr (concat "/" - (elmo-read-search-condition + (wl-read-search-condition wl-fldmgr-make-filter-default) "/" entity)))) @@ -2934,7 +2934,7 @@ Call `wl-summary-write-current-folder' with current folder name." (interactive) (save-excursion (let* ((condition (car (elmo-parse-search-condition - (elmo-read-search-condition + (wl-read-search-condition wl-summary-pick-field-default)))) (entity (wl-folder-get-entity-from-buffer)) (folder-list diff --git a/wl/wl-message.el b/wl/wl-message.el index 1592ddc..467845e 100644 --- a/wl/wl-message.el +++ b/wl/wl-message.el @@ -28,6 +28,7 @@ ;;; Code: ;; +(eval-when-compile (require 'cl)) (require 'wl-vars) (require 'wl-highlight) @@ -62,6 +63,7 @@ (defvar wl-message-buffer-original-buffer nil) ; original buffer. (defvar wl-message-buffer-mode-line-formatter nil) (defvar wl-message-buffer-flag-indicator nil) +(defvar wl-message-buffer-mime-entity nil) (make-variable-buffer-local 'wl-message-buffer-cur-folder) (make-variable-buffer-local 'wl-message-buffer-cur-number) @@ -71,6 +73,7 @@ (make-variable-buffer-local 'wl-message-buffer-original-buffer) (make-variable-buffer-local 'wl-message-buffer-mode-line-formatter) (make-variable-buffer-local 'wl-message-buffer-flag-indicator) +(make-variable-buffer-local 'wl-message-buffer-mime-entity) (defvar wl-fixed-window-configuration nil) @@ -451,14 +454,10 @@ Returns non-nil if bottom of message." (let* ((default-mime-charset wl-mime-charset) (buffer-read-only nil) (summary-buf (current-buffer)) - message-buf - strategy entity - cache-used - summary-win delim flags) + message-buf entity summary-win flags) (setq buffer-read-only nil) - (setq cache-used (wl-message-buffer-display - folder number display-type force-reload)) - (setq wl-message-buffer (car cache-used)) + (setq wl-message-buffer (wl-message-buffer-display + folder number display-type force-reload)) (setq message-buf wl-message-buffer) (wl-message-select-buffer wl-message-buffer) @@ -508,7 +507,6 @@ Returns non-nil if bottom of message." ; (when wl-highlight-body-too ; (wl-highlight-body)) (ignore-errors (wl-message-narrow-to-page)) - (setq cache-used (cdr cache-used)) (goto-char (point-min)) (when (re-search-forward "^$" nil t) (wl-message-add-buttons-to-header (point-min) (point)) @@ -524,18 +522,17 @@ Returns non-nil if bottom of message." (set-buffer summary-buf) (setq summary-win (get-buffer-window summary-buf)) (if (window-live-p summary-win) - (select-window summary-win)) - cache-used)) + (select-window summary-win)))) ;; Use message buffer cache. (defun wl-message-buffer-display (folder number display-type &optional force-reload unread) - (let* ((msg-id (ignore-errors (elmo-message-field folder number - 'message-id))) + (let* ((msg-id (ignore-errors + (elmo-message-field folder number 'message-id))) (fname (elmo-folder-name-internal folder)) (hit (wl-message-buffer-cache-hit (list fname number msg-id))) - (read nil) - cache-used) + (redisplay nil) + entity) (when (and hit (not (buffer-live-p hit))) (wl-message-buffer-cache-delete (list fname number msg-id)) (setq hit nil)) @@ -544,67 +541,72 @@ Returns non-nil if bottom of message." ;; move hit to the top. (wl-message-buffer-cache-sort (wl-message-buffer-cache-entry-make (list fname number msg-id) hit)) - ;; buffer cache is used. - (setq cache-used t) (with-current-buffer hit ;; Rewind to the top page (widen) (goto-char (point-min)) (ignore-errors (wl-message-narrow-to-page)) + (setq entity wl-message-buffer-mime-entity) (unless (eq wl-message-buffer-cur-display-type display-type) - (setq read t)))) + (setq redisplay t)))) ;; delete tail and add new to the top. (setq hit (wl-message-buffer-cache-add (list fname number msg-id))) - (setq read t)) - (if (or force-reload read) - (condition-case err - (save-excursion - (set-buffer hit) - (setq - cache-used - (wl-message-display-internal folder number display-type - force-reload unread)) - (setq wl-message-buffer-cur-display-type display-type)) - (quit - (wl-message-buffer-cache-delete) - (error "Display message %s/%s is quitted" fname number)) - (error - (wl-message-buffer-cache-delete) - (signal (car err) (cdr err)) - nil))) ;; will not be used - (cons hit cache-used))) - -(defun wl-message-display-internal (folder number display-type - &optional force-reload unread) + (setq redisplay t)) + (when (or force-reload redisplay) + (condition-case err + (save-excursion + (set-buffer hit) + (when (or force-reload + (null entity) + (not (elmo-mime-entity-display-p + entity + (if (wl-message-mime-analysis-p display-type) + 'mime + 'as-is)))) + (setq entity (elmo-message-mime-entity + folder + number + (wl-message-get-original-buffer) + force-reload + unread + (not (wl-message-mime-analysis-p display-type))))) + (unless entity + (error "Cannot display message %s/%s" fname number)) + (wl-message-display-internal entity display-type)) + (quit + (wl-message-buffer-cache-delete) + (error "Display message %s/%s is quitted" fname number)) + (error + (wl-message-buffer-cache-delete) + (signal (car err) (cdr err)) + nil))) ;; will not be used + hit)) + +(defun wl-message-display-internal (entity display-type) (let ((default-mime-charset wl-mime-charset) - (elmo-mime-charset wl-mime-charset)) - (setq wl-message-buffer-require-all-header - (wl-message-display-all-header-p display-type)) - (prog1 - (if (wl-message-mime-analysis-p display-type) - (elmo-mime-message-display folder number - (current-buffer) - (wl-message-get-original-buffer) - 'wl-original-message-mode - force-reload - unread - (wl-message-define-keymap)) - (let* ((elmo-mime-display-header-analysis - (wl-message-mime-analysis-p display-type 'header)) - (wl-highlight-x-face-function - (and elmo-mime-display-header-analysis - wl-highlight-x-face-function))) - (prog1 (elmo-mime-display-as-is folder number - (current-buffer) - (wl-message-get-original-buffer) - 'wl-original-message-mode - force-reload - unread - (wl-message-define-keymap)) - (let (buffer-read-only) - (wl-highlight-message (point-min) (point-max) t))))) - (run-hooks 'wl-message-display-internal-hook) - (setq buffer-read-only t)))) + (elmo-mime-charset wl-mime-charset) + (wl-message-buffer-require-all-header + (wl-message-display-all-header-p display-type))) + (if (wl-message-mime-analysis-p display-type) + (elmo-mime-entity-display entity + (current-buffer) + 'wl-original-message-mode + (wl-message-define-keymap)) + (let* ((elmo-mime-display-header-analysis + (wl-message-mime-analysis-p display-type 'header)) + (wl-highlight-x-face-function + (and elmo-mime-display-header-analysis + wl-highlight-x-face-function))) + (elmo-mime-entity-display-as-is entity + (current-buffer) + 'wl-original-message-mode + (wl-message-define-keymap)) + (let (buffer-read-only) + (wl-highlight-message (point-min) (point-max) t)))) + (setq wl-message-buffer-cur-display-type display-type + wl-message-buffer-mime-entity entity) + (run-hooks 'wl-message-display-internal-hook) + (setq buffer-read-only t))) (defun wl-message-buffer-prefetch-p (folder &optional number) (and (or (not number) @@ -682,7 +684,7 @@ Returns non-nil if bottom of message." &optional summary charset) (let* ((summary (or summary (get-buffer wl-summary-buffer-name))) (num number)) - (when (and count + (when (and (> count 0) (wl-message-buffer-prefetch-p folder)) (unless (wl-message-buffer-prefetch-p folder number) (setq num @@ -696,7 +698,7 @@ Returns non-nil if bottom of message." &optional summary charset) (let* ((summary (or summary (get-buffer wl-summary-buffer-name))) next) - (when (and count + (when (and (> count 0) (wl-message-buffer-prefetch-p folder)) (setq next (wl-message-buffer-prefetch-get-next folder number summary)) (when next @@ -721,7 +723,7 @@ Returns non-nil if bottom of message." (display-type (wl-message-make-display-type wl-summary-buffer-display-mime-mode wl-summary-buffer-display-header-mode)) - result time1 time2 sec micro) + time1 time2 sec micro) (when wl-message-buffer-prefetch-debug (message "%d: count %d, hit %s" number count (buffer-name hit))) (if (and hit (buffer-live-p hit)) @@ -737,8 +739,10 @@ Returns non-nil if bottom of message." (when wl-message-buffer-prefetch-debug (setq time1 (current-time)) (message "Prefetching %d..." number)) - (setq result (wl-message-buffer-display - folder number display-type nil 'unread)) + (wl-message-buffer-display folder number + display-type nil 'unread) + (when (elmo-message-use-cache-p folder number) + (elmo-message-set-cached folder number t)) (when wl-message-buffer-prefetch-debug (setq time2 (current-time)) (setq sec (- (nth 1 time2)(nth 1 time1))) diff --git a/wl/wl-mime.el b/wl/wl-mime.el index 1606ee0..26a4052 100644 --- a/wl/wl-mime.el +++ b/wl/wl-mime.el @@ -28,11 +28,11 @@ ;;; Code: ;; - (require 'mime-view) (require 'mime-edit) (require 'mime-play) (require 'elmo) +(require 'wl-vars) (eval-when-compile (defalias-maybe 'pgg-decrypt-region 'ignore) @@ -176,6 +176,51 @@ It calls following-method selected from variable (defalias 'wl-draft-enclose-digest-region 'mime-edit-enclose-digest-region) +(defun wl-draft-preview-attributes-list () + (if (listp (car wl-draft-preview-attributes-list)) + (elmo-uniq-list + (append (and (wl-message-mail-p) + (cdr (assq 'mail wl-draft-preview-attributes-list))) + (and (wl-message-news-p) + (cdr (assq 'news wl-draft-preview-attributes-list))))) + wl-draft-preview-attributes-list)) + +(defun wl-draft-show-attributes-buffer (attribute-values) + (let* ((cur-win (selected-window)) + (size (min + (- (window-height cur-win) + window-min-height 1) + (- (window-height cur-win) + (max + window-min-height + (1+ wl-draft-preview-attributes-buffer-lines)))))) + (split-window cur-win (if (> size 0) size window-min-height)) + (select-window (next-window)) + (let ((pop-up-windows nil)) + (switch-to-buffer (get-buffer-create + wl-draft-preview-attributes-buffer-name))) + (with-current-buffer + (get-buffer wl-draft-preview-attributes-buffer-name) + (setq buffer-read-only t) + (let (buffer-read-only) + (erase-buffer) + (dolist (pair attribute-values) + (insert (capitalize (symbol-name (car pair))) ": " + (format "%s" (or (cdr pair) "")) + "\n")) + (goto-char (point-min)) + (wl-highlight-headers))) + (select-window cur-win))) + +(defun wl-draft-hide-attributes-buffer () + (let (window buffer) + (when (setq window (get-buffer-window + wl-draft-preview-attributes-buffer-name)) + (select-window window) + (delete-window)) + (when (setq buffer (get-buffer wl-draft-preview-attributes-buffer-name)) + (kill-buffer buffer)))) + (defun wl-draft-attribute-recipients () (concat (mapconcat 'identity @@ -206,6 +251,36 @@ It calls following-method selected from variable (or wl-smtp-posting-port (progn (require 'smtp) smtp-service))) +(defun wl-draft-attribute-newsgroups () + (std11-field-body "Newsgroups")) + +(defun wl-draft-nntp-attribute (attribute &optional alternatives) + (let ((config (cdr (elmo-string-matched-assoc + (std11-field-body "newsgroups") + wl-nntp-posting-config-alist))) + entry) + (when (stringp config) + (setq config (list (cons 'server config)))) + (if (setq entry (assq attribute config)) + ;; maybe nil + (cdr entry) + (let (value) + (while alternatives + (if (setq value (symbol-value (car alternatives))) + (setq alternatives nil) + (setq alternatives (cdr alternatives)))) + value)))) + +(defun wl-draft-attribute-nntp-posting-server () + (wl-draft-nntp-attribute + 'server + '(wl-nntp-posting-server elmo-nntp-default-server))) + +(defun wl-draft-attribute-nntp-posting-port () + (wl-draft-nntp-attribute + 'point + '(wl-nntp-posting-port elmo-nntp-default-port))) + (defun wl-draft-attribute-value (attr) (let ((name (symbol-name attr)) fsymbol symbol) @@ -235,7 +310,7 @@ It calls following-method selected from variable (defun wl-draft-preview-message () "Preview editing message." (interactive) - (let* (attribute-list + (let* (attribute-values (orig-buffer (current-buffer)) (current-point (point)) (config-exec-flag wl-draft-config-exec-flag) @@ -249,29 +324,30 @@ It calls following-method selected from variable (symbol-value 'mime-header-encode-method-alist)))) mime-view-ignored-field-list ; all header. (mime-edit-translate-buffer-hook - (append - (list - (lambda () - (let ((wl-draft-config-exec-flag config-exec-flag) - (wl-draft-parent-folder parent-folder) - (copy-buffer (current-buffer))) + (cons + (lambda () + (let ((wl-draft-config-exec-flag config-exec-flag) + (wl-draft-parent-folder parent-folder) + (copy-buffer (current-buffer))) + (wl-copy-local-variables + orig-buffer + copy-buffer (with-current-buffer orig-buffer - (wl-copy-local-variables - orig-buffer - copy-buffer - (append wl-draft-config-variables - (wl-draft-clone-local-variables)))) - (goto-char current-point) - (run-hooks 'wl-draft-send-hook) - (condition-case err - (setq attribute-list - (mapcar - (lambda (attr) - (cons attr (wl-draft-attribute-value attr))) - wl-draft-preview-attributes-list)) - (error - (kill-buffer (current-buffer)) - (signal (car err) (cdr err))))))) + (append wl-draft-config-variables + (wl-draft-clone-local-variables)))) + (goto-char current-point) + (run-hooks 'wl-draft-send-hook) + (condition-case err + (setq attribute-values + (mapcar + (lambda (attr) + (cons attr (wl-draft-attribute-value attr))) + (if wl-draft-preview-attributes + (wl-draft-preview-attributes-list) + '(recipients)))) + (error + (kill-buffer (current-buffer)) + (signal (car err) (cdr err)))))) mime-edit-translate-buffer-hook))) (mime-edit-preview-message) (make-local-variable 'mime-preview-quitting-method-alist) @@ -282,46 +358,12 @@ It calls following-method selected from variable (wl-highlight-body)) (run-hooks 'wl-draft-preview-message-hook)) (make-local-hook 'kill-buffer-hook) - (add-hook 'kill-buffer-hook - (lambda () - (when (get-buffer-window - wl-draft-preview-attributes-buffer-name) - (select-window (get-buffer-window - wl-draft-preview-attributes-buffer-name)) - (delete-window)) - (when (get-buffer wl-draft-preview-attributes-buffer-name) - (kill-buffer (get-buffer - wl-draft-preview-attributes-buffer-name)))) - nil t) - (if (not wl-draft-preview-attributes) - (message (concat "Recipients: " - (cdr (assq 'recipients attribute-list)))) - (ignore-errors ; in case when the window is too small - (let* ((cur-win (selected-window)) - (size (min - (- (window-height cur-win) - window-min-height 1) - (- (window-height cur-win) - (max - window-min-height - (1+ wl-draft-preview-attributes-buffer-lines)))))) - (split-window cur-win (if (> size 0) size window-min-height)) - (select-window (next-window)) - (let ((pop-up-windows nil)) - (switch-to-buffer (get-buffer-create - wl-draft-preview-attributes-buffer-name))) - (with-current-buffer - (get-buffer wl-draft-preview-attributes-buffer-name) - (setq buffer-read-only t) - (let (buffer-read-only) - (erase-buffer) - (dolist (pair attribute-list) - (insert (capitalize (symbol-name (car pair))) ": " - (format "%s" (or (cdr pair) "")) - "\n")) - (goto-char (point-min)) - (wl-highlight-headers))) - (select-window cur-win)))))) + (add-hook 'kill-buffer-hook #'wl-draft-hide-attributes-buffer nil t) + (if wl-draft-preview-attributes + (ignore-errors ; in case when the window is too small + (wl-draft-show-attributes-buffer attribute-values)) + (message (concat "Recipients: " + (cdr (assq 'recipients attribute-values))))))) (defalias 'wl-draft-caesar-region 'mule-caesar-region) @@ -354,8 +396,6 @@ It calls following-method selected from variable (elmo-message-fetch (wl-folder-get-elmo-folder folder) number (elmo-make-fetch-strategy 'entire) - nil - (current-buffer) 'unread) (mime-parse-buffer nil))) @@ -394,8 +434,9 @@ It calls following-method selected from variable (with-current-buffer orig-buf (unless (string-equal (buffer-string) - (elmo-message-fetch folder number - (elmo-make-fetch-strategy 'entire))) + (elmo-message-fetch-string + folder number + (elmo-make-fetch-strategy 'entire))) (error "Buffer content differs from actual message"))) (when (and (elmo-folder-writable-p folder) (buffer-live-p orig-buf) diff --git a/wl/wl-news.el.in b/wl/wl-news.el.in index 4ca7839..1996f83 100644 --- a/wl/wl-news.el.in +++ b/wl/wl-news.el.in @@ -68,42 +68,33 @@ ;;; -*- news-list-end -*- (defun wl-news-previous-version-load () - (save-excursion + (with-temp-buffer (let ((filename (expand-file-name wl-news-version-file-name elmo-msgdb-directory)) - (tmp-buffer (get-buffer-create " *wl-news-version-tmp*")) insert-file-contents-pre-hook insert-file-contents-post-hook ret-val) (if (not (file-readable-p filename)) (cons wl-news-default-previous-version wl-news-default-previous-version) - (set-buffer tmp-buffer) (insert-file-contents filename) - (setq ret-val - (condition-case nil - (read (current-buffer)) - (error nil nil))) - (kill-buffer tmp-buffer) - ret-val)))) + (condition-case nil + (read (current-buffer)) + (error nil nil)))))) (defun wl-news-previous-version-save (current-version previous-version) - (save-excursion + (with-temp-buffer (let ((filename (expand-file-name wl-news-version-file-name elmo-msgdb-directory)) - (tmp-buffer (get-buffer-create " *wl-news-version-tmp*")) print-length print-level) - (set-buffer tmp-buffer) - (erase-buffer) - (prin1 (cons current-version previous-version) tmp-buffer) - (princ "\n" tmp-buffer) + (prin1 (cons current-version previous-version) (current-buffer)) + (princ "\n" (current-buffer)) (if (file-writable-p filename) (write-region (point-min) (point-max) filename nil 'no-msg) - (message "%s is not writable." filename)) - (kill-buffer tmp-buffer)))) + (message "%s is not writable." filename))))) (defun wl-news-append-news (lang previous-version &optional no-mime-tag) (require 'wl-mime) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 8cee114..d895a91 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -91,7 +91,7 @@ (defvar wl-summary-buffer-temp-mark-column nil) (defvar wl-summary-buffer-persistent-mark-column nil) -(defvar wl-summary-buffer-unsync-mark-number-list nil) +(defvar wl-summary-buffer-persistent-mark-version 0) (defvar wl-summary-buffer-persistent nil) (defvar wl-summary-buffer-thread-nodes nil) @@ -156,7 +156,7 @@ (make-variable-buffer-local 'wl-summary-buffer-number-column) (make-variable-buffer-local 'wl-summary-buffer-temp-mark-column) (make-variable-buffer-local 'wl-summary-buffer-persistent-mark-column) -(make-variable-buffer-local 'wl-summary-buffer-unsync-mark-number-list) +(make-variable-buffer-local 'wl-summary-buffer-persistent-mark-version) (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) @@ -612,7 +612,8 @@ See also variable `wl-use-petname'." (save-excursion (goto-char beg) (while (and (< (point) end) (not (eobp))) - (when (null (get-text-property (point) 'face)) + (when (or (null (get-text-property (point) 'face)) + (wl-summary-persistent-mark-invalid-p)) (setq number (wl-summary-message-number)) (when number (setq flags (elmo-message-flags wl-summary-buffer-elmo-folder @@ -658,10 +659,49 @@ See also variable `wl-use-petname'." numbers) (save-excursion (set-buffer (wl-summary-event-handler-buffer-internal handler)) - (dolist (number numbers) - (when (and (wl-summary-message-visible-p number) - (wl-summary-jump-to-msg number)) - (wl-summary-update-persistent-mark number))))) + (let ((window-list (get-buffer-window-list (current-buffer) 'nomini t)) + invalidate) + (dolist (number numbers) + (when (wl-summary-message-visible-p number) + (if (catch 'visible + (let ((window-list window-list) + win) + (while (setq win (car window-list)) + (when (wl-summary-jump-to-msg number + (window-start win) + (window-end win)) + (throw 'visible t)) + (setq window-list (cdr window-list))))) + (wl-summary-update-persistent-mark number) + (setq invalidate t)))) + (when invalidate + (wl-summary-invalidate-persistent-mark) + (dolist (win window-list) + (wl-summary-validate-persistent-mark + (window-start win) + (window-end win))))))) + +(luna-define-method elmo-event-handler-cache-changed + ((handler wl-summary-event-handler) number) + (save-excursion + (set-buffer (wl-summary-event-handler-buffer-internal handler)) + (let ((window-list (get-buffer-window-list (current-buffer) 'nomini t))) + (when (wl-summary-message-visible-p number) + (if (catch 'visible + (let ((window-list window-list) + win) + (while (setq win (car window-list)) + (when (wl-summary-jump-to-msg number + (window-start win) + (window-end win)) + (throw 'visible t)) + (setq window-list (cdr window-list))))) + (wl-summary-update-persistent-mark number) + (wl-summary-invalidate-persistent-mark) + (dolist (win window-list) + (wl-summary-validate-persistent-mark + (window-start win) + (window-end win)))))))) (defun wl-summary-buffer-detach () (when (and (eq major-mode 'wl-summary-mode) @@ -706,21 +746,18 @@ If optional USE-CACHE is non-nil, use cache if exists." (folder wl-summary-buffer-elmo-folder)) (if (null number) (message "No message.") - (elmo-set-work-buf - (elmo-message-fetch folder - number - (elmo-make-fetch-strategy - 'entire - use-cache ; use cache - nil ; save cache (should `t'?) - (and - use-cache - (elmo-file-cache-get-path - (elmo-message-field folder number 'message-id)))) - nil - (current-buffer) - 'unread) - (buffer-string))))) + (elmo-message-fetch-string folder + number + (elmo-make-fetch-strategy + 'entire + use-cache ; use cache + nil ; save cache (should `t'?) + (and + use-cache + (elmo-file-cache-get-path + (elmo-message-field folder number + 'message-id)))) + 'unread)))) (defun wl-summary-reedit (&optional arg) "Re-edit current message. @@ -728,7 +765,7 @@ If ARG is non-nil, Supersedes message" (interactive "P") (wl-summary-toggle-disp-msg 'off) (cond - ((not (wl-summary-message-number)) + ((null (wl-summary-message-number)) (message "No message.")) (arg (wl-summary-supersedes-message)) @@ -738,7 +775,7 @@ If ARG is non-nil, Supersedes message" (mail-position-on-field "Newsgroups") (mail-position-on-field "To"))) (t - (wl-draft-edit-string (wl-summary-message-string))))) + (wl-draft-edit-string (wl-summary-message-string 'maybe))))) (defun wl-summary-resend-bounced-mail () "Re-mail the current message. @@ -1075,7 +1112,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." wl-thread-entities nil wl-summary-scored nil wl-summary-buffer-number-list nil - wl-summary-buffer-unsync-mark-number-list nil + wl-summary-buffer-persistent-mark-version 0 wl-summary-buffer-target-mark-list nil wl-summary-buffer-temp-mark-list nil wl-summary-delayed-update nil) @@ -1548,20 +1585,11 @@ If ARG is non-nil, checking is omitted." (save-excursion (save-match-data ;; online - (if (or arg (not file-cached)) - (elmo-message-encache - wl-summary-buffer-elmo-folder - number)) + (when (or arg (not file-cached)) + (elmo-message-encache wl-summary-buffer-elmo-folder + number)) (elmo-message-set-cached wl-summary-buffer-elmo-folder - number t) - (when (and (wl-summary-jump-to-msg number) - (wl-summary-update-persistent-mark)) - (sit-for 0) - (wl-summary-count-unread) - (wl-summary-update-modeline) - (wl-folder-update-unread - (wl-summary-buffer-folder-name) - wl-summary-buffer-unread-count))) + number t)) t) nil))))) @@ -1741,7 +1769,7 @@ If ARG is non-nil, checking is omitted." number) (setq number (wl-summary-message-number)) (elmo-message-set-cached folder number nil) - (when (wl-summary-update-persistent-mark) + (ignore-errors (elmo-file-cache-delete (elmo-file-cache-get-path (elmo-message-field wl-summary-buffer-elmo-folder @@ -1761,7 +1789,6 @@ If ARG is non-nil, checking is omitted." (setq msgid (elmo-message-field folder number 'message-id)) (elmo-message-set-cached folder number (elmo-file-cache-exists-p msgid)) - (wl-summary-update-persistent-mark) (forward-line 1)) (wl-summary-count-unread) (wl-summary-update-modeline) @@ -1815,12 +1842,7 @@ If ARG is non-nil, checking is omitted." (goto-char beg) (while (and (< (point) end) (not (eobp))) (when (or (not check) - (let ((number (wl-summary-message-number))) - (when (memq number wl-summary-buffer-unsync-mark-number-list) - (setq wl-summary-buffer-unsync-mark-number-list - (delq number - wl-summary-buffer-unsync-mark-number-list)) - t))) + (wl-summary-persistent-mark-invalid-p)) (wl-summary-update-persistent-mark)) (forward-line 1)))) @@ -2075,18 +2097,27 @@ This function is defined for `window-scroll-functions'" (setq wl-summary-buffer-mode-line (funcall wl-summary-buffer-mode-line-formatter))) -(defun wl-summary-jump-to-msg (&optional number) +(defun wl-summary-jump-to-msg (&optional number beg end) (interactive "NJump to Number:") (let ((num (or number (string-to-int - (read-from-minibuffer "Jump to Message(No.): "))))) - (setq num (int-to-string num)) - (beginning-of-line) - (if (or (and (re-search-forward (concat "\r" num "[^0-9]") nil t) - (progn (backward-char 1) t)) - (re-search-backward (concat "\r" num "[^0-9]") nil t)) - (progn (beginning-of-line) t) - nil))) + (read-from-minibuffer "Jump to Message(No.): ")))) + (pos (point)) + regexp) + (setq regexp (concat "\r" (int-to-string num) "[^0-9]")) + (if (and beg end (or (< pos beg) (< end pos))) + (progn + (goto-char beg) + (if (re-search-forward regexp end t) + (progn (backward-char 1) (beginning-of-line) t) + (goto-char pos) + nil)) + (beginning-of-line) + (if (or (and (re-search-forward regexp end t) + (progn (backward-char 1) t)) + (re-search-backward regexp beg t)) + (progn (beginning-of-line) t) + nil)))) (defun wl-summary-highlight-msgs (msgs) (save-excursion @@ -2162,21 +2193,16 @@ If ARG, without confirm." (defun wl-summary-load-file-object (filename) "Load lisp object from dir." - (save-excursion - (let ((tmp-buffer (get-buffer-create " *wl-summary-load-file-object*")) - insert-file-contents-pre-hook ; To avoid autoconv-xmas... + (with-temp-buffer + (let (insert-file-contents-pre-hook ; To avoid autoconv-xmas... insert-file-contents-post-hook ret-val) (if (not (file-readable-p filename)) () - (set-buffer tmp-buffer) (as-binary-input-file (insert-file-contents filename)) - (setq ret-val - (condition-case nil - (read (current-buffer)) - (error (error "Reading failed"))))) - (kill-buffer tmp-buffer) - ret-val))) + (condition-case nil + (read (current-buffer)) + (error (error "Reading failed"))))))) (defun wl-summary-goto-folder (&optional arg) (interactive "P") @@ -2239,7 +2265,7 @@ If ARG, without confirm." wl-summary-buffer-message-modified wl-summary-buffer-thread-modified wl-summary-buffer-number-list - wl-summary-buffer-unsync-mark-number-list + wl-summary-buffer-persistent-mark-version wl-summary-buffer-folder-name wl-summary-buffer-line-formatter) (and (eq wl-summary-buffer-view 'thread) @@ -2368,6 +2394,7 @@ If ARG, without confirm." (setq wl-summary-buffer-disp-msg nil) (setq wl-summary-buffer-last-displayed-msg nil) (setq wl-summary-buffer-current-msg nil) + (setq wl-summary-buffer-persistent-mark-version 0) (let ((inhibit-read-only t) (buffer-read-only nil)) (erase-buffer) @@ -2405,8 +2432,6 @@ If ARG, without confirm." (wl-summary-update-modeline))) (unless (eq wl-summary-buffer-view 'thread) (wl-summary-make-number-list)) - (setq wl-summary-buffer-unsync-mark-number-list - (copy-sequence wl-summary-buffer-number-list)) (when (and wl-summary-cache-use (or (and wl-summary-check-line-format (wl-summary-line-format-changed-p)) @@ -2484,7 +2509,8 @@ If ARG, without confirm." (wl-message-buffer-prefetch folder (wl-summary-message-number) - wl-message-buffer-prefetch-depth + (min (or wl-message-buffer-prefetch-depth 0) + (1- wl-message-buffer-cache-size)) (current-buffer) wl-summary-buffer-mime-charset)) (if mes (message "%s" mes)) @@ -2800,7 +2826,7 @@ If ARG, without confirm." 'in-msgdb) (error "No messages"))) (condition (car (elmo-parse-search-condition - (elmo-read-search-condition + (wl-read-search-condition wl-summary-pick-field-default)))) (result (elmo-folder-search wl-summary-buffer-elmo-folder condition @@ -2841,7 +2867,7 @@ If ARG, exit virtual folder." (if arg (wl-summary-unvirtual) (wl-summary-goto-folder-subr (concat "/" - (elmo-read-search-condition + (wl-read-search-condition wl-summary-pick-field-default) "/" (wl-summary-buffer-folder-name)) @@ -2877,6 +2903,31 @@ If ARG, exit virtual folder." (wl-summary-get-score-mark number) " "))) +(defun wl-summary-persistent-mark-invalid-p () + (not + (equal + ;; mey be nil. + (get-text-property (point) 'wl-summary-persistent-mark-version) + wl-summary-buffer-persistent-mark-version))) + +(defun wl-summary-validate-persistent-mark (beg end) + (let ((inhibit-read-only t) + (buffer-read-only nil)) + (put-text-property beg end + 'wl-summary-persistent-mark-version + wl-summary-buffer-persistent-mark-version) + (set-buffer-modified-p nil))) + +(defun wl-summary-validate-persistent-mark-string (string) + (put-text-property 0 (length string) + 'wl-summary-persistent-mark-version + wl-summary-buffer-persistent-mark-version + string)) + +(defun wl-summary-invalidate-persistent-mark () + (setq wl-summary-buffer-persistent-mark-version + (1+ wl-summary-buffer-persistent-mark-version))) + (defsubst wl-summary-persistent-mark-string (folder flags cached) "Return the persistent mark string. The mark is decided according to the FOLDER, FLAGS and CACHED." @@ -3058,11 +3109,14 @@ Return non-nil if the mark is updated" (buffer-read-only nil) (mark (buffer-substring (- (point) 1) (point))) (new-mark (wl-summary-persistent-mark number flags))) - (unless (string= new-mark mark) - (delete-backward-char 1) - (insert new-mark) - (wl-summary-set-message-modified) - t)))) + (prog1 + (unless (string= new-mark mark) + (delete-backward-char 1) + (insert new-mark) + (wl-summary-set-message-modified) + t) + (wl-summary-validate-persistent-mark (point-at-bol) + (point-at-eol)))))) (when wl-summary-highlight (wl-highlight-summary-current-line)) (set-buffer-modified-p nil))) @@ -3278,6 +3332,8 @@ Return non-nil if the mark is updated" (unless (memq flag elmo-global-flags) (when (elmo-local-flag-p flag) (error "Cannot treat `%s'." flag)) + (unless (elmo-flag-valid-p flag) + (error "Invalid char in `%s'" flag)) (if (y-or-n-p (format "Flag `%s' is not registered yet. Register?" (capitalize (symbol-name flag)))) (setq elmo-global-flags (append @@ -3494,6 +3550,7 @@ Return non-nil if the mark is updated" (number-to-string (elmo-message-entity-number wl-message-entity)))) + (wl-summary-validate-persistent-mark-string line) (if wl-summary-highlight (wl-highlight-summary-line-string (elmo-message-entity-number wl-message-entity) @@ -3620,11 +3677,9 @@ Return non-nil if the mark is updated" (write-region-as-binary (point-min)(point-max) cache nil 'no-msg))) (when (file-writable-p view) ; 'thread or 'sequence - (save-excursion - (set-buffer tmp-buffer) - (erase-buffer) - (prin1 save-view tmp-buffer) - (princ "\n" tmp-buffer) + (with-temp-buffer + (prin1 save-view (current-buffer)) + (princ "\n" (current-buffer)) (write-region (point-min) (point-max) view nil 'no-msg)))) ;; kill tmp buffer. (kill-buffer tmp-buffer)))))) @@ -4485,7 +4540,7 @@ If ARG is numeric number, decode message as following: (num (or number (wl-summary-message-number))) (wl-mime-charset wl-summary-buffer-mime-charset) (default-mime-charset wl-summary-buffer-mime-charset) - no-folder-mark fld-buf fld-win thr-entity + fld-buf fld-win thr-entity (elmo-message-fetch-confirm (or elmo-message-fetch-confirm (and force-reload elmo-message-fetch-threshold)))) @@ -4507,43 +4562,39 @@ If ARG is numeric number, decode message as following: (if (setq fld-win (get-buffer-window fld-buf)) (delete-window fld-win))) (setq wl-current-summary-buffer (current-buffer)) - (setq no-folder-mark - ;; If cache is used, change folder-mark. - (if (wl-message-redisplay - folder num - (wl-message-make-display-type - (or mime-mode - (wl-summary-buffer-display-mime-mode)) - (or header-mode - (wl-summary-buffer-display-header-mode))) - (or force-reload - (string= (elmo-folder-name-internal folder) - wl-draft-folder))) - nil - ;; plugged, then leave folder-mark. - (if (and (not (elmo-folder-local-p - wl-summary-buffer-elmo-folder)) - (elmo-folder-plugged-p - wl-summary-buffer-elmo-folder)) - 'leave))) + (wl-message-redisplay folder num + (wl-message-make-display-type + (or mime-mode + (wl-summary-buffer-display-mime-mode)) + (or header-mode + (wl-summary-buffer-display-header-mode))) + (or force-reload + (string= (elmo-folder-name-internal folder) + wl-draft-folder))) (when (elmo-message-use-cache-p folder num) (elmo-message-set-cached folder num t)) (ignore-errors (if (elmo-message-flagged-p wl-summary-buffer-elmo-folder num 'unread) - (wl-summary-mark-as-read num no-folder-mark) - (wl-summary-update-persistent-mark))) + (wl-summary-mark-as-read num) + (wl-summary-count-unread) + (wl-summary-update-modeline) + (wl-folder-update-unread + (wl-summary-buffer-folder-name) + wl-summary-buffer-unread-count))) (setq wl-summary-buffer-current-msg num) (when wl-summary-recenter (recenter (/ (- (window-height) 2) 2)) (if (not wl-summary-indent-length-limit) (wl-horizontal-recenter))) (wl-highlight-summary-displaying) - (wl-message-buffer-prefetch-next folder num - wl-message-buffer-prefetch-depth - (current-buffer) - wl-summary-buffer-mime-charset) + (wl-message-buffer-prefetch-next + folder num + (min (or wl-message-buffer-prefetch-depth 0) + (1- wl-message-buffer-cache-size)) + (current-buffer) + wl-summary-buffer-mime-charset) (run-hooks 'wl-summary-redisplay-hook)) (message "No message to display.")))) diff --git a/wl/wl-thread.el b/wl/wl-thread.el index ad69175..655407a 100644 --- a/wl/wl-thread.el +++ b/wl/wl-thread.el @@ -119,30 +119,22 @@ (defun wl-thread-save-top-list (dir) (let ((top-file (expand-file-name wl-thread-entity-list-file dir)) (entity wl-thread-entity-list) - (tmp-buffer (get-buffer-create " *wl-thread-save-top-list*")) print-length) - (save-excursion - (set-buffer tmp-buffer) - (erase-buffer) + (with-temp-buffer (when (file-writable-p top-file) - (prin1 entity tmp-buffer) - (princ "\n" tmp-buffer) - (write-region (point-min) (point-max) top-file nil 'no-msg) - (kill-buffer tmp-buffer))))) + (prin1 entity (current-buffer)) + (princ "\n" (current-buffer)) + (write-region (point-min) (point-max) top-file nil 'no-msg))))) (defun wl-thread-save-entities (dir) (let ((top-file (expand-file-name wl-thread-entity-file dir)) (entities wl-thread-entities) - (tmp-buffer (get-buffer-create " *wl-thread-save-entities*")) print-length print-level) - (save-excursion - (set-buffer tmp-buffer) - (erase-buffer) + (with-temp-buffer (when (file-writable-p top-file) - (prin1 entities tmp-buffer) - (princ "\n" tmp-buffer) - (write-region (point-min) (point-max) top-file nil 'no-msg) - (kill-buffer tmp-buffer))))) + (prin1 entities (current-buffer)) + (princ "\n" (current-buffer)) + (write-region (point-min) (point-max) top-file nil 'no-msg))))) (defsubst wl-thread-entity-get-number (entity) (nth 0 entity)) @@ -231,7 +223,7 @@ (setq entity (wl-thread-get-entity (car msgs)))) ret-val)) -(defsubst wl-thread-entity-get-descendant (entity) +(defun wl-thread-entity-get-descendant (entity) (let (children ret-val msgs-stack (msgs (list (car entity)))) @@ -241,7 +233,7 @@ (if (null children) (while (and (null msgs) msgs-stack) (setq msgs (wl-pop msgs-stack))) - (setq ret-val (append ret-val (copy-sequence children))) + (setq ret-val (nconc ret-val (copy-sequence children))) (wl-push msgs msgs-stack) (setq msgs children)) (setq entity (wl-thread-get-entity (car msgs)))) diff --git a/wl/wl-util.el b/wl/wl-util.el index eba2e3c..114cdf3 100644 --- a/wl/wl-util.el +++ b/wl/wl-util.el @@ -33,8 +33,8 @@ ;;; Code: ;; (require 'bytecomp) -(eval-when-compile - (require 'elmo-util)) +(require 'elmo-util) +(require 'elmo-flag) (condition-case nil (require 'pp) (error nil)) @@ -536,11 +536,11 @@ that `read' can handle, whenever this is possible." (with-current-buffer wl-current-summary-buffer (or wl-message-buffer (and (wl-summary-message-number) - (car (wl-message-buffer-display - wl-summary-buffer-elmo-folder - (wl-summary-message-number) - wl-summary-buffer-display-mime-mode - nil nil))))))) + (wl-message-buffer-display + wl-summary-buffer-elmo-folder + (wl-summary-message-number) + wl-summary-buffer-display-mime-mode + nil nil)))))) (defmacro wl-kill-buffers (regexp) (` (mapcar (function @@ -1043,6 +1043,72 @@ is enclosed by at least one regexp grouping construct." (with-current-buffer src (symbol-value variable)))))) +;;; Search Condition +(defun wl-read-search-condition (default) + "Read search condition string interactively." + (wl-read-search-condition-internal "Search by" default)) + +(defun wl-read-search-condition-internal (prompt default &optional paren) + (let* ((completion-ignore-case t) + (denial-fields (nconc (mapcar 'capitalize elmo-msgdb-extra-fields) + '("Flag" "Since" "Before" + "From" "Subject" "To" "Cc" "Body" "ToCc"))) + (field (completing-read + (format "%s (%s): " prompt default) + (mapcar 'list + (append '("AND" "OR" "Last" "First") + denial-fields + (mapcar (lambda (f) (concat "!" f)) + denial-fields))))) + value) + (setq field (if (string= field "") + (setq field default) + field)) + (cond + ((or (string= field "AND") (string= field "OR")) + (concat (if paren "(" "") + (wl-read-search-condition-internal + (concat field "(1) Search by") default 'paren) + (if (string= field "AND") "&" "|") + (wl-read-search-condition-internal + (concat field "(2) Search by") default 'paren) + (if paren ")" ""))) + ((string-match "Since\\|Before" field) + (let ((default (format-time-string "%Y-%m-%d"))) + (setq value (completing-read + (format "Value for '%s' [%s]: " field default) + (mapcar (function + (lambda (x) + (list (format "%s" (car x))))) + elmo-date-descriptions))) + (concat (downcase field) ":" + (if (equal value "") default value)))) + ((string-match "!?Flag" field) + (while (null value) + (setq value (downcase + (completing-read + (format "Value for '%s': " field) + (mapcar (lambda (f) (list (capitalize (symbol-name f)))) + (elmo-uniq-list + (append + '(unread answered forwarded digest any) + elmo-global-flags) + #'delq))))) + (unless (elmo-flag-valid-p value) + (message "Invalid char in `%s'" value) + (setq value nil) + (sit-for 1))) + (unless (string-match (concat "^" elmo-condition-atom-regexp "$") + value) + (setq value (prin1-to-string value))) + (concat (downcase field) ":" value)) + (t + (setq value (read-from-minibuffer (format "Value for '%s': " field))) + (unless (string-match (concat "^" elmo-condition-atom-regexp "$") + value) + (setq value (prin1-to-string value))) + (concat (downcase field) ":" value))))) + (require 'product) (product-provide (provide 'wl-util) (require 'wl-version)) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 6a7d702..6aea055 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -631,7 +631,8 @@ If nil, `elmo-pop3-default-port' is used." (defcustom wl-pop-before-smtp-stream-type nil "*Stream type for POP-before-SMTP. If nil, `elmo-pop3-default-stream-type' is used." - :type 'boolean + :type '(choice (const :tag "Use `elmo-pop3-default-stream-type'" nil) + symbol) :group 'wl) (defcustom wl-pop-before-smtp-authenticate-type nil @@ -668,7 +669,8 @@ If nil, `elmo-nntp-default-port' is used." (defcustom wl-nntp-posting-stream-type nil "*Stream type for posting Netnews. If nil, `elmo-nntp-default-stream-type' is used." - :type 'boolean + :type '(choice (const :tag "Use `elmo-nntp-default-stream-type'" nil) + symbol) :group 'wl) (defcustom wl-nntp-posting-function 'elmo-nntp-post "A function to post news. @@ -1988,21 +1990,28 @@ Attributes specified in the `wl-draft-preview-attributes-list' are displayed." :type 'boolean :group 'wl-draft) -(defcustom wl-draft-preview-attributes-list '(recipients - envelope-from - smtp-posting-server - smtp-posting-port) +(defcustom wl-draft-preview-attributes-list '((mail recipients + envelope-from + smtp-posting-server + smtp-posting-port) + (news newsgroups + nntp-posting-server + nntp-posting-port)) "*Attribute symbols to display in the draft preview. Candidates are following: `recipients' `envelope-from' `smtp-posting-server' `smtp-posting-port' +`newsgroups' `nntp-posting-server' `nntp-posting-port' Also variables which begin with `wl-' can be specified \(`wl-' have to be removed\)" - :type '(repeat symbol) + :type '(choice (repeat (cons (choice (const :tag "Mail" mail) + (const :tag "News" news)) + (repeat symbol))) + (repeat symbol)) :group 'wl-draft) (defcustom wl-draft-preview-attributes-buffer-lines 5 @@ -2462,6 +2471,12 @@ Sender information in summary mode." :type 'string :group 'wl-summary) +(defcustom wl-summary-resend-use-cache nil + "*Non-nil to enable offline resending by using file cache. +Note that strict message identity is not guaranteed when cache is used." + :type 'boolean + :group 'wl-summary) + (defcustom wl-folder-removed-mark "#" "Mark for removed folder." :type 'string diff --git a/wl/wl-version.el b/wl/wl-version.el index 89f9204..68cf51c 100644 --- a/wl/wl-version.el +++ b/wl/wl-version.el @@ -46,7 +46,7 @@ "Wanderlust" nil (eval-when-compile (product-version (product-find 'elmo-version))) ; equals to ELMO version. - "Your Wildest Dreams")) + "99 Luftballons-pre")) (defconst wl-version-status nil "Wanderlust verstion status. For override default rule. -- 1.7.10.4