1 ;;; wl-summary.el --- Summary mode for Wanderlust.
3 ;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
4 ;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
5 ;; Copyright (C) 1999,2000 TSUMURA Tomoaki <tsumura@kuis.kyoto-u.ac.jp>
6 ;; Copyright (C) 1999,2000 Kenichi OKADA <okada@opaopa.org>
8 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
9 ;; Masahiro MURATA <muse@ba2.so-net.ne.jp>
10 ;; TSUMURA Tomoaki <tsumura@kuis.kyoto-u.ac.jp>
11 ;; Kenichi OKADA <okada@opaopa.org>
12 ;; Keywords: mail, net news
14 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
16 ;; This program is free software; you can redistribute it and/or modify
17 ;; it under the terms of the GNU General Public License as published by
18 ;; the Free Software Foundation; either version 2, or (at your option)
21 ;; This program is distributed in the hope that it will be useful,
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;; GNU General Public License for more details.
26 ;; You should have received a copy of the GNU General Public License
27 ;; along with GNU Emacs; see the file COPYING. If not, write to the
28 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
29 ;; Boston, MA 02111-1307, USA.
42 (require 'wl-highlight)
45 (condition-case nil (require 'timezone) (error nil))
46 (condition-case nil (require 'easymenu) (error nil))
48 (condition-case nil (require 'ps-print) (error nil))
52 (condition-case () (require 'timer) (error nil))
53 (defalias-maybe 'ps-print-buffer-with-faces 'ignore)
54 (defalias-maybe 'elmo-database-msgid-put 'ignore)
55 (defalias-maybe 'elmo-database-close 'ignore)
56 (defalias-maybe 'elmo-database-msgid-get 'ignore)
57 (defalias-maybe 'run-with-idle-timer 'ignore)
58 (defalias-maybe 'ps-print-preprint 'ignore))
60 (defvar dragdrop-drop-functions)
61 (defvar scrollbar-height)
62 (defvar mail-reply-buffer)
64 (defvar wl-summary-buffer-name "Summary")
65 (defvar wl-summary-mode-map nil)
66 (defvar wl-current-summary-buffer nil)
68 (defvar wl-summary-buffer-elmo-folder nil)
70 (defmacro wl-summary-buffer-folder-name ()
71 (` (and wl-summary-buffer-elmo-folder
72 (elmo-folder-name-internal wl-summary-buffer-elmo-folder))))
74 (defvar wl-summary-buffer-disp-msg nil)
75 (defvar wl-summary-buffer-disp-folder nil)
76 (defvar wl-summary-buffer-temp-mark-list nil)
77 (defvar wl-summary-buffer-last-displayed-msg nil)
78 (defvar wl-summary-buffer-current-msg nil)
79 (defvar wl-summary-buffer-unread-count 0)
80 (defvar wl-summary-buffer-new-count 0)
81 (defvar wl-summary-buffer-answered-count 0)
82 (defvar wl-summary-buffer-mime-charset nil)
83 (defvar wl-summary-buffer-weekday-name-lang nil)
84 (defvar wl-summary-buffer-thread-indent-set-alist nil)
85 (defvar wl-summary-buffer-view nil)
86 (defvar wl-summary-buffer-message-modified nil)
87 (defvar wl-summary-buffer-thread-modified nil)
89 (defvar wl-summary-buffer-number-column nil)
90 (defvar wl-summary-buffer-temp-mark-column nil)
91 (defvar wl-summary-buffer-persistent-mark-column nil)
93 (defvar wl-summary-buffer-persistent nil)
94 (defvar wl-summary-buffer-thread-nodes nil)
95 (defvar wl-summary-buffer-target-mark-list nil)
96 (defvar wl-summary-buffer-prev-refile-destination nil)
97 (defvar wl-summary-buffer-prev-copy-destination nil)
98 (defvar wl-summary-buffer-saved-message nil)
99 (defvar wl-summary-buffer-prev-folder-function nil)
100 (defvar wl-summary-buffer-next-folder-function nil)
101 (defvar wl-summary-buffer-exit-function nil)
102 (defvar wl-summary-buffer-next-message-function nil)
103 (defvar wl-summary-buffer-number-list nil)
104 (defvar wl-summary-buffer-msgdb nil)
105 (defvar wl-summary-buffer-folder-name nil)
106 (defvar wl-summary-buffer-line-formatter nil)
107 (defvar wl-summary-buffer-line-format nil)
108 (defvar wl-summary-buffer-mode-line-formatter nil)
109 (defvar wl-summary-buffer-mode-line nil)
111 (defvar wl-thread-indent-level-internal nil)
112 (defvar wl-thread-have-younger-brother-str-internal nil)
113 (defvar wl-thread-youngest-child-str-internal nil)
114 (defvar wl-thread-vertical-str-internal nil)
115 (defvar wl-thread-horizontal-str-internal nil)
116 (defvar wl-thread-space-str-internal nil)
117 (defvar wl-summary-last-visited-folder nil)
118 (defvar wl-read-folder-hist nil)
119 (defvar wl-summary-scored nil)
120 (defvar wl-crosspost-alist-modified nil)
121 (defvar wl-summary-alike-hashtb nil)
122 (defvar wl-summary-search-buf-name " *wl-search-subject*")
123 (defvar wl-summary-delayed-update nil)
124 (defvar wl-summary-search-buf-folder-name nil)
126 (defvar wl-summary-get-petname-function 'wl-address-get-petname-1)
128 (defvar wl-summary-shell-command-last "")
130 (defvar wl-ps-preprint-hook nil)
131 (defvar wl-ps-print-hook nil)
133 (make-variable-buffer-local 'wl-summary-buffer-elmo-folder)
134 (make-variable-buffer-local 'wl-summary-search-buf-folder-name)
135 (make-variable-buffer-local 'wl-summary-buffer-disp-msg)
136 (make-variable-buffer-local 'wl-summary-buffer-disp-folder)
137 (make-variable-buffer-local 'wl-summary-buffer-target-mark-list)
138 (make-variable-buffer-local 'wl-summary-buffer-temp-mark-list)
139 (make-variable-buffer-local 'wl-summary-buffer-last-displayed-msg)
140 (make-variable-buffer-local 'wl-summary-buffer-unread-count)
141 (make-variable-buffer-local 'wl-summary-buffer-new-count)
142 (make-variable-buffer-local 'wl-summary-buffer-answered-count)
143 (make-variable-buffer-local 'wl-summary-buffer-mime-charset)
144 (make-variable-buffer-local 'wl-summary-buffer-weekday-name-lang)
145 (make-variable-buffer-local 'wl-summary-buffer-thread-indent-set)
146 (make-variable-buffer-local 'wl-summary-buffer-view)
147 (make-variable-buffer-local 'wl-summary-buffer-message-modified)
148 (make-variable-buffer-local 'wl-summary-buffer-thread-modified)
149 (make-variable-buffer-local 'wl-summary-buffer-number-column)
150 (make-variable-buffer-local 'wl-summary-buffer-temp-mark-column)
151 (make-variable-buffer-local 'wl-summary-buffer-persistent-mark-column)
152 (make-variable-buffer-local 'wl-summary-buffer-persistent)
153 (make-variable-buffer-local 'wl-summary-buffer-thread-nodes)
154 (make-variable-buffer-local 'wl-summary-buffer-prev-refile-destination)
155 (make-variable-buffer-local 'wl-summary-buffer-saved-message)
156 (make-variable-buffer-local 'wl-summary-scored)
157 (make-variable-buffer-local 'wl-summary-default-score)
158 (make-variable-buffer-local 'wl-summary-move-direction-downward)
159 (make-variable-buffer-local 'wl-summary-important-above)
160 (make-variable-buffer-local 'wl-summary-target-above)
161 (make-variable-buffer-local 'wl-summary-mark-below)
162 (make-variable-buffer-local 'wl-summary-expunge-below)
163 (make-variable-buffer-local 'wl-thread-indent-level-internal)
164 (make-variable-buffer-local 'wl-thread-have-younger-brother-str-internal)
165 (make-variable-buffer-local 'wl-thread-youngest-child-str-internal)
166 (make-variable-buffer-local 'wl-thread-vertical-str-internal)
167 (make-variable-buffer-local 'wl-thread-horizontal-str-internal)
168 (make-variable-buffer-local 'wl-thread-space-str-internal)
169 (make-variable-buffer-local 'wl-summary-buffer-prev-folder-function)
170 (make-variable-buffer-local 'wl-summary-buffer-next-folder-function)
171 (make-variable-buffer-local 'wl-summary-buffer-exit-function)
172 (make-variable-buffer-local 'wl-summary-buffer-next-message-function)
173 (make-variable-buffer-local 'wl-summary-buffer-number-list)
174 (make-variable-buffer-local 'wl-summary-buffer-msgdb)
175 (make-variable-buffer-local 'wl-summary-buffer-folder-name)
176 (make-variable-buffer-local 'wl-summary-buffer-line-formatter)
177 (make-variable-buffer-local 'wl-summary-buffer-line-format)
178 (make-variable-buffer-local 'wl-summary-buffer-mode-line-formatter)
179 (make-variable-buffer-local 'wl-summary-buffer-mode-line)
182 (defvar wl-thr-indent-string)
183 (defvar wl-thr-children-number)
184 (defvar wl-thr-linked)
185 (defvar wl-message-entity)
186 (defvar wl-parent-message-entity)
187 (defvar wl-temp-mark)
188 (defvar wl-persistent-mark)
190 (defmacro wl-summary-sticky-buffer-name (name)
191 (` (concat wl-summary-buffer-name ":" (, name))))
193 (defun wl-summary-default-subject (subject-string)
194 (if (string-match "^[ \t]*\\[[^:]+[,: ][0-9]+\\][ \t]*" subject-string)
195 (substring subject-string (match-end 0))
198 (defun wl-summary-default-from (from)
199 "Instance of `wl-summary-from-function'.
200 Ordinarily returns the sender name. Returns recipient names if (1)
201 summary's folder name matches with `wl-summary-showto-folder-regexp'
202 and (2) sender address is yours.
204 See also variable `wl-use-petname'."
207 (and (eq major-mode 'wl-summary-mode)
208 (stringp wl-summary-showto-folder-regexp)
209 (string-match wl-summary-showto-folder-regexp
210 (wl-summary-buffer-folder-name))
211 (wl-address-user-mail-address-p from)
213 ((and (setq tos (elmo-message-entity-field
214 wl-message-entity 'to t))
215 (not (string= "" tos)))
225 wl-summary-get-petname-function to)
227 (std11-extract-address-components to))
230 (wl-parse-addresses tos)
232 ((setq ng (elmo-message-entity-field
233 wl-message-entity 'newsgroups))
234 (setq retval (concat "Ng:" ng)))))
236 (setq retval (or (funcall wl-summary-get-petname-function from)
237 (car (std11-extract-address-components from))
242 (defun wl-summary-simple-from (string)
244 (or (funcall wl-summary-get-petname-function string)
245 (car (std11-extract-address-components string))
249 (defvar wl-summary-sort-specs '(number date subject from list-info))
250 (defvar wl-summary-default-sort-spec 'date)
252 (defvar wl-summary-mode-menu-spec
254 ["Read" wl-summary-read t]
255 ["Prev page" wl-summary-prev-page t]
256 ["Next page" wl-summary-next-page t]
257 ["Top" wl-summary-display-top t]
258 ["Bottom" wl-summary-display-bottom t]
259 ["Prev" wl-summary-prev t]
260 ["Next" wl-summary-next t]
261 ["Up" wl-summary-up t]
262 ["Down" wl-summary-down t]
263 ["Parent message" wl-summary-jump-to-parent-message t]
265 ["Sync" wl-summary-sync t]
266 ["Execute" wl-summary-exec t]
267 ["Go to other folder" wl-summary-goto-folder t]
268 ["Pick" wl-summary-pick t]
269 ["Mark as read all" wl-summary-mark-as-read-all t]
270 ["Unmark all" wl-summary-unmark-all t]
271 ["Toggle display message" wl-summary-toggle-disp-msg t]
272 ["Display folder" wl-summary-toggle-disp-folder t]
273 ["Toggle threading" wl-summary-toggle-thread t]
274 ["Stick" wl-summary-stick t]
276 ["By Number" wl-summary-sort-by-number t]
277 ["By Date" wl-summary-sort-by-date t]
278 ["By From" wl-summary-sort-by-from t]
279 ["By Subject" wl-summary-sort-by-subject t]
280 ["By List Info" wl-summary-sort-by-list-info t])
283 ["Mark as read" wl-summary-mark-as-read t]
284 ["Mark as important" wl-summary-mark-as-important t]
285 ["Mark as unread" wl-summary-mark-as-unread t]
286 ["Set dispose mark" wl-summary-dispose t]
287 ["Set refile mark" wl-summary-refile t]
288 ["Set copy mark" wl-summary-copy t]
289 ["Set resend mark" wl-summary-resend t]
290 ["Prefetch" wl-summary-prefetch t]
291 ["Set target mark" wl-summary-target-mark t]
292 ["Unmark" wl-summary-unmark t]
293 ["Save" wl-summary-save t]
294 ["Cancel posted news" wl-summary-cancel-message t]
295 ["Supersedes message" wl-summary-supersedes-message t]
296 ["Resend bounced mail" wl-summary-resend-bounced-mail t]
297 ["Enter the message" wl-summary-jump-to-current-message t]
298 ["Pipe message" wl-summary-pipe-message t]
299 ["Print message" wl-summary-print-message t])
301 ["Open or Close" wl-thread-open-close (eq wl-summary-buffer-view 'thread)]
302 ["Open all" wl-thread-open-all (eq wl-summary-buffer-view 'thread)]
303 ["Close all" wl-thread-close-all (eq wl-summary-buffer-view 'thread)]
304 ["Mark as read" wl-thread-mark-as-read (eq wl-summary-buffer-view 'thread)]
305 ["Mark as important" wl-thread-mark-as-important (eq wl-summary-buffer-view 'thread)]
306 ["Mark as unread" wl-thread-mark-as-unread (eq wl-summary-buffer-view 'thread)]
307 ["Set delete mark" wl-thread-delete (eq wl-summary-buffer-view 'thread)]
308 ["Set refile mark" wl-thread-refile (eq wl-summary-buffer-view 'thread)]
309 ["Set copy mark" wl-thread-copy (eq wl-summary-buffer-view 'thread)]
310 ["Prefetch" wl-thread-prefetch (eq wl-summary-buffer-view 'thread)]
311 ["Set target mark" wl-thread-target-mark (eq wl-summary-buffer-view 'thread)]
312 ["Unmark" wl-thread-unmark (eq wl-summary-buffer-view 'thread)]
313 ["Save" wl-thread-save (eq wl-summary-buffer-view 'thread)]
314 ["Execute" wl-thread-exec (eq wl-summary-buffer-view 'thread)])
316 ["Mark as read" wl-summary-mark-as-read-region t]
317 ["Mark as important" wl-summary-mark-as-important-region t]
318 ["Mark as unread" wl-summary-mark-as-unread-region t]
319 ["Set dispose mark" wl-summary-dispose-region t]
320 ["Set refile mark" wl-summary-refile-region t]
321 ["Set copy mark" wl-summary-copy-region t]
322 ["Prefetch" wl-summary-prefetch-region t]
323 ["Set target mark" wl-summary-target-mark-region t]
324 ["Unmark" wl-summary-unmark-region t]
325 ["Save" wl-summary-save-region t]
326 ["Execute" wl-summary-exec-region t])
328 ["Mark as read" wl-summary-target-mark-mark-as-read t]
329 ["Mark as important" wl-summary-target-mark-mark-as-important t]
330 ["Mark as unread" wl-summary-target-mark-mark-as-unread t]
331 ["Set delete mark" wl-summary-target-mark-delete t]
332 ["Set refile mark" wl-summary-target-mark-refile t]
333 ["Set copy mark" wl-summary-target-mark-copy t]
334 ["Prefetch" wl-summary-target-mark-prefetch t]
335 ["Save" wl-summary-target-mark-save t]
336 ["Reply with citation" wl-summary-target-mark-reply-with-citation t]
337 ["Forward" wl-summary-target-mark-forward t]
338 ["uudecode" wl-summary-target-mark-uudecode t])
340 ["Switch current score file" wl-score-change-score-file t]
341 ["Edit current score file" wl-score-edit-current-scores t]
342 ["Edit score file" wl-score-edit-file t]
343 ["Set mark below" wl-score-set-mark-below t]
344 ["Set expunge below" wl-score-set-expunge-below t]
345 ["Rescore buffer" wl-summary-rescore t]
346 ["Increase score" wl-summary-increase-score t]
347 ["Lower score" wl-summary-lower-score t])
350 ["Write a message" wl-summary-write t]
351 ["Write for current folder" wl-summary-write-current-folder t]
352 ["Reply" wl-summary-reply t]
353 ["Reply with citation" wl-summary-reply-with-citation t]
354 ["Forward" wl-summary-forward t])
356 ["Toggle Plug Status" wl-toggle-plugged t]
357 ["Change Plug Status" wl-plugged-change t]
359 ["Exit Current Folder" wl-summary-exit t]))
362 (defun wl-summary-setup-mouse ()
363 (define-key wl-summary-mode-map 'button4 'wl-summary-prev)
364 (define-key wl-summary-mode-map 'button5 'wl-summary-next)
365 (define-key wl-summary-mode-map [(shift button4)]
367 (define-key wl-summary-mode-map [(shift button5)]
369 (define-key wl-summary-mode-map 'button2 'wl-summary-click))
370 (defun wl-summary-setup-mouse ()
371 (define-key wl-summary-mode-map [mouse-4] 'wl-summary-prev)
372 (define-key wl-summary-mode-map [mouse-5] 'wl-summary-next)
373 (define-key wl-summary-mode-map [S-mouse-4] 'wl-summary-up)
374 (define-key wl-summary-mode-map [S-mouse-5] 'wl-summary-down)
375 (define-key wl-summary-mode-map [mouse-2] 'wl-summary-click)))
377 (if wl-summary-mode-map
379 (setq wl-summary-mode-map (make-sparse-keymap))
380 (define-key wl-summary-mode-map " " 'wl-summary-read)
381 (define-key wl-summary-mode-map "." 'wl-summary-redisplay)
382 (define-key wl-summary-mode-map "<" 'wl-summary-display-top)
383 (define-key wl-summary-mode-map ">" 'wl-summary-display-bottom)
384 (define-key wl-summary-mode-map "\177" 'wl-summary-prev-page)
385 (define-key wl-summary-mode-map [backspace] 'wl-summary-prev-page)
386 (define-key wl-summary-mode-map "\r" 'wl-summary-next-line-content)
387 (define-key wl-summary-mode-map "\C-m" 'wl-summary-next-line-content)
388 (define-key wl-summary-mode-map "/" 'wl-thread-open-close)
389 (define-key wl-summary-mode-map "[" 'wl-thread-open-all)
390 (define-key wl-summary-mode-map "]" 'wl-thread-close-all)
391 (define-key wl-summary-mode-map "-" 'wl-summary-prev-line-content)
392 (define-key wl-summary-mode-map "\e\r" 'wl-summary-prev-line-content)
393 (define-key wl-summary-mode-map "g" 'wl-summary-goto-folder)
394 (define-key wl-summary-mode-map "G" 'wl-summary-goto-folder-sticky)
395 (define-key wl-summary-mode-map "c" 'wl-summary-mark-as-read-all)
397 (define-key wl-summary-mode-map "a" 'wl-summary-reply)
398 (define-key wl-summary-mode-map "A" 'wl-summary-reply-with-citation)
399 (define-key wl-summary-mode-map "C" 'wl-summary-cancel-message)
400 (define-key wl-summary-mode-map "E" 'wl-summary-reedit)
401 (define-key wl-summary-mode-map "\eE" 'wl-summary-resend-bounced-mail)
402 (define-key wl-summary-mode-map "f" 'wl-summary-forward)
403 (define-key wl-summary-mode-map "$" 'wl-summary-mark-as-important)
404 (define-key wl-summary-mode-map "&" 'wl-summary-mark-as-answered)
405 (define-key wl-summary-mode-map "@" 'wl-summary-edit-addresses)
407 (define-key wl-summary-mode-map "y" 'wl-summary-save)
408 (define-key wl-summary-mode-map "n" 'wl-summary-next)
409 (define-key wl-summary-mode-map "p" 'wl-summary-prev)
410 (define-key wl-summary-mode-map "N" 'wl-summary-down)
411 (define-key wl-summary-mode-map "P" 'wl-summary-up)
412 (define-key wl-summary-mode-map "w" 'wl-summary-write)
413 (define-key wl-summary-mode-map "W" 'wl-summary-write-current-folder)
414 (define-key wl-summary-mode-map "e" 'wl-summary-save)
415 (define-key wl-summary-mode-map "\C-c\C-o" 'wl-jump-to-draft-buffer)
416 (define-key wl-summary-mode-map "\C-c\C-a" 'wl-addrmgr)
417 (define-key wl-summary-mode-map "\C-c\C-p" 'wl-summary-previous-buffer)
418 (define-key wl-summary-mode-map "\C-c\C-n" 'wl-summary-next-buffer)
419 (define-key wl-summary-mode-map "H" 'wl-summary-redisplay-all-header)
420 (define-key wl-summary-mode-map "M" 'wl-summary-redisplay-no-mime)
421 (define-key wl-summary-mode-map "B" 'wl-summary-burst)
422 (define-key wl-summary-mode-map "Z" 'wl-status-update)
423 (define-key wl-summary-mode-map "#" 'wl-summary-print-message)
424 (define-key wl-summary-mode-map "|" 'wl-summary-pipe-message)
425 (define-key wl-summary-mode-map "z" 'wl-summary-suspend)
426 (define-key wl-summary-mode-map "q" 'wl-summary-exit)
427 (define-key wl-summary-mode-map "Q" 'wl-summary-force-exit)
429 (define-key wl-summary-mode-map "j" 'wl-summary-jump-to-current-message)
430 (define-key wl-summary-mode-map "J" 'wl-thread-jump-to-msg)
431 (define-key wl-summary-mode-map "I" 'wl-summary-incorporate)
432 (define-key wl-summary-mode-map "\M-j" 'wl-summary-jump-to-msg-by-message-id)
433 (define-key wl-summary-mode-map "^" 'wl-summary-jump-to-parent-message)
434 (define-key wl-summary-mode-map "!" 'wl-summary-mark-as-unread)
436 (define-key wl-summary-mode-map "s" 'wl-summary-sync)
437 (define-key wl-summary-mode-map "S" 'wl-summary-sort)
438 (define-key wl-summary-mode-map "\M-s" 'wl-summary-stick)
439 (define-key wl-summary-mode-map "T" 'wl-summary-toggle-thread)
441 (define-key wl-summary-mode-map "l" 'wl-summary-toggle-disp-folder)
442 (define-key wl-summary-mode-map "v" 'wl-summary-toggle-disp-msg)
443 (define-key wl-summary-mode-map "V" 'wl-summary-virtual)
445 (define-key wl-summary-mode-map "\C-i" 'wl-summary-goto-last-displayed-msg)
446 (define-key wl-summary-mode-map "?" 'wl-summary-pick)
447 (define-key wl-summary-mode-map "\ee" 'wl-summary-expire)
450 (define-key wl-summary-mode-map "\ew" 'wl-summary-save-current-message)
451 (define-key wl-summary-mode-map "\C-y" 'wl-summary-yank-saved-message)
454 (define-key wl-summary-mode-map "R" 'wl-summary-mark-as-read)
455 (define-key wl-summary-mode-map "i" 'wl-summary-prefetch)
456 (define-key wl-summary-mode-map "x" 'wl-summary-exec)
457 (define-key wl-summary-mode-map "*" 'wl-summary-target-mark)
458 (define-key wl-summary-mode-map "o" 'wl-summary-refile)
459 (define-key wl-summary-mode-map "O" 'wl-summary-copy)
460 (define-key wl-summary-mode-map "\M-o" 'wl-summary-refile-prev-destination)
461 (define-key wl-summary-mode-map "\C-o" 'wl-summary-auto-refile)
462 (define-key wl-summary-mode-map "d" 'wl-summary-dispose)
463 (define-key wl-summary-mode-map "u" 'wl-summary-unmark)
464 (define-key wl-summary-mode-map "U" 'wl-summary-unmark-all)
465 (define-key wl-summary-mode-map "D" 'wl-summary-delete)
466 (define-key wl-summary-mode-map "~" 'wl-summary-resend)
469 (define-key wl-summary-mode-map "t" (make-sparse-keymap))
470 (define-key wl-summary-mode-map "tR" 'wl-thread-mark-as-read)
471 (define-key wl-summary-mode-map "ti" 'wl-thread-prefetch)
472 (define-key wl-summary-mode-map "tx" 'wl-thread-exec)
473 (define-key wl-summary-mode-map "t*" 'wl-thread-target-mark)
474 (define-key wl-summary-mode-map "to" 'wl-thread-refile)
475 (define-key wl-summary-mode-map "tO" 'wl-thread-copy)
476 (define-key wl-summary-mode-map "td" 'wl-thread-dispose)
477 (define-key wl-summary-mode-map "tD" 'wl-thread-delete)
478 (define-key wl-summary-mode-map "t~" 'wl-thread-resend)
479 (define-key wl-summary-mode-map "tu" 'wl-thread-unmark)
480 (define-key wl-summary-mode-map "t!" 'wl-thread-mark-as-unread)
481 (define-key wl-summary-mode-map "t$" 'wl-thread-mark-as-important)
482 (define-key wl-summary-mode-map "ty" 'wl-thread-save)
483 (define-key wl-summary-mode-map "ts" 'wl-thread-set-parent)
485 ;; target-mark commands
486 (define-key wl-summary-mode-map "m" (make-sparse-keymap))
487 (define-key wl-summary-mode-map "mi" 'wl-summary-target-mark-prefetch)
488 (define-key wl-summary-mode-map "mo" 'wl-summary-target-mark-refile)
489 (define-key wl-summary-mode-map "mO" 'wl-summary-target-mark-copy)
490 (define-key wl-summary-mode-map "md" 'wl-summary-target-mark-dispose)
491 (define-key wl-summary-mode-map "mD" 'wl-summary-target-mark-delete)
492 (define-key wl-summary-mode-map "m~" 'wl-summary-target-mark-resend)
494 (define-key wl-summary-mode-map "mu" 'wl-summary-delete-all-temp-marks)
496 (define-key wl-summary-mode-map "my" 'wl-summary-target-mark-save)
497 (define-key wl-summary-mode-map "mR" 'wl-summary-target-mark-mark-as-read)
498 (define-key wl-summary-mode-map "m!" 'wl-summary-target-mark-mark-as-unread)
499 (define-key wl-summary-mode-map "m$" 'wl-summary-target-mark-mark-as-important)
500 (define-key wl-summary-mode-map "mU" 'wl-summary-target-mark-uudecode)
501 (define-key wl-summary-mode-map "ma" 'wl-summary-target-mark-all)
502 (define-key wl-summary-mode-map "mt" 'wl-summary-target-mark-thread)
503 (define-key wl-summary-mode-map "mA" 'wl-summary-target-mark-reply-with-citation)
504 (define-key wl-summary-mode-map "mf" 'wl-summary-target-mark-forward)
505 (define-key wl-summary-mode-map "m?" 'wl-summary-target-mark-pick)
506 (define-key wl-summary-mode-map "m#" 'wl-summary-target-mark-print)
507 (define-key wl-summary-mode-map "m|" 'wl-summary-target-mark-pipe)
510 (define-key wl-summary-mode-map "r" (make-sparse-keymap))
511 (define-key wl-summary-mode-map "rR" 'wl-summary-mark-as-read-region)
512 (define-key wl-summary-mode-map "ri" 'wl-summary-prefetch-region)
513 (define-key wl-summary-mode-map "rx" 'wl-summary-exec-region)
514 (define-key wl-summary-mode-map "mr" 'wl-summary-target-mark-region)
515 (define-key wl-summary-mode-map "r*" 'wl-summary-target-mark-region)
516 (define-key wl-summary-mode-map "ro" 'wl-summary-refile-region)
517 (define-key wl-summary-mode-map "rO" 'wl-summary-copy-region)
518 (define-key wl-summary-mode-map "rd" 'wl-summary-dispose-region)
519 (define-key wl-summary-mode-map "rD" 'wl-summary-delete-region)
520 (define-key wl-summary-mode-map "r~" 'wl-summary-resend-region)
521 (define-key wl-summary-mode-map "ru" 'wl-summary-unmark-region)
522 (define-key wl-summary-mode-map "r!" 'wl-summary-mark-as-unread-region)
523 (define-key wl-summary-mode-map "r$" 'wl-summary-mark-as-important-region)
524 (define-key wl-summary-mode-map "ry" 'wl-summary-save-region)
527 (define-key wl-summary-mode-map "K" 'wl-summary-increase-score)
528 (define-key wl-summary-mode-map "L" 'wl-summary-lower-score)
529 (define-key wl-summary-mode-map "h" (make-sparse-keymap))
530 (define-key wl-summary-mode-map "hR" 'wl-summary-rescore)
531 (define-key wl-summary-mode-map "hc" 'wl-score-change-score-file)
532 (define-key wl-summary-mode-map "he" 'wl-score-edit-current-scores)
533 (define-key wl-summary-mode-map "hf" 'wl-score-edit-file)
534 (define-key wl-summary-mode-map "hF" 'wl-score-flush-cache)
535 (define-key wl-summary-mode-map "hm" 'wl-score-set-mark-below)
536 (define-key wl-summary-mode-map "hx" 'wl-score-set-expunge-below)
538 (define-key wl-summary-mode-map "\M-t" 'wl-toggle-plugged)
539 (define-key wl-summary-mode-map "\C-t" 'wl-plugged-change)
541 (define-key wl-summary-mode-map "\C-x\C-s" 'wl-summary-save-status)
542 (wl-summary-setup-mouse)
546 "Menu used in Summary mode."
547 wl-summary-mode-menu-spec))
549 (defsubst wl-summary-message-visible-p (number)
550 "Return non-nil if the message with NUMBER is visible."
551 (or (eq wl-summary-buffer-view 'sequence)
552 (not (wl-thread-entity-parent-invisible-p
553 (wl-thread-get-entity number)))))
555 (defun wl-status-update ()
559 (defun wl-summary-display-top ()
561 (goto-char (point-min))
562 (when wl-summary-lazy-highlight
563 (wl-highlight-summary-window))
564 (if wl-summary-buffer-disp-msg
565 (wl-summary-redisplay)))
567 (defun wl-summary-display-bottom ()
569 (goto-char (point-max))
571 (when wl-summary-lazy-highlight
572 (wl-highlight-summary-window))
573 (if wl-summary-buffer-disp-msg
574 (wl-summary-redisplay)))
576 (defun wl-summary-count-unread ()
577 (let ((lst (elmo-folder-count-flags wl-summary-buffer-elmo-folder)))
578 (if (eq major-mode 'wl-summary-mode)
579 (setq wl-summary-buffer-new-count (car lst)
580 wl-summary-buffer-unread-count (nth 1 lst)
581 wl-summary-buffer-answered-count (nth 2 lst)))
584 (defun wl-summary-message-string (&optional use-cache)
585 "Return full body string of current message.
586 If optional USE-CACHE is non-nil, use cache if exists."
587 (let ((number (wl-summary-message-number))
588 (folder wl-summary-buffer-elmo-folder))
590 (message "No message.")
592 (elmo-message-fetch folder
594 (elmo-make-fetch-strategy
596 use-cache ; use cache
597 nil ; save cache (should `t'?)
600 (elmo-file-cache-get-path
601 (elmo-message-field folder number 'message-id))))
607 (defun wl-summary-reedit (&optional arg)
608 "Re-edit current message.
609 If ARG is non-nil, Supersedes message"
611 (wl-summary-toggle-disp-msg 'off)
613 ((not (wl-summary-message-number))
614 (message "No message."))
616 (wl-summary-supersedes-message))
617 ((string= (wl-summary-buffer-folder-name) wl-draft-folder)
618 (wl-draft-reedit (wl-summary-message-number))
619 (if (wl-message-news-p)
620 (mail-position-on-field "Newsgroups")
621 (mail-position-on-field "To")))
623 (wl-draft-edit-string (wl-summary-message-string)))))
625 (defun wl-summary-resend-bounced-mail ()
626 "Re-mail the current message.
627 This only makes sense if the current message is a bounce message which
628 contains some mail you have written but has been bounced back to
631 (wl-summary-toggle-disp-msg 'off)
633 (wl-summary-set-message-buffer-or-redisplay)
634 (set-buffer (wl-message-get-original-buffer))
635 (goto-char (point-min))
636 (let ((case-fold-search nil))
640 (concat "^\\($\\|[Cc]ontent-[Tt]ype:[ \t]+multipart/\\(report\\|mixed\\)\\)") nil t)
642 (re-search-forward "boundary=\"\\([^\"]+\\)\"" nil t))
643 (let ((boundary (buffer-substring (match-beginning 1) (match-end 1)))
646 ((and (setq start (re-search-forward
647 (concat "^--" boundary "\n"
648 "\\([Cc]ontent-[Dd]escription:.*\n\\)?"
649 "[Cc]ontent-[Tt]ype:[ \t]+"
650 "\\(message/rfc822\\|text/rfc822-headers\\).*\n"
651 "\\(.+\n\\)*\n") nil t))
653 (concat "\n\\(--" boundary "\\)--\n") nil t))
654 (wl-draft-edit-string (buffer-substring start (match-beginning 1))))
656 (message "Seems no message/rfc822 part.")))))
657 ((let ((case-fold-search t))
658 (re-search-forward wl-rejected-letter-start nil t))
659 (skip-chars-forward " \t\n")
660 (wl-draft-edit-string (buffer-substring (point) (point-max))))
662 (message "Does not appear to be a rejected letter."))))))
664 (defun wl-summary-detect-mark-position ()
665 (let ((column wl-summary-buffer-number-column)
666 (formatter wl-summary-buffer-line-formatter)
667 (dummy-temp (char-to-string 200))
668 (dummy-persistent (char-to-string 201))
671 (setq wl-summary-buffer-number-column column
672 wl-summary-buffer-line-formatter formatter)
674 (wl-summary-create-line
675 (elmo-msgdb-make-message-entity
683 (goto-char (point-min))
684 (setq temp (save-excursion
685 (when (search-forward dummy-temp nil t)
687 persistent (save-excursion
688 (when (search-forward dummy-persistent nil t)
690 (setq wl-summary-buffer-temp-mark-column temp
691 wl-summary-buffer-persistent-mark-column persistent)))
693 (defun wl-summary-buffer-set-folder (folder)
695 (setq folder (wl-folder-get-elmo-folder folder)))
696 (setq wl-summary-buffer-elmo-folder folder)
697 (make-local-variable 'wl-message-buffer)
698 (setq wl-summary-buffer-mime-charset (or (wl-get-assoc-list-value
699 wl-folder-mime-charset-alist
700 (elmo-folder-name-internal folder))
702 (setq wl-summary-buffer-weekday-name-lang
703 (or (wl-get-assoc-list-value
704 wl-folder-weekday-name-lang-alist
705 (elmo-folder-name-internal folder))
706 wl-summary-weekday-name-lang))
707 (setq wl-summary-buffer-thread-indent-set
708 (wl-get-assoc-list-value
709 wl-folder-thread-indent-set-alist
710 (elmo-folder-name-internal folder)))
711 (setq wl-summary-buffer-number-column
712 (or (wl-get-assoc-list-value wl-summary-number-column-alist
713 (wl-summary-buffer-folder-name))
714 wl-summary-default-number-column))
715 (wl-line-formatter-setup
716 wl-summary-buffer-line-formatter
717 (setq wl-summary-buffer-line-format
718 (or (wl-get-assoc-list-value
719 wl-folder-summary-line-format-alist
720 (elmo-folder-name-internal folder))
721 wl-summary-line-format))
722 wl-summary-line-format-spec-alist)
723 (wl-line-formatter-setup
724 wl-summary-buffer-mode-line-formatter
725 wl-summary-mode-line-format
726 wl-summary-mode-line-format-spec-alist)
727 (wl-summary-detect-mark-position)
728 (setq wl-summary-buffer-persistent
729 (wl-folder-persistent-p (elmo-folder-name-internal folder)))
730 (elmo-folder-set-persistent-internal folder wl-summary-buffer-persistent)
731 ;; process duplicates.
732 (elmo-folder-set-process-duplicates-internal
733 folder (cdr (elmo-string-matched-assoc
734 (elmo-folder-name-internal folder)
735 wl-folder-process-duplicates-alist)))
737 wl-thread-indent-level-internal
738 (or (nth 0 wl-summary-buffer-thread-indent-set)
739 wl-thread-indent-level)
740 wl-thread-have-younger-brother-str-internal
741 (or (nth 1 wl-summary-buffer-thread-indent-set)
742 wl-thread-have-younger-brother-str)
743 wl-thread-youngest-child-str-internal
744 (or (nth 2 wl-summary-buffer-thread-indent-set)
745 wl-thread-youngest-child-str)
746 wl-thread-vertical-str-internal
747 (or (nth 3 wl-summary-buffer-thread-indent-set)
748 wl-thread-vertical-str)
749 wl-thread-horizontal-str-internal
750 (or (nth 4 wl-summary-buffer-thread-indent-set)
751 wl-thread-horizontal-str)
752 wl-thread-space-str-internal
753 (or (nth 5 wl-summary-buffer-thread-indent-set)
754 wl-thread-space-str))
755 (run-hooks 'wl-summary-buffer-set-folder-hook))
757 (defun wl-summary-mode ()
758 "Major mode for reading threaded messages.
759 See Info under Wanderlust for full documentation.
762 \\{wl-summary-mode-map}
764 Entering Folder mode calls the value of `wl-summary-mode-hook'."
766 (unless (interactive-p) (kill-all-local-variables))
767 (setq major-mode 'wl-summary-mode)
768 (setq mode-name "Summary")
769 (use-local-map wl-summary-mode-map)
770 ;;;(setq default-directory (or wl-tmp-dir (expand-file-name "~/")))
771 (setq buffer-read-only t)
772 (setq truncate-lines t)
773 ;;;(make-local-variable 'tab-width)
774 ;;;(setq tab-width 1)
775 (buffer-disable-undo (current-buffer))
776 (setq selective-display t
777 selective-display-ellipses nil)
778 (wl-mode-line-buffer-identification '(wl-summary-buffer-mode-line))
779 (easy-menu-add wl-summary-mode-menu)
780 (when wl-summary-lazy-highlight
783 (make-local-variable 'pre-idle-hook)
784 (add-hook 'pre-idle-hook 'wl-highlight-summary-window))
785 (make-local-variable 'window-scroll-functions)
786 (add-hook 'window-scroll-functions 'wl-highlight-summary-window)))
787 ;; This hook may contain the function `wl-setup-summary' for reasons
788 ;; of system internal to accord facilities for the Emacs variants.
789 (run-hooks 'wl-summary-mode-hook))
792 (defun wl-summary-overview-entity-compare-by-date (x y)
793 "Compare entity X and Y by date."
796 (timezone-make-date-sortable
797 (elmo-message-entity-field x 'date))
798 (timezone-make-date-sortable
799 (elmo-message-entity-field y 'date)))
800 (error))) ;; ignore error.
802 (defun wl-summary-overview-entity-compare-by-number (x y)
803 "Compare entity X and Y by number."
805 (elmo-message-entity-number x)
806 (elmo-message-entity-number y)))
808 (defun wl-summary-overview-entity-compare-by-from (x y)
809 "Compare entity X and Y by from."
811 (wl-address-header-extract-address
812 (or (elmo-message-entity-field x 'from)
813 wl-summary-no-from-message))
814 (wl-address-header-extract-address
815 (or (elmo-message-entity-field y 'from)
816 wl-summary-no-from-message))))
818 (defun wl-summary-overview-entity-compare-by-subject (x y)
819 "Compare entity X and Y by subject."
820 (string< (elmo-message-entity-field x 'subject)
821 (elmo-message-entity-field y 'subject)))
823 (defun wl-summary-get-list-info (entity)
824 "Returns (\"ML-name\" . ML-count) of ENTITY."
825 (let (sequence ml-name ml-count subject return-path delivered-to mailing-list)
826 (setq sequence (elmo-message-entity-field entity 'x-sequence)
827 ml-name (or (elmo-message-entity-field entity 'x-ml-name)
829 (car (split-string sequence " "))))
830 ml-count (or (elmo-message-entity-field entity 'x-mail-count)
831 (elmo-message-entity-field entity 'x-ml-count)
833 (cadr (split-string sequence " ")))))
834 (and (setq subject (elmo-message-entity-field entity 'subject t))
835 (setq subject (elmo-delete-char ?\n subject))
836 (string-match "^\\s(\\(\\S)+\\)[ :]\\([0-9]+\\)\\s)[ \t]*" subject)
838 (or ml-name (setq ml-name (match-string 1 subject)))
839 (or ml-count (setq ml-count (match-string 2 subject)))))
840 (and (setq return-path
841 (elmo-message-entity-field entity 'return-path))
842 (string-match "^<\\([^@>]+\\)-return-\\([0-9]+\\)-" return-path)
844 (or ml-name (setq ml-name (match-string 1 return-path)))
845 (or ml-count (setq ml-count (match-string 2 return-path)))))
846 (and (setq delivered-to
847 (elmo-message-entity-field entity 'delivered-to))
848 (string-match "^mailing list \\([^@]+\\)@" delivered-to)
849 (or ml-name (setq ml-name (match-string 1 delivered-to))))
850 (and (setq mailing-list
851 (elmo-message-entity-field entity 'mailing-list))
852 ;; *-help@, *-owner@, etc.
853 (string-match "\\(^\\|; \\)contact \\([^@]+\\)-[^-@]+@" mailing-list)
854 (or ml-name (setq ml-name (match-string 2 mailing-list))))
855 (cons (and ml-name (car (split-string ml-name " ")))
856 (and ml-count (string-to-int ml-count)))))
858 (defun wl-summary-overview-entity-compare-by-list-info (x y)
859 "Compare entity X and Y by mailing-list info."
860 (let* ((list-info-x (wl-summary-get-list-info x))
861 (list-info-y (wl-summary-get-list-info y)))
862 (if (equal (car list-info-x) (car list-info-y))
863 (if (equal (cdr list-info-x) (cdr list-info-y))
864 (wl-summary-overview-entity-compare-by-date x y)
865 (< (or (cdr list-info-x) 0)
866 (or (cdr list-info-y) 0)))
867 (string< (or (car list-info-x) "")
868 (or (car list-info-y) "")))))
870 (defun wl-summary-sort-by-date ()
872 (wl-summary-rescan "date"))
873 (defun wl-summary-sort-by-number ()
875 (wl-summary-rescan "number"))
876 (defun wl-summary-sort-by-subject ()
878 (wl-summary-rescan "subject"))
879 (defun wl-summary-sort-by-from ()
881 (wl-summary-rescan "from"))
882 (defun wl-summary-sort-by-list-info ()
884 (wl-summary-rescan "list-info"))
886 (defun wl-summary-rescan (&optional sort-by disable-killed)
887 "Rescan current folder without updating."
889 (let ((elmo-mime-charset wl-summary-buffer-mime-charset)
893 (inhibit-read-only t)
894 (buffer-read-only nil)
895 (numbers (elmo-folder-list-messages wl-summary-buffer-elmo-folder
896 (not disable-killed) t)) ; in-msgdb
899 (message "Re-scanning...")
902 (message "Sorting by %s..." sort-by)
907 (intern (format "wl-summary-overview-entity-compare-by-%s"
909 (elmo-message-entity wl-summary-buffer-elmo-folder x)
910 (elmo-message-entity wl-summary-buffer-elmo-folder y)))))
911 (message "Sorting by %s...done" sort-by))
912 (setq num (length numbers))
913 (setq wl-thread-entity-hashtb (elmo-make-hash (* num 2))
914 wl-thread-entity-list nil
915 wl-thread-entities nil
916 wl-summary-scored nil
917 wl-summary-buffer-number-list nil
918 wl-summary-buffer-target-mark-list nil
919 wl-summary-buffer-temp-mark-list nil
920 wl-summary-delayed-update nil)
921 (elmo-kill-buffer wl-summary-search-buf-name)
923 (setq entity (elmo-message-entity wl-summary-buffer-elmo-folder
925 (wl-summary-insert-message entity
926 wl-summary-buffer-elmo-folder
928 (setq numbers (cdr numbers))
929 (when (> num elmo-display-progress-threshold)
931 (if (or (zerop (% i 5)) (= i num))
932 (elmo-display-progress
933 'wl-summary-rescan "Constructing summary structure..."
934 (/ (* i 100) num)))))
935 (when wl-summary-delayed-update
936 (while wl-summary-delayed-update
937 (message "Parent (%d) of message %d is no entity"
938 (caar wl-summary-delayed-update)
939 (elmo-msgdb-overview-entity-get-number
940 (cdar wl-summary-delayed-update)))
941 (wl-summary-insert-message
942 (cdar wl-summary-delayed-update)
943 wl-summary-buffer-elmo-folder nil t)
944 (setq wl-summary-delayed-update (cdr wl-summary-delayed-update))))
945 (message "Constructing summary structure...done")
946 (if (eq wl-summary-buffer-view 'thread)
948 (message "Inserting thread...")
949 (wl-thread-insert-top)
950 (message "Inserting thread...done")))
952 (wl-summary-score-headers (wl-summary-rescore-msgs
953 wl-summary-buffer-number-list)
955 (when (and wl-summary-scored
956 (setq expunged (wl-summary-score-update-all-lines)))
957 (message "%d message(s) are expunged by scoring." (length expunged))))
958 (wl-summary-set-message-modified)
959 (wl-summary-count-unread)
960 (wl-summary-update-modeline)
961 (goto-char (point-max))
963 (set-buffer-modified-p nil)))
965 (defun wl-summary-next-folder-or-exit (&optional next-entity upward)
969 (wl-summary-toggle-disp-msg 'off)
972 (wl-summary-goto-folder-subr next-entity
978 (wl-folder-set-current-entity-id (wl-folder-get-entity-id next-entity))
979 (if (and (eq retval 'more-next)
980 (memq wl-auto-select-next '(unread skip-no-unread))
981 (memq this-command wl-summary-next-no-unread-command))
984 t (eq wl-auto-select-next 'skip-no-unread))
985 (goto-char (point-max))
988 t (eq wl-auto-select-next 'skip-no-unread))))))
991 (defun wl-summary-entity-info-msg (entity finfo)
994 (if (memq 'ask-folder wl-use-folder-petname)
995 (wl-folder-get-petname entity)
997 (if (null (car finfo))
1000 " (%d new/%d unread)"
1006 (defun wl-summary-set-message-modified ()
1007 (elmo-folder-set-message-modified
1008 wl-summary-buffer-elmo-folder t)
1009 (setq wl-summary-buffer-message-modified t)
1010 (wl-summary-set-mark-modified))
1011 (defun wl-summary-message-modified-p ()
1012 wl-summary-buffer-message-modified)
1013 (defun wl-summary-set-mark-modified ()
1014 (elmo-folder-set-mark-modified-internal
1015 wl-summary-buffer-elmo-folder t))
1016 (defun wl-summary-mark-modified-p ()
1017 (elmo-folder-mark-modified-internal
1018 wl-summary-buffer-elmo-folder))
1019 (defun wl-summary-set-thread-modified ()
1020 (setq wl-summary-buffer-thread-modified t))
1021 (defun wl-summary-thread-modified-p ()
1022 wl-summary-buffer-thread-modified)
1024 (defsubst wl-summary-cleanup-temp-marks (&optional sticky)
1025 (when wl-summary-buffer-temp-mark-list
1026 (if (y-or-n-p (format "Execute remaining marks in %s? "
1027 (wl-summary-buffer-folder-name)))
1030 (if wl-summary-buffer-temp-mark-list
1031 (error "Some execution was failed")))
1032 ;; temp-mark-list is remained.
1034 (wl-summary-delete-all-temp-marks 'no-msg)
1035 (setq wl-summary-scored nil))
1037 ;; a subroutine for wl-summary-exit/wl-save-status
1038 ;; Note that folder is not commited here.
1039 (defun wl-summary-save-view ()
1040 ;; already in summary buffer.
1041 (when wl-summary-buffer-persistent
1042 ;; save the current summary buffer view.
1043 (if (and wl-summary-cache-use
1044 (or (wl-summary-message-modified-p)
1045 (wl-summary-mark-modified-p)
1046 (wl-summary-thread-modified-p)))
1047 (wl-summary-save-view-cache))))
1049 (defun wl-summary-save-status ()
1050 "Save summary view and msgdb."
1052 (if (interactive-p) (message "Saving summary status..."))
1053 (wl-summary-save-view)
1054 (elmo-folder-commit wl-summary-buffer-elmo-folder)
1055 (elmo-folder-check wl-summary-buffer-elmo-folder)
1056 (if wl-use-scoring (wl-score-save))
1057 (if (interactive-p) (message "Saving summary status...done")))
1059 (defun wl-summary-force-exit ()
1060 "Exit current summary. Buffer is deleted even the buffer is sticky."
1062 (wl-summary-exit 'force-exit))
1064 (defun wl-summary-exit (&optional force-exit)
1065 "Exit current summary. if FORCE-EXIT, exits even the summary is sticky."
1067 (let ((summary-buf (current-buffer))
1068 (sticky (wl-summary-sticky-p))
1070 message-buf message-win
1071 folder-buf folder-win)
1072 (run-hooks 'wl-summary-exit-pre-hook)
1073 (if wl-summary-buffer-exit-function
1074 (funcall wl-summary-buffer-exit-function)
1075 (if (or force-exit (not sticky))
1076 (wl-summary-cleanup-temp-marks sticky))
1078 ;; save summary status
1080 (wl-summary-save-view)
1081 (if (or force-exit (not sticky))
1082 (elmo-folder-close wl-summary-buffer-elmo-folder)
1083 (elmo-folder-commit wl-summary-buffer-elmo-folder)
1084 (elmo-folder-check wl-summary-buffer-elmo-folder))
1085 (if wl-use-scoring (wl-score-save)))
1086 ;; for sticky summary
1087 (wl-delete-all-overlays)
1088 (setq wl-summary-buffer-disp-msg nil)
1089 (elmo-kill-buffer wl-summary-search-buf-name)
1090 ;; delete message window if displayed.
1091 (if (and wl-message-buffer (get-buffer-window wl-message-buffer))
1092 (delete-window (get-buffer-window wl-message-buffer)))
1093 (if (and wl-summary-use-frame
1094 (> (length (visible-frame-list)) 1))
1096 (if (setq folder-buf (get-buffer wl-folder-buffer-name))
1097 (if wl-summary-use-frame
1099 (save-selected-window
1100 (dolist (frame (visible-frame-list))
1101 (select-frame frame)
1102 (if (get-buffer-window folder-buf)
1103 (setq select-frame frame))))
1105 (select-frame select-frame)
1106 (switch-to-buffer folder-buf)))
1107 (if (setq folder-win (get-buffer-window folder-buf))
1108 ;; folder win is already displayed.
1109 (select-window folder-win)
1110 ;; folder win is not displayed.
1111 (switch-to-buffer folder-buf)))
1112 ;; currently no folder buffer
1114 (and wl-folder-move-cur-folder
1115 wl-folder-buffer-cur-point
1116 (goto-char wl-folder-buffer-cur-point))
1117 (setq wl-folder-buffer-cur-path nil)
1118 (setq wl-folder-buffer-cur-entity-id nil)
1119 (wl-delete-all-overlays)
1120 (if wl-summary-exit-next-move
1121 (wl-folder-next-unsync t)
1122 (beginning-of-line))
1123 (if (setq summary-win (get-buffer-window summary-buf))
1124 (delete-window summary-win))
1128 (set-buffer summary-buf)
1129 (kill-buffer summary-buf)))
1130 (run-hooks 'wl-summary-exit-hook)))))
1132 (defun wl-summary-suspend ()
1135 (wl-folder-suspend))
1137 (defun wl-summary-sync-force-update (&optional unset-cursor no-check)
1139 (wl-summary-sync-update unset-cursor nil nil no-check))
1141 (defsubst wl-summary-sync-all-init ()
1142 (wl-summary-cleanup-temp-marks)
1144 (wl-summary-set-message-modified)
1145 (setq wl-thread-entity-hashtb (elmo-make-hash
1146 (* (elmo-folder-length
1147 wl-summary-buffer-elmo-folder)
1149 (setq wl-thread-entity-list nil)
1150 (setq wl-thread-entities nil)
1151 (setq wl-summary-buffer-number-list nil)
1152 (setq wl-summary-buffer-target-mark-list nil)
1153 (setq wl-summary-buffer-temp-mark-list nil))
1155 (defun wl-summary-sync (&optional unset-cursor force-range)
1157 (let* ((folder wl-summary-buffer-elmo-folder)
1158 (inhibit-read-only t)
1159 (buffer-read-only nil)
1160 (msgdb-dir (elmo-folder-msgdb-path folder))
1161 (range (or force-range (wl-summary-input-range
1162 (elmo-folder-name-internal folder)))))
1163 (cond ((string-match "rescan" range)
1164 (let ((msg (wl-summary-message-number))
1165 (wl-use-scoring (if (string-match "noscore" range)
1168 (wl-summary-rescan nil
1169 (string-match "noscore" range))
1170 (and msg (wl-summary-jump-to-msg msg))))
1171 ((string= range "mark")
1172 (let ((msg (wl-summary-message-number)))
1173 (call-interactively 'wl-summary-sync-marks)
1174 (and msg (wl-summary-jump-to-msg msg))))
1175 ((string= range "cache-status")
1176 (let ((msg (wl-summary-message-number)))
1177 (wl-summary-resume-cache-status)
1178 (and msg (wl-summary-jump-to-msg msg))))
1179 ((string= range "no-sync"))
1180 ((or (string-match "^last:" range)
1181 (string-match "^first:" range))
1182 (wl-summary-goto-folder-subr (concat "/" range "/"
1183 (elmo-folder-name-internal
1185 'force-update nil nil t))
1187 (wl-summary-sync-update unset-cursor
1188 (string-match "entirely" range)
1189 (string-match "all" range))))))
1191 (defvar wl-summary-edit-addresses-candidate-fields
1192 ;; First element becomes default.
1193 '("from" "to" "cc"))
1195 (defun wl-summary-edit-addresses-collect-candidate-fields (mime-charset)
1196 (let ((fields wl-summary-edit-addresses-candidate-fields)
1197 body candidates components)
1200 (mapconcat 'identity (elmo-multiple-field-body (car fields))
1202 (setq body (wl-parse-addresses body))
1203 (if body (setq candidates (append candidates body)))
1204 (setq fields (cdr fields)))
1205 (setq candidates (elmo-uniq-list candidates))
1207 (elmo-set-buffer-multibyte default-enable-multibyte-characters)
1210 (setq components (std11-extract-address-components x))
1211 (cons (nth 1 components)
1212 (and (car components)
1213 (eword-decode-string
1214 (decode-mime-charset-string
1219 (defun wl-summary-edit-addresses-subr (the-email name-in-addr)
1220 ;; returns nil if there's no change.
1221 (if (elmo-get-hash-val (downcase the-email) wl-address-petname-hash)
1223 (message "'%s' already exists. (e)dit/(d)elete/(c)ancel?"
1225 (while (not (or (eq (setq char (read-char)) ?\r)
1232 "Please answer `e' or `d' or `c'. (e)dit/(d)elete/(c)ancel?"))
1239 (wl-address-add-or-change
1241 (wl-address-header-extract-realname
1243 (let ((completion-ignore-case t) comp)
1245 (try-completion the-email wl-address-completion-list))
1246 (if (equal comp t) the-email comp))
1247 wl-address-completion-list))))
1251 (if (y-or-n-p (format "Delete '%s'? "
1254 (wl-address-delete the-email)
1261 (wl-address-add-or-change the-email name-in-addr)
1264 (defun wl-summary-edit-addresses (&optional addr-str)
1265 "Edit address book interactively.
1266 Optional argument ADDR-STR is used as a target address if specified."
1267 (interactive (if current-prefix-arg
1268 (list (read-from-minibuffer "Target address: "))))
1269 (if (null (wl-summary-message-number))
1270 (message "No message.")
1272 (let* ((charset wl-summary-buffer-mime-charset)
1274 (with-current-buffer (wl-summary-get-original-buffer)
1275 (wl-summary-edit-addresses-collect-candidate-fields
1277 address pair result)
1279 (setq address addr-str)
1281 (setq address (car (car candidates)))
1284 (format "Target address (%s): " address)
1286 (function (lambda (x) (cons (car x) (car x))))
1288 nil nil nil nil address))))
1290 (setq pair (assoc address candidates))
1292 (setq pair (cons address nil)))
1293 (when (setq result (wl-summary-edit-addresses-subr (car pair) (cdr pair)))
1296 (setq address (assoc (car pair) wl-address-list))
1298 (message "%s, %s, <%s> is %s."
1303 ;;; i'd like to update summary-buffer, but...
1304 ;;; (wl-summary-rescan)
1305 (run-hooks 'wl-summary-edit-addresses-hook))))))
1307 (defun wl-summary-incorporate (&optional arg)
1308 "Check and prefetch all uncached messages.
1309 If ARG is non-nil, checking is omitted."
1313 (wl-summary-sync-force-update)))
1314 (wl-summary-prefetch-region-no-mark (point-min) (point-max)
1315 wl-summary-incorporate-marks))
1317 (defun wl-summary-prefetch-msg (number &optional arg)
1318 "Prefetch message and return non-nil value. If skipped, return nil."
1319 ;; prefetching procedure.
1321 (let* ((size (elmo-message-field wl-summary-buffer-elmo-folder
1323 (file-cached (elmo-file-cache-exists-p
1324 (elmo-message-field wl-summary-buffer-elmo-folder
1325 number 'message-id)))
1326 (force-read (and size
1328 (and (null wl-prefetch-confirm) arg)
1329 (null wl-prefetch-threshold)
1330 (< size wl-prefetch-threshold))))
1334 (when (and (or arg (not file-cached))
1335 size (not force-read) wl-prefetch-confirm)
1341 "Message from %s has %d bytes. Prefetch it? "
1345 (wl-set-string-width
1347 (funcall wl-summary-from-function
1348 (eword-decode-string
1353 wl-summary-buffer-elmo-folder
1357 (message "")) ; flush.
1362 (if (or arg (not file-cached))
1363 (elmo-message-encache
1364 wl-summary-buffer-elmo-folder
1366 (elmo-message-set-cached wl-summary-buffer-elmo-folder
1368 (when (and (wl-summary-jump-to-msg number)
1369 (wl-summary-update-persistent-mark))
1371 (wl-summary-count-unread)
1372 (wl-summary-update-modeline)
1373 (wl-folder-update-unread
1374 (wl-summary-buffer-folder-name)
1375 (+ wl-summary-buffer-unread-count
1376 wl-summary-buffer-new-count))))
1380 (defun wl-summary-prefetch-region-no-mark (beg end &optional prefetch-marks)
1388 (setq start-pos (point))
1390 (narrow-to-region beg end)
1391 ;; collect prefetch targets.
1392 (message "Collecting marks...")
1393 (goto-char (point-min))
1395 (setq mark (wl-summary-persistent-mark)
1396 msg (wl-summary-message-number))
1397 (if (or (and (null prefetch-marks)
1399 (null (elmo-file-cache-exists-p
1401 wl-summary-buffer-elmo-folder
1404 (member mark prefetch-marks))
1405 (setq targets (nconc targets (list msg))))
1406 (setq entity (wl-thread-get-entity msg))
1407 (if (or (not (eq wl-summary-buffer-view 'thread))
1408 (wl-thread-entity-get-opened entity))
1409 (); opened. no hidden children.
1410 (setq targets (nconc
1412 (wl-thread-get-children-msgs-uncached
1413 msg prefetch-marks))))
1415 (setq length (length targets))
1416 (message "Prefetching...")
1418 (when (if (not (wl-thread-entity-parent-invisible-p
1419 (wl-thread-get-entity (car targets))))
1421 (wl-summary-jump-to-msg (car targets))
1422 (wl-summary-prefetch-msg
1423 (wl-summary-message-number)))
1424 (wl-summary-prefetch-msg (car targets)))
1425 (message "Prefetching... %d/%d message(s)"
1426 (setq count (+ 1 count)) length))
1427 (setq targets (cdr targets)))
1428 (message "Prefetched %d/%d message(s)" count length)
1429 (cons count length)))))
1431 (defun wl-summary-delete-marks-on-buffer (marks)
1433 (wl-summary-unmark (pop marks))))
1435 (defun wl-summary-delete-copy-marks-on-buffer (copies)
1436 (wl-summary-delete-marks-on-buffer copies))
1439 (defun wl-summary-delete-all-target-marks ()
1440 (wl-summary-delete-marks-on-buffer wl-summary-buffer-target-mark-list))
1442 (defun wl-summary-mark-as-read-region (beg end)
1446 (narrow-to-region beg end)
1447 (goto-char (point-min))
1448 (if (eq wl-summary-buffer-view 'thread)
1451 (let* ((number (wl-summary-message-number))
1452 (entity (wl-thread-get-entity number)))
1453 (if (wl-thread-entity-get-opened entity)
1454 (setq number-list (append number-list (list number)))
1457 (wl-thread-get-children-msgs number))))
1459 (wl-summary-mark-as-read number-list))
1463 (append number-list (list (wl-summary-message-number))))
1465 (wl-summary-mark-as-read number-list))))))
1467 (defun wl-summary-mark-as-unread-region (beg end)
1471 (narrow-to-region beg end)
1472 (goto-char (point-min))
1473 (if (eq wl-summary-buffer-view 'thread)
1476 (let* ((number (wl-summary-message-number))
1477 (entity (wl-thread-get-entity number)))
1478 (if (wl-thread-entity-get-opened entity)
1479 (setq number-list (append number-list (list number)))
1482 (wl-thread-get-children-msgs number))))
1484 (wl-summary-mark-as-unread number-list))
1488 (append number-list (list (wl-summary-message-number))))
1490 (wl-summary-mark-as-unread number-list))))))
1492 (defun wl-summary-mark-as-important-region (beg end)
1496 (narrow-to-region beg end);(save-excursion (goto-char end)
1497 ; (end-of-line) (point)))
1498 (goto-char (point-min))
1499 (if (eq wl-summary-buffer-view 'thread)
1502 (let* ((number (wl-summary-message-number))
1503 (entity (wl-thread-get-entity number))
1505 (if (wl-thread-entity-get-opened entity)
1506 ;; opened...mark line.
1507 ;; Crossposts are not processed
1508 (wl-summary-mark-as-important)
1510 (wl-summary-mark-as-important) ; mark itself.
1512 (delq number (wl-thread-get-children-msgs number)))
1514 (wl-summary-mark-as-important (car children))
1515 (setq children (cdr children))))
1518 (wl-summary-mark-as-important)
1519 (forward-line 1)))))
1520 (wl-summary-count-unread)
1521 (wl-summary-update-modeline))
1523 (defun wl-summary-mark-as-read-all ()
1525 (if (or (not (interactive-p))
1526 (y-or-n-p "Mark all messages as read? "))
1527 (let ((folder wl-summary-buffer-elmo-folder)
1528 (cur-buf (current-buffer)))
1529 (message "Setting all msgs as read...")
1530 (elmo-folder-mark-as-read folder
1531 (elmo-folder-list-unreads
1534 (goto-char (point-min))
1536 (wl-summary-update-persistent-mark)
1538 (wl-folder-update-unread (wl-summary-buffer-folder-name) 0)
1539 (setq wl-summary-buffer-unread-count 0)
1540 (setq wl-summary-buffer-new-count 0)
1541 (wl-summary-update-modeline)
1542 (message "Setting all msgs as read...done"))))
1544 (defun wl-summary-delete-cache ()
1545 "Delete cache of current message."
1548 (let* ((folder wl-summary-buffer-elmo-folder)
1550 (setq number (wl-summary-message-number))
1551 (elmo-message-set-cached folder number nil)
1552 (when (wl-summary-update-persistent-mark)
1553 (elmo-file-cache-delete
1554 (elmo-file-cache-get-path
1555 (elmo-message-field wl-summary-buffer-elmo-folder
1559 (defun wl-summary-resume-cache-status ()
1560 "Resume the cache status of all messages in the current folder."
1562 (let ((folder wl-summary-buffer-elmo-folder)
1564 (message "Resuming cache status...")
1566 (goto-char (point-min))
1568 (setq number (wl-summary-message-number))
1569 (setq msgid (elmo-message-field folder number 'message-id))
1570 (elmo-message-set-cached folder number
1571 (elmo-file-cache-exists-p msgid))
1572 (wl-summary-update-persistent-mark)
1574 (wl-summary-count-unread)
1575 (wl-summary-update-modeline)
1576 (message "Resuming cache status...done"))))
1578 (defun wl-summary-delete-messages-on-buffer (msgs &optional deleting-info)
1581 (let ((inhibit-read-only t)
1582 (buffer-read-only nil)
1586 ;(deleting-info (or deleting-info "Deleting..."))
1588 (elmo-kill-buffer wl-summary-search-buf-name)
1590 (if (eq wl-summary-buffer-view 'thread)
1592 ;; don't use wl-append(nconc), because list is broken. ...why?
1595 (wl-thread-delete-message (car msgs))))
1596 (setq update-list (delq (car msgs) update-list)))
1597 (goto-char (point-min))
1598 (if (wl-summary-jump-to-msg (car msgs))
1600 (delete-region (point-at-bol) (point-at-eol))
1601 (delete-char 1) ; delete '\n'
1602 (setq wl-summary-buffer-number-list
1603 (delq (car msgs) wl-summary-buffer-number-list)))))
1604 ; (when (> len elmo-display-progress-threshold)
1606 ; (if (or (zerop (% i 5)) (= i len))
1607 ; (elmo-display-progress
1608 ; 'wl-summary-delete-messages-on-buffer deleting-info
1609 ; (/ (* i 100) len))))
1610 (setq msgs (cdr msgs)))
1611 (when (eq wl-summary-buffer-view 'thread)
1612 (wl-thread-update-line-msgs (elmo-uniq-list update-list))
1613 (wl-thread-cleanup-symbols msgs2))
1614 ;;(message (concat deleting-info "done"))
1615 (wl-summary-count-unread)
1616 (wl-summary-update-modeline)
1617 (wl-folder-set-folder-updated
1618 (elmo-folder-name-internal wl-summary-buffer-elmo-folder)
1620 (+ wl-summary-buffer-unread-count wl-summary-buffer-new-count)
1621 (elmo-folder-length wl-summary-buffer-elmo-folder))))))
1623 (defun wl-summary-update-status-marks ()
1624 "Synchronize status marks on current buffer to the msgdb."
1627 (goto-char (point-min))
1629 (wl-summary-update-persistent-mark)
1632 (defun wl-summary-insert-message (&rest args)
1633 (if (eq wl-summary-buffer-view 'thread)
1634 (apply 'wl-summary-insert-thread args)
1635 (apply 'wl-summary-insert-sequential args)))
1637 (defun wl-summary-sort ()
1641 (format "Sort by (%s): " (symbol-name wl-summary-default-sort-spec))
1642 (mapcar (lambda (spec)
1643 (list (symbol-name spec)))
1644 wl-summary-sort-specs)
1645 nil t nil nil (symbol-name wl-summary-default-sort-spec))))
1647 (defun wl-summary-sync-marks ()
1648 "Update persistent marks in summary."
1650 (let ((last-progress 0)
1651 (folder wl-summary-buffer-elmo-folder)
1653 answereds importants unreads diff diffs
1655 ;; synchronize marks.
1656 (when (not (eq (elmo-folder-type-internal
1657 wl-summary-buffer-elmo-folder)
1659 (message "Updating marks...")
1660 (setq importants (elmo-uniq-list
1662 (elmo-folder-list-importants
1663 wl-summary-buffer-elmo-folder)
1664 (elmo-folder-list-messages-with-global-mark
1665 wl-summary-buffer-elmo-folder
1666 elmo-msgdb-important-mark)))
1667 unreads (elmo-folder-list-unreads
1668 wl-summary-buffer-elmo-folder)
1669 answereds (elmo-folder-list-answereds
1670 wl-summary-buffer-elmo-folder))
1671 (setq diff (elmo-list-diff importants
1672 (elmo-folder-list-flagged
1673 wl-summary-buffer-elmo-folder
1674 'important 'in-msgdb)))
1675 (setq diffs (cadr diff)) ; important-deletes
1676 (setq mes (format "Updated (-%d" (length diffs)))
1678 (wl-summary-mark-as-important (car diffs)
1679 elmo-msgdb-important-mark
1681 (setq diffs (cdr diffs)))
1682 (setq diffs (car diff)) ; important-appends
1683 (setq mes (concat mes (format "/+%d) important," (length diffs))))
1685 (wl-summary-mark-as-important (car diffs) " " 'no-server)
1686 (setq diffs (cdr diffs)))
1688 (setq diff (elmo-list-diff answereds
1689 (elmo-folder-list-flagged
1690 wl-summary-buffer-elmo-folder
1691 'answered 'in-msgdb)))
1692 (setq diffs (cadr diff))
1693 (setq mes (concat mes (format "(-%d" (length diffs))))
1695 (wl-summary-mark-as-unanswered (car diffs) 'no-modeline)
1696 (setq diffs (cdr diffs)))
1697 (setq diffs (car diff)) ; unread-appends
1698 (setq mes (concat mes (format "/+%d) answered mark(s)," (length diffs))))
1700 (wl-summary-mark-as-answered (car diffs) 'no-modeline)
1701 (setq diffs (cdr diffs)))
1703 (setq diff (elmo-list-diff unreads
1704 (elmo-folder-list-flagged
1705 wl-summary-buffer-elmo-folder
1706 'unread 'in-msgdb)))
1707 (setq diffs (cadr diff))
1708 (setq mes (concat mes (format "(-%d" (length diffs))))
1710 (wl-summary-mark-as-read (car diffs) 'no-folder 'no-modeline)
1711 (setq diffs (cdr diffs)))
1712 (setq diffs (car diff)) ; unread-appends
1713 (setq mes (concat mes (format "/+%d) unread mark(s)." (length diffs))))
1715 (wl-summary-mark-as-unread (car diffs) 'no-folder 'no-modeline)
1716 (setq diffs (cdr diffs)))
1717 (if (interactive-p) (message "%s" mes)))))
1719 (defun wl-summary-sync-update (&optional unset-cursor
1723 "Update the summary view to the newest folder status."
1725 (let* ((folder wl-summary-buffer-elmo-folder)
1726 (elmo-mime-charset wl-summary-buffer-mime-charset)
1727 (inhibit-read-only t)
1728 (buffer-read-only nil)
1732 append-list delete-list crossed
1733 update-thread update-top-list
1734 expunged mes entity)
1737 (unless wl-summary-buffer-elmo-folder
1738 (error "(Internal error) Folder is not set:%s" (buffer-name
1740 ;; Flush pending append operations (disconnected operation).
1742 ;;(wl-summary-flush-pending-append-operations seen-list))
1743 (goto-char (point-max))
1744 (wl-folder-confirm-existence folder (elmo-folder-plugged-p folder))
1745 (setq crossed (elmo-folder-synchronize folder
1752 (if sync-all (wl-summary-sync-all-init))
1753 (setq diff (elmo-list-diff (elmo-folder-list-messages
1755 (not disable-killed)
1757 wl-summary-buffer-number-list))
1758 (setq append-list (car diff))
1759 (setq delete-list (cadr diff))
1762 (wl-summary-delete-messages-on-buffer delete-list))
1763 (wl-summary-update-status-marks)
1764 (setq num (length append-list))
1766 (setq wl-summary-delayed-update nil)
1767 (elmo-kill-buffer wl-summary-search-buf-name)
1768 (dolist (number append-list)
1769 (setq entity (elmo-message-entity folder number))
1770 (when (setq update-thread
1771 (wl-summary-insert-message
1774 (wl-append update-top-list update-thread))
1775 (if elmo-use-database
1776 (elmo-database-msgid-put
1777 (car entity) (elmo-folder-name-internal folder)
1778 (elmo-msgdb-overview-entity-get-number entity)))
1779 (when (> num elmo-display-progress-threshold)
1781 (if (or (zerop (% i 5)) (= i num))
1782 (elmo-display-progress
1783 'wl-summary-sync-update
1784 (if (eq wl-summary-buffer-view 'thread)
1786 "Inserting message...")
1787 (/ (* i 100) num)))))
1788 (when wl-summary-delayed-update
1789 (while wl-summary-delayed-update
1790 (message "Parent (%d) of message %d is no entity"
1791 (caar wl-summary-delayed-update)
1792 (elmo-msgdb-overview-entity-get-number
1793 (cdar wl-summary-delayed-update)))
1794 (when (setq update-thread
1795 (wl-summary-insert-message
1796 (cdar wl-summary-delayed-update)
1797 wl-summary-buffer-elmo-folder
1799 (wl-append update-top-list update-thread))
1800 (setq wl-summary-delayed-update
1801 (cdr wl-summary-delayed-update))))
1802 (when (and (eq wl-summary-buffer-view 'thread)
1804 (wl-thread-update-indent-string-thread
1805 (elmo-uniq-list update-top-list)))
1806 (message (if (eq wl-summary-buffer-view 'thread)
1807 "Making thread...done"
1808 "Inserting message...done"))
1809 (when (or delete-list append-list)
1810 (wl-summary-set-message-modified))
1811 (when (and sync-all (eq wl-summary-buffer-view 'thread))
1812 (elmo-kill-buffer wl-summary-search-buf-name)
1813 (message "Inserting message...")
1814 (wl-thread-insert-top)
1815 (message "Inserting message...done"))
1816 (if elmo-use-database
1817 (elmo-database-close))
1818 (run-hooks 'wl-summary-sync-updated-hook)
1820 (if (and (eq (length delete-list) 0)
1823 "No updates for \"%s\"" (elmo-folder-name-internal
1825 (format "Updated (-%d/+%d) message(s)"
1826 (length delete-list) num))))
1827 (setq mes "Quit updating.")))
1828 ;; synchronize marks.
1829 (if (and crossed wl-summary-auto-sync-marks)
1830 (wl-summary-sync-marks))
1832 (when wl-use-scoring
1833 (setq wl-summary-scored nil)
1834 (wl-summary-score-headers (and sync-all
1835 (wl-summary-rescore-msgs
1836 wl-summary-buffer-number-list))
1838 (when (and wl-summary-scored
1839 (setq expunged (wl-summary-score-update-all-lines)))
1840 (setq mes (concat mes
1841 (format " (%d expunged)"
1842 (length expunged))))))
1843 (if (and crossed (> crossed 0))
1847 (format " (%d crosspost)" crossed))
1848 (format "%d crosspost message(s)" crossed)))
1849 (and mes (setq mes (concat mes "."))))
1850 ;; Update Folder mode
1851 (wl-folder-set-folder-updated
1852 (elmo-folder-name-internal folder)
1854 (let ((lst (wl-summary-count-unread)))
1855 (+ (car lst) (nth 1 lst)))
1856 (elmo-folder-length folder)))
1857 (wl-summary-update-modeline)
1859 (unless unset-cursor
1860 (goto-char (point-min))
1861 (if (not (wl-summary-cursor-down t))
1863 (goto-char (point-max))
1865 (if (and wl-summary-highlight
1866 (not wl-summary-lazy-highlight)
1867 (not (get-text-property (point) 'face)))
1871 wl-summary-partial-highlight-above-lines
1872 wl-summary-highlight-partial-threshold)))
1873 (wl-highlight-summary (point) (point-max))))))
1874 (setq wl-summary-buffer-msgdb (elmo-folder-msgdb folder))
1875 (wl-delete-all-overlays)
1876 (set-buffer-modified-p nil)
1877 (if mes (message "%s" mes)))))
1879 (defun wl-summary-set-score-mark (mark)
1882 (let ((cur-mark (wl-summary-temp-mark)))
1883 (when (member cur-mark (list " "
1884 wl-summary-score-below-mark
1885 wl-summary-score-over-mark))
1886 (wl-summary-put-temp-mark mark)
1887 (if wl-summary-highlight
1888 (wl-highlight-summary-current-line))
1889 (set-buffer-modified-p nil)))))
1891 (defun wl-summary-get-score-mark (msg-num)
1892 (let ((score (cdr (assq msg-num wl-summary-scored))))
1894 (cond ((< score wl-summary-default-score)
1896 ((> score wl-summary-default-score)
1899 (defun wl-summary-update-modeline ()
1900 (setq wl-summary-buffer-mode-line
1901 (funcall wl-summary-buffer-mode-line-formatter)))
1903 (defun wl-summary-jump-to-msg (&optional number)
1905 (let ((num (or number
1907 (read-from-minibuffer "Jump to Message(No.): ")))))
1908 (setq num (int-to-string num))
1910 (if (or (and (re-search-forward (concat "\r" num "[^0-9]") nil t)
1911 (progn (backward-char 1) t))
1912 (re-search-backward (concat "\r" num "[^0-9]") nil t))
1913 (progn (beginning-of-line) t)
1916 (defun wl-summary-highlight-msgs (msgs)
1918 (let ((len (length msgs))
1920 (message "Hilighting...")
1923 (if (wl-summary-jump-to-msg (car msgs))
1924 (wl-highlight-summary-current-line))
1925 (setq msgs (cdr msgs))
1926 (when (> len elmo-display-progress-threshold)
1928 (if (or (zerop (% i 5)) (= i len))
1929 (elmo-display-progress
1930 'wl-summary-highlight-msgs "Highlighting..."
1931 (/ (* i 100) len)))))
1932 (message "Highlighting...done"))))
1934 (defun wl-summary-message-number ()
1937 (if (or (re-search-forward "\r\\(-?[0-9]+\\)" (point-at-eol) t)
1938 (re-search-forward "^ *\\(-?[0-9]+\\)" (point-at-eol) t))
1939 (string-to-int (wl-match-buffer 1))
1942 (defun wl-summary-delete-all-msgs ()
1944 (let ((cur-buf (current-buffer))
1945 (dels (elmo-folder-list-messages wl-summary-buffer-elmo-folder)))
1946 (set-buffer cur-buf)
1948 (message "No message to delete.")
1949 (if (y-or-n-p (format "%s has %d message(s). Delete all? "
1950 (wl-summary-buffer-folder-name)
1953 (message "Deleting...")
1954 (elmo-folder-delete-messages wl-summary-buffer-elmo-folder dels)
1955 (elmo-folder-detach-messages wl-summary-buffer-elmo-folder dels)
1956 (wl-summary-set-message-modified)
1957 (wl-folder-set-folder-updated (wl-summary-buffer-folder-name)
1960 ;;; (setq wl-thread-top-entity '(nil t nil nil))
1961 (setq wl-summary-buffer-unread-count 0)
1962 (setq wl-summary-buffer-new-count 0)
1963 (wl-summary-update-modeline)
1964 (set-buffer cur-buf)
1965 (let ((inhibit-read-only t)
1966 (buffer-read-only nil))
1968 ;;; (if wl-summary-cache-use (wl-summary-save-view-cache))
1969 (message "Deleting...done")
1973 (defun wl-summary-toggle-thread (&optional arg)
1974 "Toggle thread status (T)hread and (S)equential.
1975 If ARG, without confirm."
1978 (y-or-n-p (format "Toggle threading? (y=%s): "
1979 (if (eq wl-summary-buffer-view 'thread)
1980 "\"off\"" "\"on\""))))
1981 (if (eq wl-summary-buffer-view 'thread)
1982 (setq wl-summary-buffer-view 'sequence)
1983 (setq wl-summary-buffer-view 'thread))
1984 (wl-summary-update-modeline)
1985 (force-mode-line-update)
1986 (wl-summary-rescan)))
1988 (defun wl-summary-load-file-object (filename)
1989 "Load lisp object from dir."
1991 (let ((tmp-buffer (get-buffer-create " *wl-summary-load-file-object*"))
1992 insert-file-contents-pre-hook ; To avoid autoconv-xmas...
1993 insert-file-contents-post-hook
1995 (if (not (file-readable-p filename))
1997 (set-buffer tmp-buffer)
1998 (as-binary-input-file (insert-file-contents filename))
2001 (read (current-buffer))
2002 (error (error "Reading failed")))))
2003 (kill-buffer tmp-buffer)
2006 (defun wl-summary-goto-folder (&optional arg)
2008 (wl-summary-goto-folder-subr nil nil nil nil t nil arg))
2010 (defun wl-summary-goto-folder-sticky ()
2012 (wl-summary-goto-folder-subr nil nil nil t t))
2014 (defun wl-summary-goto-last-visited-folder ()
2017 (wl-folder-search-entity-by-name wl-summary-last-visited-folder
2020 (if entity (wl-folder-set-current-entity-id
2021 (wl-folder-get-entity-id entity))))
2022 (wl-summary-goto-folder-subr wl-summary-last-visited-folder nil nil nil t))
2024 (defun wl-summary-sticky-p (&optional folder)
2026 (get-buffer (wl-summary-sticky-buffer-name
2027 (elmo-folder-name-internal folder)))
2028 (not (string= wl-summary-buffer-name (buffer-name)))))
2030 (defun wl-summary-always-sticky-folder-p (folder)
2031 (or (eq t wl-summary-always-sticky-folder-list)
2032 (wl-string-match-member
2033 (elmo-folder-name-internal folder)
2034 wl-summary-always-sticky-folder-list)))
2036 (defun wl-summary-stick (&optional force)
2037 "Make current summary buffer sticky."
2039 (if (wl-summary-sticky-p)
2040 (message "Current summary buffer is already sticky.")
2041 (when (or force (y-or-n-p "Stick current summary buffer? "))
2042 (wl-summary-toggle-disp-msg 'off)
2043 (wl-summary-switch-to-clone-buffer
2044 (wl-summary-sticky-buffer-name
2045 (wl-summary-buffer-folder-name)))
2047 ;;; (rename-buffer (wl-summary-sticky-buffer-name
2048 ;;; (wl-summary-buffer-folder-name))))
2049 (message "Folder `%s' is now sticky." (wl-summary-buffer-folder-name)))))
2051 (defun wl-summary-switch-to-clone-buffer (buffer-name)
2052 (let ((cur-buf (current-buffer))
2053 (msg (wl-summary-message-number))
2054 (buf (get-buffer-create buffer-name))
2055 (folder wl-summary-buffer-elmo-folder)
2057 (append '(wl-summary-buffer-view
2058 wl-summary-buffer-temp-mark-list
2059 wl-summary-buffer-target-mark-list
2060 wl-summary-buffer-elmo-folder
2061 wl-summary-buffer-number-column
2062 wl-summary-buffer-temp-mark-column
2063 wl-summary-buffer-persistent-mark-column
2064 wl-summary-buffer-message-modified
2065 wl-summary-buffer-thread-modified
2066 wl-summary-buffer-number-list
2067 wl-summary-buffer-msgdb
2068 wl-summary-buffer-folder-name
2069 wl-summary-buffer-line-formatter)
2070 (and (eq wl-summary-buffer-view 'thread)
2071 '(wl-thread-entity-hashtb
2073 wl-thread-entity-list))
2076 wl-summary-default-score
2077 wl-summary-important-above
2078 wl-summary-target-above
2079 wl-summary-mark-below
2080 wl-summary-expunge-below))
2081 (and (featurep 'wl-score)
2082 '(wl-current-score-file
2086 (wl-summary-buffer-set-folder folder)
2087 (let ((buffer-read-only nil))
2088 (insert-buffer cur-buf))
2089 (set-buffer-modified-p nil)
2090 (while copy-variables
2091 (set (car copy-variables)
2093 (set-buffer cur-buf)
2094 (symbol-value (car copy-variables))))
2095 (setq copy-variables (cdr copy-variables)))
2096 (switch-to-buffer buf)
2097 (kill-buffer cur-buf)
2098 (wl-summary-count-unread)
2099 (wl-summary-update-modeline)
2101 (if (eq wl-summary-buffer-view 'thread)
2102 (wl-thread-jump-to-msg msg)
2103 (wl-summary-jump-to-msg msg))
2104 (goto-char (point-max))
2105 (beginning-of-line))))
2107 (defun wl-summary-get-buffer (folder)
2109 (get-buffer (wl-summary-sticky-buffer-name folder)))
2110 (get-buffer wl-summary-buffer-name)))
2112 (defun wl-summary-get-buffer-create (name &optional force-sticky)
2115 (wl-summary-sticky-buffer-name name))
2116 (or (get-buffer (wl-summary-sticky-buffer-name name))
2117 (get-buffer-create wl-summary-buffer-name))))
2119 (defun wl-summary-make-number-list ()
2121 (goto-char (point-min))
2122 (setq wl-summary-buffer-number-list nil)
2124 (setq wl-summary-buffer-number-list
2125 (cons (wl-summary-message-number)
2126 wl-summary-buffer-number-list))
2128 (setq wl-summary-buffer-number-list
2129 (nreverse wl-summary-buffer-number-list))))
2131 (defun wl-summary-auto-select-msg-p (unread-msg)
2135 wl-summary-buffer-elmo-folder
2137 elmo-msgdb-important-mark))))
2139 (defsubst wl-summary-open-folder (folder)
2141 (let ((elmo-mime-charset wl-summary-buffer-mime-charset))
2143 (elmo-folder-open folder 'load-msgdb)
2144 ;; For compatibility
2145 (setq wl-summary-buffer-msgdb (elmo-folder-msgdb folder))
2146 (setq wl-summary-buffer-folder-name (elmo-folder-name-internal
2149 (defun wl-summary-goto-folder-subr (&optional name scan-type other-window
2150 sticky interactive scoring
2152 "Display target folder on summary."
2154 (let* ((keep-cursor (memq this-command
2155 wl-summary-keep-cursor-command))
2156 (name (or name (wl-summary-read-folder wl-default-folder)))
2157 (cur-fld wl-summary-buffer-elmo-folder)
2158 folder buf mes hilit reuse-buf
2160 (if (string= name "")
2161 (setq name wl-default-folder))
2162 (setq folder (wl-folder-get-elmo-folder name))
2163 (when (and (not (string=
2164 (and cur-fld (elmo-folder-name-internal cur-fld))
2165 (elmo-folder-name-internal folder))) ; folder is moved.
2166 (eq major-mode 'wl-summary-mode)) ; called in summary.
2167 (setq wl-summary-last-visited-folder (wl-summary-buffer-folder-name))
2168 (run-hooks 'wl-summary-exit-pre-hook)
2169 (if (or force-exit (not (wl-summary-sticky-p)))
2170 (wl-summary-cleanup-temp-marks (wl-summary-sticky-p)))
2171 (wl-summary-save-view)
2172 (elmo-folder-commit wl-summary-buffer-elmo-folder)
2173 (if (and (wl-summary-sticky-p) force-exit)
2174 (kill-buffer (current-buffer))))
2175 (setq buf (wl-summary-get-buffer-create (elmo-folder-name-internal folder)
2180 (string= (elmo-folder-name-internal folder)
2181 (wl-summary-buffer-folder-name))))
2185 (switch-to-buffer buf)
2188 (delete-other-windows))
2190 (unless (eq major-mode 'wl-summary-mode)
2192 (wl-summary-buffer-set-folder folder)
2193 (setq wl-summary-buffer-disp-msg nil)
2194 (setq wl-summary-buffer-last-displayed-msg nil)
2195 (setq wl-summary-buffer-current-msg nil)
2196 (let ((inhibit-read-only t)
2197 (buffer-read-only nil))
2199 ;; Resume summary view
2200 (if wl-summary-cache-use
2201 (let* ((dir (elmo-folder-msgdb-path folder))
2202 (cache (expand-file-name wl-summary-cache-file dir))
2203 (view (expand-file-name wl-summary-view-file dir)))
2204 (when (file-exists-p cache)
2205 (insert-file-contents-as-binary cache)
2206 (elmo-set-buffer-multibyte
2207 default-enable-multibyte-characters)
2208 (decode-mime-charset-region
2209 (point-min)(point-max)
2210 wl-summary-buffer-mime-charset 'LF))
2211 (if (file-exists-p view)
2212 (setq wl-summary-buffer-view
2213 (wl-summary-load-file-object view))
2214 (setq wl-summary-buffer-view
2215 (or (wl-get-assoc-list-value
2216 wl-summary-default-view-alist
2217 (elmo-folder-name-internal folder))
2218 wl-summary-default-view)))
2219 (wl-thread-resume-entity folder)
2220 (wl-summary-open-folder folder))
2221 (setq wl-summary-buffer-view
2222 (wl-summary-load-file-object
2223 (expand-file-name wl-summary-view-file
2224 (elmo-folder-msgdb-path folder))))
2225 (wl-summary-open-folder folder)
2226 (wl-summary-rescan))
2227 (wl-summary-count-unread)
2228 (wl-summary-update-modeline)))
2229 (unless (eq wl-summary-buffer-view 'thread)
2230 (wl-summary-make-number-list))
2231 (when (and wl-summary-cache-use
2232 (or (and wl-summary-check-line-format
2233 (wl-summary-line-format-changed-p))
2234 (wl-summary-view-old-p)))
2235 (wl-summary-rescan))
2236 (wl-summary-toggle-disp-msg (if wl-summary-buffer-disp-msg 'on 'off))
2237 (unless (and reuse-buf keep-cursor)
2239 (let ((wl-use-scoring
2240 (if (or scoring interactive) wl-use-scoring)))
2241 (if (and (not scan-type)
2244 (setq scan-type (wl-summary-get-sync-range folder)))
2247 (wl-summary-sync 'unset-cursor))
2248 ((eq scan-type 'all)
2249 (wl-summary-sync 'unset-cursor "all"))
2250 ((eq scan-type 'no-sync))
2251 ((eq scan-type 'rescan)
2252 (wl-summary-rescan))
2253 ((or (eq scan-type 'force-update)
2254 (eq scan-type 'update))
2255 (setq mes (wl-summary-sync-force-update
2256 'unset-cursor 'no-check)))))
2258 (switch-to-buffer buf)
2260 ;; stick always-sticky-folder
2261 (when (wl-summary-always-sticky-folder-p folder)
2262 (or (wl-summary-sticky-p) (wl-summary-stick t)))
2263 (run-hooks 'wl-summary-prepared-pre-hook)
2264 (set-buffer-modified-p nil)
2265 (goto-char (point-min))
2266 (if (wl-summary-cursor-down t)
2267 (let ((unreadp (wl-summary-next-message
2268 (wl-summary-message-number)
2270 (cond ((and wl-auto-select-first
2271 (wl-summary-auto-select-msg-p unreadp))
2272 ;; wl-auto-select-first is non-nil and
2273 ;; unreadp is non-nil but not important
2274 (setq retval 'disp-msg))
2275 ((and wl-auto-prefetch-first
2276 (wl-summary-auto-select-msg-p unreadp))
2277 ;; wl-auto-select-first is non-nil and
2278 ;; unreadp is non-nil but not important
2279 (setq retval 'prefetch-msg))
2280 ((not (wl-summary-auto-select-msg-p unreadp))
2281 ;; unreadp is nil or important
2282 (setq retval 'more-next))))
2283 (goto-char (point-max))
2284 (if (elmo-folder-plugged-p folder)
2287 (setq retval 'more-next))
2288 (if (and wl-summary-highlight
2289 (not wl-summary-lazy-highlight)
2291 (if (and wl-summary-highlight-partial-threshold
2292 (> (count-lines (point-min) (point-max))
2293 wl-summary-highlight-partial-threshold))
2298 wl-summary-partial-highlight-above-lines
2299 wl-summary-highlight-partial-threshold)))
2300 (wl-highlight-summary (point) (point-max)))
2301 (wl-highlight-summary (point-min) (point-max))))
2302 (if (eq retval 'disp-msg)
2303 (wl-summary-redisplay))
2304 (if (eq retval 'prefetch-msg)
2305 (wl-message-buffer-prefetch
2307 (wl-summary-message-number)
2308 wl-message-buffer-prefetch-depth
2310 wl-summary-buffer-mime-charset))
2311 (if mes (message "%s" mes))
2312 (if (and interactive wl-summary-recenter)
2313 (recenter (/ (- (window-height) 2) 2))))))
2314 ;; set current entity-id
2317 (wl-folder-search-entity-by-name
2318 (elmo-folder-name-internal folder)
2321 ;; entity-id is unknown.
2322 (wl-folder-set-current-entity-id
2323 (wl-folder-get-entity-id entity)))
2324 (when (and wl-summary-lazy-highlight
2328 (run-hooks 'wl-summary-prepared-hook)
2329 (set-buffer-modified-p nil))
2332 (defun wl-summary-goto-previous-message-beginning ()
2334 (re-search-backward "\r\\(-?[0-9]+\\)" nil t)
2335 (beginning-of-line))
2337 (defun wl-summary-goto-top-of-current-thread ()
2338 (wl-summary-jump-to-msg
2339 (wl-thread-entity-get-number
2340 (wl-thread-entity-get-top-entity (wl-thread-get-entity
2341 (wl-summary-message-number))))))
2343 (defun wl-summary-goto-bottom-of-sub-thread (&optional depth)
2345 (let ((depth (or depth
2346 (wl-thread-get-depth-of-current-line))))
2348 (while (and (not (eobp))
2349 (>= (wl-thread-get-depth-of-current-line)
2352 (beginning-of-line)))
2354 (defun wl-summary-insert-line (line)
2355 "Insert LINE in the Summary."
2356 (if wl-use-highlight-mouse-line
2357 ;; remove 'mouse-face of current line.
2359 (save-excursion (beginning-of-line)(point))
2360 (save-excursion (end-of-line)(point))
2363 (if wl-use-highlight-mouse-line
2364 ;; remove 'mouse-face of current line.
2366 (save-excursion (beginning-of-line)(point))
2367 (save-excursion (end-of-line)(point))
2370 (run-hooks 'wl-summary-line-inserted-hook)))
2372 (defun wl-summary-insert-sequential (entity folder &rest args)
2373 (let ((inhibit-read-only t)
2375 (goto-char (point-max))
2376 (wl-summary-insert-line
2377 (wl-summary-create-line entity nil nil
2380 (elmo-message-entity-number
2382 (setq wl-summary-buffer-number-list
2383 (wl-append wl-summary-buffer-number-list
2384 (list (elmo-message-entity-number entity))))
2387 (defun wl-summary-default-subject-filter (subject)
2388 (setq subject (elmo-replace-in-string subject "[ \t]*\\(re\\|was\\)[:>]" ""))
2389 (setq subject (elmo-replace-in-string subject "[ \t]" ""))
2390 (elmo-replace-in-string subject "^\\[.*\\]" ""))
2392 (defun wl-summary-subject-equal (subject1 subject2)
2393 (string= (funcall wl-summary-subject-filter-function subject1)
2394 (funcall wl-summary-subject-filter-function subject2)))
2396 (defmacro wl-summary-put-alike (alike)
2397 (` (elmo-set-hash-val (format "#%d" (wl-count-lines))
2399 wl-summary-alike-hashtb)))
2401 (defmacro wl-summary-get-alike ()
2402 (` (elmo-get-hash-val (format "#%d" (wl-count-lines))
2403 wl-summary-alike-hashtb)))
2405 (defun wl-summary-insert-headers (folder func mime-decode)
2406 (let ((numbers (elmo-folder-list-messages folder nil t))
2408 (buffer-disable-undo (current-buffer))
2409 (make-local-variable 'wl-summary-alike-hashtb)
2410 (setq wl-summary-alike-hashtb (elmo-make-hash (* (length numbers) 2)))
2412 (elmo-set-buffer-multibyte default-enable-multibyte-characters))
2413 (while (setq ov (elmo-message-entity folder (pop numbers)))
2414 (setq this (funcall func ov))
2415 (and this (setq this (std11-unfold-string this)))
2416 (if (equal last this)
2417 (setq alike (cons ov alike))
2419 (wl-summary-put-alike alike)
2421 (setq alike (list ov)
2424 (wl-summary-put-alike alike)
2427 (decode-mime-charset-region (point-min) (point-max)
2429 (when (eq mime-decode 'mime)
2430 (eword-decode-region (point-min) (point-max))))
2431 (run-hooks 'wl-summary-insert-headers-hook)))
2433 (defun wl-summary-search-by-subject (entity folder)
2434 (let ((summary-buf (current-buffer))
2435 (buf (get-buffer-create wl-summary-search-buf-name))
2436 (folder-name (wl-summary-buffer-folder-name))
2437 match founds cur result)
2438 (with-current-buffer buf
2439 (let ((case-fold-search t))
2440 (when (or (not (string= wl-summary-search-buf-folder-name folder-name))
2441 (zerop (buffer-size)))
2442 (setq wl-summary-search-buf-folder-name folder-name)
2443 (message "Creating subject cache...")
2444 (wl-summary-insert-headers
2448 (funcall wl-summary-subject-filter-function
2449 (elmo-message-entity-field x 'subject))))
2451 (message "Creating subject cache...done"))
2452 (setq match (funcall wl-summary-subject-filter-function
2453 (elmo-message-entity-field entity 'subject
2455 (if (string= match "")
2457 (goto-char (point-max))
2458 (while (and (null result)
2459 (not (= (point) (point-min)))
2460 (search-backward match nil t))
2461 ;; check exactly match
2462 (when (and (bolp) (= (point-at-eol)(match-end 0)))
2463 (setq founds (wl-summary-get-alike))
2464 (with-current-buffer summary-buf
2467 ;; the first element of found-entity list exists on
2469 (wl-thread-get-entity
2470 (elmo-message-entity-number (car founds)))
2471 ;; message id is not same as myself.
2473 (elmo-message-entity-field entity 'message-id)
2474 (elmo-message-entity-field (car founds)
2476 ;; not a descendant.
2477 (not (wl-thread-descendant-p
2478 (elmo-message-entity-number entity)
2479 (elmo-message-entity-number (car founds)))))
2480 (setq result (car founds)
2482 (setq founds (cdr founds))))))
2485 (defun wl-summary-insert-thread (entity folder update
2486 &optional force-insert)
2488 this-id parent-entity parent-number relatives anumber
2489 cur number cur-entity linked retval delayed-entity
2490 update-list entity-stack)
2492 (setq this-id (elmo-message-entity-field entity 'message-id)
2494 (elmo-message-entity-parent folder entity)
2495 parent-number (elmo-message-entity-number parent-entity))
2496 (setq number (elmo-message-entity-number entity))
2498 ;; If thread loop detected, set parent as nil.
2501 (elmo-message-entity-number
2502 (setq cur (elmo-message-entity-parent folder cur))))
2503 (if (memq anumber relatives)
2504 (setq parent-number nil
2506 (setq relatives (cons
2507 (elmo-message-entity-number cur)
2509 (if (and parent-number
2510 (not (wl-thread-get-entity parent-number))
2512 ;; parent exists in overview, but not in wl-thread-entities
2514 (wl-append wl-summary-delayed-update
2515 (list (cons parent-number entity)))
2516 (setq entity nil)) ;; exit loop
2517 ;; Search parent by subject.
2518 (when (and (null parent-number)
2519 wl-summary-search-parent-by-subject-regexp
2521 wl-summary-search-parent-by-subject-regexp
2522 (elmo-msgdb-overview-entity-get-subject entity)))
2523 (let ((found (wl-summary-search-by-subject entity folder)))
2525 (not (member found wl-summary-delayed-update)))
2526 (setq parent-entity found)
2528 (elmo-message-entity-number parent-entity))
2530 ;; If subject is change, divide thread.
2531 (if (and parent-number
2532 wl-summary-divide-thread-when-subject-changed
2533 (not (wl-summary-subject-equal
2534 (or (elmo-message-entity-field entity
2536 (or (elmo-message-entity-field parent-entity
2538 (setq parent-number nil))
2540 (wl-thread-insert-message entity
2541 number parent-number update linked))
2543 (wl-append update-list (list retval)))
2544 (setq entity nil) ; exit loop
2545 (while (setq delayed-entity (assq number wl-summary-delayed-update))
2546 (setq wl-summary-delayed-update
2547 (delq delayed-entity wl-summary-delayed-update))
2548 ;; update delayed message
2549 (wl-append entity-stack (list (cdr delayed-entity)))))
2550 (if (and (not entity)
2552 (setq entity (pop entity-stack))))
2555 (defun wl-summary-update-thread (entity
2558 (let* ((this-id (elmo-msgdb-overview-entity-get-id entity))
2559 (overview-entity entity)
2560 (parent-id (elmo-msgdb-overview-entity-get-id parent-entity))
2561 (number (elmo-msgdb-overview-entity-get-number entity))
2562 (parent-number (elmo-msgdb-overview-entity-get-number parent-entity))
2565 ((or (not parent-id)
2566 (string= this-id parent-id))
2567 (goto-char (point-max))
2569 (setq insert-line t))
2570 ;; parent already exists in buffer.
2571 ((wl-summary-jump-to-msg parent-number)
2572 (wl-thread-goto-bottom-of-sub-thread)
2573 (setq insert-line t)))
2575 (let (buffer-read-only)
2576 (wl-summary-insert-line
2577 (wl-summary-create-line
2581 (elmo-message-mark wl-summary-buffer-elmo-folder number)
2582 (wl-thread-maybe-get-children-num number)
2583 (wl-thread-make-indent-string thr-entity)
2584 (wl-thread-entity-get-linked thr-entity)))))))
2586 (defun wl-summary-target-mark-msgs (msgs)
2587 "Return the number of marked messages."
2589 (dolist (number msgs)
2590 (when (wl-summary-target-mark number)
2594 (defun wl-summary-pick (&optional from-list delete-marks)
2597 (let* ((condition (car (elmo-parse-search-condition
2598 (elmo-read-search-condition
2599 wl-summary-pick-field-default))))
2600 (result (elmo-folder-search wl-summary-buffer-elmo-folder
2605 (let ((mlist wl-summary-buffer-target-mark-list))
2607 (when (wl-summary-jump-to-msg (car mlist))
2608 (wl-summary-unmark))
2609 (setq mlist (cdr mlist)))
2610 (setq wl-summary-buffer-target-mark-list nil)))
2612 (setq num (wl-summary-target-mark-msgs result))
2614 (if (= num (length result))
2615 (message "%d message(s) are picked." num)
2616 (message "%d(%d) message(s) are picked." num
2617 (- (length result) num)))
2618 (message "No message was picked.")))))
2620 (defun wl-summary-unvirtual ()
2621 "Exit from current virtual folder."
2624 (elmo-folder-type-internal wl-summary-buffer-elmo-folder))
2625 (wl-summary-goto-folder-subr
2626 (elmo-folder-name-internal
2627 (elmo-filter-folder-target-internal
2628 wl-summary-buffer-elmo-folder))
2630 (error "This folder is not filtered")))
2632 (defun wl-summary-virtual (&optional arg)
2633 "Goto virtual folder.
2634 If ARG, exit virtual folder."
2637 (wl-summary-unvirtual)
2638 (wl-summary-goto-folder-subr (concat "/"
2639 (elmo-read-search-condition
2640 wl-summary-pick-field-default)
2642 (wl-summary-buffer-folder-name))
2644 (run-hooks 'wl-summary-virtual-hook)))
2646 (defun wl-summary-delete-all-temp-marks (&optional no-msg force)
2647 "Erase all temp marks from buffer."
2649 (when (or wl-summary-buffer-target-mark-list
2650 wl-summary-buffer-temp-mark-list
2653 (goto-char (point-min))
2655 (message "Unmarking..."))
2657 (wl-summary-unset-mark nil nil force)
2660 (message "Unmarking...done"))
2661 (setq wl-summary-buffer-target-mark-list nil)
2662 (setq wl-summary-buffer-temp-mark-list nil))))
2664 (defsubst wl-summary-temp-mark ()
2665 "Return temp-mark string of current line."
2666 (let ((number (wl-summary-message-number))
2668 (or (and (wl-summary-have-target-mark-p number)
2670 (and (setq info (wl-summary-registered-temp-mark number))
2672 (wl-summary-get-score-mark number)
2675 (defsubst wl-summary-persistent-mark ()
2676 "Return persistent-mark string of current line."
2678 (elmo-message-mark wl-summary-buffer-elmo-folder
2679 (wl-summary-message-number)))
2682 (defun wl-summary-put-temp-mark (mark)
2683 "Put temp MARK on current line."
2684 (when wl-summary-buffer-temp-mark-column
2687 (let ((inhibit-read-only t)
2688 (buffer-read-only nil))
2689 (move-to-column wl-summary-buffer-temp-mark-column)
2690 (delete-backward-char 1)
2693 (defun wl-summary-next-buffer ()
2694 "Switch to next summary buffer."
2696 (let ((buffers (sort (wl-collect-summary)
2697 (lambda (buffer1 buffer2)
2698 (string-lessp (buffer-name buffer1)
2699 (buffer-name buffer2))))))
2701 (or (cadr (memq (current-buffer) buffers))
2704 (defun wl-summary-previous-buffer ()
2705 "Switch to previous summary buffer."
2707 (let ((buffers (sort (wl-collect-summary)
2708 (lambda (buffer1 buffer2)
2709 (not (string-lessp (buffer-name buffer1)
2710 (buffer-name buffer2)))))))
2712 (or (cadr (memq (current-buffer) buffers))
2715 (defun wl-summary-target-mark-mark-as-read ()
2718 (goto-char (point-min))
2719 (let ((inhibit-read-only t)
2720 (buffer-read-only nil)
2721 wl-summary-buffer-disp-msg
2722 (mlist wl-summary-buffer-temp-mark-list))
2723 (dolist (number mlist)
2724 (wl-summary-unset-mark number))
2725 (wl-summary-mark-as-read mlist))))
2727 (defun wl-summary-target-mark-mark-as-unread ()
2730 (goto-char (point-min))
2731 (let ((inhibit-read-only t)
2732 (buffer-read-only nil)
2733 wl-summary-buffer-disp-msg
2734 (mlist wl-summary-buffer-target-mark-list))
2735 (dolist (number mlist)
2736 (wl-summary-unset-mark number))
2737 (wl-summary-mark-as-unread mlist))))
2739 (defun wl-summary-target-mark-mark-as-important ()
2742 (goto-char (point-min))
2743 (let ((inhibit-read-only t)
2744 (buffer-read-only nil)
2745 wl-summary-buffer-disp-msg
2746 (mlist wl-summary-buffer-target-mark-list))
2747 (dolist (number mlist)
2748 (wl-summary-unset-mark number)
2749 (wl-summary-mark-as-important number))
2750 (wl-summary-count-unread)
2751 (wl-summary-update-modeline))))
2753 (defun wl-summary-target-mark-save ()
2756 (wl-read-directory-name "Save to directory: "
2757 wl-temporary-file-directory))
2759 (if (null (file-exists-p wl-save-dir))
2760 (make-directory wl-save-dir))
2761 (while (setq number (car wl-summary-buffer-target-mark-list))
2762 (wl-thread-jump-to-msg number)
2763 (wl-summary-save t wl-save-dir)
2764 (wl-summary-unmark))))
2766 (defun wl-summary-target-mark-pick ()
2768 (wl-summary-pick wl-summary-buffer-target-mark-list 'delete))
2770 (defun wl-summary-update-persistent-mark ()
2771 "Synch up persistent mark of current line with msgdb's.
2772 Return non-nil if the mark is updated"
2773 (if wl-summary-buffer-persistent-mark-column
2775 (move-to-column wl-summary-buffer-persistent-mark-column)
2776 (let ((inhibit-read-only t)
2777 (buffer-read-only nil)
2778 (mark (buffer-substring (- (point) 1) (point)))
2779 (new-mark (wl-summary-persistent-mark)))
2780 (unless (string= new-mark mark)
2781 (delete-backward-char 1)
2783 (when wl-summary-highlight
2784 (wl-highlight-summary-current-line))
2785 (set-buffer-modified-p nil)
2787 (when wl-summary-highlight
2788 (wl-highlight-summary-current-line))
2789 (set-buffer-modified-p nil)))
2791 (defsubst wl-summary-mark-as-read-internal (inverse
2796 (let ((folder wl-summary-buffer-elmo-folder)
2797 unread-message number
2798 number-list visible)
2799 (setq number-list (cond ((numberp number-or-numbers)
2800 (setq unread-message
2801 (member (elmo-message-mark
2804 (elmo-msgdb-unread-marks)))
2805 (list number-or-numbers))
2806 ((and (not (null number-or-numbers))
2807 (listp number-or-numbers))
2809 ((setq number (wl-summary-message-number))
2811 (setq unread-message
2812 (member (elmo-message-mark folder number)
2813 (elmo-msgdb-unread-marks)))
2815 (if (null number-list)
2816 (message "No message.")
2818 (elmo-folder-unmark-read folder number-list no-folder-mark)
2819 (elmo-folder-mark-as-read folder number-list no-folder-mark))
2820 (dolist (number number-list)
2821 (setq visible (wl-summary-jump-to-msg number))
2823 (when unread-message
2824 (run-hooks 'wl-summary-unread-message-hook)))
2825 ;; set mark on buffer
2827 (wl-summary-update-persistent-mark)))
2828 (unless no-modeline-update
2829 ;; Update unread numbers.
2830 ;; should elmo-folder-mark-as-read return unread numbers?
2831 (wl-summary-count-unread)
2832 (wl-summary-update-modeline)
2833 (wl-folder-update-unread
2834 (wl-summary-buffer-folder-name)
2835 (+ wl-summary-buffer-unread-count
2836 wl-summary-buffer-new-count)))))))
2838 (defun wl-summary-mark-as-read (&optional number-or-numbers
2842 (wl-summary-mark-as-read-internal nil
2845 no-modeline-update))
2847 (defun wl-summary-mark-as-unread (&optional number-or-numbers
2851 (wl-summary-mark-as-read-internal 'inverse
2854 no-modeline-update))
2856 (defsubst wl-summary-mark-as-answered-internal (inverse
2860 (let ((folder wl-summary-buffer-elmo-folder)
2861 number number-list visible)
2862 (setq number-list (cond ((numberp number-or-numbers)
2863 (list number-or-numbers))
2864 ((and (not (null number-or-numbers))
2865 (listp number-or-numbers))
2867 ((setq number (wl-summary-message-number))
2870 (if (null number-list)
2871 (message "No message.")
2873 (elmo-folder-unmark-answered folder number-list)
2874 (elmo-folder-mark-as-answered folder number-list))
2875 (dolist (number number-list)
2876 (setq visible (wl-summary-jump-to-msg number))
2877 ;; set mark on buffer
2879 (wl-summary-update-persistent-mark)))
2880 (unless no-modeline-update
2881 ;; Update unread numbers.
2882 ;; should elmo-folder-mark-as-read return unread numbers?
2883 (wl-summary-count-unread)
2884 (wl-summary-update-modeline)
2885 (wl-folder-update-unread
2886 (wl-summary-buffer-folder-name)
2887 (+ wl-summary-buffer-unread-count
2888 wl-summary-buffer-new-count)))))))
2890 (defun wl-summary-mark-as-answered (&optional number-or-numbers
2893 (wl-summary-mark-as-answered-internal
2894 (and (interactive-p)
2895 (member (elmo-message-mark wl-summary-buffer-elmo-folder
2896 (wl-summary-message-number))
2897 (elmo-msgdb-answered-marks)))
2899 no-modeline-update))
2901 (defun wl-summary-mark-as-unanswered (&optional number-or-numbers
2903 (wl-summary-mark-as-answered-internal 'inverse
2905 no-modeline-update))
2907 (defun wl-summary-mark-as-important (&optional number
2911 (if (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
2913 (error "Cannot process mark in this folder"))
2915 (let* ((folder wl-summary-buffer-elmo-folder)
2916 message-id visible cur-mark)
2918 (setq visible (wl-summary-jump-to-msg number))
2919 (setq cur-mark (or mark
2921 wl-summary-buffer-elmo-folder number)
2923 ((setq number (wl-summary-message-number))
2925 (setq cur-mark (or mark (wl-summary-persistent-mark))))
2927 (error "No message")))
2929 ;; already exists in msgdb.
2930 (elmo-message-entity wl-summary-buffer-elmo-folder
2932 (setq message-id (elmo-message-field
2933 wl-summary-buffer-elmo-folder
2936 (if (string= cur-mark elmo-msgdb-important-mark)
2940 (elmo-folder-unmark-important folder (list number)
2942 (unless no-server-update
2943 (elmo-msgdb-global-mark-delete message-id))
2944 ;; Remove cache if local folder.
2945 (if (and (elmo-folder-local-p folder)
2947 (elmo-folder-type-internal folder))))
2948 (elmo-file-cache-delete
2949 (elmo-file-cache-get-path message-id)))))
2951 (elmo-folder-mark-as-important folder (list number)
2953 (if (eq (elmo-file-cache-exists-p message-id) 'entire)
2954 (elmo-folder-mark-as-read folder (list number))
2955 ;; Force cache message.
2956 (elmo-message-encache folder number 'read))
2957 (unless no-server-update
2958 (elmo-msgdb-global-mark-set message-id
2959 elmo-msgdb-important-mark))))
2961 (wl-summary-update-persistent-mark))))
2965 (defvar wl-summary-line-formatter nil)
2967 (defun wl-summary-view-old-p ()
2968 "Return non-nil when summary view cache has old format."
2970 (goto-char (point-min))
2971 (and wl-summary-buffer-number-list
2972 (not (re-search-forward "\r-?[0-9]+" (point-at-eol) t)))))
2974 (defun wl-summary-line-format-changed-p ()
2975 "Return non-nil when summary line format is changed."
2977 wl-summary-buffer-line-format
2978 (or (elmo-object-load (expand-file-name
2979 wl-summary-line-format-file
2980 (elmo-folder-msgdb-path
2981 wl-summary-buffer-elmo-folder))
2982 wl-summary-buffer-mime-charset)
2983 wl-summary-buffer-line-format))))
2985 (defun wl-summary-line-format-save ()
2986 "Save current summary line format."
2988 (expand-file-name wl-summary-line-format-file
2989 (elmo-folder-msgdb-path
2990 wl-summary-buffer-elmo-folder))
2991 wl-summary-buffer-line-format
2992 wl-summary-buffer-mime-charset))
2994 (defun wl-summary-line-number ()
2995 (wl-set-string-width
2996 (- wl-summary-buffer-number-column)
2998 (elmo-msgdb-overview-entity-get-number wl-message-entity))))
3000 (defun wl-summary-line-year ()
3001 (aref wl-datevec 0))
3002 (defun wl-summary-line-month ()
3003 (format "%02d" (aref wl-datevec 1)))
3004 (defun wl-summary-line-day ()
3005 (format "%02d" (aref wl-datevec 2)))
3006 (defun wl-summary-line-day-of-week ()
3008 (elmo-date-get-week (aref wl-datevec 0)
3010 (aref wl-datevec 2))
3012 (defun wl-summary-line-hour ()
3013 (format "%02d" (aref wl-datevec 3)))
3014 (defun wl-summary-line-minute ()
3015 (format "%02d" (aref wl-datevec 4)))
3017 (defun wl-summary-line-size ()
3018 (let ((size (elmo-msgdb-overview-entity-get-size wl-message-entity)))
3021 ((<= 1 (/ size 1048576))
3022 (format "%.0fM" (/ size 1048576.0)))
3023 ((<= 1 (/ size 1024))
3024 (format "%.0fK" (/ size 1024.0)))
3025 (t (format "%dB" size)))
3028 (defun wl-summary-line-subject ()
3029 (let (no-parent subject parent-raw-subject parent-subject)
3030 (if (string= wl-thr-indent-string "")
3031 (setq no-parent t)) ; no parent
3033 (elmo-delete-char ?\n
3034 (or (elmo-msgdb-overview-entity-get-subject
3036 wl-summary-no-subject-message)))
3037 (setq parent-raw-subject
3038 (elmo-msgdb-overview-entity-get-subject wl-parent-message-entity))
3039 (setq parent-subject
3040 (if parent-raw-subject
3041 (elmo-delete-char ?\n parent-raw-subject)))
3043 (null parent-subject)
3044 (not (wl-summary-subject-equal
3045 subject parent-subject)))
3046 (funcall wl-summary-subject-function subject)
3049 (defun wl-summary-line-from ()
3050 (elmo-delete-char ?\n
3051 (funcall wl-summary-from-function
3052 (elmo-msgdb-overview-entity-get-from
3053 wl-message-entity))))
3055 (defun wl-summary-line-list-info ()
3056 (let ((list-info (wl-summary-get-list-info wl-message-entity)))
3058 (format (if (cdr list-info) "(%s %05.0f)" "(%s)")
3059 (car list-info) (cdr list-info))
3062 (defun wl-summary-line-list-count ()
3063 (let ((ml-count (cdr (wl-summary-get-list-info wl-message-entity))))
3065 (format "%.0f" ml-count)
3068 (defun wl-summary-line-attached ()
3069 (let ((content-type (elmo-msgdb-overview-entity-get-extra-field
3070 wl-message-entity "content-type"))
3071 (case-fold-search t))
3072 (if (and content-type
3073 (string-match "multipart/mixed" content-type))
3077 (defun wl-summary-create-line (wl-message-entity
3078 wl-parent-message-entity
3082 wl-thr-children-number
3083 wl-thr-indent-string
3085 "Create a summary line."
3086 (let ((wl-mime-charset wl-summary-buffer-mime-charset)
3087 (elmo-mime-charset wl-summary-buffer-mime-charset)
3088 (elmo-lang wl-summary-buffer-weekday-name-lang)
3089 (wl-datevec (or (ignore-errors (timezone-fix-time
3090 (elmo-msgdb-overview-entity-get-date
3093 wl-summary-fix-timezone))
3095 (entity wl-message-entity) ; backward compatibility.
3097 (if (and wl-thr-indent-string
3098 wl-summary-indent-length-limit
3099 (< wl-summary-indent-length-limit
3100 (string-width wl-thr-indent-string)))
3101 (setq wl-thr-indent-string (wl-set-string-width
3102 wl-summary-indent-length-limit
3103 wl-thr-indent-string)))
3104 (setq line (funcall wl-summary-buffer-line-formatter))
3105 (if wl-summary-width (setq line
3106 (wl-set-string-width
3107 (- wl-summary-width 1) line nil
3109 (setq line (concat line
3112 (elmo-msgdb-overview-entity-get-number
3113 wl-message-entity))))
3114 (if wl-summary-highlight
3115 (wl-highlight-summary-line-string line
3118 wl-thr-indent-string))
3121 (defsubst wl-summary-proc-wday (wday-str year month mday)
3123 (if (string-match "\\([A-Z][a-z][a-z]\\).*" wday-str)
3124 (wl-match-string 1 wday-str)
3125 (elmo-date-get-week year month mday))))
3127 (defvar wl-summary-move-spec-alist
3132 (unread . ((t . nil)
3136 (defsubst wl-summary-next-message (num direction hereto)
3137 (if wl-summary-buffer-next-message-function
3138 (funcall wl-summary-buffer-next-message-function num direction hereto)
3139 (let ((cur-spec (cdr (assq wl-summary-move-order
3140 wl-summary-move-spec-alist)))
3141 (nums (memq num (if (eq direction 'up)
3142 (reverse wl-summary-buffer-number-list)
3143 wl-summary-buffer-number-list)))
3145 (unless hereto (setq nums (cdr nums)))
3151 (cond ((eq (car (car cur-spec)) 'p)
3152 (if (setq flagged-list
3153 (elmo-folder-list-flagged
3154 wl-summary-buffer-elmo-folder
3155 (cdr (car cur-spec))))
3157 (if (and (memq (car nums) flagged-list)
3158 (elmo-message-accessible-p
3159 wl-summary-buffer-elmo-folder
3161 (throw 'done (car nums)))
3162 (setq nums (cdr nums)))))
3163 ((eq (car (car cur-spec)) 't)
3164 (if wl-summary-buffer-target-mark-list
3166 (if (memq (car nums)
3167 wl-summary-buffer-target-mark-list)
3168 (throw 'done (car nums)))
3169 (setq nums (cdr nums))))))
3170 (setq cur-spec (cdr cur-spec))))
3173 (defsubst wl-summary-cursor-move (direction hereto)
3174 (when (and (eq direction 'up)
3179 (when (setq num (wl-summary-next-message (wl-summary-message-number)
3182 (wl-thread-jump-to-msg num))
3185 ;; Goto unread or important
3186 ;; returns t if next message exists in this folder.
3187 (defun wl-summary-cursor-down (&optional hereto)
3189 (wl-summary-cursor-move 'down hereto))
3191 (defun wl-summary-cursor-up (&optional hereto)
3193 (wl-summary-cursor-move 'up hereto))
3195 (defun wl-summary-save-view-cache ()
3197 (let* ((dir (elmo-folder-msgdb-path wl-summary-buffer-elmo-folder))
3198 (cache (expand-file-name wl-summary-cache-file dir))
3199 (view (expand-file-name wl-summary-view-file dir))
3200 (save-view wl-summary-buffer-view)
3201 (mark-list (copy-sequence wl-summary-buffer-target-mark-list))
3202 (temp-list (copy-sequence wl-summary-buffer-temp-mark-list))
3203 (tmp-buffer (get-buffer-create " *wl-summary-save-view-cache*"))
3204 (temp-column wl-summary-buffer-temp-mark-column)
3205 (charset wl-summary-buffer-mime-charset))
3206 (if (file-directory-p dir)
3208 (if (file-exists-p dir)
3209 (error "File %s already exists" dir)
3210 (elmo-make-directory dir)))
3211 (if (eq save-view 'thread)
3212 (wl-thread-save-entity dir))
3213 (when wl-summary-check-line-format
3214 (wl-summary-line-format-save))
3217 (when (file-writable-p cache)
3218 (copy-to-buffer tmp-buffer (point-min) (point-max))
3219 (with-current-buffer tmp-buffer
3221 (make-local-variable 'wl-summary-highlight)
3222 (setq wl-summary-highlight nil
3223 wl-summary-buffer-target-mark-list mark-list
3224 wl-summary-buffer-temp-mark-list temp-list
3225 wl-summary-buffer-temp-mark-column temp-column)
3226 (wl-summary-delete-all-temp-marks 'no-msg 'force)
3227 (encode-coding-region
3228 (point-min) (point-max)
3230 ;; one in mcs-ltn1(apel<10.4) cannot take 2 arg.
3231 (mime-charset-to-coding-system charset 'LF))
3232 ;; Mule 2 doesn't have `*ctext*unix'.
3233 (mime-charset-to-coding-system charset)))
3234 (write-region-as-binary (point-min)(point-max)
3235 cache nil 'no-msg)))
3236 (when (file-writable-p view) ; 'thread or 'sequence
3238 (set-buffer tmp-buffer)
3240 (prin1 save-view tmp-buffer)
3241 (princ "\n" tmp-buffer)
3242 (write-region (point-min) (point-max) view nil 'no-msg))))
3244 (kill-buffer tmp-buffer)))))
3246 (defsubst wl-summary-get-sync-range (folder)
3248 (elmo-folder-plugged-p folder)
3249 (wl-get-assoc-list-value
3250 wl-folder-sync-range-alist
3251 (elmo-folder-name-internal folder)))
3252 wl-default-sync-range)))
3254 ;; redefined for wl-summary-sync-update
3255 (defun wl-summary-input-range (folder)
3256 "returns update or all or rescan."
3257 ;; for the case when parts are expanded in the bottom of the folder
3258 (let ((input-range-list '("no-sync"
3269 (default (or (wl-get-assoc-list-value
3270 wl-folder-sync-range-alist
3272 wl-default-sync-range))
3275 (completing-read (format "Range (%s): " default)
3277 (function (lambda (x) (cons x x)))
3279 (if (string= range "")
3283 (defun wl-summary-toggle-disp-folder (&optional arg)
3285 (let ((cur-buf (current-buffer))
3286 (summary-win (get-buffer-window (current-buffer)))
3290 (setq wl-summary-buffer-disp-folder t)
3291 ;; hide your folder window
3292 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3293 (if (setq fld-win (get-buffer-window fld-buf))
3294 (delete-window fld-win))))
3296 (setq wl-summary-buffer-disp-folder nil)
3297 ;; hide your wl-message window!
3298 (when (buffer-live-p wl-message-buffer)
3299 (wl-message-select-buffer wl-message-buffer)
3301 (select-window (get-buffer-window cur-buf))
3302 ;; display wl-folder window!!
3303 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3304 (if (setq fld-win (get-buffer-window fld-buf))
3305 ;; folder win is already displayed.
3306 (select-window fld-win)
3307 ;; folder win is not displayed.
3308 (switch-to-buffer fld-buf))
3311 ;; temporarily delete summary-win.
3313 (delete-window summary-win))
3314 (split-window-horizontally wl-folder-window-width)
3316 (switch-to-buffer cur-buf))
3318 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3319 (if (setq fld-win (get-buffer-window fld-buf))
3320 (setq wl-summary-buffer-disp-folder nil)
3321 (setq wl-summary-buffer-disp-folder t)))
3322 (if (not wl-summary-buffer-disp-folder)
3323 ;; hide message window
3324 (let ((mes-win (and wl-message-buffer
3325 (get-buffer-window wl-message-buffer)))
3326 (wl-stay-folder-window t))
3327 (if mes-win (delete-window mes-win))
3328 ;; hide your folder window
3329 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3330 (if (setq fld-win (get-buffer-window fld-buf))
3332 (delete-window (get-buffer-window cur-buf))
3333 (select-window fld-win)
3334 (switch-to-buffer cur-buf))))
3335 (run-hooks 'wl-summary-toggle-disp-folder-off-hook)
3336 ;; resume message window.
3338 (wl-message-select-buffer wl-message-buffer)
3339 (run-hooks 'wl-summary-toggle-disp-folder-message-resumed-hook)
3340 (select-window (get-buffer-window cur-buf))))
3341 ;; hide message window
3342 (let ((wl-stay-folder-window t)
3343 (mes-win (and wl-message-buffer
3344 (get-buffer-window wl-message-buffer))))
3345 (if mes-win (delete-window mes-win))
3346 (select-window (get-buffer-window cur-buf))
3347 ;; display wl-folder window!!
3348 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3349 (if (setq fld-win (get-buffer-window fld-buf))
3350 ;; folder win is already displayed.
3351 (select-window fld-win)
3352 ;; folder win is not displayed...occupy all.
3353 (switch-to-buffer fld-buf))
3356 (split-window-horizontally wl-folder-window-width)
3358 (switch-to-buffer cur-buf)
3359 ;; resume message window.
3360 (run-hooks 'wl-summary-toggle-disp-folder-on-hook)
3362 (wl-message-select-buffer wl-message-buffer)
3363 (run-hooks 'wl-summary-toggle-disp-folder-message-resumed-hook)
3364 (select-window (get-buffer-window cur-buf))))))))
3365 (run-hooks 'wl-summary-toggle-disp-folder-hook))
3367 (defun wl-summary-toggle-disp-msg (&optional arg)
3369 (let ((cur-buf (current-buffer))
3374 (setq wl-summary-buffer-disp-msg t)
3376 ;; hide your folder window
3377 (if (and (not wl-stay-folder-window)
3378 (setq fld-buf (get-buffer wl-folder-buffer-name)))
3379 (if (setq fld-win (get-buffer-window fld-buf))
3380 (unless (one-window-p fld-win)
3381 (delete-window fld-win))))))
3383 (wl-delete-all-overlays)
3384 (setq wl-summary-buffer-disp-msg nil)
3386 (when (buffer-live-p wl-message-buffer)
3387 (wl-message-select-buffer wl-message-buffer)
3389 (and (get-buffer-window cur-buf)
3390 (select-window (get-buffer-window cur-buf))))
3391 (run-hooks 'wl-summary-toggle-disp-off-hook)))
3393 (if (and wl-message-buffer
3394 (get-buffer-window wl-message-buffer)) ; already displayed
3395 (setq wl-summary-buffer-disp-msg nil)
3396 (setq wl-summary-buffer-disp-msg t))
3397 (if wl-summary-buffer-disp-msg
3399 (wl-summary-redisplay)
3400 ;;; hide your folder window
3401 ;;; (setq fld-buf (get-buffer wl-folder-buffer-name))
3402 ;;; (if (setq fld-win (get-buffer-window fld-buf))
3403 ;;; (delete-window fld-win)))
3404 (run-hooks 'wl-summary-toggle-disp-on-hook))
3405 (wl-delete-all-overlays)
3407 (wl-message-select-buffer wl-message-buffer)
3409 (select-window (get-buffer-window cur-buf))
3410 (setq wl-message-buffer nil)
3411 (run-hooks 'wl-summary-toggle-disp-off-hook))
3412 ;;; (switch-to-buffer cur-buf)
3414 (when wl-summary-lazy-highlight
3415 (wl-highlight-summary-window))))
3417 (defun wl-summary-next-line-content ()
3418 "Show next line of the message."
3420 (let ((cur-buf (current-buffer)))
3421 (wl-summary-toggle-disp-msg 'on)
3422 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3423 (set-buffer cur-buf)
3424 (wl-message-next-page 1))))
3426 (defun wl-summary-prev-line-content ()
3428 (let ((cur-buf (current-buffer)))
3429 (wl-summary-toggle-disp-msg 'on)
3430 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3431 (set-buffer cur-buf)
3432 (wl-message-prev-page 1))))
3434 (defun wl-summary-next-page ()
3436 (let ((cur-buf (current-buffer)))
3437 (wl-summary-toggle-disp-msg 'on)
3438 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3439 (set-buffer cur-buf)
3440 (wl-message-next-page))))
3442 (defun wl-summary-prev-page ()
3444 (let ((cur-buf (current-buffer)))
3445 (wl-summary-toggle-disp-msg 'on)
3446 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3447 (set-buffer cur-buf)
3448 (wl-message-prev-page))))
3450 (defsubst wl-summary-no-mime-p (folder)
3451 (wl-string-match-member (elmo-folder-name-internal folder)
3452 wl-summary-no-mime-folder-list))
3454 (defun wl-summary-set-message-buffer-or-redisplay (&rest args)
3455 "Set message buffer.
3456 If message is not displayed yet, display it.
3457 Return t if message exists."
3458 (let ((folder wl-summary-buffer-elmo-folder)
3459 (number (wl-summary-message-number))
3460 cur-folder cur-number message-last-pos)
3461 (when (buffer-live-p wl-message-buffer)
3462 (save-window-excursion
3463 (wl-message-select-buffer wl-message-buffer)
3464 (setq cur-folder wl-message-buffer-cur-folder)
3465 (setq cur-number wl-message-buffer-cur-number)))
3466 (if (and (string= (elmo-folder-name-internal folder) (or cur-folder ""))
3467 (eq number (or cur-number 0)))
3469 (set-buffer wl-message-buffer)
3471 (if (wl-summary-no-mime-p folder)
3472 (wl-summary-redisplay-no-mime-internal folder number)
3473 (wl-summary-redisplay-internal folder number))
3474 (when (buffer-live-p wl-message-buffer)
3475 (set-buffer wl-message-buffer))
3478 (defun wl-summary-target-mark-forward (&optional arg)
3480 (let ((mlist (nreverse wl-summary-buffer-target-mark-list))
3481 (summary-buf (current-buffer))
3482 (wl-draft-forward t)
3485 (wl-summary-jump-to-msg (car mlist))
3486 (wl-summary-forward t)
3487 (setq start-point (point))
3488 (setq draft-buf (current-buffer))
3489 (setq mlist (cdr mlist))
3490 (save-window-excursion
3493 (set-buffer summary-buf)
3494 (wl-summary-jump-to-msg (car mlist))
3495 (wl-summary-redisplay)
3496 (set-buffer draft-buf)
3497 (goto-char (point-max))
3498 (wl-draft-insert-message)
3499 (setq mlist (cdr mlist)))
3500 (wl-draft-body-goto-top)
3501 (wl-draft-enclose-digest-region (point) (point-max)))
3502 (goto-char start-point)
3504 (set-buffer summary-buf)
3505 (wl-summary-delete-all-temp-marks)))
3506 (run-hooks 'wl-mail-setup-hook)))
3508 (defun wl-summary-target-mark-reply-with-citation (&optional arg)
3510 (let ((mlist (nreverse wl-summary-buffer-target-mark-list))
3511 (summary-buf (current-buffer))
3512 change-major-mode-hook
3515 (wl-summary-jump-to-msg (car mlist))
3516 (when (wl-summary-reply arg t)
3517 (goto-char (point-max))
3518 (setq start-point (point-marker))
3519 (setq draft-buf (current-buffer))
3520 (save-window-excursion
3522 (set-buffer summary-buf)
3523 (delete-other-windows)
3524 (wl-summary-jump-to-msg (car mlist))
3525 (wl-summary-redisplay)
3526 (set-buffer draft-buf)
3527 (goto-char (point-max))
3528 (wl-draft-yank-original)
3529 (setq mlist (cdr mlist)))
3530 (goto-char start-point)
3532 (set-buffer summary-buf)
3533 (wl-summary-delete-all-temp-marks)))
3534 (wl-draft-reply-position wl-draft-reply-default-position)
3535 (run-hooks 'wl-mail-setup-hook))))
3537 (defun wl-summary-reply-with-citation (&optional arg)
3539 (when (wl-summary-reply arg t)
3540 (goto-char (point-max))
3541 (wl-draft-yank-original)
3542 (wl-draft-reply-position wl-draft-reply-default-position)
3543 (run-hooks 'wl-mail-setup-hook)))
3545 (defun wl-summary-jump-to-msg-by-message-id (&optional id)
3547 (let* ((original (wl-summary-message-number))
3548 (msgid (elmo-string (or id (read-from-minibuffer "Message-ID: "))))
3549 (entity (elmo-message-entity wl-summary-buffer-elmo-folder msgid))
3551 (errmsg (format "No message with id \"%s\" in the folder." msgid)))
3552 (if (setq msg (elmo-message-entity-number entity))
3554 (wl-thread-jump-to-msg msg)
3557 (if (and elmo-use-database
3560 "No message with id \"%s\" in the database." msgid))
3561 (setq otherfld (elmo-database-msgid-get msgid)))
3562 (if (cdr (wl-summary-jump-to-msg-internal
3563 (car otherfld) (nth 1 otherfld) 'no-sync))
3565 ;; Back to original.
3566 (wl-summary-jump-to-msg-internal
3567 (wl-summary-buffer-folder-name) original 'no-sync))
3568 (cond ((eq wl-summary-search-via-nntp 'confirm)
3569 (require 'elmo-nntp)
3570 (message "Search message in nntp server \"%s\" <y/n/s(elect)>? "
3571 elmo-nntp-default-server)
3572 (setq schar (let ((cursor-in-echo-area t)) (read-char)))
3573 (cond ((eq schar ?y)
3574 (wl-summary-jump-to-msg-by-message-id-via-nntp msgid))
3576 (wl-summary-jump-to-msg-by-message-id-via-nntp
3578 (read-from-minibuffer "NNTP Server: ")))
3580 (message "%s" errmsg)
3582 ((or (eq wl-summary-search-via-nntp 'force)
3584 (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
3586 wl-summary-search-via-nntp))
3587 (wl-summary-jump-to-msg-by-message-id-via-nntp msgid))
3589 (message "%s" errmsg)
3592 (defun wl-summary-jump-to-msg-by-message-id-via-nntp (&optional id server-spec)
3594 (let* ((msgid (elmo-string (or id (read-from-minibuffer "Message-ID: "))))
3595 newsgroups folder ret
3596 user server port type spec)
3598 (if (string-match "^-" server-spec)
3599 (setq spec (wl-folder-get-elmo-folder server-spec)
3600 user (elmo-net-folder-user-internal spec)
3601 server (elmo-net-folder-server-internal spec)
3602 port (elmo-net-folder-port-internal spec)
3603 type (elmo-net-folder-stream-type-internal spec))
3604 (setq server server-spec)))
3605 (when (setq ret (elmo-nntp-get-newsgroup-by-msgid
3607 (or server elmo-nntp-default-server)
3608 (or user elmo-nntp-default-user)
3609 (or port elmo-nntp-default-port)
3610 (or type elmo-nntp-default-stream-type)))
3611 (setq newsgroups (elmo-nntp-parse-newsgroups ret))
3612 (setq folder (concat "-" (car newsgroups)
3613 (elmo-nntp-folder-postfix user server port type)))
3616 (if (wl-folder-entity-exists-p (car newsgroups)
3617 wl-folder-newsgroups-hashtb)
3619 (setq folder (concat "-" (car newsgroups)
3620 (elmo-nntp-folder-postfix
3621 user server port type)))))
3622 (setq newsgroups (cdr newsgroups)))))
3624 (wl-summary-jump-to-msg-internal folder nil 'update msgid)
3625 (message "No message id \"%s\" in nntp server \"%s\"."
3626 msgid (or server elmo-nntp-default-server))
3629 (defun wl-summary-jump-to-msg-internal (folder msg scan-type &optional msgid)
3630 (let (wl-auto-select-first entity)
3631 (if (or (string= folder (wl-summary-buffer-folder-name))
3634 "Message was found in the folder \"%s\". Jump to it? "
3638 (wl-summary-goto-folder-subr
3639 folder scan-type nil nil t)
3642 (elmo-message-entity-number
3643 (elmo-message-entity
3644 wl-summary-buffer-elmo-folder
3646 (setq entity (wl-folder-search-entity-by-name folder
3650 (wl-folder-set-current-entity-id
3651 (wl-folder-get-entity-id entity))))
3653 (message "Message was not found currently in this folder.")
3654 (setq msg (and (wl-thread-jump-to-msg msg) msg)))
3655 (cons folder msg)))))
3657 (defun wl-summary-jump-to-parent-message (arg)
3659 (let ((cur-buf (current-buffer))
3660 (disp-msg wl-summary-buffer-disp-msg)
3661 (number (wl-summary-message-number))
3662 (regexp "\\(<[^<>]*>\\)[ \t]*$")
3664 msg-id msg-num ref-list ref irt)
3666 (message "No message.")
3667 (when (eq wl-summary-buffer-view 'thread)
3668 (cond ((and arg (not (numberp arg)))
3670 (wl-thread-entity-get-number
3671 (wl-thread-entity-get-top-entity
3672 (wl-thread-get-entity number)))))
3673 ((and arg (numberp arg))
3675 (setq msg-num number)
3678 (wl-thread-entity-get-number
3679 (wl-thread-entity-get-parent-entity
3680 (wl-thread-get-entity msg-num))))
3683 (wl-thread-entity-get-number
3684 (wl-thread-entity-get-parent-entity
3685 (wl-thread-get-entity number)))))))
3686 (when (null msg-num)
3687 (wl-summary-set-message-buffer-or-redisplay)
3688 (set-buffer (wl-message-get-original-buffer))
3689 (message "Searching parent message...")
3690 (setq ref (std11-field-body "References")
3691 irt (std11-field-body "In-Reply-To"))
3693 ((and arg (not (numberp arg)) ref (not (string= ref ""))
3694 (string-match regexp ref))
3695 ;; The first message of the thread.
3696 (setq msg-id (wl-match-string 1 ref)))
3697 ;; "In-Reply-To:" has only one msg-id.
3698 ((and (null arg) irt (not (string= irt ""))
3699 (string-match regexp irt))
3700 (setq msg-id (wl-match-string 1 irt)))
3701 ((and (or (null arg) (numberp arg)) ref (not (string= ref ""))
3702 (string-match regexp ref))
3703 ;; "^" searching parent, "C-u 2 ^" looking for grandparent.
3704 (while (string-match regexp ref)
3707 (wl-match-string 1 ref))
3709 (setq ref (substring ref (match-end 0)))
3712 (if (null arg) (nth 0 ref-list) ;; previous
3713 (if (<= arg i) (nth (1- arg) ref-list)
3714 (nth i ref-list))))))
3715 (set-buffer cur-buf)
3716 (or disp-msg (wl-summary-toggle-disp-msg 'off)))
3717 (cond ((and (null msg-id) (null msg-num))
3718 (message "No parent message!")
3720 ((and msg-id (wl-summary-jump-to-msg-by-message-id msg-id))
3721 (if wl-summary-buffer-disp-msg (wl-summary-redisplay))
3722 (message "Searching parent message...done")
3724 ((and msg-num (wl-summary-jump-to-msg msg-num))
3725 (if wl-summary-buffer-disp-msg (wl-summary-redisplay))
3726 (message "Searching parent message...done")
3729 (message "Parent message was not found.")
3732 (defun wl-summary-reply (&optional arg without-setup-hook)
3733 "Reply to current message. Default is \"wide\" reply.
3734 Reply to author if invoked with ARG."
3736 (let ((folder wl-summary-buffer-elmo-folder)
3737 (number (wl-summary-message-number))
3738 (summary-buf (current-buffer))
3739 (winconf (current-window-configuration))
3743 (wl-summary-redisplay-internal folder number))
3744 (setq mes-buf wl-message-buffer)
3745 (wl-message-select-buffer wl-message-buffer)
3746 (set-buffer mes-buf)
3747 (goto-char (point-min))
3749 (when (setq mes-buf (wl-message-get-original-buffer))
3750 (wl-draft-reply mes-buf arg summary-buf number)
3751 (wl-draft-reply-position wl-draft-reply-default-position)
3752 (unless without-setup-hook
3753 (run-hooks 'wl-mail-setup-hook)))
3754 (error (set-window-configuration winconf)
3755 (signal (car err)(cdr err))))
3756 (with-current-buffer summary-buf
3757 (elmo-folder-mark-as-answered folder (list number))
3758 (wl-summary-update-persistent-mark))
3761 (defun wl-summary-write ()
3762 "Write a new draft from Summary."
3764 (wl-draft (list (cons 'To ""))
3765 nil nil nil nil (wl-summary-buffer-folder-name))
3766 (run-hooks 'wl-mail-setup-hook)
3767 (mail-position-on-field "To"))
3769 (defvar wl-summary-write-current-folder-functions
3770 '(wl-folder-get-newsgroups
3771 wl-folder-guess-mailing-list-by-refile-rule
3772 wl-folder-guess-mailing-list-by-folder-name)
3773 "Newsgroups or Mailing List address guess functions list.
3774 Call from `wl-summary-write-current-folder'.
3775 When guess function return nil, challenge next guess-function.")
3777 (defun wl-summary-write-current-folder (&optional folder)
3778 "Write message to current FOLDER's newsgroup or mailing-list.
3779 Use function list is `wl-summary-write-current-folder-functions'."
3781 ;; default FOLDER is current buffer folder
3782 (setq folder (or folder (wl-summary-buffer-folder-name)))
3783 (let ((func-list wl-summary-write-current-folder-functions)
3784 guess-list guess-func)
3786 (setq guess-list (funcall (car func-list) folder))
3787 (if (null guess-list)
3788 (setq func-list (cdr func-list))
3789 (setq guess-func (car func-list))
3790 (setq func-list nil)))
3791 (if (null guess-func)
3793 (unless (or (stringp (nth 0 guess-list))
3794 (stringp (nth 1 guess-list))
3795 (stringp (nth 2 guess-list)))
3796 (error "Invalid value return guess function `%s'"
3797 (symbol-name guess-func)))
3798 (wl-draft (list (cons 'To (nth 0 guess-list))
3799 (cons 'Cc (nth 1 guess-list))
3800 (cons 'Newsgroups (nth 2 guess-list)))
3801 nil nil nil nil folder)
3802 (run-hooks 'wl-mail-setup-hook)
3803 (mail-position-on-field "Subject"))))
3805 (defun wl-summary-forward (&optional without-setup-hook)
3808 (let ((folder wl-summary-buffer-elmo-folder)
3809 (number (wl-summary-message-number))
3810 (summary-buf (current-buffer))
3811 (wl-draft-forward t)
3815 (message "No message.")
3816 (if (and (elmo-message-use-cache-p folder number)
3817 (eq (elmo-file-cache-status
3818 (elmo-file-cache-get
3819 (elmo-message-field folder number 'message-id)))
3822 (wl-summary-redisplay-internal nil nil 'force-reload)
3823 (wl-summary-redisplay-internal folder number))
3824 (setq mes-buf wl-message-buffer)
3825 (wl-message-select-buffer mes-buf)
3826 ;; get original subject.
3829 (set-buffer summary-buf)
3831 (or (elmo-message-field folder number 'subject) ""))))
3832 (set-buffer mes-buf)
3833 (wl-draft-forward subject summary-buf)
3834 (unless without-setup-hook
3835 (run-hooks 'wl-mail-setup-hook)))))
3837 (defun wl-summary-click (e)
3842 (defun wl-summary-read ()
3843 "Proceed reading message in the summary buffer."
3845 (let ((cur-buf (current-buffer)))
3846 (wl-summary-toggle-disp-msg 'on)
3847 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3848 (set-buffer cur-buf)
3849 (if (wl-message-next-page)
3850 (wl-summary-down t)))))
3852 (defsubst wl-summary-cursor-move-surface (downward interactive)
3853 (if wl-summary-move-direction-toggle
3854 (setq wl-summary-move-direction-downward downward))
3855 (let ((start (point))
3856 (skip-tmark-regexp (wl-regexp-opt wl-summary-skip-mark-list))
3858 (column (current-column))
3859 skip-pmark-regexp goto-next next-entity finfo)
3860 (if (elmo-folder-plugged-p wl-summary-buffer-elmo-folder)
3862 (setq skip-pmark-regexp
3863 (wl-regexp-opt (list " "
3864 elmo-msgdb-unread-cached-mark
3865 elmo-msgdb-important-mark))))
3868 (not (if downward (eobp) (bobp))))
3872 (setq skip (or (string-match skip-tmark-regexp
3874 (wl-summary-temp-mark)))
3875 (and skip-pmark-regexp
3879 (wl-summary-persistent-mark))))))))
3880 (if (if downward (eobp) (and (bobp) skip)) (setq goto-next t))
3881 (if (or (eobp) (and (bobp) skip))
3883 (move-to-column column)
3886 (if wl-summary-buffer-disp-msg
3887 (wl-summary-redisplay))
3890 ((and (not downward) wl-summary-buffer-prev-folder-function)
3891 (funcall wl-summary-buffer-prev-folder-function))
3892 ((and downward wl-summary-buffer-next-folder-function)
3893 (funcall wl-summary-buffer-next-folder-function))
3895 (when wl-auto-select-next
3898 (wl-summary-get-next-folder)
3899 (wl-summary-get-prev-folder)))
3901 (setq finfo (wl-folder-get-entity-info next-entity))))
3903 '(lambda () (wl-summary-next-folder-or-exit next-entity))
3905 "No more messages. Type SPC to go to %s."
3906 (wl-summary-entity-info-msg next-entity finfo)))))))))
3908 (defun wl-summary-prev (&optional interactive)
3910 (wl-summary-cursor-move-surface nil (or interactive (interactive-p))))
3912 (defun wl-summary-next (&optional interactive)
3914 (wl-summary-cursor-move-surface t (or interactive (interactive-p))))
3916 (defun wl-summary-up (&optional interactive skip-no-unread)
3919 (if wl-summary-move-direction-toggle
3920 (setq wl-summary-move-direction-downward nil))
3921 (if (wl-summary-cursor-up)
3922 (if wl-summary-buffer-disp-msg
3923 (wl-summary-redisplay))
3926 (if wl-summary-buffer-prev-folder-function
3927 (funcall wl-summary-buffer-prev-folder-function)
3928 (let (next-entity finfo)
3929 (when wl-auto-select-next
3931 (setq next-entity (wl-summary-get-prev-unread-folder))
3933 (setq finfo (wl-folder-get-entity-info next-entity)))))
3934 (if (and skip-no-unread
3935 (eq wl-auto-select-next 'skip-no-unread))
3936 (wl-summary-next-folder-or-exit next-entity t)
3938 '(lambda () (wl-summary-next-folder-or-exit next-entity t))
3940 "No more unread messages. Type SPC to go to %s."
3941 (wl-summary-entity-info-msg next-entity finfo)))))))))
3943 (defun wl-summary-get-prev-folder ()
3944 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3947 (setq cur-id (save-excursion (set-buffer folder-buf)
3948 wl-folder-buffer-cur-entity-id))
3949 (wl-folder-get-prev-folder cur-id))))
3951 (defun wl-summary-get-next-folder ()
3952 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3955 (setq cur-id (save-excursion (set-buffer folder-buf)
3956 wl-folder-buffer-cur-entity-id))
3957 (wl-folder-get-next-folder cur-id))))
3959 (defun wl-summary-get-next-unread-folder ()
3960 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3963 (setq cur-id (save-excursion (set-buffer folder-buf)
3964 wl-folder-buffer-cur-entity-id))
3965 (wl-folder-get-next-folder cur-id 'unread))))
3967 (defun wl-summary-get-prev-unread-folder ()
3968 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3971 (setq cur-id (save-excursion (set-buffer folder-buf)
3972 wl-folder-buffer-cur-entity-id))
3973 (wl-folder-get-prev-folder cur-id 'unread))))
3975 (defun wl-summary-down (&optional interactive skip-no-unread)
3977 (if wl-summary-move-direction-toggle
3978 (setq wl-summary-move-direction-downward t))
3979 (if (wl-summary-cursor-down)
3980 (if wl-summary-buffer-disp-msg
3981 (wl-summary-redisplay))
3984 (if wl-summary-buffer-next-folder-function
3985 (funcall wl-summary-buffer-next-folder-function)
3986 (let (next-entity finfo)
3987 (when wl-auto-select-next
3988 (setq next-entity (wl-summary-get-next-unread-folder)))
3990 (setq finfo (wl-folder-get-entity-info next-entity)))
3991 (if (and skip-no-unread
3992 (eq wl-auto-select-next 'skip-no-unread))
3993 (wl-summary-next-folder-or-exit next-entity)
3995 '(lambda () (wl-summary-next-folder-or-exit next-entity))
3997 "No more unread messages. Type SPC to go to %s."
3998 (wl-summary-entity-info-msg next-entity finfo)))))))))
4000 (defun wl-summary-goto-last-displayed-msg ()
4002 (unless wl-summary-buffer-last-displayed-msg
4003 (setq wl-summary-buffer-last-displayed-msg
4004 wl-summary-buffer-current-msg))
4005 (if wl-summary-buffer-last-displayed-msg
4007 (wl-summary-jump-to-msg wl-summary-buffer-last-displayed-msg)
4008 (if wl-summary-buffer-disp-msg
4009 (wl-summary-redisplay)))
4010 (message "No last message.")))
4012 (defun wl-summary-redisplay (&optional arg)
4015 (wl-summary-no-mime-p wl-summary-buffer-elmo-folder))
4016 (wl-summary-redisplay-no-mime)
4017 (wl-summary-redisplay-internal nil nil arg)))
4019 (defsubst wl-summary-redisplay-internal (&optional folder number force-reload)
4021 (let* ((folder (or folder wl-summary-buffer-elmo-folder))
4022 (num (or number (wl-summary-message-number)))
4023 (wl-mime-charset wl-summary-buffer-mime-charset)
4024 (default-mime-charset wl-summary-buffer-mime-charset)
4025 no-folder-mark fld-buf fld-win thr-entity)
4026 (if (and wl-thread-open-reading-thread
4027 (eq wl-summary-buffer-view 'thread)
4028 (not (wl-thread-entity-get-opened
4029 (setq thr-entity (wl-thread-get-entity
4031 (wl-thread-entity-get-children thr-entity))
4032 (wl-thread-force-open))
4035 (setq wl-summary-buffer-disp-msg t)
4036 (setq wl-summary-buffer-last-displayed-msg
4037 wl-summary-buffer-current-msg)
4038 ;; hide folder window
4039 (if (and (not wl-stay-folder-window)
4040 (setq fld-buf (get-buffer wl-folder-buffer-name)))
4041 (if (setq fld-win (get-buffer-window fld-buf))
4042 (delete-window fld-win)))
4043 (setq wl-current-summary-buffer (current-buffer))
4044 (setq no-folder-mark
4045 ;; If cache is used, change folder-mark.
4046 (if (wl-message-redisplay folder num
4050 (string= (elmo-folder-name-internal
4054 ;; plugged, then leave folder-mark.
4055 (if (and (not (elmo-folder-local-p
4056 wl-summary-buffer-elmo-folder))
4057 (elmo-folder-plugged-p
4058 wl-summary-buffer-elmo-folder))
4060 (when (elmo-message-use-cache-p folder num)
4061 (elmo-message-set-cached folder num t))
4063 (if (member (elmo-message-mark wl-summary-buffer-elmo-folder
4065 (elmo-msgdb-unread-marks))
4066 (wl-summary-mark-as-read num no-folder-mark)
4067 (wl-summary-update-persistent-mark)))
4068 (setq wl-summary-buffer-current-msg num)
4069 (when wl-summary-recenter
4070 (recenter (/ (- (window-height) 2) 2))
4071 (if (not wl-summary-indent-length-limit)
4072 (wl-horizontal-recenter)))
4073 (wl-highlight-summary-displaying)
4074 (wl-message-buffer-prefetch-next folder num
4075 wl-message-buffer-prefetch-depth
4077 wl-summary-buffer-mime-charset)
4078 (run-hooks 'wl-summary-redisplay-hook))
4079 (message "No message to display."))))
4081 (defun wl-summary-redisplay-no-mime (&optional ask-coding)
4082 "Display message without MIME decoding.
4083 If ASK-CODING is non-nil, coding-system for the message is asked."
4085 (let ((elmo-mime-display-as-is-coding-system
4087 (or (read-coding-system "Coding system: ")
4088 elmo-mime-display-as-is-coding-system)
4089 elmo-mime-display-as-is-coding-system)))
4090 (wl-summary-redisplay-no-mime-internal)))
4092 (defun wl-summary-redisplay-no-mime-internal (&optional folder number)
4093 (let* ((fld (or folder wl-summary-buffer-elmo-folder))
4094 (num (or number (wl-summary-message-number)))
4098 (setq wl-summary-buffer-disp-msg t)
4099 (setq wl-summary-buffer-last-displayed-msg
4100 wl-summary-buffer-current-msg)
4101 (setq wl-current-summary-buffer (current-buffer))
4102 (wl-message-redisplay fld num 'as-is
4103 (string= (elmo-folder-name-internal fld)
4106 (if (member (elmo-message-mark fld num)
4107 (elmo-msgdb-unread-marks))
4108 (wl-summary-mark-as-read num); no-folder-mark)
4109 (wl-summary-update-persistent-mark)))
4110 (setq wl-summary-buffer-current-msg num)
4111 (when wl-summary-recenter
4112 (recenter (/ (- (window-height) 2) 2))
4113 (if (not wl-summary-indent-length-limit)
4114 (wl-horizontal-recenter)))
4115 (wl-highlight-summary-displaying)
4116 (run-hooks 'wl-summary-redisplay-hook))
4117 (message "No message to display.")
4118 (wl-ask-folder 'wl-summary-exit
4119 "No more messages. Type SPC to go to folder mode."))))
4121 (defun wl-summary-redisplay-all-header (&optional folder number)
4123 (let* ((fld (or folder wl-summary-buffer-elmo-folder))
4124 (num (or number (wl-summary-message-number)))
4125 (wl-mime-charset wl-summary-buffer-mime-charset)
4126 (default-mime-charset wl-summary-buffer-mime-charset))
4129 (setq wl-summary-buffer-disp-msg t)
4130 (setq wl-summary-buffer-last-displayed-msg
4131 wl-summary-buffer-current-msg)
4132 (setq wl-current-summary-buffer (current-buffer))
4133 (if (wl-message-redisplay fld num 'all-header
4134 (string= (elmo-folder-name-internal fld)
4136 (wl-summary-mark-as-read num))
4137 (setq wl-summary-buffer-current-msg num)
4138 (when wl-summary-recenter
4139 (recenter (/ (- (window-height) 2) 2))
4140 (if (not wl-summary-indent-length-limit)
4141 (wl-horizontal-recenter)))
4142 (wl-highlight-summary-displaying)
4143 (run-hooks 'wl-summary-redisplay-hook))
4144 (message "No message to display."))))
4146 (defun wl-summary-jump-to-current-message ()
4147 "Jump into Message buffer."
4149 (let (message-buf message-win)
4150 (if (setq message-buf wl-message-buffer)
4151 (if (setq message-win (get-buffer-window message-buf))
4152 (select-window message-win)
4153 (wl-message-select-buffer wl-message-buffer))
4154 (wl-summary-redisplay)
4155 (wl-message-select-buffer wl-message-buffer))))
4157 (defun wl-summary-cancel-message ()
4158 "Cancel an article on news."
4160 (if (null (wl-summary-message-number))
4161 (message "No message.")
4162 (let ((summary-buf (current-buffer))
4164 (wl-summary-set-message-buffer-or-redisplay)
4165 (if (setq message-buf (wl-message-get-original-buffer))
4166 (set-buffer message-buf))
4167 (unless (wl-message-news-p)
4168 (set-buffer summary-buf)
4169 (if (and (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
4171 (y-or-n-p "Cannot get Newsgroups. Fetch again? "))
4173 (wl-summary-redisplay t)
4174 (wl-summary-supersedes-message))
4175 (error "This is not a news article; supersedes is impossible")))
4176 (when (yes-or-no-p "Do you really want to cancel this article? ")
4177 (let (from newsgroups message-id distribution buf)
4179 (setq from (std11-field-body "from")
4180 newsgroups (std11-field-body "newsgroups")
4181 message-id (std11-field-body "message-id")
4182 distribution (std11-field-body "distribution"))
4183 ;; Make sure that this article was written by the user.
4184 (unless (wl-address-user-mail-address-p
4185 (wl-address-header-extract-address
4186 (car (wl-parse-addresses from))))
4187 (error "This article is not yours"))
4188 ;; Make control message.
4189 (setq buf (set-buffer (get-buffer-create " *message cancel*")))
4190 (setq wl-draft-buffer-cur-summary-buffer summary-buf)
4191 (buffer-disable-undo (current-buffer))
4193 (insert "Newsgroups: " newsgroups "\n"
4194 "From: " (wl-address-header-extract-address
4196 "Subject: cmsg cancel " message-id "\n"
4197 "Control: cancel " message-id "\n"
4199 (concat "Distribution: " distribution "\n")
4201 mail-header-separator "\n"
4202 wl-summary-cancel-message)
4203 (message "Canceling your message...")
4204 (wl-draft-raw-send t t) ; kill when done, force-pre-hooks.
4205 (message "Canceling your message...done")))))))
4207 (defun wl-summary-supersedes-message ()
4208 "Supersede current message."
4210 (wl-summary-toggle-disp-msg 'off)
4211 (let ((summary-buf (current-buffer))
4213 (wl-summary-set-message-buffer-or-redisplay)
4214 (if (setq message-buf (wl-message-get-original-buffer))
4215 (set-buffer message-buf))
4216 (unless (wl-message-news-p)
4217 (set-buffer summary-buf)
4218 (if (and (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
4220 (y-or-n-p "Cannot get Newsgroups. Fetch again? "))
4222 (wl-summary-redisplay t)
4223 (wl-summary-supersedes-message))
4224 (error "This is not a news article; supersedes is impossible")))
4226 (setq from (std11-field-body "from"))
4227 ;; Make sure that this article was written by the user.
4228 (unless (wl-address-user-mail-address-p
4229 (wl-address-header-extract-address
4230 (car (wl-parse-addresses from))))
4231 (error "This article is not yours"))
4232 (let* ((message-id (std11-field-body "message-id"))
4233 (followup-to (std11-field-body "followup-to"))
4234 (mail-default-headers
4235 (concat mail-default-headers
4236 "Supersedes: " message-id "\n"
4238 (concat "Followup-To: " followup-to "\n")))))
4239 (if message-buf (set-buffer message-buf))
4240 (wl-draft-edit-string (buffer-substring (point-min) (point-max)))))))
4242 (defun wl-summary-save (&optional arg wl-save-dir)
4243 "Save current message to disk."
4246 (num (wl-summary-message-number)))
4247 (if (null wl-save-dir)
4248 (setq wl-save-dir wl-temporary-file-directory))
4251 (setq filename (expand-file-name
4255 (null (file-exists-p filename))))
4257 (read-file-name "Save to file: " filename)))
4259 (wl-summary-set-message-buffer-or-redisplay)
4260 (set-buffer (wl-message-get-original-buffer))
4261 (if (and (null arg) (file-exists-p filename))
4262 (if (y-or-n-p "File already exists. override it? ")
4263 (write-region (point-min) (point-max) filename))
4264 (write-region (point-min) (point-max) filename)))
4265 (message "No message to save."))
4268 (defun wl-summary-save-region (beg end)
4272 (narrow-to-region beg end)
4273 (goto-char (point-min))
4275 (wl-read-directory-name "Save to directory: "
4276 wl-temporary-file-directory)))
4277 (if (null (file-exists-p wl-save-dir))
4278 (make-directory wl-save-dir))
4279 (if (eq wl-summary-buffer-view 'thread)
4282 (let* ((number (wl-summary-message-number))
4283 (entity (wl-thread-get-entity number)))
4284 (if (wl-thread-entity-get-opened entity)
4285 (wl-summary-save t wl-save-dir)
4287 (wl-summary-save t wl-save-dir))
4290 (wl-summary-save t wl-save-dir)
4291 (forward-line 1)))))))
4293 ;; mew-summary-pipe-message()
4294 (defun wl-summary-pipe-message (prefix command)
4295 "Send this message via pipe."
4296 (interactive (list current-prefix-arg nil))
4297 (if (null (wl-summary-message-number))
4298 (message "No message.")
4299 (setq command (read-string "Shell command on message: "
4300 wl-summary-shell-command-last))
4301 (if (y-or-n-p "Send this message to pipe? ")
4302 (wl-summary-pipe-message-subr prefix command))))
4304 (defun wl-summary-target-mark-pipe (prefix command)
4305 "Send each marked messages via pipe."
4306 (interactive (list current-prefix-arg nil))
4307 (if (null wl-summary-buffer-target-mark-list)
4308 (message "No marked message.")
4309 (setq command (read-string "Shell command on each marked message: "
4310 wl-summary-shell-command-last))
4311 (when (y-or-n-p "Send each marked message to pipe? ")
4312 (while (car wl-summary-buffer-target-mark-list)
4313 (let ((num (car wl-summary-buffer-target-mark-list)))
4314 (wl-thread-jump-to-msg num)
4315 (wl-summary-pipe-message-subr prefix command)
4316 (wl-summary-unmark))))))
4318 (defun wl-summary-pipe-message-subr (prefix command)
4320 (wl-summary-set-message-buffer-or-redisplay)
4321 (set-buffer (wl-message-get-original-buffer))
4322 (if (string= command "")
4323 (setq command wl-summary-shell-command-last))
4324 (goto-char (point-min)) ; perhaps this line won't be necessary
4326 (search-forward "\n\n"))
4327 (shell-command-on-region (point) (point-max) command nil)
4328 (setq wl-summary-shell-command-last command)))
4330 (defun wl-summary-print-message (&optional arg)
4332 (if (null (wl-summary-message-number))
4333 (message "No message.")
4335 (wl-summary-set-message-buffer-or-redisplay)
4336 (if (or (not (interactive-p))
4337 (y-or-n-p "Print ok? "))
4339 (let ((buffer (generate-new-buffer " *print*")))
4340 (copy-to-buffer buffer (point-min) (point-max))
4342 (funcall wl-print-buffer-function)
4343 (kill-buffer buffer)))
4346 (defun wl-summary-print-message-with-ps-print (&optional filename)
4347 "Print message via ps-print."
4349 (if (null (wl-summary-message-number))
4350 (message "No message.")
4351 (setq filename (ps-print-preprint current-prefix-arg))
4352 (if (or (not (interactive-p))
4353 (y-or-n-p "Print ok? "))
4354 (let ((summary-buffer (current-buffer))
4357 (wl-summary-set-message-buffer-or-redisplay)
4358 ;; (wl-summary-redisplay-internal)
4359 (let* ((buffer (generate-new-buffer " *print*"))
4361 (set-buffer summary-buffer)
4362 (elmo-message-entity
4363 wl-summary-buffer-elmo-folder
4364 (wl-summary-message-number))))
4367 (or (elmo-msgdb-overview-entity-get-subject entity)
4371 (or (elmo-msgdb-overview-entity-get-from entity) "")))
4374 (or (elmo-msgdb-overview-entity-get-date entity) ""))))
4375 (run-hooks 'wl-ps-preprint-hook)
4376 (set-buffer wl-message-buffer)
4377 (copy-to-buffer buffer (point-min) (point-max))
4380 (let ((ps-left-header
4381 (list (concat "(" wl-ps-subject ")")
4382 (concat "(" wl-ps-from ")")))
4384 (list "/pagenumberstring load"
4385 (concat "(" wl-ps-date ")"))))
4386 (run-hooks 'wl-ps-print-hook)
4387 (funcall wl-ps-print-buffer-function filename))
4388 (kill-buffer buffer)))))
4391 (if (featurep 'ps-print) ; ps-print is available.
4392 (fset 'wl-summary-print-message 'wl-summary-print-message-with-ps-print))
4394 (defun wl-summary-target-mark-print ()
4396 (if (null wl-summary-buffer-target-mark-list)
4397 (message "No marked message.")
4398 (when (y-or-n-p "Print all marked messages. OK? ")
4399 (while (car wl-summary-buffer-target-mark-list)
4400 (let ((num (car wl-summary-buffer-target-mark-list)))
4401 (wl-thread-jump-to-msg num)
4402 (wl-summary-print-message)
4403 (wl-summary-unmark))))))
4405 (defun wl-summary-folder-info-update ()
4406 (wl-folder-set-folder-updated
4407 (elmo-string (wl-summary-buffer-folder-name))
4409 (+ wl-summary-buffer-unread-count
4410 wl-summary-buffer-new-count)
4412 wl-summary-buffer-elmo-folder))))
4414 (defun wl-summary-get-original-buffer ()
4415 "Get original buffer for the current summary."
4417 (wl-summary-set-message-buffer-or-redisplay)
4418 (wl-message-get-original-buffer)))
4420 (defun wl-summary-pack-number (&optional arg)
4422 (elmo-folder-pack-numbers wl-summary-buffer-elmo-folder)
4423 (let (wl-use-scoring)
4424 (wl-summary-rescan)))
4426 (defun wl-summary-target-mark-uudecode ()
4428 (let ((mlist (reverse wl-summary-buffer-target-mark-list))
4429 (summary-buf (current-buffer))
4430 (tmp-buf (get-buffer-create "*WL UUENCODE*"))
4431 orig-buf i k filename rc errmsg)
4433 (setq k (length mlist))
4434 (set-buffer tmp-buf)
4436 (save-window-excursion
4438 (set-buffer summary-buf)
4439 (wl-summary-jump-to-msg (car mlist))
4440 (wl-summary-redisplay)
4441 (set-buffer (setq orig-buf (wl-summary-get-original-buffer)))
4442 (goto-char (point-min))
4443 (cond ((= i 1) ; first
4444 (if (setq filename (wl-message-uu-substring
4448 (error "Can't find begin line")))
4450 (wl-message-uu-substring orig-buf tmp-buf))
4452 (wl-message-uu-substring orig-buf tmp-buf nil t)))
4454 (setq mlist (cdr mlist)))
4455 (set-buffer tmp-buf)
4456 (message "Exec %s..." wl-prog-uudecode)
4458 (let ((decode-dir wl-temporary-file-directory))
4459 (if (not wl-prog-uudecode-no-stdout-option)
4460 (setq filename (read-file-name "Save to file: "
4462 (elmo-safe-filename filename)
4463 wl-temporary-file-directory)))
4465 (wl-read-directory-name "Save to directory: "
4466 wl-temporary-file-directory))
4467 (setq filename (expand-file-name filename decode-dir)))
4468 (if (file-exists-p filename)
4469 (or (yes-or-no-p (format "File %s exists. Save anyway? "
4472 (elmo-bind-directory
4476 (apply 'call-process-region (point-min) (point-max)
4477 wl-prog-uudecode t (current-buffer) nil
4478 wl-prog-uudecode-arg))))
4479 (when (not (= 0 rc))
4480 (setq errmsg (buffer-substring (point-min)(point-max)))
4481 (error "Uudecode error: %s" errmsg))
4482 (if (not wl-prog-uudecode-no-stdout-option)
4483 (let (file-name-handler-alist) ;; void jka-compr
4484 (as-binary-output-file
4485 (write-region (point-min) (point-max)
4486 filename nil 'no-msg))))
4488 (set-buffer summary-buf)
4489 (wl-summary-delete-all-temp-marks))
4490 (if (file-exists-p filename)
4491 (message "Saved as %s" filename)))
4492 (kill-buffer tmp-buf)))))
4495 ;; (defun wl-summary-drop-unsync ()
4496 ;; "Drop all unsync messages."
4498 ;; (if (elmo-folder-pipe-p (wl-summary-buffer-folder-name))
4499 ;; (error "You cannot drop unsync messages in this folder"))
4500 ;; (if (or (not (interactive-p))
4501 ;; (y-or-n-p "Drop all unsync messages? "))
4502 ;; (let* ((folder-list (elmo-folder-get-primitive-folder-list
4503 ;; (wl-summary-buffer-folder-name)))
4504 ;; (is-multi (elmo-multi-p (wl-summary-buffer-folder-name)))
4508 ;; (message "Dropping...")
4509 ;; (while folder-list
4510 ;; (setq pair (elmo-folder-message-numbers (car folder-list)))
4511 ;; (when is-multi ;; dirty hack...
4513 ;; (setcar pair (+ (* multi-num elmo-multi-divide-number)
4515 ;; (elmo-msgdb-set-number-alist
4516 ;; (wl-summary-buffer-msgdb)
4518 ;; (elmo-msgdb-get-number-alist (wl-summary-buffer-msgdb))
4519 ;; (list (cons (car pair) nil))))
4520 ;; (setq sum (+ sum (cdr pair)))
4521 ;; (setq folder-list (cdr folder-list)))
4522 ;; (wl-summary-set-message-modified)
4523 ;; (wl-folder-set-folder-updated (wl-summary-buffer-folder-name)
4525 ;; (+ wl-summary-buffer-unread-count
4526 ;; wl-summary-buffer-new-count)
4528 ;; (message "Dropping...done"))))
4530 (defun wl-summary-default-get-next-msg (msg)
4531 (or (wl-summary-next-message msg
4532 (if wl-summary-move-direction-downward 'down
4535 (cadr (memq msg (if wl-summary-move-direction-downward
4536 wl-summary-buffer-number-list
4537 (reverse wl-summary-buffer-number-list))))))
4539 (defun wl-summary-save-current-message ()
4540 "Save current message for `wl-summary-yank-saved-message'."
4542 (let ((number (wl-summary-message-number)))
4543 (setq wl-summary-buffer-saved-message number)
4544 (and number (message "No: %s is saved." number))))
4546 (defun wl-summary-yank-saved-message ()
4547 "Set current message as a parent of the saved message."
4549 (if wl-summary-buffer-saved-message
4550 (let ((number (wl-summary-message-number)))
4551 (if (eq wl-summary-buffer-saved-message number)
4552 (message "Cannot set itself as a parent.")
4554 (wl-thread-jump-to-msg wl-summary-buffer-saved-message)
4555 (wl-thread-set-parent number)
4556 (wl-summary-set-thread-modified))
4557 (setq wl-summary-buffer-saved-message nil)))
4558 (message "There's no saved message.")))
4561 (product-provide (provide 'wl-summary) (require 'wl-version))
4563 ;;; wl-summary.el ends here