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 (defmacro wl-summary-buffer-msgdb ()
75 (` (and wl-summary-buffer-elmo-folder
76 (elmo-folder-msgdb wl-summary-buffer-elmo-folder))))
78 (defvar wl-summary-buffer-disp-msg nil)
79 (defvar wl-summary-buffer-disp-folder nil)
80 (defvar wl-summary-buffer-temp-mark-list nil)
81 (defvar wl-summary-buffer-last-displayed-msg nil)
82 (defvar wl-summary-buffer-current-msg nil)
83 (defvar wl-summary-buffer-unread-count 0)
84 (defvar wl-summary-buffer-new-count 0)
85 (defvar wl-summary-buffer-answered-count 0)
86 (defvar wl-summary-buffer-mime-charset nil)
87 (defvar wl-summary-buffer-weekday-name-lang nil)
88 (defvar wl-summary-buffer-thread-indent-set-alist nil)
89 (defvar wl-summary-buffer-view nil)
90 (defvar wl-summary-buffer-message-modified nil)
91 (defvar wl-summary-buffer-thread-modified nil)
93 (defvar wl-summary-buffer-number-column nil)
94 (defvar wl-summary-buffer-temp-mark-column nil)
95 (defvar wl-summary-buffer-persistent-mark-column nil)
97 (defvar wl-summary-buffer-persistent nil)
98 (defvar wl-summary-buffer-thread-nodes nil)
99 (defvar wl-summary-buffer-target-mark-list nil)
100 (defvar wl-summary-buffer-prev-refile-destination nil)
101 (defvar wl-summary-buffer-prev-copy-destination nil)
102 (defvar wl-summary-buffer-saved-message nil)
103 (defvar wl-summary-buffer-prev-folder-function nil)
104 (defvar wl-summary-buffer-next-folder-function nil)
105 (defvar wl-summary-buffer-exit-function nil)
106 (defvar wl-summary-buffer-next-message-function nil)
107 (defvar wl-summary-buffer-number-list nil)
108 (defvar wl-summary-buffer-msgdb nil)
109 (defvar wl-summary-buffer-folder-name nil)
110 (defvar wl-summary-buffer-line-formatter nil)
111 (defvar wl-summary-buffer-line-format nil)
112 (defvar wl-summary-buffer-mode-line-formatter nil)
113 (defvar wl-summary-buffer-mode-line nil)
115 (defvar wl-thread-indent-level-internal nil)
116 (defvar wl-thread-have-younger-brother-str-internal nil)
117 (defvar wl-thread-youngest-child-str-internal nil)
118 (defvar wl-thread-vertical-str-internal nil)
119 (defvar wl-thread-horizontal-str-internal nil)
120 (defvar wl-thread-space-str-internal nil)
121 (defvar wl-summary-last-visited-folder nil)
122 (defvar wl-read-folder-hist nil)
123 (defvar wl-summary-scored nil)
124 (defvar wl-crosspost-alist-modified nil)
125 (defvar wl-summary-alike-hashtb nil)
126 (defvar wl-summary-search-buf-name " *wl-search-subject*")
127 (defvar wl-summary-delayed-update nil)
128 (defvar wl-summary-search-buf-folder-name nil)
130 (defvar wl-summary-get-petname-function 'wl-address-get-petname-1)
132 (defvar wl-summary-shell-command-last "")
134 (defvar wl-ps-preprint-hook nil)
135 (defvar wl-ps-print-hook nil)
137 (make-variable-buffer-local 'wl-summary-buffer-elmo-folder)
138 (make-variable-buffer-local 'wl-summary-search-buf-folder-name)
139 (make-variable-buffer-local 'wl-summary-buffer-disp-msg)
140 (make-variable-buffer-local 'wl-summary-buffer-disp-folder)
141 (make-variable-buffer-local 'wl-summary-buffer-target-mark-list)
142 (make-variable-buffer-local 'wl-summary-buffer-temp-mark-list)
143 (make-variable-buffer-local 'wl-summary-buffer-last-displayed-msg)
144 (make-variable-buffer-local 'wl-summary-buffer-unread-count)
145 (make-variable-buffer-local 'wl-summary-buffer-new-count)
146 (make-variable-buffer-local 'wl-summary-buffer-answered-count)
147 (make-variable-buffer-local 'wl-summary-buffer-mime-charset)
148 (make-variable-buffer-local 'wl-summary-buffer-weekday-name-lang)
149 (make-variable-buffer-local 'wl-summary-buffer-thread-indent-set)
150 (make-variable-buffer-local 'wl-summary-buffer-view)
151 (make-variable-buffer-local 'wl-summary-buffer-message-modified)
152 (make-variable-buffer-local 'wl-summary-buffer-thread-modified)
153 (make-variable-buffer-local 'wl-summary-buffer-number-column)
154 (make-variable-buffer-local 'wl-summary-buffer-temp-mark-column)
155 (make-variable-buffer-local 'wl-summary-buffer-persistent-mark-column)
156 (make-variable-buffer-local 'wl-summary-buffer-persistent)
157 (make-variable-buffer-local 'wl-summary-buffer-thread-nodes)
158 (make-variable-buffer-local 'wl-summary-buffer-prev-refile-destination)
159 (make-variable-buffer-local 'wl-summary-buffer-saved-message)
160 (make-variable-buffer-local 'wl-summary-scored)
161 (make-variable-buffer-local 'wl-summary-default-score)
162 (make-variable-buffer-local 'wl-summary-move-direction-downward)
163 (make-variable-buffer-local 'wl-summary-important-above)
164 (make-variable-buffer-local 'wl-summary-target-above)
165 (make-variable-buffer-local 'wl-summary-mark-below)
166 (make-variable-buffer-local 'wl-summary-expunge-below)
167 (make-variable-buffer-local 'wl-thread-indent-level-internal)
168 (make-variable-buffer-local 'wl-thread-have-younger-brother-str-internal)
169 (make-variable-buffer-local 'wl-thread-youngest-child-str-internal)
170 (make-variable-buffer-local 'wl-thread-vertical-str-internal)
171 (make-variable-buffer-local 'wl-thread-horizontal-str-internal)
172 (make-variable-buffer-local 'wl-thread-space-str-internal)
173 (make-variable-buffer-local 'wl-summary-buffer-prev-folder-function)
174 (make-variable-buffer-local 'wl-summary-buffer-next-folder-function)
175 (make-variable-buffer-local 'wl-summary-buffer-exit-function)
176 (make-variable-buffer-local 'wl-summary-buffer-next-message-function)
177 (make-variable-buffer-local 'wl-summary-buffer-number-list)
178 (make-variable-buffer-local 'wl-summary-buffer-msgdb)
179 (make-variable-buffer-local 'wl-summary-buffer-folder-name)
180 (make-variable-buffer-local 'wl-summary-buffer-line-formatter)
181 (make-variable-buffer-local 'wl-summary-buffer-line-format)
182 (make-variable-buffer-local 'wl-summary-buffer-mode-line-formatter)
183 (make-variable-buffer-local 'wl-summary-buffer-mode-line)
186 (defvar wl-thr-indent-string)
187 (defvar wl-thr-children-number)
188 (defvar wl-thr-linked)
189 (defvar wl-message-entity)
190 (defvar wl-parent-message-entity)
191 (defvar wl-temp-mark)
192 (defvar wl-persistent-mark)
194 (defmacro wl-summary-sticky-buffer-name (name)
195 (` (concat wl-summary-buffer-name ":" (, name))))
197 (defun wl-summary-default-subject (subject-string)
198 (if (string-match "^[ \t]*\\[[^:]+[,: ][0-9]+\\][ \t]*" subject-string)
199 (substring subject-string (match-end 0))
202 (defun wl-summary-default-from (from)
203 "Instance of `wl-summary-from-function'.
204 Ordinarily returns the sender name. Returns recipient names if (1)
205 summary's folder name matches with `wl-summary-showto-folder-regexp'
206 and (2) sender address is yours.
208 See also variable `wl-use-petname'."
211 (and (eq major-mode 'wl-summary-mode)
212 (stringp wl-summary-showto-folder-regexp)
213 (string-match wl-summary-showto-folder-regexp
214 (wl-summary-buffer-folder-name))
215 (wl-address-user-mail-address-p from)
217 ((and (setq tos (elmo-message-entity-field
218 wl-message-entity 'to t))
219 (not (string= "" tos)))
229 wl-summary-get-petname-function to)
231 (std11-extract-address-components to))
234 (wl-parse-addresses tos)
236 ((setq ng (elmo-message-entity-field
237 wl-message-entity 'newsgroups))
238 (setq retval (concat "Ng:" ng)))))
240 (setq retval (or (funcall wl-summary-get-petname-function from)
241 (car (std11-extract-address-components from))
246 (defun wl-summary-simple-from (string)
248 (or (funcall wl-summary-get-petname-function string)
249 (car (std11-extract-address-components string))
253 (defvar wl-summary-sort-specs '(number date subject from list-info))
254 (defvar wl-summary-default-sort-spec 'date)
256 (defvar wl-summary-mode-menu-spec
258 ["Read" wl-summary-read t]
259 ["Prev page" wl-summary-prev-page t]
260 ["Next page" wl-summary-next-page t]
261 ["Top" wl-summary-display-top t]
262 ["Bottom" wl-summary-display-bottom t]
263 ["Prev" wl-summary-prev t]
264 ["Next" wl-summary-next t]
265 ["Up" wl-summary-up t]
266 ["Down" wl-summary-down t]
267 ["Parent message" wl-summary-jump-to-parent-message t]
269 ["Sync" wl-summary-sync t]
270 ["Execute" wl-summary-exec t]
271 ["Go to other folder" wl-summary-goto-folder t]
272 ["Pick" wl-summary-pick t]
273 ["Mark as read all" wl-summary-mark-as-read-all t]
274 ["Unmark all" wl-summary-unmark-all t]
275 ["Toggle display message" wl-summary-toggle-disp-msg t]
276 ["Display folder" wl-summary-toggle-disp-folder t]
277 ["Toggle threading" wl-summary-toggle-thread t]
278 ["Stick" wl-summary-stick t]
280 ["By Number" wl-summary-sort-by-number t]
281 ["By Date" wl-summary-sort-by-date t]
282 ["By From" wl-summary-sort-by-from t]
283 ["By Subject" wl-summary-sort-by-subject t]
284 ["By List Info" wl-summary-sort-by-list-info t])
287 ["Mark as read" wl-summary-mark-as-read t]
288 ["Mark as important" wl-summary-mark-as-important t]
289 ["Mark as unread" wl-summary-mark-as-unread t]
290 ["Set dispose mark" wl-summary-dispose t]
291 ["Set refile mark" wl-summary-refile t]
292 ["Set copy mark" wl-summary-copy t]
293 ["Set resend mark" wl-summary-resend t]
294 ["Prefetch" wl-summary-prefetch t]
295 ["Set target mark" wl-summary-target-mark t]
296 ["Unmark" wl-summary-unmark t]
297 ["Save" wl-summary-save t]
298 ["Cancel posted news" wl-summary-cancel-message t]
299 ["Supersedes message" wl-summary-supersedes-message t]
300 ["Resend bounced mail" wl-summary-resend-bounced-mail t]
301 ["Enter the message" wl-summary-jump-to-current-message t]
302 ["Pipe message" wl-summary-pipe-message t]
303 ["Print message" wl-summary-print-message t])
305 ["Open or Close" wl-thread-open-close (eq wl-summary-buffer-view 'thread)]
306 ["Open all" wl-thread-open-all (eq wl-summary-buffer-view 'thread)]
307 ["Close all" wl-thread-close-all (eq wl-summary-buffer-view 'thread)]
308 ["Mark as read" wl-thread-mark-as-read (eq wl-summary-buffer-view 'thread)]
309 ["Mark as important" wl-thread-mark-as-important (eq wl-summary-buffer-view 'thread)]
310 ["Mark as unread" wl-thread-mark-as-unread (eq wl-summary-buffer-view 'thread)]
311 ["Set delete mark" wl-thread-delete (eq wl-summary-buffer-view 'thread)]
312 ["Set refile mark" wl-thread-refile (eq wl-summary-buffer-view 'thread)]
313 ["Set copy mark" wl-thread-copy (eq wl-summary-buffer-view 'thread)]
314 ["Prefetch" wl-thread-prefetch (eq wl-summary-buffer-view 'thread)]
315 ["Set target mark" wl-thread-target-mark (eq wl-summary-buffer-view 'thread)]
316 ["Unmark" wl-thread-unmark (eq wl-summary-buffer-view 'thread)]
317 ["Save" wl-thread-save (eq wl-summary-buffer-view 'thread)]
318 ["Execute" wl-thread-exec (eq wl-summary-buffer-view 'thread)])
320 ["Mark as read" wl-summary-mark-as-read-region t]
321 ["Mark as important" wl-summary-mark-as-important-region t]
322 ["Mark as unread" wl-summary-mark-as-unread-region t]
323 ["Set dispose mark" wl-summary-dispose-region t]
324 ["Set refile mark" wl-summary-refile-region t]
325 ["Set copy mark" wl-summary-copy-region t]
326 ["Prefetch" wl-summary-prefetch-region t]
327 ["Set target mark" wl-summary-target-mark-region t]
328 ["Unmark" wl-summary-unmark-region t]
329 ["Save" wl-summary-save-region t]
330 ["Execute" wl-summary-exec-region t])
332 ["Mark as read" wl-summary-target-mark-mark-as-read t]
333 ["Mark as important" wl-summary-target-mark-mark-as-important t]
334 ["Mark as unread" wl-summary-target-mark-mark-as-unread t]
335 ["Set delete mark" wl-summary-target-mark-delete t]
336 ["Set refile mark" wl-summary-target-mark-refile t]
337 ["Set copy mark" wl-summary-target-mark-copy t]
338 ["Prefetch" wl-summary-target-mark-prefetch t]
339 ["Save" wl-summary-target-mark-save t]
340 ["Reply with citation" wl-summary-target-mark-reply-with-citation t]
341 ["Forward" wl-summary-target-mark-forward t]
342 ["uudecode" wl-summary-target-mark-uudecode t])
344 ["Switch current score file" wl-score-change-score-file t]
345 ["Edit current score file" wl-score-edit-current-scores t]
346 ["Edit score file" wl-score-edit-file t]
347 ["Set mark below" wl-score-set-mark-below t]
348 ["Set expunge below" wl-score-set-expunge-below t]
349 ["Rescore buffer" wl-summary-rescore t]
350 ["Increase score" wl-summary-increase-score t]
351 ["Lower score" wl-summary-lower-score t])
354 ["Write a message" wl-summary-write t]
355 ["Write for current folder" wl-summary-write-current-folder t]
356 ["Reply" wl-summary-reply t]
357 ["Reply with citation" wl-summary-reply-with-citation t]
358 ["Forward" wl-summary-forward t])
360 ["Toggle Plug Status" wl-toggle-plugged t]
361 ["Change Plug Status" wl-plugged-change t]
363 ["Exit Current Folder" wl-summary-exit t]))
366 (defun wl-summary-setup-mouse ()
367 (define-key wl-summary-mode-map 'button4 'wl-summary-prev)
368 (define-key wl-summary-mode-map 'button5 'wl-summary-next)
369 (define-key wl-summary-mode-map [(shift button4)]
371 (define-key wl-summary-mode-map [(shift button5)]
373 (define-key wl-summary-mode-map 'button2 'wl-summary-click))
374 (defun wl-summary-setup-mouse ()
375 (define-key wl-summary-mode-map [mouse-4] 'wl-summary-prev)
376 (define-key wl-summary-mode-map [mouse-5] 'wl-summary-next)
377 (define-key wl-summary-mode-map [S-mouse-4] 'wl-summary-up)
378 (define-key wl-summary-mode-map [S-mouse-5] 'wl-summary-down)
379 (define-key wl-summary-mode-map [mouse-2] 'wl-summary-click)))
381 (if wl-summary-mode-map
383 (setq wl-summary-mode-map (make-sparse-keymap))
384 (define-key wl-summary-mode-map " " 'wl-summary-read)
385 (define-key wl-summary-mode-map "." 'wl-summary-redisplay)
386 (define-key wl-summary-mode-map "<" 'wl-summary-display-top)
387 (define-key wl-summary-mode-map ">" 'wl-summary-display-bottom)
388 (define-key wl-summary-mode-map "\177" 'wl-summary-prev-page)
389 (define-key wl-summary-mode-map [backspace] 'wl-summary-prev-page)
390 (define-key wl-summary-mode-map "\r" 'wl-summary-next-line-content)
391 (define-key wl-summary-mode-map "\C-m" 'wl-summary-next-line-content)
392 (define-key wl-summary-mode-map "/" 'wl-thread-open-close)
393 (define-key wl-summary-mode-map "[" 'wl-thread-open-all)
394 (define-key wl-summary-mode-map "]" 'wl-thread-close-all)
395 (define-key wl-summary-mode-map "-" 'wl-summary-prev-line-content)
396 (define-key wl-summary-mode-map "\e\r" 'wl-summary-prev-line-content)
397 (define-key wl-summary-mode-map "g" 'wl-summary-goto-folder)
398 (define-key wl-summary-mode-map "G" 'wl-summary-goto-folder-sticky)
399 (define-key wl-summary-mode-map "c" 'wl-summary-mark-as-read-all)
401 (define-key wl-summary-mode-map "a" 'wl-summary-reply)
402 (define-key wl-summary-mode-map "A" 'wl-summary-reply-with-citation)
403 (define-key wl-summary-mode-map "C" 'wl-summary-cancel-message)
404 (define-key wl-summary-mode-map "E" 'wl-summary-reedit)
405 (define-key wl-summary-mode-map "\eE" 'wl-summary-resend-bounced-mail)
406 (define-key wl-summary-mode-map "f" 'wl-summary-forward)
407 (define-key wl-summary-mode-map "$" 'wl-summary-mark-as-important)
408 (define-key wl-summary-mode-map "&" 'wl-summary-mark-as-answered)
409 (define-key wl-summary-mode-map "@" 'wl-summary-edit-addresses)
411 (define-key wl-summary-mode-map "y" 'wl-summary-save)
412 (define-key wl-summary-mode-map "n" 'wl-summary-next)
413 (define-key wl-summary-mode-map "p" 'wl-summary-prev)
414 (define-key wl-summary-mode-map "N" 'wl-summary-down)
415 (define-key wl-summary-mode-map "P" 'wl-summary-up)
416 (define-key wl-summary-mode-map "w" 'wl-summary-write)
417 (define-key wl-summary-mode-map "W" 'wl-summary-write-current-folder)
418 (define-key wl-summary-mode-map "e" 'wl-summary-save)
419 (define-key wl-summary-mode-map "\C-c\C-o" 'wl-jump-to-draft-buffer)
420 (define-key wl-summary-mode-map "\C-c\C-a" 'wl-addrmgr)
421 (define-key wl-summary-mode-map "\C-c\C-p" 'wl-summary-previous-buffer)
422 (define-key wl-summary-mode-map "\C-c\C-n" 'wl-summary-next-buffer)
423 (define-key wl-summary-mode-map "H" 'wl-summary-redisplay-all-header)
424 (define-key wl-summary-mode-map "M" 'wl-summary-redisplay-no-mime)
425 (define-key wl-summary-mode-map "B" 'wl-summary-burst)
426 (define-key wl-summary-mode-map "Z" 'wl-status-update)
427 (define-key wl-summary-mode-map "#" 'wl-summary-print-message)
428 (define-key wl-summary-mode-map "|" 'wl-summary-pipe-message)
429 (define-key wl-summary-mode-map "z" 'wl-summary-suspend)
430 (define-key wl-summary-mode-map "q" 'wl-summary-exit)
431 (define-key wl-summary-mode-map "Q" 'wl-summary-force-exit)
433 (define-key wl-summary-mode-map "j" 'wl-summary-jump-to-current-message)
434 (define-key wl-summary-mode-map "J" 'wl-thread-jump-to-msg)
435 (define-key wl-summary-mode-map "I" 'wl-summary-incorporate)
436 (define-key wl-summary-mode-map "\M-j" 'wl-summary-jump-to-msg-by-message-id)
437 (define-key wl-summary-mode-map "^" 'wl-summary-jump-to-parent-message)
438 (define-key wl-summary-mode-map "!" 'wl-summary-mark-as-unread)
440 (define-key wl-summary-mode-map "s" 'wl-summary-sync)
441 (define-key wl-summary-mode-map "S" 'wl-summary-sort)
442 (define-key wl-summary-mode-map "\M-s" 'wl-summary-stick)
443 (define-key wl-summary-mode-map "T" 'wl-summary-toggle-thread)
445 (define-key wl-summary-mode-map "l" 'wl-summary-toggle-disp-folder)
446 (define-key wl-summary-mode-map "v" 'wl-summary-toggle-disp-msg)
447 (define-key wl-summary-mode-map "V" 'wl-summary-virtual)
449 (define-key wl-summary-mode-map "\C-i" 'wl-summary-goto-last-displayed-msg)
450 (define-key wl-summary-mode-map "?" 'wl-summary-pick)
451 (define-key wl-summary-mode-map "\ee" 'wl-summary-expire)
454 (define-key wl-summary-mode-map "\ew" 'wl-summary-save-current-message)
455 (define-key wl-summary-mode-map "\C-y" 'wl-summary-yank-saved-message)
458 (define-key wl-summary-mode-map "R" 'wl-summary-mark-as-read)
459 (define-key wl-summary-mode-map "i" 'wl-summary-prefetch)
460 (define-key wl-summary-mode-map "x" 'wl-summary-exec)
461 (define-key wl-summary-mode-map "*" 'wl-summary-target-mark)
462 (define-key wl-summary-mode-map "o" 'wl-summary-refile)
463 (define-key wl-summary-mode-map "O" 'wl-summary-copy)
464 (define-key wl-summary-mode-map "\M-o" 'wl-summary-refile-prev-destination)
465 (define-key wl-summary-mode-map "\C-o" 'wl-summary-auto-refile)
466 (define-key wl-summary-mode-map "d" 'wl-summary-dispose)
467 (define-key wl-summary-mode-map "u" 'wl-summary-unmark)
468 (define-key wl-summary-mode-map "U" 'wl-summary-unmark-all)
469 (define-key wl-summary-mode-map "D" 'wl-summary-delete)
470 (define-key wl-summary-mode-map "~" 'wl-summary-resend)
473 (define-key wl-summary-mode-map "t" (make-sparse-keymap))
474 (define-key wl-summary-mode-map "tR" 'wl-thread-mark-as-read)
475 (define-key wl-summary-mode-map "ti" 'wl-thread-prefetch)
476 (define-key wl-summary-mode-map "tx" 'wl-thread-exec)
477 (define-key wl-summary-mode-map "t*" 'wl-thread-target-mark)
478 (define-key wl-summary-mode-map "to" 'wl-thread-refile)
479 (define-key wl-summary-mode-map "tO" 'wl-thread-copy)
480 (define-key wl-summary-mode-map "td" 'wl-thread-dispose)
481 (define-key wl-summary-mode-map "tD" 'wl-thread-delete)
482 (define-key wl-summary-mode-map "t~" 'wl-thread-resend)
483 (define-key wl-summary-mode-map "tu" 'wl-thread-unmark)
484 (define-key wl-summary-mode-map "t!" 'wl-thread-mark-as-unread)
485 (define-key wl-summary-mode-map "t$" 'wl-thread-mark-as-important)
486 (define-key wl-summary-mode-map "ty" 'wl-thread-save)
487 (define-key wl-summary-mode-map "ts" 'wl-thread-set-parent)
489 ;; target-mark commands
490 (define-key wl-summary-mode-map "m" (make-sparse-keymap))
491 (define-key wl-summary-mode-map "mi" 'wl-summary-target-mark-prefetch)
492 (define-key wl-summary-mode-map "mo" 'wl-summary-target-mark-refile)
493 (define-key wl-summary-mode-map "mO" 'wl-summary-target-mark-copy)
494 (define-key wl-summary-mode-map "md" 'wl-summary-target-mark-dispose)
495 (define-key wl-summary-mode-map "mD" 'wl-summary-target-mark-delete)
496 (define-key wl-summary-mode-map "m~" 'wl-summary-target-mark-resend)
498 (define-key wl-summary-mode-map "mu" 'wl-summary-delete-all-temp-marks)
500 (define-key wl-summary-mode-map "my" 'wl-summary-target-mark-save)
501 (define-key wl-summary-mode-map "mR" 'wl-summary-target-mark-mark-as-read)
502 (define-key wl-summary-mode-map "m!" 'wl-summary-target-mark-mark-as-unread)
503 (define-key wl-summary-mode-map "m$" 'wl-summary-target-mark-mark-as-important)
504 (define-key wl-summary-mode-map "mU" 'wl-summary-target-mark-uudecode)
505 (define-key wl-summary-mode-map "ma" 'wl-summary-target-mark-all)
506 (define-key wl-summary-mode-map "mt" 'wl-summary-target-mark-thread)
507 (define-key wl-summary-mode-map "mA" 'wl-summary-target-mark-reply-with-citation)
508 (define-key wl-summary-mode-map "mf" 'wl-summary-target-mark-forward)
509 (define-key wl-summary-mode-map "m?" 'wl-summary-target-mark-pick)
510 (define-key wl-summary-mode-map "m#" 'wl-summary-target-mark-print)
511 (define-key wl-summary-mode-map "m|" 'wl-summary-target-mark-pipe)
514 (define-key wl-summary-mode-map "r" (make-sparse-keymap))
515 (define-key wl-summary-mode-map "rR" 'wl-summary-mark-as-read-region)
516 (define-key wl-summary-mode-map "ri" 'wl-summary-prefetch-region)
517 (define-key wl-summary-mode-map "rx" 'wl-summary-exec-region)
518 (define-key wl-summary-mode-map "mr" 'wl-summary-target-mark-region)
519 (define-key wl-summary-mode-map "r*" 'wl-summary-target-mark-region)
520 (define-key wl-summary-mode-map "ro" 'wl-summary-refile-region)
521 (define-key wl-summary-mode-map "rO" 'wl-summary-copy-region)
522 (define-key wl-summary-mode-map "rd" 'wl-summary-dispose-region)
523 (define-key wl-summary-mode-map "rD" 'wl-summary-delete-region)
524 (define-key wl-summary-mode-map "r~" 'wl-summary-resend-region)
525 (define-key wl-summary-mode-map "ru" 'wl-summary-unmark-region)
526 (define-key wl-summary-mode-map "r!" 'wl-summary-mark-as-unread-region)
527 (define-key wl-summary-mode-map "r$" 'wl-summary-mark-as-important-region)
528 (define-key wl-summary-mode-map "ry" 'wl-summary-save-region)
531 (define-key wl-summary-mode-map "K" 'wl-summary-increase-score)
532 (define-key wl-summary-mode-map "L" 'wl-summary-lower-score)
533 (define-key wl-summary-mode-map "h" (make-sparse-keymap))
534 (define-key wl-summary-mode-map "hR" 'wl-summary-rescore)
535 (define-key wl-summary-mode-map "hc" 'wl-score-change-score-file)
536 (define-key wl-summary-mode-map "he" 'wl-score-edit-current-scores)
537 (define-key wl-summary-mode-map "hf" 'wl-score-edit-file)
538 (define-key wl-summary-mode-map "hF" 'wl-score-flush-cache)
539 (define-key wl-summary-mode-map "hm" 'wl-score-set-mark-below)
540 (define-key wl-summary-mode-map "hx" 'wl-score-set-expunge-below)
542 (define-key wl-summary-mode-map "\M-t" 'wl-toggle-plugged)
543 (define-key wl-summary-mode-map "\C-t" 'wl-plugged-change)
545 (define-key wl-summary-mode-map "\C-x\C-s" 'wl-summary-save-status)
546 (wl-summary-setup-mouse)
550 "Menu used in Summary mode."
551 wl-summary-mode-menu-spec))
553 (defsubst wl-summary-message-visible-p (number)
554 "Return non-nil if the message with NUMBER is visible."
555 (or (eq wl-summary-buffer-view 'sequence)
556 (not (wl-thread-entity-parent-invisible-p
557 (wl-thread-get-entity number)))))
559 (defun wl-status-update ()
563 (defun wl-summary-display-top ()
565 (goto-char (point-min))
566 (when wl-summary-lazy-highlight
567 (wl-highlight-summary-window))
568 (if wl-summary-buffer-disp-msg
569 (wl-summary-redisplay)))
571 (defun wl-summary-display-bottom ()
573 (goto-char (point-max))
575 (when wl-summary-lazy-highlight
576 (wl-highlight-summary-window))
577 (if wl-summary-buffer-disp-msg
578 (wl-summary-redisplay)))
580 (defun wl-summary-count-unread ()
581 (let ((lst (elmo-folder-count-flags wl-summary-buffer-elmo-folder)))
582 (if (eq major-mode 'wl-summary-mode)
583 (setq wl-summary-buffer-new-count (car lst)
584 wl-summary-buffer-unread-count (nth 1 lst)
585 wl-summary-buffer-answered-count (nth 2 lst)))
588 (defun wl-summary-message-string (&optional use-cache)
589 "Return full body string of current message.
590 If optional USE-CACHE is non-nil, use cache if exists."
591 (let ((number (wl-summary-message-number))
592 (folder wl-summary-buffer-elmo-folder))
594 (message "No message.")
596 (elmo-message-fetch folder
598 (elmo-make-fetch-strategy
600 use-cache ; use cache
601 nil ; save cache (should `t'?)
604 (elmo-file-cache-get-path
605 (elmo-message-field folder number 'message-id))))
611 (defun wl-summary-reedit (&optional arg)
612 "Re-edit current message.
613 If ARG is non-nil, Supersedes message"
615 (wl-summary-toggle-disp-msg 'off)
617 ((not (wl-summary-message-number))
618 (message "No message."))
620 (wl-summary-supersedes-message))
621 ((string= (wl-summary-buffer-folder-name) wl-draft-folder)
622 (wl-draft-reedit (wl-summary-message-number))
623 (if (wl-message-news-p)
624 (mail-position-on-field "Newsgroups")
625 (mail-position-on-field "To")))
627 (wl-draft-edit-string (wl-summary-message-string)))))
629 (defun wl-summary-resend-bounced-mail ()
630 "Re-mail the current message.
631 This only makes sense if the current message is a bounce message which
632 contains some mail you have written but has been bounced back to
635 (wl-summary-toggle-disp-msg 'off)
637 (wl-summary-set-message-buffer-or-redisplay)
638 (set-buffer (wl-message-get-original-buffer))
639 (goto-char (point-min))
640 (let ((case-fold-search nil))
644 (concat "^\\($\\|[Cc]ontent-[Tt]ype:[ \t]+multipart/\\(report\\|mixed\\)\\)") nil t)
646 (re-search-forward "boundary=\"\\([^\"]+\\)\"" nil t))
647 (let ((boundary (buffer-substring (match-beginning 1) (match-end 1)))
650 ((and (setq start (re-search-forward
651 (concat "^--" boundary "\n"
652 "\\([Cc]ontent-[Dd]escription:.*\n\\)?"
653 "[Cc]ontent-[Tt]ype:[ \t]+"
654 "\\(message/rfc822\\|text/rfc822-headers\\).*\n"
655 "\\(.+\n\\)*\n") nil t))
657 (concat "\n\\(--" boundary "\\)--\n") nil t))
658 (wl-draft-edit-string (buffer-substring start (match-beginning 1))))
660 (message "Seems no message/rfc822 part.")))))
661 ((let ((case-fold-search t))
662 (re-search-forward wl-rejected-letter-start nil t))
663 (skip-chars-forward " \t\n")
664 (wl-draft-edit-string (buffer-substring (point) (point-max))))
666 (message "Does not appear to be a rejected letter."))))))
668 (defun wl-summary-detect-mark-position ()
669 (let ((column wl-summary-buffer-number-column)
670 (formatter wl-summary-buffer-line-formatter)
671 (dummy-temp (char-to-string 200))
672 (dummy-persistent (char-to-string 201))
675 (setq wl-summary-buffer-number-column column
676 wl-summary-buffer-line-formatter formatter)
678 (wl-summary-create-line
679 (elmo-msgdb-make-message-entity
687 (goto-char (point-min))
688 (setq temp (save-excursion
689 (when (search-forward dummy-temp nil t)
691 persistent (save-excursion
692 (when (search-forward dummy-persistent nil t)
694 (setq wl-summary-buffer-temp-mark-column temp
695 wl-summary-buffer-persistent-mark-column persistent)))
697 (defun wl-summary-buffer-set-folder (folder)
699 (setq folder (wl-folder-get-elmo-folder folder)))
700 (setq wl-summary-buffer-elmo-folder folder)
701 (make-local-variable 'wl-message-buffer)
702 (setq wl-summary-buffer-mime-charset (or (wl-get-assoc-list-value
703 wl-folder-mime-charset-alist
704 (elmo-folder-name-internal folder))
706 (setq wl-summary-buffer-weekday-name-lang
707 (or (wl-get-assoc-list-value
708 wl-folder-weekday-name-lang-alist
709 (elmo-folder-name-internal folder))
710 wl-summary-weekday-name-lang))
711 (setq wl-summary-buffer-thread-indent-set
712 (wl-get-assoc-list-value
713 wl-folder-thread-indent-set-alist
714 (elmo-folder-name-internal folder)))
715 (setq wl-summary-buffer-number-column
716 (or (wl-get-assoc-list-value wl-summary-number-column-alist
717 (wl-summary-buffer-folder-name))
718 wl-summary-default-number-column))
719 (wl-line-formatter-setup
720 wl-summary-buffer-line-formatter
721 (setq wl-summary-buffer-line-format
722 (or (wl-get-assoc-list-value
723 wl-folder-summary-line-format-alist
724 (elmo-folder-name-internal folder))
725 wl-summary-line-format))
726 wl-summary-line-format-spec-alist)
727 (wl-line-formatter-setup
728 wl-summary-buffer-mode-line-formatter
729 wl-summary-mode-line-format
730 wl-summary-mode-line-format-spec-alist)
731 (wl-summary-detect-mark-position)
732 (setq wl-summary-buffer-persistent
733 (wl-folder-persistent-p (elmo-folder-name-internal folder)))
734 (elmo-folder-set-persistent-internal folder wl-summary-buffer-persistent)
735 ;; process duplicates.
736 (elmo-folder-set-process-duplicates-internal
737 folder (cdr (elmo-string-matched-assoc
738 (elmo-folder-name-internal folder)
739 wl-folder-process-duplicates-alist)))
741 wl-thread-indent-level-internal
742 (or (nth 0 wl-summary-buffer-thread-indent-set)
743 wl-thread-indent-level)
744 wl-thread-have-younger-brother-str-internal
745 (or (nth 1 wl-summary-buffer-thread-indent-set)
746 wl-thread-have-younger-brother-str)
747 wl-thread-youngest-child-str-internal
748 (or (nth 2 wl-summary-buffer-thread-indent-set)
749 wl-thread-youngest-child-str)
750 wl-thread-vertical-str-internal
751 (or (nth 3 wl-summary-buffer-thread-indent-set)
752 wl-thread-vertical-str)
753 wl-thread-horizontal-str-internal
754 (or (nth 4 wl-summary-buffer-thread-indent-set)
755 wl-thread-horizontal-str)
756 wl-thread-space-str-internal
757 (or (nth 5 wl-summary-buffer-thread-indent-set)
758 wl-thread-space-str))
759 (run-hooks 'wl-summary-buffer-set-folder-hook))
761 (defun wl-summary-mode ()
762 "Major mode for reading threaded messages.
763 See Info under Wanderlust for full documentation.
766 \\{wl-summary-mode-map}
768 Entering Folder mode calls the value of `wl-summary-mode-hook'."
770 (unless (interactive-p) (kill-all-local-variables))
771 (setq major-mode 'wl-summary-mode)
772 (setq mode-name "Summary")
773 (use-local-map wl-summary-mode-map)
774 ;;;(setq default-directory (or wl-tmp-dir (expand-file-name "~/")))
775 (setq buffer-read-only t)
776 (setq truncate-lines t)
777 ;;;(make-local-variable 'tab-width)
778 ;;;(setq tab-width 1)
779 (buffer-disable-undo (current-buffer))
780 (setq selective-display t
781 selective-display-ellipses nil)
782 (wl-mode-line-buffer-identification '(wl-summary-buffer-mode-line))
783 (easy-menu-add wl-summary-mode-menu)
784 (when wl-summary-lazy-highlight
787 (make-local-variable 'pre-idle-hook)
788 (add-hook 'pre-idle-hook 'wl-highlight-summary-window))
789 (make-local-variable 'window-scroll-functions)
790 (add-hook 'window-scroll-functions 'wl-highlight-summary-window)))
791 ;; This hook may contain the function `wl-setup-summary' for reasons
792 ;; of system internal to accord facilities for the Emacs variants.
793 (run-hooks 'wl-summary-mode-hook))
796 (defun wl-summary-overview-entity-compare-by-date (x y)
797 "Compare entity X and Y by date."
800 (timezone-make-date-sortable
801 (elmo-message-entity-field x 'date))
802 (timezone-make-date-sortable
803 (elmo-message-entity-field y 'date)))
804 (error))) ;; ignore error.
806 (defun wl-summary-overview-entity-compare-by-number (x y)
807 "Compare entity X and Y by number."
809 (elmo-message-entity-number x)
810 (elmo-message-entity-number y)))
812 (defun wl-summary-overview-entity-compare-by-from (x y)
813 "Compare entity X and Y by from."
815 (wl-address-header-extract-address
816 (or (elmo-message-entity-field x 'from)
817 wl-summary-no-from-message))
818 (wl-address-header-extract-address
819 (or (elmo-message-entity-field y 'from)
820 wl-summary-no-from-message))))
822 (defun wl-summary-overview-entity-compare-by-subject (x y)
823 "Compare entity X and Y by subject."
824 (string< (elmo-message-entity-field x 'subject)
825 (elmo-message-entity-field y 'subject)))
827 (defun wl-summary-get-list-info (entity)
828 "Returns (\"ML-name\" . ML-count) of ENTITY."
829 (let (sequence ml-name ml-count subject return-path delivered-to mailing-list)
830 (setq sequence (elmo-message-entity-field entity 'x-sequence)
831 ml-name (or (elmo-message-entity-field entity 'x-ml-name)
833 (car (split-string sequence " "))))
834 ml-count (or (elmo-message-entity-field entity 'x-mail-count)
835 (elmo-message-entity-field entity 'x-ml-count)
837 (cadr (split-string sequence " ")))))
838 (and (setq subject (elmo-message-entity-field entity 'subject t))
839 (setq subject (elmo-delete-char ?\n subject))
840 (string-match "^\\s(\\(\\S)+\\)[ :]\\([0-9]+\\)\\s)[ \t]*" subject)
842 (or ml-name (setq ml-name (match-string 1 subject)))
843 (or ml-count (setq ml-count (match-string 2 subject)))))
844 (and (setq return-path
845 (elmo-message-entity-field entity 'return-path))
846 (string-match "^<\\([^@>]+\\)-return-\\([0-9]+\\)-" return-path)
848 (or ml-name (setq ml-name (match-string 1 return-path)))
849 (or ml-count (setq ml-count (match-string 2 return-path)))))
850 (and (setq delivered-to
851 (elmo-message-entity-field entity 'delivered-to))
852 (string-match "^mailing list \\([^@]+\\)@" delivered-to)
853 (or ml-name (setq ml-name (match-string 1 delivered-to))))
854 (and (setq mailing-list
855 (elmo-message-entity-field entity 'mailing-list))
856 ;; *-help@, *-owner@, etc.
857 (string-match "\\(^\\|; \\)contact \\([^@]+\\)-[^-@]+@" mailing-list)
858 (or ml-name (setq ml-name (match-string 2 mailing-list))))
859 (cons (and ml-name (car (split-string ml-name " ")))
860 (and ml-count (string-to-int ml-count)))))
862 (defun wl-summary-overview-entity-compare-by-list-info (x y)
863 "Compare entity X and Y by mailing-list info."
864 (let* ((list-info-x (wl-summary-get-list-info x))
865 (list-info-y (wl-summary-get-list-info y)))
866 (if (equal (car list-info-x) (car list-info-y))
867 (if (equal (cdr list-info-x) (cdr list-info-y))
868 (wl-summary-overview-entity-compare-by-date x y)
869 (< (or (cdr list-info-x) 0)
870 (or (cdr list-info-y) 0)))
871 (string< (or (car list-info-x) "")
872 (or (car list-info-y) "")))))
874 (defun wl-summary-sort-by-date ()
876 (wl-summary-rescan "date"))
877 (defun wl-summary-sort-by-number ()
879 (wl-summary-rescan "number"))
880 (defun wl-summary-sort-by-subject ()
882 (wl-summary-rescan "subject"))
883 (defun wl-summary-sort-by-from ()
885 (wl-summary-rescan "from"))
886 (defun wl-summary-sort-by-list-info ()
888 (wl-summary-rescan "list-info"))
890 (defun wl-summary-rescan (&optional sort-by disable-killed)
891 "Rescan current folder without updating."
893 (let ((elmo-mime-charset wl-summary-buffer-mime-charset)
897 (inhibit-read-only t)
898 (buffer-read-only nil)
899 (numbers (elmo-folder-list-messages wl-summary-buffer-elmo-folder
900 (not disable-killed) t)) ; in-msgdb
903 (message "Re-scanning...")
906 (message "Sorting by %s..." sort-by)
911 (intern (format "wl-summary-overview-entity-compare-by-%s"
913 (elmo-message-entity wl-summary-buffer-elmo-folder x)
914 (elmo-message-entity wl-summary-buffer-elmo-folder y)))))
915 (message "Sorting by %s...done" sort-by))
916 (setq num (length numbers))
917 (setq wl-thread-entity-hashtb (elmo-make-hash (* num 2))
918 wl-thread-entity-list nil
919 wl-thread-entities nil
920 wl-summary-scored nil
921 wl-summary-buffer-number-list nil
922 wl-summary-buffer-target-mark-list nil
923 wl-summary-buffer-temp-mark-list nil
924 wl-summary-delayed-update nil)
925 (elmo-kill-buffer wl-summary-search-buf-name)
927 (setq entity (elmo-message-entity wl-summary-buffer-elmo-folder
929 (wl-summary-insert-message entity
930 wl-summary-buffer-elmo-folder
932 (setq numbers (cdr numbers))
933 (when (> num elmo-display-progress-threshold)
935 (if (or (zerop (% i 5)) (= i num))
936 (elmo-display-progress
937 'wl-summary-rescan "Constructing summary structure..."
938 (/ (* i 100) num)))))
939 (when wl-summary-delayed-update
940 (while wl-summary-delayed-update
941 (message "Parent (%d) of message %d is no entity"
942 (caar wl-summary-delayed-update)
943 (elmo-msgdb-overview-entity-get-number
944 (cdar wl-summary-delayed-update)))
945 (wl-summary-insert-message
946 (cdar wl-summary-delayed-update)
947 wl-summary-buffer-elmo-folder nil t)
948 (setq wl-summary-delayed-update (cdr wl-summary-delayed-update))))
949 (message "Constructing summary structure...done")
950 (if (eq wl-summary-buffer-view 'thread)
952 (message "Inserting thread...")
953 (wl-thread-insert-top)
954 (message "Inserting thread...done")))
956 (wl-summary-score-headers (wl-summary-rescore-msgs
957 wl-summary-buffer-number-list)
959 (when (and wl-summary-scored
960 (setq expunged (wl-summary-score-update-all-lines)))
961 (message "%d message(s) are expunged by scoring." (length expunged))))
962 (wl-summary-set-message-modified)
963 (wl-summary-count-unread)
964 (wl-summary-update-modeline)
965 (goto-char (point-max))
967 (set-buffer-modified-p nil)))
969 (defun wl-summary-next-folder-or-exit (&optional next-entity upward)
973 (wl-summary-toggle-disp-msg 'off)
976 (wl-summary-goto-folder-subr next-entity
982 (wl-folder-set-current-entity-id (wl-folder-get-entity-id next-entity))
983 (if (and (eq retval 'more-next)
984 (memq wl-auto-select-next '(unread skip-no-unread))
985 (memq this-command wl-summary-next-no-unread-command))
988 t (eq wl-auto-select-next 'skip-no-unread))
989 (goto-char (point-max))
992 t (eq wl-auto-select-next 'skip-no-unread))))))
995 (defun wl-summary-entity-info-msg (entity finfo)
998 (if (memq 'ask-folder wl-use-folder-petname)
999 (wl-folder-get-petname entity)
1001 (if (null (car finfo))
1004 " (%d new/%d unread)"
1010 (defun wl-summary-set-message-modified ()
1011 (elmo-folder-set-message-modified
1012 wl-summary-buffer-elmo-folder t)
1013 (setq wl-summary-buffer-message-modified t)
1014 (wl-summary-set-mark-modified))
1015 (defun wl-summary-message-modified-p ()
1016 wl-summary-buffer-message-modified)
1017 (defun wl-summary-set-mark-modified ()
1018 (elmo-folder-set-mark-modified-internal
1019 wl-summary-buffer-elmo-folder t))
1020 (defun wl-summary-mark-modified-p ()
1021 (elmo-folder-mark-modified-internal
1022 wl-summary-buffer-elmo-folder))
1023 (defun wl-summary-set-thread-modified ()
1024 (setq wl-summary-buffer-thread-modified t))
1025 (defun wl-summary-thread-modified-p ()
1026 wl-summary-buffer-thread-modified)
1028 (defsubst wl-summary-cleanup-temp-marks (&optional sticky)
1029 (when wl-summary-buffer-temp-mark-list
1030 (if (y-or-n-p (format "Execute remaining marks in %s? "
1031 (wl-summary-buffer-folder-name)))
1034 (if wl-summary-buffer-temp-mark-list
1035 (error "Some execution was failed")))
1036 ;; temp-mark-list is remained.
1038 (wl-summary-delete-all-temp-marks 'no-msg)
1039 (setq wl-summary-scored nil))
1041 ;; a subroutine for wl-summary-exit/wl-save-status
1042 ;; Note that folder is not commited here.
1043 (defun wl-summary-save-view ()
1044 ;; already in summary buffer.
1045 (when wl-summary-buffer-persistent
1046 ;; save the current summary buffer view.
1047 (if (and wl-summary-cache-use
1048 (or (wl-summary-message-modified-p)
1049 (wl-summary-mark-modified-p)
1050 (wl-summary-thread-modified-p)))
1051 (wl-summary-save-view-cache))))
1053 (defun wl-summary-save-status ()
1054 "Save summary view and msgdb."
1056 (if (interactive-p) (message "Saving summary status..."))
1057 (wl-summary-save-view)
1058 (elmo-folder-commit wl-summary-buffer-elmo-folder)
1059 (elmo-folder-check wl-summary-buffer-elmo-folder)
1060 (if wl-use-scoring (wl-score-save))
1061 (if (interactive-p) (message "Saving summary status...done")))
1063 (defun wl-summary-force-exit ()
1064 "Exit current summary. Buffer is deleted even the buffer is sticky."
1066 (wl-summary-exit 'force-exit))
1068 (defun wl-summary-exit (&optional force-exit)
1069 "Exit current summary. if FORCE-EXIT, exits even the summary is sticky."
1071 (let ((summary-buf (current-buffer))
1072 (sticky (wl-summary-sticky-p))
1074 message-buf message-win
1075 folder-buf folder-win)
1076 (run-hooks 'wl-summary-exit-pre-hook)
1077 (if wl-summary-buffer-exit-function
1078 (funcall wl-summary-buffer-exit-function)
1079 (if (or force-exit (not sticky))
1080 (wl-summary-cleanup-temp-marks sticky))
1082 ;; save summary status
1084 (wl-summary-save-view)
1085 (if (or force-exit (not sticky))
1086 (elmo-folder-close wl-summary-buffer-elmo-folder)
1087 (elmo-folder-commit wl-summary-buffer-elmo-folder)
1088 (elmo-folder-check wl-summary-buffer-elmo-folder))
1089 (if wl-use-scoring (wl-score-save)))
1090 ;; for sticky summary
1091 (wl-delete-all-overlays)
1092 (setq wl-summary-buffer-disp-msg nil)
1093 (elmo-kill-buffer wl-summary-search-buf-name)
1094 ;; delete message window if displayed.
1095 (if (and wl-message-buffer (get-buffer-window wl-message-buffer))
1096 (delete-window (get-buffer-window wl-message-buffer)))
1097 (if (and wl-summary-use-frame
1098 (> (length (visible-frame-list)) 1))
1100 (if (setq folder-buf (get-buffer wl-folder-buffer-name))
1101 (if wl-summary-use-frame
1103 (save-selected-window
1104 (dolist (frame (visible-frame-list))
1105 (select-frame frame)
1106 (if (get-buffer-window folder-buf)
1107 (setq select-frame frame))))
1109 (select-frame select-frame)
1110 (switch-to-buffer folder-buf)))
1111 (if (setq folder-win (get-buffer-window folder-buf))
1112 ;; folder win is already displayed.
1113 (select-window folder-win)
1114 ;; folder win is not displayed.
1115 (switch-to-buffer folder-buf)))
1116 ;; currently no folder buffer
1118 (and wl-folder-move-cur-folder
1119 wl-folder-buffer-cur-point
1120 (goto-char wl-folder-buffer-cur-point))
1121 (setq wl-folder-buffer-cur-path nil)
1122 (setq wl-folder-buffer-cur-entity-id nil)
1123 (wl-delete-all-overlays)
1124 (if wl-summary-exit-next-move
1125 (wl-folder-next-unsync t)
1126 (beginning-of-line))
1127 (if (setq summary-win (get-buffer-window summary-buf))
1128 (delete-window summary-win))
1132 (set-buffer summary-buf)
1133 (kill-buffer summary-buf)))
1134 (run-hooks 'wl-summary-exit-hook)))))
1136 (defun wl-summary-suspend ()
1139 (wl-folder-suspend))
1141 (defun wl-summary-sync-force-update (&optional unset-cursor no-check)
1143 (wl-summary-sync-update unset-cursor nil nil no-check))
1145 (defsubst wl-summary-sync-all-init ()
1146 (wl-summary-cleanup-temp-marks)
1148 (wl-summary-set-message-modified)
1149 (setq wl-thread-entity-hashtb (elmo-make-hash
1150 (* (elmo-folder-length
1151 wl-summary-buffer-elmo-folder)
1153 (setq wl-thread-entity-list nil)
1154 (setq wl-thread-entities nil)
1155 (setq wl-summary-buffer-number-list nil)
1156 (setq wl-summary-buffer-target-mark-list nil)
1157 (setq wl-summary-buffer-temp-mark-list nil))
1159 (defun wl-summary-sync (&optional unset-cursor force-range)
1161 (let* ((folder wl-summary-buffer-elmo-folder)
1162 (inhibit-read-only t)
1163 (buffer-read-only nil)
1164 (msgdb-dir (elmo-folder-msgdb-path folder))
1165 (range (or force-range (wl-summary-input-range
1166 (elmo-folder-name-internal folder)))))
1167 (cond ((string-match "rescan" range)
1168 (let ((msg (wl-summary-message-number))
1169 (wl-use-scoring (if (string-match "noscore" range)
1172 (wl-summary-rescan nil
1173 (string-match "noscore" range))
1174 (and msg (wl-summary-jump-to-msg msg))))
1175 ((string= range "mark")
1176 (let ((msg (wl-summary-message-number)))
1177 (call-interactively 'wl-summary-sync-marks)
1178 (and msg (wl-summary-jump-to-msg msg))))
1179 ((string= range "cache-status")
1180 (let ((msg (wl-summary-message-number)))
1181 (wl-summary-resume-cache-status)
1182 (and msg (wl-summary-jump-to-msg msg))))
1183 ((or (string-match "last:" range)
1184 (string-match "first:" range))
1185 (wl-summary-goto-folder-subr (concat "/" range "/"
1186 (elmo-folder-name-internal
1188 'force-update nil nil t))
1190 (wl-summary-sync-update unset-cursor
1191 (string-match "entirely" range)
1192 (string-match "all" range))))))
1194 (defvar wl-summary-edit-addresses-candidate-fields
1195 ;; First element becomes default.
1196 '("from" "to" "cc"))
1198 (defun wl-summary-edit-addresses-collect-candidate-fields (mime-charset)
1199 (let ((fields wl-summary-edit-addresses-candidate-fields)
1200 body candidates components)
1203 (mapconcat 'identity (elmo-multiple-field-body (car fields))
1205 (setq body (wl-parse-addresses body))
1206 (if body (setq candidates (append candidates body)))
1207 (setq fields (cdr fields)))
1208 (setq candidates (elmo-uniq-list candidates))
1210 (elmo-set-buffer-multibyte default-enable-multibyte-characters)
1213 (setq components (std11-extract-address-components x))
1214 (cons (nth 1 components)
1215 (and (car components)
1216 (eword-decode-string
1217 (decode-mime-charset-string
1222 (defun wl-summary-edit-addresses-subr (the-email name-in-addr)
1223 ;; returns nil if there's no change.
1224 (if (elmo-get-hash-val (downcase the-email) wl-address-petname-hash)
1226 (message "'%s' already exists. (e)dit/(d)elete/(c)ancel?"
1228 (while (not (or (eq (setq char (read-char)) ?\r)
1235 "Please answer `e' or `d' or `c'. (e)dit/(d)elete/(c)ancel?"))
1242 (wl-address-add-or-change
1244 (wl-address-header-extract-realname
1246 (let ((completion-ignore-case t) comp)
1248 (try-completion the-email wl-address-completion-list))
1249 (if (equal comp t) the-email comp))
1250 wl-address-completion-list))))
1254 (if (y-or-n-p (format "Delete '%s'? "
1257 (wl-address-delete the-email)
1264 (wl-address-add-or-change the-email name-in-addr)
1267 (defun wl-summary-edit-addresses (&optional addr-str)
1268 "Edit address book interactively.
1269 Optional argument ADDR-STR is used as a target address if specified."
1270 (interactive (if current-prefix-arg
1271 (list (read-from-minibuffer "Target address: "))))
1272 (if (null (wl-summary-message-number))
1273 (message "No message.")
1275 (let* ((charset wl-summary-buffer-mime-charset)
1277 (with-current-buffer (wl-summary-get-original-buffer)
1278 (wl-summary-edit-addresses-collect-candidate-fields
1280 address pair result)
1282 (setq address addr-str)
1284 (setq address (car (car candidates)))
1287 (format "Target address (%s): " address)
1289 (function (lambda (x) (cons (car x) (car x))))
1291 nil nil nil nil address))))
1293 (setq pair (assoc address candidates))
1295 (setq pair (cons address nil)))
1296 (when (setq result (wl-summary-edit-addresses-subr (car pair) (cdr pair)))
1299 (setq address (assoc (car pair) wl-address-list))
1301 (message "%s, %s, <%s> is %s."
1306 ;;; i'd like to update summary-buffer, but...
1307 ;;; (wl-summary-rescan)
1308 (run-hooks 'wl-summary-edit-addresses-hook))))))
1310 (defun wl-summary-incorporate (&optional arg)
1311 "Check and prefetch all uncached messages.
1312 If ARG is non-nil, checking is omitted."
1316 (wl-summary-sync-force-update)))
1317 (wl-summary-prefetch-region-no-mark (point-min) (point-max)
1318 wl-summary-incorporate-marks))
1320 (defun wl-summary-prefetch-msg (number &optional arg)
1321 "Prefetch message and return non-nil value. If skipped, return nil."
1322 ;; prefetching procedure.
1324 (let* ((size (elmo-message-field wl-summary-buffer-elmo-folder
1326 (file-cached (elmo-file-cache-exists-p
1327 (elmo-message-field wl-summary-buffer-elmo-folder
1328 number 'message-id)))
1329 (force-read (and size
1331 (and (null wl-prefetch-confirm) arg)
1332 (null wl-prefetch-threshold)
1333 (< size wl-prefetch-threshold))))
1337 (when (and (or arg (not file-cached))
1338 size (not force-read) wl-prefetch-confirm)
1344 "Message from %s has %d bytes. Prefetch it? "
1348 (wl-set-string-width
1350 (funcall wl-summary-from-function
1351 (eword-decode-string
1356 wl-summary-buffer-elmo-folder
1360 (message "")) ; flush.
1365 (if (or arg (not file-cached))
1366 (elmo-message-encache
1367 wl-summary-buffer-elmo-folder
1369 (elmo-message-set-cached wl-summary-buffer-elmo-folder
1371 (when (and (wl-summary-jump-to-msg number)
1372 (wl-summary-update-persistent-mark))
1374 (wl-summary-count-unread)
1375 (wl-summary-update-modeline)
1376 (wl-folder-update-unread
1377 (wl-summary-buffer-folder-name)
1378 (+ wl-summary-buffer-unread-count
1379 wl-summary-buffer-new-count))))
1383 (defun wl-summary-prefetch-region-no-mark (beg end &optional prefetch-marks)
1391 (setq start-pos (point))
1393 (narrow-to-region beg end)
1394 ;; collect prefetch targets.
1395 (message "Collecting marks...")
1396 (goto-char (point-min))
1398 (setq mark (wl-summary-persistent-mark)
1399 msg (wl-summary-message-number))
1400 (if (or (and (null prefetch-marks)
1402 (null (elmo-file-cache-exists-p
1404 wl-summary-buffer-elmo-folder
1407 (member mark prefetch-marks))
1408 (setq targets (nconc targets (list msg))))
1409 (setq entity (wl-thread-get-entity msg))
1410 (if (or (not (eq wl-summary-buffer-view 'thread))
1411 (wl-thread-entity-get-opened entity))
1412 (); opened. no hidden children.
1413 (setq targets (nconc
1415 (wl-thread-get-children-msgs-uncached
1416 msg prefetch-marks))))
1418 (setq length (length targets))
1419 (message "Prefetching...")
1421 (when (if (not (wl-thread-entity-parent-invisible-p
1422 (wl-thread-get-entity (car targets))))
1424 (wl-summary-jump-to-msg (car targets))
1425 (wl-summary-prefetch-msg
1426 (wl-summary-message-number)))
1427 (wl-summary-prefetch-msg (car targets)))
1428 (message "Prefetching... %d/%d message(s)"
1429 (setq count (+ 1 count)) length))
1430 (setq targets (cdr targets)))
1431 (message "Prefetched %d/%d message(s)" count length)
1432 (cons count length)))))
1434 (defun wl-summary-delete-marks-on-buffer (marks)
1436 (wl-summary-unmark (pop marks))))
1438 (defun wl-summary-delete-copy-marks-on-buffer (copies)
1439 (wl-summary-delete-marks-on-buffer copies))
1442 (defun wl-summary-delete-all-target-marks ()
1443 (wl-summary-delete-marks-on-buffer wl-summary-buffer-target-mark-list))
1445 (defun wl-summary-mark-as-read-region (beg end)
1449 (narrow-to-region beg end)
1450 (goto-char (point-min))
1451 (if (eq wl-summary-buffer-view 'thread)
1454 (let* ((number (wl-summary-message-number))
1455 (entity (wl-thread-get-entity number)))
1456 (if (wl-thread-entity-get-opened entity)
1457 (setq number-list (append number-list (list number)))
1460 (wl-thread-get-children-msgs number))))
1462 (wl-summary-mark-as-read number-list))
1466 (append number-list (list (wl-summary-message-number))))
1468 (wl-summary-mark-as-read number-list))))))
1470 (defun wl-summary-mark-as-unread-region (beg end)
1474 (narrow-to-region beg end)
1475 (goto-char (point-min))
1476 (if (eq wl-summary-buffer-view 'thread)
1479 (let* ((number (wl-summary-message-number))
1480 (entity (wl-thread-get-entity number)))
1481 (if (wl-thread-entity-get-opened entity)
1482 (setq number-list (append number-list (list number)))
1485 (wl-thread-get-children-msgs number))))
1487 (wl-summary-mark-as-unread number-list))
1491 (append number-list (list (wl-summary-message-number))))
1493 (wl-summary-mark-as-unread number-list))))))
1495 (defun wl-summary-mark-as-important-region (beg end)
1499 (narrow-to-region beg end);(save-excursion (goto-char end)
1500 ; (end-of-line) (point)))
1501 (goto-char (point-min))
1502 (if (eq wl-summary-buffer-view 'thread)
1505 (let* ((number (wl-summary-message-number))
1506 (entity (wl-thread-get-entity number))
1508 (if (wl-thread-entity-get-opened entity)
1509 ;; opened...mark line.
1510 ;; Crossposts are not processed
1511 (wl-summary-mark-as-important)
1513 (wl-summary-mark-as-important) ; mark itself.
1515 (delq number (wl-thread-get-children-msgs number)))
1517 (wl-summary-mark-as-important (car children))
1518 (setq children (cdr children))))
1521 (wl-summary-mark-as-important)
1522 (forward-line 1)))))
1523 (wl-summary-count-unread)
1524 (wl-summary-update-modeline))
1526 (defun wl-summary-mark-as-read-all ()
1528 (if (or (not (interactive-p))
1529 (y-or-n-p "Mark all messages as read? "))
1530 (let ((folder wl-summary-buffer-elmo-folder)
1531 (cur-buf (current-buffer)))
1532 (message "Setting all msgs as read...")
1533 (elmo-folder-mark-as-read folder
1534 (elmo-folder-list-unreads
1537 (goto-char (point-min))
1539 (wl-summary-update-persistent-mark)
1541 (wl-folder-update-unread (wl-summary-buffer-folder-name) 0)
1542 (setq wl-summary-buffer-unread-count 0)
1543 (setq wl-summary-buffer-new-count 0)
1544 (wl-summary-update-modeline)
1545 (message "Setting all msgs as read...done"))))
1547 (defun wl-summary-delete-cache ()
1548 "Delete cache of current message."
1551 (let* ((folder wl-summary-buffer-elmo-folder)
1553 (setq number (wl-summary-message-number))
1554 (elmo-message-set-cached folder number nil)
1555 (when (wl-summary-update-persistent-mark)
1556 (elmo-file-cache-delete
1557 (elmo-file-cache-get-path
1558 (elmo-message-field wl-summary-buffer-elmo-folder
1562 (defun wl-summary-resume-cache-status ()
1563 "Resume the cache status of all messages in the current folder."
1565 (let ((folder wl-summary-buffer-elmo-folder)
1567 (message "Resuming cache status...")
1569 (goto-char (point-min))
1571 (setq number (wl-summary-message-number))
1572 (setq msgid (elmo-message-field folder number 'message-id))
1573 (elmo-message-set-cached folder number
1574 (elmo-file-cache-exists-p msgid))
1575 (wl-summary-update-persistent-mark)
1577 (wl-summary-count-unread)
1578 (wl-summary-update-modeline)
1579 (message "Resuming cache status...done"))))
1581 (defun wl-summary-delete-messages-on-buffer (msgs &optional deleting-info)
1584 (let ((inhibit-read-only t)
1585 (buffer-read-only nil)
1589 ;(deleting-info (or deleting-info "Deleting..."))
1591 (elmo-kill-buffer wl-summary-search-buf-name)
1593 (if (eq wl-summary-buffer-view 'thread)
1595 ;; don't use wl-append(nconc), because list is broken. ...why?
1598 (wl-thread-delete-message (car msgs))))
1599 (setq update-list (delq (car msgs) update-list)))
1600 (goto-char (point-min))
1601 (if (wl-summary-jump-to-msg (car msgs))
1603 (delete-region (point-at-bol) (point-at-eol))
1604 (delete-char 1) ; delete '\n'
1605 (setq wl-summary-buffer-number-list
1606 (delq (car msgs) wl-summary-buffer-number-list)))))
1607 ; (when (> len elmo-display-progress-threshold)
1609 ; (if (or (zerop (% i 5)) (= i len))
1610 ; (elmo-display-progress
1611 ; 'wl-summary-delete-messages-on-buffer deleting-info
1612 ; (/ (* i 100) len))))
1613 (setq msgs (cdr msgs)))
1614 (when (eq wl-summary-buffer-view 'thread)
1615 (wl-thread-update-line-msgs (elmo-uniq-list update-list))
1616 (wl-thread-cleanup-symbols msgs2))
1617 ;;(message (concat deleting-info "done"))
1618 (wl-summary-count-unread)
1619 (wl-summary-update-modeline)
1620 (wl-folder-set-folder-updated
1621 (elmo-folder-name-internal wl-summary-buffer-elmo-folder)
1623 (+ wl-summary-buffer-unread-count wl-summary-buffer-new-count)
1624 (elmo-folder-length wl-summary-buffer-elmo-folder))))))
1626 (defun wl-summary-update-status-marks ()
1627 "Synchronize status marks on current buffer to the msgdb."
1630 (goto-char (point-min))
1632 (wl-summary-update-persistent-mark)
1635 (defun wl-summary-insert-message (&rest args)
1636 (if (eq wl-summary-buffer-view 'thread)
1637 (apply 'wl-summary-insert-thread args)
1638 (apply 'wl-summary-insert-sequential args)))
1640 (defun wl-summary-sort ()
1644 (format "Sort by (%s): " (symbol-name wl-summary-default-sort-spec))
1645 (mapcar (lambda (spec)
1646 (list (symbol-name spec)))
1647 wl-summary-sort-specs)
1648 nil t nil nil (symbol-name wl-summary-default-sort-spec))))
1650 (defun wl-summary-sync-marks ()
1651 "Update persistent marks in summary."
1653 (let ((last-progress 0)
1654 (folder wl-summary-buffer-elmo-folder)
1656 answereds importants unreads diff diffs
1658 ;; synchronize marks.
1659 (when (not (eq (elmo-folder-type-internal
1660 wl-summary-buffer-elmo-folder)
1662 (message "Updating marks...")
1663 (setq importants (elmo-uniq-list
1665 (elmo-folder-list-importants
1666 wl-summary-buffer-elmo-folder)
1667 (elmo-folder-list-messages-with-global-mark
1668 wl-summary-buffer-elmo-folder
1669 elmo-msgdb-important-mark)))
1670 unreads (elmo-folder-list-unreads
1671 wl-summary-buffer-elmo-folder)
1672 answereds (elmo-folder-list-answereds
1673 wl-summary-buffer-elmo-folder))
1674 (setq diff (elmo-list-diff importants
1675 (elmo-folder-list-flagged
1676 wl-summary-buffer-elmo-folder
1677 'important 'in-msgdb)))
1678 (setq diffs (cadr diff)) ; important-deletes
1679 (setq mes (format "Updated (-%d" (length diffs)))
1681 (wl-summary-mark-as-important (car diffs)
1682 elmo-msgdb-important-mark
1684 (setq diffs (cdr diffs)))
1685 (setq diffs (car diff)) ; important-appends
1686 (setq mes (concat mes (format "/+%d) important," (length diffs))))
1688 (wl-summary-mark-as-important (car diffs) " " 'no-server)
1689 (setq diffs (cdr diffs)))
1691 (setq diff (elmo-list-diff answereds
1692 (elmo-folder-list-flagged
1693 wl-summary-buffer-elmo-folder
1694 'answered 'in-msgdb)))
1695 (setq diffs (cadr diff))
1696 (setq mes (concat mes (format "(-%d" (length diffs))))
1698 (wl-summary-mark-as-unanswered (car diffs) 'no-modeline)
1699 (setq diffs (cdr diffs)))
1700 (setq diffs (car diff)) ; unread-appends
1701 (setq mes (concat mes (format "/+%d) answered mark(s)," (length diffs))))
1703 (wl-summary-mark-as-answered (car diffs) 'no-modeline)
1704 (setq diffs (cdr diffs)))
1706 (setq diff (elmo-list-diff unreads
1707 (elmo-folder-list-flagged
1708 wl-summary-buffer-elmo-folder
1709 'unread 'in-msgdb)))
1710 (setq diffs (cadr diff))
1711 (setq mes (concat mes (format "(-%d" (length diffs))))
1713 (wl-summary-mark-as-read (car diffs) 'no-folder 'no-modeline)
1714 (setq diffs (cdr diffs)))
1715 (setq diffs (car diff)) ; unread-appends
1716 (setq mes (concat mes (format "/+%d) unread mark(s)." (length diffs))))
1718 (wl-summary-mark-as-unread (car diffs) 'no-folder 'no-modeline)
1719 (setq diffs (cdr diffs)))
1720 (if (interactive-p) (message "%s" mes)))))
1722 (defun wl-summary-sync-update (&optional unset-cursor
1726 "Update the summary view to the newest folder status."
1728 (let* ((folder wl-summary-buffer-elmo-folder)
1729 (elmo-mime-charset wl-summary-buffer-mime-charset)
1730 (inhibit-read-only t)
1731 (buffer-read-only nil)
1735 append-list delete-list crossed
1736 update-thread update-top-list
1737 expunged mes entity)
1740 (unless wl-summary-buffer-elmo-folder
1741 (error "(Internal error) Folder is not set:%s" (buffer-name
1743 ;; Flush pending append operations (disconnected operation).
1745 ;;(wl-summary-flush-pending-append-operations seen-list))
1746 (goto-char (point-max))
1747 (wl-folder-confirm-existence folder (elmo-folder-plugged-p folder))
1748 (setq crossed (elmo-folder-synchronize folder
1755 (if sync-all (wl-summary-sync-all-init))
1756 (setq diff (elmo-list-diff (elmo-folder-list-messages
1758 (not disable-killed)
1760 wl-summary-buffer-number-list))
1761 (setq append-list (car diff))
1762 (setq delete-list (cadr diff))
1765 (wl-summary-delete-messages-on-buffer delete-list))
1766 (wl-summary-update-status-marks)
1767 (setq num (length append-list))
1769 (setq wl-summary-delayed-update nil)
1770 (elmo-kill-buffer wl-summary-search-buf-name)
1771 (dolist (number append-list)
1772 (setq entity (elmo-message-entity folder number))
1773 (when (setq update-thread
1774 (wl-summary-insert-message
1777 (wl-append update-top-list update-thread))
1778 (if elmo-use-database
1779 (elmo-database-msgid-put
1780 (car entity) (elmo-folder-name-internal folder)
1781 (elmo-msgdb-overview-entity-get-number entity)))
1782 (when (> num elmo-display-progress-threshold)
1784 (if (or (zerop (% i 5)) (= i num))
1785 (elmo-display-progress
1786 'wl-summary-sync-update
1787 (if (eq wl-summary-buffer-view 'thread)
1789 "Inserting message...")
1790 (/ (* i 100) num)))))
1791 (when wl-summary-delayed-update
1792 (while wl-summary-delayed-update
1793 (message "Parent (%d) of message %d is no entity"
1794 (caar wl-summary-delayed-update)
1795 (elmo-msgdb-overview-entity-get-number
1796 (cdar wl-summary-delayed-update)))
1797 (when (setq update-thread
1798 (wl-summary-insert-message
1799 (cdar wl-summary-delayed-update)
1800 wl-summary-buffer-elmo-folder
1802 (wl-append update-top-list update-thread))
1803 (setq wl-summary-delayed-update
1804 (cdr wl-summary-delayed-update))))
1805 (when (and (eq wl-summary-buffer-view 'thread)
1807 (wl-thread-update-indent-string-thread
1808 (elmo-uniq-list update-top-list)))
1809 (message (if (eq wl-summary-buffer-view 'thread)
1810 "Making thread...done"
1811 "Inserting message...done"))
1812 (when (or delete-list append-list)
1813 (wl-summary-set-message-modified))
1814 (when (and sync-all (eq wl-summary-buffer-view 'thread))
1815 (elmo-kill-buffer wl-summary-search-buf-name)
1816 (message "Inserting message...")
1817 (wl-thread-insert-top)
1818 (message "Inserting message...done"))
1819 (if elmo-use-database
1820 (elmo-database-close))
1821 (run-hooks 'wl-summary-sync-updated-hook)
1823 (if (and (eq (length delete-list) 0)
1826 "No updates for \"%s\"" (elmo-folder-name-internal
1828 (format "Updated (-%d/+%d) message(s)"
1829 (length delete-list) num))))
1830 (setq mes "Quit updating.")))
1831 ;; synchronize marks.
1832 (if (and crossed wl-summary-auto-sync-marks)
1833 (wl-summary-sync-marks))
1835 (when wl-use-scoring
1836 (setq wl-summary-scored nil)
1837 (wl-summary-score-headers (and sync-all
1838 (wl-summary-rescore-msgs
1839 wl-summary-buffer-number-list))
1841 (when (and wl-summary-scored
1842 (setq expunged (wl-summary-score-update-all-lines)))
1843 (setq mes (concat mes
1844 (format " (%d expunged)"
1845 (length expunged))))))
1846 (if (and crossed (> crossed 0))
1850 (format " (%d crosspost)" crossed))
1851 (format "%d crosspost message(s)" crossed)))
1852 (and mes (setq mes (concat mes "."))))
1853 ;; Update Folder mode
1854 (wl-folder-set-folder-updated
1855 (elmo-folder-name-internal folder)
1857 (let ((lst (wl-summary-count-unread)))
1858 (+ (car lst) (nth 1 lst)))
1859 (elmo-folder-length folder)))
1860 (wl-summary-update-modeline)
1862 (unless unset-cursor
1863 (goto-char (point-min))
1864 (if (not (wl-summary-cursor-down t))
1866 (goto-char (point-max))
1868 (if (and wl-summary-highlight
1869 (not wl-summary-lazy-highlight)
1870 (not (get-text-property (point) 'face)))
1874 wl-summary-partial-highlight-above-lines
1875 wl-summary-highlight-partial-threshold)))
1876 (wl-highlight-summary (point) (point-max))))))
1877 (setq wl-summary-buffer-msgdb (elmo-folder-msgdb folder))
1878 (wl-delete-all-overlays)
1879 (set-buffer-modified-p nil)
1880 (if mes (message "%s" mes)))))
1882 (defun wl-summary-set-score-mark (mark)
1885 (let ((cur-mark (wl-summary-temp-mark)))
1886 (when (member cur-mark (list " "
1887 wl-summary-score-below-mark
1888 wl-summary-score-over-mark))
1889 (wl-summary-put-temp-mark mark)
1890 (if wl-summary-highlight
1891 (wl-highlight-summary-current-line))
1892 (set-buffer-modified-p nil)))))
1894 (defun wl-summary-get-score-mark (msg-num)
1895 (let ((score (cdr (assq msg-num wl-summary-scored))))
1897 (cond ((< score wl-summary-default-score)
1899 ((> score wl-summary-default-score)
1902 (defun wl-summary-update-modeline ()
1903 (setq wl-summary-buffer-mode-line
1904 (funcall wl-summary-buffer-mode-line-formatter)))
1906 (defun wl-summary-jump-to-msg (&optional number)
1908 (let ((num (or number
1910 (read-from-minibuffer "Jump to Message(No.): ")))))
1911 (setq num (int-to-string num))
1913 (if (or (and (re-search-forward (concat "\r" num "[^0-9]") nil t)
1914 (progn (backward-char 1) t))
1915 (re-search-backward (concat "\r" num "[^0-9]") nil t))
1916 (progn (beginning-of-line) t)
1919 (defun wl-summary-highlight-msgs (msgs)
1921 (let ((len (length msgs))
1923 (message "Hilighting...")
1926 (if (wl-summary-jump-to-msg (car msgs))
1927 (wl-highlight-summary-current-line))
1928 (setq msgs (cdr msgs))
1929 (when (> len elmo-display-progress-threshold)
1931 (if (or (zerop (% i 5)) (= i len))
1932 (elmo-display-progress
1933 'wl-summary-highlight-msgs "Highlighting..."
1934 (/ (* i 100) len)))))
1935 (message "Highlighting...done"))))
1937 (defun wl-summary-message-number ()
1940 (if (or (re-search-forward "\r\\(-?[0-9]+\\)" (point-at-eol) t)
1941 (re-search-forward "^ *\\(-?[0-9]+\\)" (point-at-eol) t))
1942 (string-to-int (wl-match-buffer 1))
1945 (defun wl-summary-delete-all-msgs ()
1947 (let ((cur-buf (current-buffer))
1948 (dels (elmo-folder-list-messages wl-summary-buffer-elmo-folder)))
1949 (set-buffer cur-buf)
1951 (message "No message to delete.")
1952 (if (y-or-n-p (format "%s has %d message(s). Delete all? "
1953 (wl-summary-buffer-folder-name)
1956 (message "Deleting...")
1957 (elmo-folder-delete-messages wl-summary-buffer-elmo-folder dels)
1958 (elmo-folder-detach-messages wl-summary-buffer-elmo-folder dels)
1959 (wl-summary-set-message-modified)
1960 (wl-folder-set-folder-updated (wl-summary-buffer-folder-name)
1963 ;;; (setq wl-thread-top-entity '(nil t nil nil))
1964 (setq wl-summary-buffer-unread-count 0)
1965 (setq wl-summary-buffer-new-count 0)
1966 (wl-summary-update-modeline)
1967 (set-buffer cur-buf)
1968 (let ((inhibit-read-only t)
1969 (buffer-read-only nil))
1971 ;;; (if wl-summary-cache-use (wl-summary-save-view-cache))
1972 (message "Deleting...done")
1976 (defun wl-summary-toggle-thread (&optional arg)
1977 "Toggle thread status (T)hread and (S)equential.
1978 If ARG, without confirm."
1981 (y-or-n-p (format "Toggle threading? (y=%s): "
1982 (if (eq wl-summary-buffer-view 'thread)
1983 "\"off\"" "\"on\""))))
1984 (if (eq wl-summary-buffer-view 'thread)
1985 (setq wl-summary-buffer-view 'sequence)
1986 (setq wl-summary-buffer-view 'thread))
1987 (wl-summary-update-modeline)
1988 (force-mode-line-update)
1989 (wl-summary-rescan)))
1991 (defun wl-summary-load-file-object (filename)
1992 "Load lisp object from dir."
1994 (let ((tmp-buffer (get-buffer-create " *wl-summary-load-file-object*"))
1995 insert-file-contents-pre-hook ; To avoid autoconv-xmas...
1996 insert-file-contents-post-hook
1998 (if (not (file-readable-p filename))
2000 (set-buffer tmp-buffer)
2001 (as-binary-input-file (insert-file-contents filename))
2004 (read (current-buffer))
2005 (error (error "Reading failed")))))
2006 (kill-buffer tmp-buffer)
2009 (defun wl-summary-goto-folder (&optional arg)
2011 (wl-summary-goto-folder-subr nil nil nil nil t nil arg))
2013 (defun wl-summary-goto-folder-sticky ()
2015 (wl-summary-goto-folder-subr nil nil nil t t))
2017 (defun wl-summary-goto-last-visited-folder ()
2020 (wl-folder-search-entity-by-name wl-summary-last-visited-folder
2023 (if entity (wl-folder-set-current-entity-id
2024 (wl-folder-get-entity-id entity))))
2025 (wl-summary-goto-folder-subr wl-summary-last-visited-folder nil nil nil t))
2027 (defun wl-summary-sticky-p (&optional folder)
2029 (get-buffer (wl-summary-sticky-buffer-name
2030 (elmo-folder-name-internal folder)))
2031 (not (string= wl-summary-buffer-name (buffer-name)))))
2033 (defun wl-summary-always-sticky-folder-p (folder)
2034 (or (eq t wl-summary-always-sticky-folder-list)
2035 (wl-string-match-member
2036 (elmo-folder-name-internal folder)
2037 wl-summary-always-sticky-folder-list)))
2039 (defun wl-summary-stick (&optional force)
2040 "Make current summary buffer sticky."
2042 (if (wl-summary-sticky-p)
2043 (message "Current summary buffer is already sticky.")
2044 (when (or force (y-or-n-p "Stick current summary buffer? "))
2045 (wl-summary-toggle-disp-msg 'off)
2046 (wl-summary-switch-to-clone-buffer
2047 (wl-summary-sticky-buffer-name
2048 (wl-summary-buffer-folder-name)))
2050 ;;; (rename-buffer (wl-summary-sticky-buffer-name
2051 ;;; (wl-summary-buffer-folder-name))))
2052 (message "Folder `%s' is now sticky." (wl-summary-buffer-folder-name)))))
2054 (defun wl-summary-switch-to-clone-buffer (buffer-name)
2055 (let ((cur-buf (current-buffer))
2056 (msg (wl-summary-message-number))
2057 (buf (get-buffer-create buffer-name))
2058 (folder wl-summary-buffer-elmo-folder)
2060 (append '(wl-summary-buffer-view
2061 wl-summary-buffer-temp-mark-list
2062 wl-summary-buffer-target-mark-list
2063 wl-summary-buffer-elmo-folder
2064 wl-summary-buffer-number-column
2065 wl-summary-buffer-temp-mark-column
2066 wl-summary-buffer-persistent-mark-column
2067 wl-summary-buffer-message-modified
2068 wl-summary-buffer-thread-modified
2069 wl-summary-buffer-number-list
2070 wl-summary-buffer-msgdb
2071 wl-summary-buffer-folder-name
2072 wl-summary-buffer-line-formatter)
2073 (and (eq wl-summary-buffer-view 'thread)
2074 '(wl-thread-entity-hashtb
2076 wl-thread-entity-list))
2079 wl-summary-default-score
2080 wl-summary-important-above
2081 wl-summary-target-above
2082 wl-summary-mark-below
2083 wl-summary-expunge-below))
2084 (and (featurep 'wl-score)
2085 '(wl-current-score-file
2089 (wl-summary-buffer-set-folder folder)
2090 (let ((buffer-read-only nil))
2091 (insert-buffer cur-buf))
2092 (set-buffer-modified-p nil)
2093 (while copy-variables
2094 (set (car copy-variables)
2096 (set-buffer cur-buf)
2097 (symbol-value (car copy-variables))))
2098 (setq copy-variables (cdr copy-variables)))
2099 (switch-to-buffer buf)
2100 (kill-buffer cur-buf)
2101 (wl-summary-count-unread)
2102 (wl-summary-update-modeline)
2104 (if (eq wl-summary-buffer-view 'thread)
2105 (wl-thread-jump-to-msg msg)
2106 (wl-summary-jump-to-msg msg))
2107 (goto-char (point-max))
2108 (beginning-of-line))))
2110 (defun wl-summary-get-buffer (folder)
2112 (get-buffer (wl-summary-sticky-buffer-name folder)))
2113 (get-buffer wl-summary-buffer-name)))
2115 (defun wl-summary-get-buffer-create (name &optional force-sticky)
2118 (wl-summary-sticky-buffer-name name))
2119 (or (get-buffer (wl-summary-sticky-buffer-name name))
2120 (get-buffer-create wl-summary-buffer-name))))
2122 (defun wl-summary-make-number-list ()
2124 (goto-char (point-min))
2125 (setq wl-summary-buffer-number-list nil)
2127 (setq wl-summary-buffer-number-list
2128 (cons (wl-summary-message-number)
2129 wl-summary-buffer-number-list))
2131 (setq wl-summary-buffer-number-list
2132 (nreverse wl-summary-buffer-number-list))))
2134 (defun wl-summary-auto-select-msg-p (unread-msg)
2138 wl-summary-buffer-elmo-folder
2140 elmo-msgdb-important-mark))))
2142 (defsubst wl-summary-open-folder (folder)
2144 (let ((elmo-mime-charset wl-summary-buffer-mime-charset))
2146 (elmo-folder-open folder 'load-msgdb)
2147 ;; For compatibility
2148 (setq wl-summary-buffer-msgdb (elmo-folder-msgdb folder))
2149 (setq wl-summary-buffer-folder-name (elmo-folder-name-internal
2152 (defun wl-summary-goto-folder-subr (&optional name scan-type other-window
2153 sticky interactive scoring
2155 "Display target folder on summary."
2157 (let* ((keep-cursor (memq this-command
2158 wl-summary-keep-cursor-command))
2159 (name (or name (wl-summary-read-folder wl-default-folder)))
2160 (cur-fld wl-summary-buffer-elmo-folder)
2161 folder buf mes hilit reuse-buf
2163 (if (string= name "")
2164 (setq name wl-default-folder))
2165 (setq folder (wl-folder-get-elmo-folder name))
2166 (when (and (not (string=
2167 (and cur-fld (elmo-folder-name-internal cur-fld))
2168 (elmo-folder-name-internal folder))) ; folder is moved.
2169 (eq major-mode 'wl-summary-mode)) ; called in summary.
2170 (setq wl-summary-last-visited-folder (wl-summary-buffer-folder-name))
2171 (run-hooks 'wl-summary-exit-pre-hook)
2172 (if (or force-exit (not (wl-summary-sticky-p)))
2173 (wl-summary-cleanup-temp-marks (wl-summary-sticky-p)))
2174 (wl-summary-save-view)
2175 (elmo-folder-commit wl-summary-buffer-elmo-folder)
2176 (if (and (wl-summary-sticky-p) force-exit)
2177 (kill-buffer (current-buffer))))
2178 (setq buf (wl-summary-get-buffer-create (elmo-folder-name-internal folder)
2183 (string= (elmo-folder-name-internal folder)
2184 (wl-summary-buffer-folder-name))))
2188 (switch-to-buffer buf)
2191 (delete-other-windows))
2193 (unless (eq major-mode 'wl-summary-mode)
2195 (wl-summary-buffer-set-folder folder)
2196 (setq wl-summary-buffer-disp-msg nil)
2197 (setq wl-summary-buffer-last-displayed-msg nil)
2198 (setq wl-summary-buffer-current-msg nil)
2199 (let ((inhibit-read-only t)
2200 (buffer-read-only nil))
2202 ;; Resume summary view
2203 (if wl-summary-cache-use
2204 (let* ((dir (elmo-folder-msgdb-path folder))
2205 (cache (expand-file-name wl-summary-cache-file dir))
2206 (view (expand-file-name wl-summary-view-file dir)))
2207 (when (file-exists-p cache)
2208 (insert-file-contents-as-binary cache)
2209 (elmo-set-buffer-multibyte
2210 default-enable-multibyte-characters)
2211 (decode-mime-charset-region
2212 (point-min)(point-max)
2213 wl-summary-buffer-mime-charset 'LF))
2214 (if (file-exists-p view)
2215 (setq wl-summary-buffer-view
2216 (wl-summary-load-file-object view))
2217 (setq wl-summary-buffer-view
2218 (or (wl-get-assoc-list-value
2219 wl-summary-default-view-alist
2220 (elmo-folder-name-internal folder))
2221 wl-summary-default-view)))
2222 (wl-thread-resume-entity folder)
2223 (wl-summary-open-folder folder))
2224 (setq wl-summary-buffer-view
2225 (wl-summary-load-file-object
2226 (expand-file-name wl-summary-view-file
2227 (elmo-folder-msgdb-path folder))))
2228 (wl-summary-open-folder folder)
2229 (wl-summary-rescan))
2230 (wl-summary-count-unread)
2231 (wl-summary-update-modeline)))
2232 (unless (eq wl-summary-buffer-view 'thread)
2233 (wl-summary-make-number-list))
2234 (when (and wl-summary-cache-use
2235 (or (and wl-summary-check-line-format
2236 (wl-summary-line-format-changed-p))
2237 (wl-summary-view-old-p)))
2238 (wl-summary-rescan))
2239 (wl-summary-toggle-disp-msg (if wl-summary-buffer-disp-msg 'on 'off))
2240 (unless (and reuse-buf keep-cursor)
2242 (let ((wl-use-scoring
2243 (if (or scoring interactive) wl-use-scoring)))
2244 (if (and (not scan-type)
2247 (setq scan-type (wl-summary-get-sync-range folder)))
2250 (wl-summary-sync 'unset-cursor))
2251 ((eq scan-type 'all)
2252 (wl-summary-sync 'unset-cursor "all"))
2253 ((eq scan-type 'no-sync))
2254 ((or (eq scan-type 'force-update)
2255 (eq scan-type 'update))
2256 (setq mes (wl-summary-sync-force-update
2257 'unset-cursor 'no-check)))))
2259 (switch-to-buffer buf)
2261 ;; stick always-sticky-folder
2262 (when (wl-summary-always-sticky-folder-p folder)
2263 (or (wl-summary-sticky-p) (wl-summary-stick t)))
2264 (run-hooks 'wl-summary-prepared-pre-hook)
2265 (set-buffer-modified-p nil)
2266 (goto-char (point-min))
2267 (if (wl-summary-cursor-down t)
2268 (let ((unreadp (wl-summary-next-message
2269 (wl-summary-message-number)
2271 (cond ((and wl-auto-select-first
2272 (wl-summary-auto-select-msg-p unreadp))
2273 ;; wl-auto-select-first is non-nil and
2274 ;; unreadp is non-nil but not important
2275 (setq retval 'disp-msg))
2276 ((and wl-auto-prefetch-first
2277 (wl-summary-auto-select-msg-p unreadp))
2278 ;; wl-auto-select-first is non-nil and
2279 ;; unreadp is non-nil but not important
2280 (setq retval 'prefetch-msg))
2281 ((not (wl-summary-auto-select-msg-p unreadp))
2282 ;; unreadp is nil or important
2283 (setq retval 'more-next))))
2284 (goto-char (point-max))
2285 (if (elmo-folder-plugged-p folder)
2288 (setq retval 'more-next))
2289 (if (and wl-summary-highlight
2290 (not wl-summary-lazy-highlight)
2292 (if (and wl-summary-highlight-partial-threshold
2293 (> (count-lines (point-min) (point-max))
2294 wl-summary-highlight-partial-threshold))
2299 wl-summary-partial-highlight-above-lines
2300 wl-summary-highlight-partial-threshold)))
2301 (wl-highlight-summary (point) (point-max)))
2302 (wl-highlight-summary (point-min) (point-max))))
2303 (if (eq retval 'disp-msg)
2304 (wl-summary-redisplay))
2305 (if (eq retval 'prefetch-msg)
2306 (wl-message-buffer-prefetch
2308 (wl-summary-message-number)
2309 wl-message-buffer-prefetch-depth
2311 wl-summary-buffer-mime-charset))
2312 (if mes (message "%s" mes))
2313 (if (and interactive wl-summary-recenter)
2314 (recenter (/ (- (window-height) 2) 2))))))
2315 ;; set current entity-id
2318 (wl-folder-search-entity-by-name
2319 (elmo-folder-name-internal folder)
2322 ;; entity-id is unknown.
2323 (wl-folder-set-current-entity-id
2324 (wl-folder-get-entity-id entity)))
2325 (when (and wl-summary-lazy-highlight
2329 (run-hooks 'wl-summary-prepared-hook)
2330 (set-buffer-modified-p nil))
2333 (defun wl-summary-goto-previous-message-beginning ()
2335 (re-search-backward "\r\\(-?[0-9]+\\)" nil t)
2336 (beginning-of-line))
2338 (defun wl-summary-goto-top-of-current-thread ()
2339 (wl-summary-jump-to-msg
2340 (wl-thread-entity-get-number
2341 (wl-thread-entity-get-top-entity (wl-thread-get-entity
2342 (wl-summary-message-number))))))
2344 (defun wl-summary-goto-bottom-of-sub-thread (&optional depth)
2346 (let ((depth (or depth
2347 (wl-thread-get-depth-of-current-line))))
2349 (while (and (not (eobp))
2350 (>= (wl-thread-get-depth-of-current-line)
2353 (beginning-of-line)))
2355 (defun wl-summary-insert-line (line)
2356 "Insert LINE in the Summary."
2357 (if wl-use-highlight-mouse-line
2358 ;; remove 'mouse-face of current line.
2360 (save-excursion (beginning-of-line)(point))
2361 (save-excursion (end-of-line)(point))
2364 (if wl-use-highlight-mouse-line
2365 ;; remove 'mouse-face of current line.
2367 (save-excursion (beginning-of-line)(point))
2368 (save-excursion (end-of-line)(point))
2371 (run-hooks 'wl-summary-line-inserted-hook)))
2373 (defun wl-summary-insert-sequential (entity folder &rest args)
2374 (let ((inhibit-read-only t)
2376 (goto-char (point-max))
2377 (wl-summary-insert-line
2378 (wl-summary-create-line entity nil nil
2381 (elmo-message-entity-number
2383 (setq wl-summary-buffer-number-list
2384 (wl-append wl-summary-buffer-number-list
2385 (list (elmo-message-entity-number entity))))
2388 (defun wl-summary-default-subject-filter (subject)
2389 (setq subject (elmo-replace-in-string subject "[ \t]*\\(re\\|was\\)[:>]" ""))
2390 (setq subject (elmo-replace-in-string subject "[ \t]" ""))
2391 (elmo-replace-in-string subject "^\\[.*\\]" ""))
2393 (defun wl-summary-subject-equal (subject1 subject2)
2394 (string= (funcall wl-summary-subject-filter-function subject1)
2395 (funcall wl-summary-subject-filter-function subject2)))
2397 (defmacro wl-summary-put-alike (alike)
2398 (` (elmo-set-hash-val (format "#%d" (wl-count-lines))
2400 wl-summary-alike-hashtb)))
2402 (defmacro wl-summary-get-alike ()
2403 (` (elmo-get-hash-val (format "#%d" (wl-count-lines))
2404 wl-summary-alike-hashtb)))
2406 (defun wl-summary-insert-headers (folder func mime-decode)
2407 (let ((numbers (elmo-folder-list-messages folder nil t))
2409 (buffer-disable-undo (current-buffer))
2410 (make-local-variable 'wl-summary-alike-hashtb)
2411 (setq wl-summary-alike-hashtb (elmo-make-hash (* (length numbers) 2)))
2413 (elmo-set-buffer-multibyte default-enable-multibyte-characters))
2414 (while (setq ov (elmo-message-entity folder (pop numbers)))
2415 (setq this (funcall func ov))
2416 (and this (setq this (std11-unfold-string this)))
2417 (if (equal last this)
2418 (setq alike (cons ov alike))
2420 (wl-summary-put-alike alike)
2422 (setq alike (list ov)
2425 (wl-summary-put-alike alike)
2428 (decode-mime-charset-region (point-min) (point-max)
2430 (when (eq mime-decode 'mime)
2431 (eword-decode-region (point-min) (point-max))))
2432 (run-hooks 'wl-summary-insert-headers-hook)))
2434 (defun wl-summary-search-by-subject (entity folder)
2435 (let ((summary-buf (current-buffer))
2436 (buf (get-buffer-create wl-summary-search-buf-name))
2437 (folder-name (wl-summary-buffer-folder-name))
2438 match founds cur result)
2439 (with-current-buffer buf
2440 (let ((case-fold-search t))
2441 (when (or (not (string= wl-summary-search-buf-folder-name folder-name))
2442 (zerop (buffer-size)))
2443 (setq wl-summary-search-buf-folder-name folder-name)
2444 (message "Creating subject cache...")
2445 (wl-summary-insert-headers
2449 (funcall wl-summary-subject-filter-function
2450 (elmo-message-entity-field x 'subject))))
2452 (message "Creating subject cache...done"))
2453 (setq match (funcall wl-summary-subject-filter-function
2454 (elmo-message-entity-field entity 'subject
2456 (if (string= match "")
2458 (goto-char (point-max))
2459 (while (and (null result)
2460 (not (= (point) (point-min)))
2461 (search-backward match nil t))
2462 ;; check exactly match
2463 (when (and (bolp) (= (point-at-eol)(match-end 0)))
2464 (setq founds (wl-summary-get-alike))
2465 (with-current-buffer summary-buf
2468 ;; the first element of found-entity list exists on
2470 (wl-thread-get-entity
2471 (elmo-message-entity-number (car founds)))
2472 ;; message id is not same as myself.
2474 (elmo-message-entity-field entity 'message-id)
2475 (elmo-message-entity-field (car founds)
2477 ;; not a descendant.
2478 (not (wl-thread-descendant-p
2479 (elmo-message-entity-number entity)
2480 (elmo-message-entity-number (car founds)))))
2481 (setq result (car founds)
2483 (setq founds (cdr founds))))))
2486 (defun wl-summary-insert-thread (entity folder update
2487 &optional force-insert)
2489 this-id parent-entity parent-number relatives anumber
2490 cur number cur-entity linked retval delayed-entity
2491 update-list entity-stack)
2493 (setq this-id (elmo-message-entity-field entity 'message-id)
2495 (elmo-message-entity-parent folder entity)
2496 parent-number (elmo-message-entity-number parent-entity))
2497 (setq number (elmo-message-entity-number entity))
2499 ;; If thread loop detected, set parent as nil.
2502 (elmo-message-entity-number
2503 (setq cur (elmo-message-entity-parent folder cur))))
2504 (if (memq anumber relatives)
2505 (setq parent-number nil
2507 (setq relatives (cons
2508 (elmo-message-entity-number cur)
2510 (if (and parent-number
2511 (not (wl-thread-get-entity parent-number))
2513 ;; parent exists in overview, but not in wl-thread-entities
2515 (wl-append wl-summary-delayed-update
2516 (list (cons parent-number entity)))
2517 (setq entity nil)) ;; exit loop
2518 ;; Search parent by subject.
2519 (when (and (null parent-number)
2520 wl-summary-search-parent-by-subject-regexp
2522 wl-summary-search-parent-by-subject-regexp
2523 (elmo-msgdb-overview-entity-get-subject entity)))
2524 (let ((found (wl-summary-search-by-subject entity folder)))
2526 (not (member found wl-summary-delayed-update)))
2527 (setq parent-entity found)
2529 (elmo-message-entity-number parent-entity))
2531 ;; If subject is change, divide thread.
2532 (if (and parent-number
2533 wl-summary-divide-thread-when-subject-changed
2534 (not (wl-summary-subject-equal
2535 (or (elmo-message-entity-field entity
2537 (or (elmo-message-entity-field parent-entity
2539 (setq parent-number nil))
2541 (wl-thread-insert-message entity
2542 number parent-number update linked))
2544 (wl-append update-list (list retval)))
2545 (setq entity nil) ; exit loop
2546 (while (setq delayed-entity (assq number wl-summary-delayed-update))
2547 (setq wl-summary-delayed-update
2548 (delq delayed-entity wl-summary-delayed-update))
2549 ;; update delayed message
2550 (wl-append entity-stack (list (cdr delayed-entity)))))
2551 (if (and (not entity)
2553 (setq entity (pop entity-stack))))
2556 (defun wl-summary-update-thread (entity
2559 (let* ((this-id (elmo-msgdb-overview-entity-get-id entity))
2560 (overview-entity entity)
2561 (parent-id (elmo-msgdb-overview-entity-get-id parent-entity))
2562 (number (elmo-msgdb-overview-entity-get-number entity))
2563 (parent-number (elmo-msgdb-overview-entity-get-number parent-entity))
2566 ((or (not parent-id)
2567 (string= this-id parent-id))
2568 (goto-char (point-max))
2570 (setq insert-line t))
2571 ;; parent already exists in buffer.
2572 ((wl-summary-jump-to-msg parent-number)
2573 (wl-thread-goto-bottom-of-sub-thread)
2574 (setq insert-line t)))
2576 (let (buffer-read-only)
2577 (wl-summary-insert-line
2578 (wl-summary-create-line
2582 (elmo-message-mark wl-summary-buffer-elmo-folder number)
2583 (wl-thread-maybe-get-children-num number)
2584 (wl-thread-make-indent-string thr-entity)
2585 (wl-thread-entity-get-linked thr-entity)))))))
2587 (defun wl-summary-target-mark-msgs (msgs)
2588 "Return the number of marked messages."
2590 (dolist (number msgs)
2591 (when (wl-summary-target-mark number)
2595 (defun wl-summary-pick (&optional from-list delete-marks)
2598 (let* ((condition (car (elmo-parse-search-condition
2599 (elmo-read-search-condition
2600 wl-summary-pick-field-default))))
2601 (result (elmo-folder-search wl-summary-buffer-elmo-folder
2606 (let ((mlist wl-summary-buffer-target-mark-list))
2608 (when (wl-summary-jump-to-msg (car mlist))
2609 (wl-summary-unmark))
2610 (setq mlist (cdr mlist)))
2611 (setq wl-summary-buffer-target-mark-list nil)))
2613 (setq num (wl-summary-target-mark-msgs result))
2615 (if (= num (length result))
2616 (message "%d message(s) are picked." num)
2617 (message "%d(%d) message(s) are picked." num
2618 (- (length result) num)))
2619 (message "No message was picked.")))))
2621 (defun wl-summary-unvirtual ()
2622 "Exit from current virtual folder."
2625 (elmo-folder-type-internal wl-summary-buffer-elmo-folder))
2626 (wl-summary-goto-folder-subr
2627 (elmo-folder-name-internal
2628 (elmo-filter-folder-target-internal
2629 wl-summary-buffer-elmo-folder))
2631 (error "This folder is not filtered")))
2633 (defun wl-summary-virtual (&optional arg)
2634 "Goto virtual folder.
2635 If ARG, exit virtual folder."
2638 (wl-summary-unvirtual)
2639 (wl-summary-goto-folder-subr (concat "/"
2640 (elmo-read-search-condition
2641 wl-summary-pick-field-default)
2643 (wl-summary-buffer-folder-name))
2645 (run-hooks 'wl-summary-virtual-hook)))
2647 (defun wl-summary-delete-all-temp-marks (&optional no-msg)
2648 "Erase all temp marks from buffer."
2650 (when (or wl-summary-buffer-target-mark-list
2651 wl-summary-buffer-temp-mark-list)
2653 (goto-char (point-min))
2655 (message "Unmarking..."))
2657 (wl-summary-unset-mark)
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"))
2916 (folder wl-summary-buffer-elmo-folder)
2917 message-id visible cur-mark)
2919 (setq visible (wl-summary-jump-to-msg number))
2920 (setq cur-mark (or mark
2922 wl-summary-buffer-elmo-folder number)
2924 ((setq number (wl-summary-message-number))
2926 (setq cur-mark (or mark (wl-summary-persistent-mark))))
2928 (error "No message")))
2930 ;; already exists in msgdb.
2931 (elmo-message-entity wl-summary-buffer-elmo-folder
2933 (setq message-id (elmo-message-field
2934 wl-summary-buffer-elmo-folder
2937 (if (string= cur-mark elmo-msgdb-important-mark)
2941 (elmo-folder-unmark-important folder (list number)
2943 (unless no-server-update
2944 (elmo-msgdb-global-mark-delete message-id))
2945 ;; Remove cache if local folder.
2946 (if (and (elmo-folder-local-p folder)
2948 (elmo-folder-type-internal folder))))
2949 (elmo-file-cache-delete
2950 (elmo-file-cache-get-path message-id)))))
2952 (elmo-folder-mark-as-important folder (list number)
2954 (if (eq (elmo-file-cache-exists-p message-id) 'entire)
2955 (elmo-folder-mark-as-read folder (list number))
2956 ;; Force cache message.
2957 (elmo-message-encache folder number 'read))
2958 (unless no-server-update
2959 (elmo-msgdb-global-mark-set message-id
2960 elmo-msgdb-important-mark))))
2962 (wl-summary-update-persistent-mark))))
2966 (defvar wl-summary-line-formatter nil)
2968 (defun wl-summary-view-old-p ()
2969 "Return non-nil when summary view cache has old format."
2971 (goto-char (point-min))
2972 (and wl-summary-buffer-number-list
2973 (not (re-search-forward "\r-?[0-9]+" (point-at-eol) t)))))
2975 (defun wl-summary-line-format-changed-p ()
2976 "Return non-nil when summary line format is changed."
2978 wl-summary-buffer-line-format
2979 (or (elmo-object-load (expand-file-name
2980 wl-summary-line-format-file
2981 (elmo-folder-msgdb-path
2982 wl-summary-buffer-elmo-folder))
2983 wl-summary-buffer-mime-charset)
2984 wl-summary-buffer-line-format))))
2986 (defun wl-summary-line-format-save ()
2987 "Save current summary line format."
2989 (expand-file-name wl-summary-line-format-file
2990 (elmo-folder-msgdb-path
2991 wl-summary-buffer-elmo-folder))
2992 wl-summary-buffer-line-format
2993 wl-summary-buffer-mime-charset))
2995 (defun wl-summary-line-number ()
2996 (wl-set-string-width
2997 (- wl-summary-buffer-number-column)
2999 (elmo-msgdb-overview-entity-get-number wl-message-entity))))
3001 (defun wl-summary-line-year ()
3002 (aref wl-datevec 0))
3003 (defun wl-summary-line-month ()
3004 (format "%02d" (aref wl-datevec 1)))
3005 (defun wl-summary-line-day ()
3006 (format "%02d" (aref wl-datevec 2)))
3007 (defun wl-summary-line-day-of-week ()
3009 (elmo-date-get-week (aref wl-datevec 0)
3011 (aref wl-datevec 2))
3013 (defun wl-summary-line-hour ()
3014 (format "%02d" (aref wl-datevec 3)))
3015 (defun wl-summary-line-minute ()
3016 (format "%02d" (aref wl-datevec 4)))
3018 (defun wl-summary-line-size ()
3019 (let ((size (elmo-msgdb-overview-entity-get-size wl-message-entity)))
3022 ((<= 1 (/ size 1048576))
3023 (format "%.0fM" (/ size 1048576.0)))
3024 ((<= 1 (/ size 1024))
3025 (format "%.0fK" (/ size 1024.0)))
3026 (t (format "%dB" size)))
3029 (defun wl-summary-line-subject ()
3030 (let (no-parent subject parent-raw-subject parent-subject)
3031 (if (string= wl-thr-indent-string "")
3032 (setq no-parent t)) ; no parent
3034 (elmo-delete-char ?\n
3035 (or (elmo-msgdb-overview-entity-get-subject
3037 wl-summary-no-subject-message)))
3038 (setq parent-raw-subject
3039 (elmo-msgdb-overview-entity-get-subject wl-parent-message-entity))
3040 (setq parent-subject
3041 (if parent-raw-subject
3042 (elmo-delete-char ?\n parent-raw-subject)))
3044 (null parent-subject)
3045 (not (wl-summary-subject-equal
3046 subject parent-subject)))
3047 (funcall wl-summary-subject-function subject)
3050 (defun wl-summary-line-from ()
3051 (elmo-delete-char ?\n
3052 (funcall wl-summary-from-function
3053 (elmo-msgdb-overview-entity-get-from
3054 wl-message-entity))))
3056 (defun wl-summary-line-list-info ()
3057 (let ((list-info (wl-summary-get-list-info wl-message-entity)))
3059 (format (if (cdr list-info) "(%s %05.0f)" "(%s)")
3060 (car list-info) (cdr list-info))
3063 (defun wl-summary-line-list-count ()
3064 (let ((ml-count (cdr (wl-summary-get-list-info wl-message-entity))))
3066 (format "%.0f" ml-count)
3069 (defun wl-summary-line-attached ()
3070 (let ((content-type (elmo-msgdb-overview-entity-get-extra-field
3071 wl-message-entity "content-type"))
3072 (case-fold-search t))
3073 (if (and content-type
3074 (string-match "multipart/mixed" content-type))
3078 (defun wl-summary-create-line (wl-message-entity
3079 wl-parent-message-entity
3083 wl-thr-children-number
3084 wl-thr-indent-string
3086 "Create a summary line."
3087 (let ((wl-mime-charset wl-summary-buffer-mime-charset)
3088 (elmo-mime-charset wl-summary-buffer-mime-charset)
3089 (elmo-lang wl-summary-buffer-weekday-name-lang)
3090 (wl-datevec (or (ignore-errors (timezone-fix-time
3091 (elmo-msgdb-overview-entity-get-date
3094 wl-summary-fix-timezone))
3096 (entity wl-message-entity) ; backward compatibility.
3098 (if (and wl-thr-indent-string
3099 wl-summary-indent-length-limit
3100 (< wl-summary-indent-length-limit
3101 (string-width wl-thr-indent-string)))
3102 (setq wl-thr-indent-string (wl-set-string-width
3103 wl-summary-indent-length-limit
3104 wl-thr-indent-string)))
3105 (setq line (funcall wl-summary-buffer-line-formatter))
3106 (if wl-summary-width (setq line
3107 (wl-set-string-width
3108 (- wl-summary-width 1) line nil
3110 (setq line (concat line
3113 (elmo-msgdb-overview-entity-get-number
3114 wl-message-entity))))
3115 (if wl-summary-highlight
3116 (wl-highlight-summary-line-string line
3119 wl-thr-indent-string))
3122 (defsubst wl-summary-proc-wday (wday-str year month mday)
3124 (if (string-match "\\([A-Z][a-z][a-z]\\).*" wday-str)
3125 (wl-match-string 1 wday-str)
3126 (elmo-date-get-week year month mday))))
3128 (defvar wl-summary-move-spec-alist
3133 (unread . ((t . nil)
3137 (defsubst wl-summary-next-message (num direction hereto)
3138 (if wl-summary-buffer-next-message-function
3139 (funcall wl-summary-buffer-next-message-function num direction hereto)
3140 (let ((cur-spec (cdr (assq wl-summary-move-order
3141 wl-summary-move-spec-alist)))
3142 (nums (memq num (if (eq direction 'up)
3143 (reverse wl-summary-buffer-number-list)
3144 wl-summary-buffer-number-list)))
3146 (unless hereto (setq nums (cdr nums)))
3152 (cond ((eq (car (car cur-spec)) 'p)
3153 (if (setq flagged-list
3154 (elmo-folder-list-flagged
3155 wl-summary-buffer-elmo-folder
3156 (cdr (car cur-spec))))
3158 (if (and (memq (car nums) flagged-list)
3159 (elmo-message-accessible-p
3160 wl-summary-buffer-elmo-folder
3162 (throw 'done (car nums)))
3163 (setq nums (cdr nums)))))
3164 ((eq (car (car cur-spec)) 't)
3165 (if wl-summary-buffer-target-mark-list
3167 (if (memq (car nums)
3168 wl-summary-buffer-target-mark-list)
3169 (throw 'done (car nums)))
3170 (setq nums (cdr nums))))))
3171 (setq cur-spec (cdr cur-spec))))
3174 (defsubst wl-summary-cursor-move (direction hereto)
3175 (when (and (eq direction 'up)
3180 (when (setq num (wl-summary-next-message (wl-summary-message-number)
3183 (wl-thread-jump-to-msg num))
3186 ;; Goto unread or important
3187 ;; returns t if next message exists in this folder.
3188 (defun wl-summary-cursor-down (&optional hereto)
3190 (wl-summary-cursor-move 'down hereto))
3192 (defun wl-summary-cursor-up (&optional hereto)
3194 (wl-summary-cursor-move 'up hereto))
3196 (defun wl-summary-save-view-cache ()
3198 (let* ((dir (elmo-folder-msgdb-path wl-summary-buffer-elmo-folder))
3199 (cache (expand-file-name wl-summary-cache-file dir))
3200 (view (expand-file-name wl-summary-view-file dir))
3201 (save-view wl-summary-buffer-view)
3202 (mark-list (copy-sequence wl-summary-buffer-target-mark-list))
3203 (temp-list (copy-sequence wl-summary-buffer-temp-mark-list))
3204 (tmp-buffer (get-buffer-create " *wl-summary-save-view-cache*"))
3205 (temp-column wl-summary-buffer-temp-mark-column)
3206 (charset wl-summary-buffer-mime-charset))
3207 (if (file-directory-p dir)
3209 (if (file-exists-p dir)
3210 (error "File %s already exists" dir)
3211 (elmo-make-directory dir)))
3212 (if (eq save-view 'thread)
3213 (wl-thread-save-entity dir))
3214 (when wl-summary-check-line-format
3215 (wl-summary-line-format-save))
3218 (when (file-writable-p cache)
3219 (copy-to-buffer tmp-buffer (point-min) (point-max))
3220 (with-current-buffer tmp-buffer
3222 (make-local-variable 'wl-summary-highlight)
3223 (setq wl-summary-highlight nil
3224 wl-summary-buffer-target-mark-list mark-list
3225 wl-summary-buffer-temp-mark-list temp-list
3226 wl-summary-buffer-temp-mark-column temp-column)
3227 (wl-summary-delete-all-temp-marks 'no-msg)
3228 (encode-coding-region
3229 (point-min) (point-max)
3230 (or (and wl-on-mule ; 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