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 ((eq scan-type 'rescan)
2255 (wl-summary-rescan))
2256 ((or (eq scan-type 'force-update)
2257 (eq scan-type 'update))
2258 (setq mes (wl-summary-sync-force-update
2259 'unset-cursor 'no-check)))))
2261 (switch-to-buffer buf)
2263 ;; stick always-sticky-folder
2264 (when (wl-summary-always-sticky-folder-p folder)
2265 (or (wl-summary-sticky-p) (wl-summary-stick t)))
2266 (run-hooks 'wl-summary-prepared-pre-hook)
2267 (set-buffer-modified-p nil)
2268 (goto-char (point-min))
2269 (if (wl-summary-cursor-down t)
2270 (let ((unreadp (wl-summary-next-message
2271 (wl-summary-message-number)
2273 (cond ((and wl-auto-select-first
2274 (wl-summary-auto-select-msg-p unreadp))
2275 ;; wl-auto-select-first is non-nil and
2276 ;; unreadp is non-nil but not important
2277 (setq retval 'disp-msg))
2278 ((and wl-auto-prefetch-first
2279 (wl-summary-auto-select-msg-p unreadp))
2280 ;; wl-auto-select-first is non-nil and
2281 ;; unreadp is non-nil but not important
2282 (setq retval 'prefetch-msg))
2283 ((not (wl-summary-auto-select-msg-p unreadp))
2284 ;; unreadp is nil or important
2285 (setq retval 'more-next))))
2286 (goto-char (point-max))
2287 (if (elmo-folder-plugged-p folder)
2290 (setq retval 'more-next))
2291 (if (and wl-summary-highlight
2292 (not wl-summary-lazy-highlight)
2294 (if (and wl-summary-highlight-partial-threshold
2295 (> (count-lines (point-min) (point-max))
2296 wl-summary-highlight-partial-threshold))
2301 wl-summary-partial-highlight-above-lines
2302 wl-summary-highlight-partial-threshold)))
2303 (wl-highlight-summary (point) (point-max)))
2304 (wl-highlight-summary (point-min) (point-max))))
2305 (if (eq retval 'disp-msg)
2306 (wl-summary-redisplay))
2307 (if (eq retval 'prefetch-msg)
2308 (wl-message-buffer-prefetch
2310 (wl-summary-message-number)
2311 wl-message-buffer-prefetch-depth
2313 wl-summary-buffer-mime-charset))
2314 (if mes (message "%s" mes))
2315 (if (and interactive wl-summary-recenter)
2316 (recenter (/ (- (window-height) 2) 2))))))
2317 ;; set current entity-id
2320 (wl-folder-search-entity-by-name
2321 (elmo-folder-name-internal folder)
2324 ;; entity-id is unknown.
2325 (wl-folder-set-current-entity-id
2326 (wl-folder-get-entity-id entity)))
2327 (when (and wl-summary-lazy-highlight
2331 (run-hooks 'wl-summary-prepared-hook)
2332 (set-buffer-modified-p nil))
2335 (defun wl-summary-goto-previous-message-beginning ()
2337 (re-search-backward "\r\\(-?[0-9]+\\)" nil t)
2338 (beginning-of-line))
2340 (defun wl-summary-goto-top-of-current-thread ()
2341 (wl-summary-jump-to-msg
2342 (wl-thread-entity-get-number
2343 (wl-thread-entity-get-top-entity (wl-thread-get-entity
2344 (wl-summary-message-number))))))
2346 (defun wl-summary-goto-bottom-of-sub-thread (&optional depth)
2348 (let ((depth (or depth
2349 (wl-thread-get-depth-of-current-line))))
2351 (while (and (not (eobp))
2352 (>= (wl-thread-get-depth-of-current-line)
2355 (beginning-of-line)))
2357 (defun wl-summary-insert-line (line)
2358 "Insert LINE in the Summary."
2359 (if wl-use-highlight-mouse-line
2360 ;; remove 'mouse-face of current line.
2362 (save-excursion (beginning-of-line)(point))
2363 (save-excursion (end-of-line)(point))
2366 (if wl-use-highlight-mouse-line
2367 ;; remove 'mouse-face of current line.
2369 (save-excursion (beginning-of-line)(point))
2370 (save-excursion (end-of-line)(point))
2373 (run-hooks 'wl-summary-line-inserted-hook)))
2375 (defun wl-summary-insert-sequential (entity folder &rest args)
2376 (let ((inhibit-read-only t)
2378 (goto-char (point-max))
2379 (wl-summary-insert-line
2380 (wl-summary-create-line entity nil nil
2383 (elmo-message-entity-number
2385 (setq wl-summary-buffer-number-list
2386 (wl-append wl-summary-buffer-number-list
2387 (list (elmo-message-entity-number entity))))
2390 (defun wl-summary-default-subject-filter (subject)
2391 (setq subject (elmo-replace-in-string subject "[ \t]*\\(re\\|was\\)[:>]" ""))
2392 (setq subject (elmo-replace-in-string subject "[ \t]" ""))
2393 (elmo-replace-in-string subject "^\\[.*\\]" ""))
2395 (defun wl-summary-subject-equal (subject1 subject2)
2396 (string= (funcall wl-summary-subject-filter-function subject1)
2397 (funcall wl-summary-subject-filter-function subject2)))
2399 (defmacro wl-summary-put-alike (alike)
2400 (` (elmo-set-hash-val (format "#%d" (wl-count-lines))
2402 wl-summary-alike-hashtb)))
2404 (defmacro wl-summary-get-alike ()
2405 (` (elmo-get-hash-val (format "#%d" (wl-count-lines))
2406 wl-summary-alike-hashtb)))
2408 (defun wl-summary-insert-headers (folder func mime-decode)
2409 (let ((numbers (elmo-folder-list-messages folder nil t))
2411 (buffer-disable-undo (current-buffer))
2412 (make-local-variable 'wl-summary-alike-hashtb)
2413 (setq wl-summary-alike-hashtb (elmo-make-hash (* (length numbers) 2)))
2415 (elmo-set-buffer-multibyte default-enable-multibyte-characters))
2416 (while (setq ov (elmo-message-entity folder (pop numbers)))
2417 (setq this (funcall func ov))
2418 (and this (setq this (std11-unfold-string this)))
2419 (if (equal last this)
2420 (setq alike (cons ov alike))
2422 (wl-summary-put-alike alike)
2424 (setq alike (list ov)
2427 (wl-summary-put-alike alike)
2430 (decode-mime-charset-region (point-min) (point-max)
2432 (when (eq mime-decode 'mime)
2433 (eword-decode-region (point-min) (point-max))))
2434 (run-hooks 'wl-summary-insert-headers-hook)))
2436 (defun wl-summary-search-by-subject (entity folder)
2437 (let ((summary-buf (current-buffer))
2438 (buf (get-buffer-create wl-summary-search-buf-name))
2439 (folder-name (wl-summary-buffer-folder-name))
2440 match founds cur result)
2441 (with-current-buffer buf
2442 (let ((case-fold-search t))
2443 (when (or (not (string= wl-summary-search-buf-folder-name folder-name))
2444 (zerop (buffer-size)))
2445 (setq wl-summary-search-buf-folder-name folder-name)
2446 (message "Creating subject cache...")
2447 (wl-summary-insert-headers
2451 (funcall wl-summary-subject-filter-function
2452 (elmo-message-entity-field x 'subject))))
2454 (message "Creating subject cache...done"))
2455 (setq match (funcall wl-summary-subject-filter-function
2456 (elmo-message-entity-field entity 'subject
2458 (if (string= match "")
2460 (goto-char (point-max))
2461 (while (and (null result)
2462 (not (= (point) (point-min)))
2463 (search-backward match nil t))
2464 ;; check exactly match
2465 (when (and (bolp) (= (point-at-eol)(match-end 0)))
2466 (setq founds (wl-summary-get-alike))
2467 (with-current-buffer summary-buf
2470 ;; the first element of found-entity list exists on
2472 (wl-thread-get-entity
2473 (elmo-message-entity-number (car founds)))
2474 ;; message id is not same as myself.
2476 (elmo-message-entity-field entity 'message-id)
2477 (elmo-message-entity-field (car founds)
2479 ;; not a descendant.
2480 (not (wl-thread-descendant-p
2481 (elmo-message-entity-number entity)
2482 (elmo-message-entity-number (car founds)))))
2483 (setq result (car founds)
2485 (setq founds (cdr founds))))))
2488 (defun wl-summary-insert-thread (entity folder update
2489 &optional force-insert)
2491 this-id parent-entity parent-number relatives anumber
2492 cur number cur-entity linked retval delayed-entity
2493 update-list entity-stack)
2495 (setq this-id (elmo-message-entity-field entity 'message-id)
2497 (elmo-message-entity-parent folder entity)
2498 parent-number (elmo-message-entity-number parent-entity))
2499 (setq number (elmo-message-entity-number entity))
2501 ;; If thread loop detected, set parent as nil.
2504 (elmo-message-entity-number
2505 (setq cur (elmo-message-entity-parent folder cur))))
2506 (if (memq anumber relatives)
2507 (setq parent-number nil
2509 (setq relatives (cons
2510 (elmo-message-entity-number cur)
2512 (if (and parent-number
2513 (not (wl-thread-get-entity parent-number))
2515 ;; parent exists in overview, but not in wl-thread-entities
2517 (wl-append wl-summary-delayed-update
2518 (list (cons parent-number entity)))
2519 (setq entity nil)) ;; exit loop
2520 ;; Search parent by subject.
2521 (when (and (null parent-number)
2522 wl-summary-search-parent-by-subject-regexp
2524 wl-summary-search-parent-by-subject-regexp
2525 (elmo-msgdb-overview-entity-get-subject entity)))
2526 (let ((found (wl-summary-search-by-subject entity folder)))
2528 (not (member found wl-summary-delayed-update)))
2529 (setq parent-entity found)
2531 (elmo-message-entity-number parent-entity))
2533 ;; If subject is change, divide thread.
2534 (if (and parent-number
2535 wl-summary-divide-thread-when-subject-changed
2536 (not (wl-summary-subject-equal
2537 (or (elmo-message-entity-field entity
2539 (or (elmo-message-entity-field parent-entity
2541 (setq parent-number nil))
2543 (wl-thread-insert-message entity
2544 number parent-number update linked))
2546 (wl-append update-list (list retval)))
2547 (setq entity nil) ; exit loop
2548 (while (setq delayed-entity (assq number wl-summary-delayed-update))
2549 (setq wl-summary-delayed-update
2550 (delq delayed-entity wl-summary-delayed-update))
2551 ;; update delayed message
2552 (wl-append entity-stack (list (cdr delayed-entity)))))
2553 (if (and (not entity)
2555 (setq entity (pop entity-stack))))
2558 (defun wl-summary-update-thread (entity
2561 (let* ((this-id (elmo-msgdb-overview-entity-get-id entity))
2562 (overview-entity entity)
2563 (parent-id (elmo-msgdb-overview-entity-get-id parent-entity))
2564 (number (elmo-msgdb-overview-entity-get-number entity))
2565 (parent-number (elmo-msgdb-overview-entity-get-number parent-entity))
2568 ((or (not parent-id)
2569 (string= this-id parent-id))
2570 (goto-char (point-max))
2572 (setq insert-line t))
2573 ;; parent already exists in buffer.
2574 ((wl-summary-jump-to-msg parent-number)
2575 (wl-thread-goto-bottom-of-sub-thread)
2576 (setq insert-line t)))
2578 (let (buffer-read-only)
2579 (wl-summary-insert-line
2580 (wl-summary-create-line
2584 (elmo-message-mark wl-summary-buffer-elmo-folder number)
2585 (wl-thread-maybe-get-children-num number)
2586 (wl-thread-make-indent-string thr-entity)
2587 (wl-thread-entity-get-linked thr-entity)))))))
2589 (defun wl-summary-target-mark-msgs (msgs)
2590 "Return the number of marked messages."
2592 (dolist (number msgs)
2593 (when (wl-summary-target-mark number)
2597 (defun wl-summary-pick (&optional from-list delete-marks)
2600 (let* ((condition (car (elmo-parse-search-condition
2601 (elmo-read-search-condition
2602 wl-summary-pick-field-default))))
2603 (result (elmo-folder-search wl-summary-buffer-elmo-folder
2608 (let ((mlist wl-summary-buffer-target-mark-list))
2610 (when (wl-summary-jump-to-msg (car mlist))
2611 (wl-summary-unmark))
2612 (setq mlist (cdr mlist)))
2613 (setq wl-summary-buffer-target-mark-list nil)))
2615 (setq num (wl-summary-target-mark-msgs result))
2617 (if (= num (length result))
2618 (message "%d message(s) are picked." num)
2619 (message "%d(%d) message(s) are picked." num
2620 (- (length result) num)))
2621 (message "No message was picked.")))))
2623 (defun wl-summary-unvirtual ()
2624 "Exit from current virtual folder."
2627 (elmo-folder-type-internal wl-summary-buffer-elmo-folder))
2628 (wl-summary-goto-folder-subr
2629 (elmo-folder-name-internal
2630 (elmo-filter-folder-target-internal
2631 wl-summary-buffer-elmo-folder))
2633 (error "This folder is not filtered")))
2635 (defun wl-summary-virtual (&optional arg)
2636 "Goto virtual folder.
2637 If ARG, exit virtual folder."
2640 (wl-summary-unvirtual)
2641 (wl-summary-goto-folder-subr (concat "/"
2642 (elmo-read-search-condition
2643 wl-summary-pick-field-default)
2645 (wl-summary-buffer-folder-name))
2647 (run-hooks 'wl-summary-virtual-hook)))
2649 (defun wl-summary-delete-all-temp-marks (&optional no-msg force)
2650 "Erase all temp marks from buffer."
2652 (when (or wl-summary-buffer-target-mark-list
2653 wl-summary-buffer-temp-mark-list
2656 (goto-char (point-min))
2658 (message "Unmarking..."))
2660 (wl-summary-unset-mark nil nil force)
2663 (message "Unmarking...done"))
2664 (setq wl-summary-buffer-target-mark-list nil)
2665 (setq wl-summary-buffer-temp-mark-list nil))))
2667 (defsubst wl-summary-temp-mark ()
2668 "Return temp-mark string of current line."
2669 (let ((number (wl-summary-message-number))
2671 (or (and (wl-summary-have-target-mark-p number)
2673 (and (setq info (wl-summary-registered-temp-mark number))
2675 (wl-summary-get-score-mark number)
2678 (defsubst wl-summary-persistent-mark ()
2679 "Return persistent-mark string of current line."
2681 (elmo-message-mark wl-summary-buffer-elmo-folder
2682 (wl-summary-message-number)))
2685 (defun wl-summary-put-temp-mark (mark)
2686 "Put temp MARK on current line."
2687 (when wl-summary-buffer-temp-mark-column
2690 (let ((inhibit-read-only t)
2691 (buffer-read-only nil))
2692 (move-to-column wl-summary-buffer-temp-mark-column)
2693 (delete-backward-char 1)
2696 (defun wl-summary-next-buffer ()
2697 "Switch to next summary buffer."
2699 (let ((buffers (sort (wl-collect-summary)
2700 (lambda (buffer1 buffer2)
2701 (string-lessp (buffer-name buffer1)
2702 (buffer-name buffer2))))))
2704 (or (cadr (memq (current-buffer) buffers))
2707 (defun wl-summary-previous-buffer ()
2708 "Switch to previous summary buffer."
2710 (let ((buffers (sort (wl-collect-summary)
2711 (lambda (buffer1 buffer2)
2712 (not (string-lessp (buffer-name buffer1)
2713 (buffer-name buffer2)))))))
2715 (or (cadr (memq (current-buffer) buffers))
2718 (defun wl-summary-target-mark-mark-as-read ()
2721 (goto-char (point-min))
2722 (let ((inhibit-read-only t)
2723 (buffer-read-only nil)
2724 wl-summary-buffer-disp-msg
2725 (mlist wl-summary-buffer-temp-mark-list))
2726 (dolist (number mlist)
2727 (wl-summary-unset-mark number))
2728 (wl-summary-mark-as-read mlist))))
2730 (defun wl-summary-target-mark-mark-as-unread ()
2733 (goto-char (point-min))
2734 (let ((inhibit-read-only t)
2735 (buffer-read-only nil)
2736 wl-summary-buffer-disp-msg
2737 (mlist wl-summary-buffer-target-mark-list))
2738 (dolist (number mlist)
2739 (wl-summary-unset-mark number))
2740 (wl-summary-mark-as-unread mlist))))
2742 (defun wl-summary-target-mark-mark-as-important ()
2745 (goto-char (point-min))
2746 (let ((inhibit-read-only t)
2747 (buffer-read-only nil)
2748 wl-summary-buffer-disp-msg
2749 (mlist wl-summary-buffer-target-mark-list))
2750 (dolist (number mlist)
2751 (wl-summary-unset-mark number)
2752 (wl-summary-mark-as-important number))
2753 (wl-summary-count-unread)
2754 (wl-summary-update-modeline))))
2756 (defun wl-summary-target-mark-save ()
2759 (wl-read-directory-name "Save to directory: "
2760 wl-temporary-file-directory))
2762 (if (null (file-exists-p wl-save-dir))
2763 (make-directory wl-save-dir))
2764 (while (setq number (car wl-summary-buffer-target-mark-list))
2765 (wl-thread-jump-to-msg number)
2766 (wl-summary-save t wl-save-dir)
2767 (wl-summary-unmark))))
2769 (defun wl-summary-target-mark-pick ()
2771 (wl-summary-pick wl-summary-buffer-target-mark-list 'delete))
2773 (defun wl-summary-update-persistent-mark ()
2774 "Synch up persistent mark of current line with msgdb's.
2775 Return non-nil if the mark is updated"
2776 (if wl-summary-buffer-persistent-mark-column
2778 (move-to-column wl-summary-buffer-persistent-mark-column)
2779 (let ((inhibit-read-only t)
2780 (buffer-read-only nil)
2781 (mark (buffer-substring (- (point) 1) (point)))
2782 (new-mark (wl-summary-persistent-mark)))
2783 (unless (string= new-mark mark)
2784 (delete-backward-char 1)
2786 (when wl-summary-highlight
2787 (wl-highlight-summary-current-line))
2788 (set-buffer-modified-p nil)
2790 (when wl-summary-highlight
2791 (wl-highlight-summary-current-line))
2792 (set-buffer-modified-p nil)))
2794 (defsubst wl-summary-mark-as-read-internal (inverse
2799 (let ((folder wl-summary-buffer-elmo-folder)
2800 unread-message number
2801 number-list visible)
2802 (setq number-list (cond ((numberp number-or-numbers)
2803 (setq unread-message
2804 (member (elmo-message-mark
2807 (elmo-msgdb-unread-marks)))
2808 (list number-or-numbers))
2809 ((and (not (null number-or-numbers))
2810 (listp number-or-numbers))
2812 ((setq number (wl-summary-message-number))
2814 (setq unread-message
2815 (member (elmo-message-mark folder number)
2816 (elmo-msgdb-unread-marks)))
2818 (if (null number-list)
2819 (message "No message.")
2821 (elmo-folder-unmark-read folder number-list no-folder-mark)
2822 (elmo-folder-mark-as-read folder number-list no-folder-mark))
2823 (dolist (number number-list)
2824 (setq visible (wl-summary-jump-to-msg number))
2826 (when unread-message
2827 (run-hooks 'wl-summary-unread-message-hook)))
2828 ;; set mark on buffer
2830 (wl-summary-update-persistent-mark)))
2831 (unless no-modeline-update
2832 ;; Update unread numbers.
2833 ;; should elmo-folder-mark-as-read return unread numbers?
2834 (wl-summary-count-unread)
2835 (wl-summary-update-modeline)
2836 (wl-folder-update-unread
2837 (wl-summary-buffer-folder-name)
2838 (+ wl-summary-buffer-unread-count
2839 wl-summary-buffer-new-count)))))))
2841 (defun wl-summary-mark-as-read (&optional number-or-numbers
2845 (wl-summary-mark-as-read-internal nil
2848 no-modeline-update))
2850 (defun wl-summary-mark-as-unread (&optional number-or-numbers
2854 (wl-summary-mark-as-read-internal 'inverse
2857 no-modeline-update))
2859 (defsubst wl-summary-mark-as-answered-internal (inverse
2863 (let ((folder wl-summary-buffer-elmo-folder)
2864 number number-list visible)
2865 (setq number-list (cond ((numberp number-or-numbers)
2866 (list number-or-numbers))
2867 ((and (not (null number-or-numbers))
2868 (listp number-or-numbers))
2870 ((setq number (wl-summary-message-number))
2873 (if (null number-list)
2874 (message "No message.")
2876 (elmo-folder-unmark-answered folder number-list)
2877 (elmo-folder-mark-as-answered folder number-list))
2878 (dolist (number number-list)
2879 (setq visible (wl-summary-jump-to-msg number))
2880 ;; set mark on buffer
2882 (wl-summary-update-persistent-mark)))
2883 (unless no-modeline-update
2884 ;; Update unread numbers.
2885 ;; should elmo-folder-mark-as-read return unread numbers?
2886 (wl-summary-count-unread)
2887 (wl-summary-update-modeline)
2888 (wl-folder-update-unread
2889 (wl-summary-buffer-folder-name)
2890 (+ wl-summary-buffer-unread-count
2891 wl-summary-buffer-new-count)))))))
2893 (defun wl-summary-mark-as-answered (&optional number-or-numbers
2896 (wl-summary-mark-as-answered-internal
2897 (and (interactive-p)
2898 (member (elmo-message-mark wl-summary-buffer-elmo-folder
2899 (wl-summary-message-number))
2900 (elmo-msgdb-answered-marks)))
2902 no-modeline-update))
2904 (defun wl-summary-mark-as-unanswered (&optional number-or-numbers
2906 (wl-summary-mark-as-answered-internal 'inverse
2908 no-modeline-update))
2910 (defun wl-summary-mark-as-important (&optional number
2914 (if (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
2916 (error "Cannot process mark in this folder"))
2918 (let* ((folder wl-summary-buffer-elmo-folder)
2919 message-id visible cur-mark)
2921 (setq visible (wl-summary-jump-to-msg number))
2922 (setq cur-mark (or mark
2924 wl-summary-buffer-elmo-folder number)
2926 ((setq number (wl-summary-message-number))
2928 (setq cur-mark (or mark (wl-summary-persistent-mark))))
2930 (error "No message")))
2932 ;; already exists in msgdb.
2933 (elmo-message-entity wl-summary-buffer-elmo-folder
2935 (setq message-id (elmo-message-field
2936 wl-summary-buffer-elmo-folder
2939 (if (string= cur-mark elmo-msgdb-important-mark)
2943 (elmo-folder-unmark-important folder (list number)
2945 (unless no-server-update
2946 (elmo-msgdb-global-mark-delete message-id))
2947 ;; Remove cache if local folder.
2948 (if (and (elmo-folder-local-p folder)
2950 (elmo-folder-type-internal folder))))
2951 (elmo-file-cache-delete
2952 (elmo-file-cache-get-path message-id)))))
2954 (elmo-folder-mark-as-important folder (list number)
2956 (if (eq (elmo-file-cache-exists-p message-id) 'entire)
2957 (elmo-folder-mark-as-read folder (list number))
2958 ;; Force cache message.
2959 (elmo-message-encache folder number 'read))
2960 (unless no-server-update
2961 (elmo-msgdb-global-mark-set message-id
2962 elmo-msgdb-important-mark))))
2964 (wl-summary-update-persistent-mark))))
2968 (defvar wl-summary-line-formatter nil)
2970 (defun wl-summary-view-old-p ()
2971 "Return non-nil when summary view cache has old format."
2973 (goto-char (point-min))
2974 (and wl-summary-buffer-number-list
2975 (not (re-search-forward "\r-?[0-9]+" (point-at-eol) t)))))
2977 (defun wl-summary-line-format-changed-p ()
2978 "Return non-nil when summary line format is changed."
2980 wl-summary-buffer-line-format
2981 (or (elmo-object-load (expand-file-name
2982 wl-summary-line-format-file
2983 (elmo-folder-msgdb-path
2984 wl-summary-buffer-elmo-folder))
2985 wl-summary-buffer-mime-charset)
2986 wl-summary-buffer-line-format))))
2988 (defun wl-summary-line-format-save ()
2989 "Save current summary line format."
2991 (expand-file-name wl-summary-line-format-file
2992 (elmo-folder-msgdb-path
2993 wl-summary-buffer-elmo-folder))
2994 wl-summary-buffer-line-format
2995 wl-summary-buffer-mime-charset))
2997 (defun wl-summary-line-number ()
2998 (wl-set-string-width
2999 (- wl-summary-buffer-number-column)
3001 (elmo-msgdb-overview-entity-get-number wl-message-entity))))
3003 (defun wl-summary-line-year ()
3004 (aref wl-datevec 0))
3005 (defun wl-summary-line-month ()
3006 (format "%02d" (aref wl-datevec 1)))
3007 (defun wl-summary-line-day ()
3008 (format "%02d" (aref wl-datevec 2)))
3009 (defun wl-summary-line-day-of-week ()
3011 (elmo-date-get-week (aref wl-datevec 0)
3013 (aref wl-datevec 2))
3015 (defun wl-summary-line-hour ()
3016 (format "%02d" (aref wl-datevec 3)))
3017 (defun wl-summary-line-minute ()
3018 (format "%02d" (aref wl-datevec 4)))
3020 (defun wl-summary-line-size ()
3021 (let ((size (elmo-msgdb-overview-entity-get-size wl-message-entity)))
3024 ((<= 1 (/ size 1048576))
3025 (format "%.0fM" (/ size 1048576.0)))
3026 ((<= 1 (/ size 1024))
3027 (format "%.0fK" (/ size 1024.0)))
3028 (t (format "%dB" size)))
3031 (defun wl-summary-line-subject ()
3032 (let (no-parent subject parent-raw-subject parent-subject)
3033 (if (string= wl-thr-indent-string "")
3034 (setq no-parent t)) ; no parent
3036 (elmo-delete-char ?\n
3037 (or (elmo-msgdb-overview-entity-get-subject
3039 wl-summary-no-subject-message)))
3040 (setq parent-raw-subject
3041 (elmo-msgdb-overview-entity-get-subject wl-parent-message-entity))
3042 (setq parent-subject
3043 (if parent-raw-subject
3044 (elmo-delete-char ?\n parent-raw-subject)))
3046 (null parent-subject)
3047 (not (wl-summary-subject-equal
3048 subject parent-subject)))
3049 (funcall wl-summary-subject-function subject)
3052 (defun wl-summary-line-from ()
3053 (elmo-delete-char ?\n
3054 (funcall wl-summary-from-function
3055 (elmo-msgdb-overview-entity-get-from
3056 wl-message-entity))))
3058 (defun wl-summary-line-list-info ()
3059 (let ((list-info (wl-summary-get-list-info wl-message-entity)))
3061 (format (if (cdr list-info) "(%s %05.0f)" "(%s)")
3062 (car list-info) (cdr list-info))
3065 (defun wl-summary-line-list-count ()
3066 (let ((ml-count (cdr (wl-summary-get-list-info wl-message-entity))))
3068 (format "%.0f" ml-count)
3071 (defun wl-summary-line-attached ()
3072 (let ((content-type (elmo-msgdb-overview-entity-get-extra-field
3073 wl-message-entity "content-type"))
3074 (case-fold-search t))
3075 (if (and content-type
3076 (string-match "multipart/mixed" content-type))
3080 (defun wl-summary-create-line (wl-message-entity
3081 wl-parent-message-entity
3085 wl-thr-children-number
3086 wl-thr-indent-string
3088 "Create a summary line."
3089 (let ((wl-mime-charset wl-summary-buffer-mime-charset)
3090 (elmo-mime-charset wl-summary-buffer-mime-charset)
3091 (elmo-lang wl-summary-buffer-weekday-name-lang)
3092 (wl-datevec (or (ignore-errors (timezone-fix-time
3093 (elmo-msgdb-overview-entity-get-date
3096 wl-summary-fix-timezone))
3098 (entity wl-message-entity) ; backward compatibility.
3100 (if (and wl-thr-indent-string
3101 wl-summary-indent-length-limit
3102 (< wl-summary-indent-length-limit
3103 (string-width wl-thr-indent-string)))
3104 (setq wl-thr-indent-string (wl-set-string-width
3105 wl-summary-indent-length-limit
3106 wl-thr-indent-string)))
3107 (setq line (funcall wl-summary-buffer-line-formatter))
3108 (if wl-summary-width (setq line
3109 (wl-set-string-width
3110 (- wl-summary-width 1) line nil
3112 (setq line (concat line
3115 (elmo-msgdb-overview-entity-get-number
3116 wl-message-entity))))
3117 (if wl-summary-highlight
3118 (wl-highlight-summary-line-string line
3121 wl-thr-indent-string))
3124 (defsubst wl-summary-proc-wday (wday-str year month mday)
3126 (if (string-match "\\([A-Z][a-z][a-z]\\).*" wday-str)
3127 (wl-match-string 1 wday-str)
3128 (elmo-date-get-week year month mday))))
3130 (defvar wl-summary-move-spec-alist
3135 (unread . ((t . nil)
3139 (defsubst wl-summary-next-message (num direction hereto)
3140 (if wl-summary-buffer-next-message-function
3141 (funcall wl-summary-buffer-next-message-function num direction hereto)
3142 (let ((cur-spec (cdr (assq wl-summary-move-order
3143 wl-summary-move-spec-alist)))
3144 (nums (memq num (if (eq direction 'up)
3145 (reverse wl-summary-buffer-number-list)
3146 wl-summary-buffer-number-list)))
3148 (unless hereto (setq nums (cdr nums)))
3154 (cond ((eq (car (car cur-spec)) 'p)
3155 (if (setq flagged-list
3156 (elmo-folder-list-flagged
3157 wl-summary-buffer-elmo-folder
3158 (cdr (car cur-spec))))
3160 (if (and (memq (car nums) flagged-list)
3161 (elmo-message-accessible-p
3162 wl-summary-buffer-elmo-folder
3164 (throw 'done (car nums)))
3165 (setq nums (cdr nums)))))
3166 ((eq (car (car cur-spec)) 't)
3167 (if wl-summary-buffer-target-mark-list
3169 (if (memq (car nums)
3170 wl-summary-buffer-target-mark-list)
3171 (throw 'done (car nums)))
3172 (setq nums (cdr nums))))))
3173 (setq cur-spec (cdr cur-spec))))
3176 (defsubst wl-summary-cursor-move (direction hereto)
3177 (when (and (eq direction 'up)
3182 (when (setq num (wl-summary-next-message (wl-summary-message-number)
3185 (wl-thread-jump-to-msg num))
3188 ;; Goto unread or important
3189 ;; returns t if next message exists in this folder.
3190 (defun wl-summary-cursor-down (&optional hereto)
3192 (wl-summary-cursor-move 'down hereto))
3194 (defun wl-summary-cursor-up (&optional hereto)
3196 (wl-summary-cursor-move 'up hereto))
3198 (defun wl-summary-save-view-cache ()
3200 (let* ((dir (elmo-folder-msgdb-path wl-summary-buffer-elmo-folder))
3201 (cache (expand-file-name wl-summary-cache-file dir))
3202 (view (expand-file-name wl-summary-view-file dir))
3203 (save-view wl-summary-buffer-view)
3204 (mark-list (copy-sequence wl-summary-buffer-target-mark-list))
3205 (temp-list (copy-sequence wl-summary-buffer-temp-mark-list))
3206 (tmp-buffer (get-buffer-create " *wl-summary-save-view-cache*"))
3207 (temp-column wl-summary-buffer-temp-mark-column)
3208 (charset wl-summary-buffer-mime-charset))
3209 (if (file-directory-p dir)
3211 (if (file-exists-p dir)
3212 (error "File %s already exists" dir)
3213 (elmo-make-directory dir)))
3214 (if (eq save-view 'thread)
3215 (wl-thread-save-entity dir))
3216 (when wl-summary-check-line-format
3217 (wl-summary-line-format-save))
3220 (when (file-writable-p cache)
3221 (copy-to-buffer tmp-buffer (point-min) (point-max))
3222 (with-current-buffer tmp-buffer
3224 (make-local-variable 'wl-summary-highlight)
3225 (setq wl-summary-highlight nil
3226 wl-summary-buffer-target-mark-list mark-list
3227 wl-summary-buffer-temp-mark-list temp-list
3228 wl-summary-buffer-temp-mark-column temp-column)
3229 (wl-summary-delete-all-temp-marks 'no-msg 'force)
3230 (encode-coding-region
3231 (point-min) (point-max)
3233 ;; one in mcs-ltn1(apel<10.4) cannot take 2 arg.
3234 (mime-charset-to-coding-system charset 'LF))
3235 ;; Mule 2 doesn't have `*ctext*unix'.
3236 (mime-charset-to-coding-system charset)))
3237 (write-region-as-binary (point-min)(point-max)
3238 cache nil 'no-msg)))
3239 (when (file-writable-p view) ; 'thread or 'sequence
3241 (set-buffer tmp-buffer)
3243 (prin1 save-view tmp-buffer)
3244 (princ "\n" tmp-buffer)
3245 (write-region (point-min) (point-max) view nil 'no-msg))))
3247 (kill-buffer tmp-buffer)))))
3249 (defsubst wl-summary-get-sync-range (folder)
3251 (elmo-folder-plugged-p folder)
3252 (wl-get-assoc-list-value
3253 wl-folder-sync-range-alist
3254 (elmo-folder-name-internal folder)))
3255 wl-default-sync-range)))
3257 ;; redefined for wl-summary-sync-update
3258 (defun wl-summary-input-range (folder)
3259 "returns update or all or rescan."
3260 ;; for the case when parts are expanded in the bottom of the folder
3261 (let ((input-range-list '("no-sync"
3272 (default (or (wl-get-assoc-list-value
3273 wl-folder-sync-range-alist
3275 wl-default-sync-range))
3278 (completing-read (format "Range (%s): " default)
3280 (function (lambda (x) (cons x x)))
3282 (if (string= range "")
3286 (defun wl-summary-toggle-disp-folder (&optional arg)
3288 (let ((cur-buf (current-buffer))
3289 (summary-win (get-buffer-window (current-buffer)))
3293 (setq wl-summary-buffer-disp-folder t)
3294 ;; hide your folder window
3295 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3296 (if (setq fld-win (get-buffer-window fld-buf))
3297 (delete-window fld-win))))
3299 (setq wl-summary-buffer-disp-folder nil)
3300 ;; hide your wl-message window!
3301 (when (buffer-live-p wl-message-buffer)
3302 (wl-message-select-buffer wl-message-buffer)
3304 (select-window (get-buffer-window cur-buf))
3305 ;; display wl-folder window!!
3306 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3307 (if (setq fld-win (get-buffer-window fld-buf))
3308 ;; folder win is already displayed.
3309 (select-window fld-win)
3310 ;; folder win is not displayed.
3311 (switch-to-buffer fld-buf))
3314 ;; temporarily delete summary-win.
3316 (delete-window summary-win))
3317 (split-window-horizontally wl-folder-window-width)
3319 (switch-to-buffer cur-buf))
3321 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3322 (if (setq fld-win (get-buffer-window fld-buf))
3323 (setq wl-summary-buffer-disp-folder nil)
3324 (setq wl-summary-buffer-disp-folder t)))
3325 (if (not wl-summary-buffer-disp-folder)
3326 ;; hide message window
3327 (let ((mes-win (and wl-message-buffer
3328 (get-buffer-window wl-message-buffer)))
3329 (wl-stay-folder-window t))
3330 (if mes-win (delete-window mes-win))
3331 ;; hide your folder window
3332 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3333 (if (setq fld-win (get-buffer-window fld-buf))
3335 (delete-window (get-buffer-window cur-buf))
3336 (select-window fld-win)
3337 (switch-to-buffer cur-buf))))
3338 (run-hooks 'wl-summary-toggle-disp-folder-off-hook)
3339 ;; resume message window.
3341 (wl-message-select-buffer wl-message-buffer)
3342 (run-hooks 'wl-summary-toggle-disp-folder-message-resumed-hook)
3343 (select-window (get-buffer-window cur-buf))))
3344 ;; hide message window
3345 (let ((wl-stay-folder-window t)
3346 (mes-win (and wl-message-buffer
3347 (get-buffer-window wl-message-buffer))))
3348 (if mes-win (delete-window mes-win))
3349 (select-window (get-buffer-window cur-buf))
3350 ;; display wl-folder window!!
3351 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3352 (if (setq fld-win (get-buffer-window fld-buf))
3353 ;; folder win is already displayed.
3354 (select-window fld-win)
3355 ;; folder win is not displayed...occupy all.
3356 (switch-to-buffer fld-buf))
3359 (split-window-horizontally wl-folder-window-width)
3361 (switch-to-buffer cur-buf)
3362 ;; resume message window.
3363 (run-hooks 'wl-summary-toggle-disp-folder-on-hook)
3365 (wl-message-select-buffer wl-message-buffer)
3366 (run-hooks 'wl-summary-toggle-disp-folder-message-resumed-hook)
3367 (select-window (get-buffer-window cur-buf))))))))
3368 (run-hooks 'wl-summary-toggle-disp-folder-hook))
3370 (defun wl-summary-toggle-disp-msg (&optional arg)
3372 (let ((cur-buf (current-buffer))
3377 (setq wl-summary-buffer-disp-msg t)
3379 ;; hide your folder window
3380 (if (and (not wl-stay-folder-window)
3381 (setq fld-buf (get-buffer wl-folder-buffer-name)))
3382 (if (setq fld-win (get-buffer-window fld-buf))
3383 (unless (one-window-p fld-win)
3384 (delete-window fld-win))))))
3386 (wl-delete-all-overlays)
3387 (setq wl-summary-buffer-disp-msg nil)
3389 (when (buffer-live-p wl-message-buffer)
3390 (wl-message-select-buffer wl-message-buffer)
3392 (and (get-buffer-window cur-buf)
3393 (select-window (get-buffer-window cur-buf))))
3394 (run-hooks 'wl-summary-toggle-disp-off-hook)))
3396 (if (and wl-message-buffer
3397 (get-buffer-window wl-message-buffer)) ; already displayed
3398 (setq wl-summary-buffer-disp-msg nil)
3399 (setq wl-summary-buffer-disp-msg t))
3400 (if wl-summary-buffer-disp-msg
3402 (wl-summary-redisplay)
3403 ;;; hide your folder window
3404 ;;; (setq fld-buf (get-buffer wl-folder-buffer-name))
3405 ;;; (if (setq fld-win (get-buffer-window fld-buf))
3406 ;;; (delete-window fld-win)))
3407 (run-hooks 'wl-summary-toggle-disp-on-hook))
3408 (wl-delete-all-overlays)
3410 (wl-message-select-buffer wl-message-buffer)
3412 (select-window (get-buffer-window cur-buf))
3413 (setq wl-message-buffer nil)
3414 (run-hooks 'wl-summary-toggle-disp-off-hook))
3415 ;;; (switch-to-buffer cur-buf)
3417 (when wl-summary-lazy-highlight
3418 (wl-highlight-summary-window))))
3420 (defun wl-summary-next-line-content ()
3421 "Show next line of the message."
3423 (let ((cur-buf (current-buffer)))
3424 (wl-summary-toggle-disp-msg 'on)
3425 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3426 (set-buffer cur-buf)
3427 (wl-message-next-page 1))))
3429 (defun wl-summary-prev-line-content ()
3431 (let ((cur-buf (current-buffer)))
3432 (wl-summary-toggle-disp-msg 'on)
3433 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3434 (set-buffer cur-buf)
3435 (wl-message-prev-page 1))))
3437 (defun wl-summary-next-page ()
3439 (let ((cur-buf (current-buffer)))
3440 (wl-summary-toggle-disp-msg 'on)
3441 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3442 (set-buffer cur-buf)
3443 (wl-message-next-page))))
3445 (defun wl-summary-prev-page ()
3447 (let ((cur-buf (current-buffer)))
3448 (wl-summary-toggle-disp-msg 'on)
3449 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3450 (set-buffer cur-buf)
3451 (wl-message-prev-page))))
3453 (defsubst wl-summary-no-mime-p (folder)
3454 (wl-string-match-member (elmo-folder-name-internal folder)
3455 wl-summary-no-mime-folder-list))
3457 (defun wl-summary-set-message-buffer-or-redisplay (&rest args)
3458 "Set message buffer.
3459 If message is not displayed yet, display it.
3460 Return t if message exists."
3461 (let ((folder wl-summary-buffer-elmo-folder)
3462 (number (wl-summary-message-number))
3463 cur-folder cur-number message-last-pos)
3464 (when (buffer-live-p wl-message-buffer)
3465 (save-window-excursion
3466 (wl-message-select-buffer wl-message-buffer)
3467 (setq cur-folder wl-message-buffer-cur-folder)
3468 (setq cur-number wl-message-buffer-cur-number)))
3469 (if (and (string= (elmo-folder-name-internal folder) (or cur-folder ""))
3470 (eq number (or cur-number 0)))
3472 (set-buffer wl-message-buffer)
3474 (if (wl-summary-no-mime-p folder)
3475 (wl-summary-redisplay-no-mime-internal folder number)
3476 (wl-summary-redisplay-internal folder number))
3477 (when (buffer-live-p wl-message-buffer)
3478 (set-buffer wl-message-buffer))
3481 (defun wl-summary-target-mark-forward (&optional arg)
3483 (let ((mlist (nreverse wl-summary-buffer-target-mark-list))
3484 (summary-buf (current-buffer))
3485 (wl-draft-forward t)
3488 (wl-summary-jump-to-msg (car mlist))
3489 (wl-summary-forward t)
3490 (setq start-point (point))
3491 (setq draft-buf (current-buffer))
3492 (setq mlist (cdr mlist))
3493 (save-window-excursion
3496 (set-buffer summary-buf)
3497 (wl-summary-jump-to-msg (car mlist))
3498 (wl-summary-redisplay)
3499 (set-buffer draft-buf)
3500 (goto-char (point-max))
3501 (wl-draft-insert-message)
3502 (setq mlist (cdr mlist)))
3503 (wl-draft-body-goto-top)
3504 (wl-draft-enclose-digest-region (point) (point-max)))
3505 (goto-char start-point)
3507 (set-buffer summary-buf)
3508 (wl-summary-delete-all-temp-marks)))
3509 (run-hooks 'wl-mail-setup-hook)))
3511 (defun wl-summary-target-mark-reply-with-citation (&optional arg)
3513 (let ((mlist (nreverse wl-summary-buffer-target-mark-list))
3514 (summary-buf (current-buffer))
3515 change-major-mode-hook
3518 (wl-summary-jump-to-msg (car mlist))
3519 (when (wl-summary-reply arg t)
3520 (goto-char (point-max))
3521 (setq start-point (point-marker))
3522 (setq draft-buf (current-buffer))
3523 (save-window-excursion
3525 (set-buffer summary-buf)
3526 (delete-other-windows)
3527 (wl-summary-jump-to-msg (car mlist))
3528 (wl-summary-redisplay)
3529 (set-buffer draft-buf)
3530 (goto-char (point-max))
3531 (wl-draft-yank-original)
3532 (setq mlist (cdr mlist)))
3533 (goto-char start-point)
3535 (set-buffer summary-buf)
3536 (wl-summary-delete-all-temp-marks)))
3537 (wl-draft-reply-position wl-draft-reply-default-position)
3538 (run-hooks 'wl-mail-setup-hook))))
3540 (defun wl-summary-reply-with-citation (&optional arg)
3542 (when (wl-summary-reply arg t)
3543 (goto-char (point-max))
3544 (wl-draft-yank-original)
3545 (wl-draft-reply-position wl-draft-reply-default-position)
3546 (run-hooks 'wl-mail-setup-hook)))
3548 (defun wl-summary-jump-to-msg-by-message-id (&optional id)
3550 (let* ((original (wl-summary-message-number))
3551 (msgid (elmo-string (or id (read-from-minibuffer "Message-ID: "))))
3552 (entity (elmo-message-entity wl-summary-buffer-elmo-folder msgid))
3554 (errmsg (format "No message with id \"%s\" in the folder." msgid)))
3555 (if (setq msg (elmo-message-entity-number entity))
3557 (wl-thread-jump-to-msg msg)
3560 (if (and elmo-use-database
3563 "No message with id \"%s\" in the database." msgid))
3564 (setq otherfld (elmo-database-msgid-get msgid)))
3565 (if (cdr (wl-summary-jump-to-msg-internal
3566 (car otherfld) (nth 1 otherfld) 'no-sync))
3568 ;; Back to original.
3569 (wl-summary-jump-to-msg-internal
3570 (wl-summary-buffer-folder-name) original 'no-sync))
3571 (cond ((eq wl-summary-search-via-nntp 'confirm)
3572 (require 'elmo-nntp)
3573 (message "Search message in nntp server \"%s\" <y/n/s(elect)>? "
3574 elmo-nntp-default-server)
3575 (setq schar (let ((cursor-in-echo-area t)) (read-char)))
3576 (cond ((eq schar ?y)
3577 (wl-summary-jump-to-msg-by-message-id-via-nntp msgid))
3579 (wl-summary-jump-to-msg-by-message-id-via-nntp
3581 (read-from-minibuffer "NNTP Server: ")))
3583 (message "%s" errmsg)
3585 ((or (eq wl-summary-search-via-nntp 'force)
3587 (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
3589 wl-summary-search-via-nntp))
3590 (wl-summary-jump-to-msg-by-message-id-via-nntp msgid))
3592 (message "%s" errmsg)
3595 (defun wl-summary-jump-to-msg-by-message-id-via-nntp (&optional id server-spec)
3597 (let* ((msgid (elmo-string (or id (read-from-minibuffer "Message-ID: "))))
3598 newsgroups folder ret
3599 user server port type spec)
3601 (if (string-match "^-" server-spec)
3602 (setq spec (wl-folder-get-elmo-folder server-spec)
3603 user (elmo-net-folder-user-internal spec)
3604 server (elmo-net-folder-server-internal spec)
3605 port (elmo-net-folder-port-internal spec)
3606 type (elmo-net-folder-stream-type-internal spec))
3607 (setq server server-spec)))
3608 (when (setq ret (elmo-nntp-get-newsgroup-by-msgid
3610 (or server elmo-nntp-default-server)
3611 (or user elmo-nntp-default-user)
3612 (or port elmo-nntp-default-port)
3613 (or type elmo-nntp-default-stream-type)))
3614 (setq newsgroups (elmo-nntp-parse-newsgroups ret))
3615 (setq folder (concat "-" (car newsgroups)
3616 (elmo-nntp-folder-postfix user server port type)))
3619 (if (wl-folder-entity-exists-p (car newsgroups)
3620 wl-folder-newsgroups-hashtb)
3622 (setq folder (concat "-" (car newsgroups)
3623 (elmo-nntp-folder-postfix
3624 user server port type)))))
3625 (setq newsgroups (cdr newsgroups)))))
3627 (wl-summary-jump-to-msg-internal folder nil 'update msgid)
3628 (message "No message id \"%s\" in nntp server \"%s\"."
3629 msgid (or server elmo-nntp-default-server))
3632 (defun wl-summary-jump-to-msg-internal (folder msg scan-type &optional msgid)
3633 (let (wl-auto-select-first entity)
3634 (if (or (string= folder (wl-summary-buffer-folder-name))
3637 "Message was found in the folder \"%s\". Jump to it? "
3641 (wl-summary-goto-folder-subr
3642 folder scan-type nil nil t)
3645 (elmo-message-entity-number
3646 (elmo-message-entity
3647 wl-summary-buffer-elmo-folder
3649 (setq entity (wl-folder-search-entity-by-name folder
3653 (wl-folder-set-current-entity-id
3654 (wl-folder-get-entity-id entity))))
3656 (message "Message was not found currently in this folder.")
3657 (setq msg (and (wl-thread-jump-to-msg msg) msg)))
3658 (cons folder msg)))))
3660 (defun wl-summary-jump-to-parent-message (arg)
3662 (let ((cur-buf (current-buffer))
3663 (disp-msg wl-summary-buffer-disp-msg)
3664 (number (wl-summary-message-number))
3665 (regexp "\\(<[^<>]*>\\)[ \t]*$")
3667 msg-id msg-num ref-list ref irt)
3669 (message "No message.")
3670 (when (eq wl-summary-buffer-view 'thread)
3671 (cond ((and arg (not (numberp arg)))
3673 (wl-thread-entity-get-number
3674 (wl-thread-entity-get-top-entity
3675 (wl-thread-get-entity number)))))
3676 ((and arg (numberp arg))
3678 (setq msg-num number)
3681 (wl-thread-entity-get-number
3682 (wl-thread-entity-get-parent-entity
3683 (wl-thread-get-entity msg-num))))
3686 (wl-thread-entity-get-number
3687 (wl-thread-entity-get-parent-entity
3688 (wl-thread-get-entity number)))))))
3689 (when (null msg-num)
3690 (wl-summary-set-message-buffer-or-redisplay)
3691 (set-buffer (wl-message-get-original-buffer))
3692 (message "Searching parent message...")
3693 (setq ref (std11-field-body "References")
3694 irt (std11-field-body "In-Reply-To"))
3696 ((and arg (not (numberp arg)) ref (not (string= ref ""))
3697 (string-match regexp ref))
3698 ;; The first message of the thread.
3699 (setq msg-id (wl-match-string 1 ref)))
3700 ;; "In-Reply-To:" has only one msg-id.
3701 ((and (null arg) irt (not (string= irt ""))
3702 (string-match regexp irt))
3703 (setq msg-id (wl-match-string 1 irt)))
3704 ((and (or (null arg) (numberp arg)) ref (not (string= ref ""))
3705 (string-match regexp ref))
3706 ;; "^" searching parent, "C-u 2 ^" looking for grandparent.
3707 (while (string-match regexp ref)
3710 (wl-match-string 1 ref))
3712 (setq ref (substring ref (match-end 0)))
3715 (if (null arg) (nth 0 ref-list) ;; previous
3716 (if (<= arg i) (nth (1- arg) ref-list)
3717 (nth i ref-list))))))
3718 (set-buffer cur-buf)
3719 (or disp-msg (wl-summary-toggle-disp-msg 'off)))
3720 (cond ((and (null msg-id) (null msg-num))
3721 (message "No parent message!")
3723 ((and msg-id (wl-summary-jump-to-msg-by-message-id msg-id))
3724 (if wl-summary-buffer-disp-msg (wl-summary-redisplay))
3725 (message "Searching parent message...done")
3727 ((and msg-num (wl-summary-jump-to-msg msg-num))
3728 (if wl-summary-buffer-disp-msg (wl-summary-redisplay))
3729 (message "Searching parent message...done")
3732 (message "Parent message was not found.")
3735 (defun wl-summary-reply (&optional arg without-setup-hook)
3736 "Reply to current message. Default is \"wide\" reply.
3737 Reply to author if invoked with ARG."
3739 (let ((folder wl-summary-buffer-elmo-folder)
3740 (number (wl-summary-message-number))
3741 (summary-buf (current-buffer))
3742 (winconf (current-window-configuration))
3746 (wl-summary-redisplay-internal folder number))
3747 (setq mes-buf wl-message-buffer)
3748 (wl-message-select-buffer wl-message-buffer)
3749 (set-buffer mes-buf)
3750 (goto-char (point-min))
3752 (when (setq mes-buf (wl-message-get-original-buffer))
3753 (wl-draft-reply mes-buf arg summary-buf number)
3754 (wl-draft-reply-position wl-draft-reply-default-position)
3755 (unless without-setup-hook
3756 (run-hooks 'wl-mail-setup-hook)))
3757 (error (set-window-configuration winconf)
3758 (signal (car err)(cdr err))))
3759 (with-current-buffer summary-buf
3760 (elmo-folder-mark-as-answered folder (list number))
3761 (wl-summary-update-persistent-mark))
3764 (defun wl-summary-write ()
3765 "Write a new draft from Summary."
3767 (wl-draft (list (cons 'To ""))
3768 nil nil nil nil (wl-summary-buffer-folder-name))
3769 (run-hooks 'wl-mail-setup-hook)
3770 (mail-position-on-field "To"))
3772 (defvar wl-summary-write-current-folder-functions
3773 '(wl-folder-get-newsgroups
3774 wl-folder-guess-mailing-list-by-refile-rule
3775 wl-folder-guess-mailing-list-by-folder-name)
3776 "Newsgroups or Mailing List address guess functions list.
3777 Call from `wl-summary-write-current-folder'.
3778 When guess function return nil, challenge next guess-function.")
3780 (defun wl-summary-write-current-folder (&optional folder)
3781 "Write message to current FOLDER's newsgroup or mailing-list.
3782 Use function list is `wl-summary-write-current-folder-functions'."
3784 ;; default FOLDER is current buffer folder
3785 (setq folder (or folder (wl-summary-buffer-folder-name)))
3786 (let ((func-list wl-summary-write-current-folder-functions)
3787 guess-list guess-func)
3789 (setq guess-list (funcall (car func-list) folder))
3790 (if (null guess-list)
3791 (setq func-list (cdr func-list))
3792 (setq guess-func (car func-list))
3793 (setq func-list nil)))
3794 (if (null guess-func)
3796 (unless (or (stringp (nth 0 guess-list))
3797 (stringp (nth 1 guess-list))
3798 (stringp (nth 2 guess-list)))
3799 (error "Invalid value return guess function `%s'"
3800 (symbol-name guess-func)))
3801 (wl-draft (list (cons 'To (nth 0 guess-list))
3802 (cons 'Cc (nth 1 guess-list))
3803 (cons 'Newsgroups (nth 2 guess-list)))
3804 nil nil nil nil folder)
3805 (run-hooks 'wl-mail-setup-hook)
3806 (mail-position-on-field "Subject"))))
3808 (defun wl-summary-forward (&optional without-setup-hook)
3811 (let ((folder wl-summary-buffer-elmo-folder)
3812 (number (wl-summary-message-number))
3813 (summary-buf (current-buffer))
3814 (wl-draft-forward t)
3818 (message "No message.")
3819 (if (and (elmo-message-use-cache-p folder number)
3820 (eq (elmo-file-cache-status
3821 (elmo-file-cache-get
3822 (elmo-message-field folder number 'message-id)))
3825 (wl-summary-redisplay-internal nil nil 'force-reload)
3826 (wl-summary-redisplay-internal folder number))
3827 (setq mes-buf wl-message-buffer)
3828 (wl-message-select-buffer mes-buf)
3829 ;; get original subject.
3832 (set-buffer summary-buf)
3834 (or (elmo-message-field folder number 'subject) ""))))
3835 (set-buffer mes-buf)
3836 (wl-draft-forward subject summary-buf)
3837 (unless without-setup-hook
3838 (run-hooks 'wl-mail-setup-hook)))))
3840 (defun wl-summary-click (e)
3845 (defun wl-summary-read ()
3846 "Proceed reading message in the summary buffer."
3848 (let ((cur-buf (current-buffer)))
3849 (wl-summary-toggle-disp-msg 'on)
3850 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3851 (set-buffer cur-buf)
3852 (if (wl-message-next-page)
3853 (wl-summary-down t)))))
3855 (defsubst wl-summary-cursor-move-surface (downward interactive)
3856 (if wl-summary-move-direction-toggle
3857 (setq wl-summary-move-direction-downward downward))
3858 (let ((start (point))
3859 (skip-tmark-regexp (wl-regexp-opt wl-summary-skip-mark-list))
3861 (column (current-column))
3862 skip-pmark-regexp goto-next next-entity finfo)
3863 (if (elmo-folder-plugged-p wl-summary-buffer-elmo-folder)
3865 (setq skip-pmark-regexp
3866 (wl-regexp-opt (list " "
3867 elmo-msgdb-unread-cached-mark
3868 elmo-msgdb-important-mark))))
3871 (not (if downward (eobp) (bobp))))
3875 (setq skip (or (string-match skip-tmark-regexp
3877 (wl-summary-temp-mark)))
3878 (and skip-pmark-regexp
3882 (wl-summary-persistent-mark))))))))
3883 (if (if downward (eobp) (and (bobp) skip)) (setq goto-next t))
3884 (if (or (eobp) (and (bobp) skip))
3886 (move-to-column column)
3889 (if wl-summary-buffer-disp-msg
3890 (wl-summary-redisplay))
3893 ((and (not downward) wl-summary-buffer-prev-folder-function)
3894 (funcall wl-summary-buffer-prev-folder-function))
3895 ((and downward wl-summary-buffer-next-folder-function)
3896 (funcall wl-summary-buffer-next-folder-function))
3898 (when wl-auto-select-next
3901 (wl-summary-get-next-folder)
3902 (wl-summary-get-prev-folder)))
3904 (setq finfo (wl-folder-get-entity-info next-entity))))
3906 '(lambda () (wl-summary-next-folder-or-exit next-entity))
3908 "No more messages. Type SPC to go to %s."
3909 (wl-summary-entity-info-msg next-entity finfo)))))))))
3911 (defun wl-summary-prev (&optional interactive)
3913 (wl-summary-cursor-move-surface nil (or interactive (interactive-p))))
3915 (defun wl-summary-next (&optional interactive)
3917 (wl-summary-cursor-move-surface t (or interactive (interactive-p))))
3919 (defun wl-summary-up (&optional interactive skip-no-unread)
3922 (if wl-summary-move-direction-toggle
3923 (setq wl-summary-move-direction-downward nil))
3924 (if (wl-summary-cursor-up)
3925 (if wl-summary-buffer-disp-msg
3926 (wl-summary-redisplay))
3929 (if wl-summary-buffer-prev-folder-function
3930 (funcall wl-summary-buffer-prev-folder-function)
3931 (let (next-entity finfo)
3932 (when wl-auto-select-next
3934 (setq next-entity (wl-summary-get-prev-unread-folder))
3936 (setq finfo (wl-folder-get-entity-info next-entity)))))
3937 (if (and skip-no-unread
3938 (eq wl-auto-select-next 'skip-no-unread))
3939 (wl-summary-next-folder-or-exit next-entity t)
3941 '(lambda () (wl-summary-next-folder-or-exit next-entity t))
3943 "No more unread messages. Type SPC to go to %s."
3944 (wl-summary-entity-info-msg next-entity finfo)))))))))
3946 (defun wl-summary-get-prev-folder ()
3947 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3950 (setq cur-id (save-excursion (set-buffer folder-buf)
3951 wl-folder-buffer-cur-entity-id))
3952 (wl-folder-get-prev-folder cur-id))))
3954 (defun wl-summary-get-next-folder ()
3955 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3958 (setq cur-id (save-excursion (set-buffer folder-buf)
3959 wl-folder-buffer-cur-entity-id))
3960 (wl-folder-get-next-folder cur-id))))
3962 (defun wl-summary-get-next-unread-folder ()
3963 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3966 (setq cur-id (save-excursion (set-buffer folder-buf)
3967 wl-folder-buffer-cur-entity-id))
3968 (wl-folder-get-next-folder cur-id 'unread))))
3970 (defun wl-summary-get-prev-unread-folder ()
3971 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3974 (setq cur-id (save-excursion (set-buffer folder-buf)
3975 wl-folder-buffer-cur-entity-id))
3976 (wl-folder-get-prev-folder cur-id 'unread))))
3978 (defun wl-summary-down (&optional interactive skip-no-unread)
3980 (if wl-summary-move-direction-toggle
3981 (setq wl-summary-move-direction-downward t))
3982 (if (wl-summary-cursor-down)
3983 (if wl-summary-buffer-disp-msg
3984 (wl-summary-redisplay))
3987 (if wl-summary-buffer-next-folder-function
3988 (funcall wl-summary-buffer-next-folder-function)
3989 (let (next-entity finfo)
3990 (when wl-auto-select-next
3991 (setq next-entity (wl-summary-get-next-unread-folder)))
3993 (setq finfo (wl-folder-get-entity-info next-entity)))
3994 (if (and skip-no-unread
3995 (eq wl-auto-select-next 'skip-no-unread))
3996 (wl-summary-next-folder-or-exit next-entity)
3998 '(lambda () (wl-summary-next-folder-or-exit next-entity))
4000 "No more unread messages. Type SPC to go to %s."
4001 (wl-summary-entity-info-msg next-entity finfo)))))))))
4003 (defun wl-summary-goto-last-displayed-msg ()
4005 (unless wl-summary-buffer-last-displayed-msg
4006 (setq wl-summary-buffer-last-displayed-msg
4007 wl-summary-buffer-current-msg))
4008 (if wl-summary-buffer-last-displayed-msg
4010 (wl-summary-jump-to-msg wl-summary-buffer-last-displayed-msg)
4011 (if wl-summary-buffer-disp-msg
4012 (wl-summary-redisplay)))
4013 (message "No last message.")))
4015 (defun wl-summary-redisplay (&optional arg)
4018 (wl-summary-no-mime-p wl-summary-buffer-elmo-folder))
4019 (wl-summary-redisplay-no-mime)
4020 (wl-summary-redisplay-internal nil nil arg)))
4022 (defsubst wl-summary-redisplay-internal (&optional folder number force-reload)
4024 (let* ((folder (or folder wl-summary-buffer-elmo-folder))
4025 (num (or number (wl-summary-message-number)))
4026 (wl-mime-charset wl-summary-buffer-mime-charset)
4027 (default-mime-charset wl-summary-buffer-mime-charset)
4028 no-folder-mark fld-buf fld-win thr-entity)
4029 (if (and wl-thread-open-reading-thread
4030 (eq wl-summary-buffer-view 'thread)
4031 (not (wl-thread-entity-get-opened
4032 (setq thr-entity (wl-thread-get-entity
4034 (wl-thread-entity-get-children thr-entity))
4035 (wl-thread-force-open))
4038 (setq wl-summary-buffer-disp-msg t)
4039 (setq wl-summary-buffer-last-displayed-msg
4040 wl-summary-buffer-current-msg)
4041 ;; hide folder window
4042 (if (and (not wl-stay-folder-window)
4043 (setq fld-buf (get-buffer wl-folder-buffer-name)))
4044 (if (setq fld-win (get-buffer-window fld-buf))
4045 (delete-window fld-win)))
4046 (setq wl-current-summary-buffer (current-buffer))
4047 (setq no-folder-mark
4048 ;; If cache is used, change folder-mark.
4049 (if (wl-message-redisplay folder num
4053 (string= (elmo-folder-name-internal
4057 ;; plugged, then leave folder-mark.
4058 (if (and (not (elmo-folder-local-p
4059 wl-summary-buffer-elmo-folder))
4060 (elmo-folder-plugged-p
4061 wl-summary-buffer-elmo-folder))
4063 (when (elmo-message-use-cache-p folder num)
4064 (elmo-message-set-cached folder num t))
4066 (if (member (elmo-message-mark wl-summary-buffer-elmo-folder
4068 (elmo-msgdb-unread-marks))
4069 (wl-summary-mark-as-read num no-folder-mark)
4070 (wl-summary-update-persistent-mark)))
4071 (setq wl-summary-buffer-current-msg num)
4072 (when wl-summary-recenter
4073 (recenter (/ (- (window-height) 2) 2))
4074 (if (not wl-summary-indent-length-limit)
4075 (wl-horizontal-recenter)))
4076 (wl-highlight-summary-displaying)
4077 (wl-message-buffer-prefetch-next folder num
4078 wl-message-buffer-prefetch-depth
4080 wl-summary-buffer-mime-charset)
4081 (run-hooks 'wl-summary-redisplay-hook))
4082 (message "No message to display."))))
4084 (defun wl-summary-redisplay-no-mime (&optional ask-coding)
4085 "Display message without MIME decoding.
4086 If ASK-CODING is non-nil, coding-system for the message is asked."
4088 (let ((elmo-mime-display-as-is-coding-system
4090 (or (read-coding-system "Coding system: ")
4091 elmo-mime-display-as-is-coding-system)
4092 elmo-mime-display-as-is-coding-system)))
4093 (wl-summary-redisplay-no-mime-internal)))
4095 (defun wl-summary-redisplay-no-mime-internal (&optional folder number)
4096 (let* ((fld (or folder wl-summary-buffer-elmo-folder))
4097 (num (or number (wl-summary-message-number)))
4101 (setq wl-summary-buffer-disp-msg t)
4102 (setq wl-summary-buffer-last-displayed-msg
4103 wl-summary-buffer-current-msg)
4104 (setq wl-current-summary-buffer (current-buffer))
4105 (wl-message-redisplay fld num 'as-is
4106 (string= (elmo-folder-name-internal fld)
4109 (if (member (elmo-message-mark fld num)
4110 (elmo-msgdb-unread-marks))
4111 (wl-summary-mark-as-read num); no-folder-mark)
4112 (wl-summary-update-persistent-mark)))
4113 (setq wl-summary-buffer-current-msg num)
4114 (when wl-summary-recenter
4115 (recenter (/ (- (window-height) 2) 2))
4116 (if (not wl-summary-indent-length-limit)
4117 (wl-horizontal-recenter)))
4118 (wl-highlight-summary-displaying)
4119 (run-hooks 'wl-summary-redisplay-hook))
4120 (message "No message to display.")
4121 (wl-ask-folder 'wl-summary-exit
4122 "No more messages. Type SPC to go to folder mode."))))
4124 (defun wl-summary-redisplay-all-header (&optional folder number)
4126 (let* ((fld (or folder wl-summary-buffer-elmo-folder))
4127 (num (or number (wl-summary-message-number)))
4128 (wl-mime-charset wl-summary-buffer-mime-charset)
4129 (default-mime-charset wl-summary-buffer-mime-charset))
4132 (setq wl-summary-buffer-disp-msg t)
4133 (setq wl-summary-buffer-last-displayed-msg
4134 wl-summary-buffer-current-msg)
4135 (setq wl-current-summary-buffer (current-buffer))
4136 (if (wl-message-redisplay fld num 'all-header
4137 (string= (elmo-folder-name-internal fld)
4139 (wl-summary-mark-as-read num))
4140 (setq wl-summary-buffer-current-msg num)
4141 (when wl-summary-recenter
4142 (recenter (/ (- (window-height) 2) 2))
4143 (if (not wl-summary-indent-length-limit)
4144 (wl-horizontal-recenter)))
4145 (wl-highlight-summary-displaying)
4146 (run-hooks 'wl-summary-redisplay-hook))
4147 (message "No message to display."))))
4149 (defun wl-summary-jump-to-current-message ()
4150 "Jump into Message buffer."
4152 (let (message-buf message-win)
4153 (if (setq message-buf wl-message-buffer)
4154 (if (setq message-win (get-buffer-window message-buf))
4155 (select-window message-win)
4156 (wl-message-select-buffer wl-message-buffer))
4157 (wl-summary-redisplay)
4158 (wl-message-select-buffer wl-message-buffer))))
4160 (defun wl-summary-cancel-message ()
4161 "Cancel an article on news."
4163 (if (null (wl-summary-message-number))
4164 (message "No message.")
4165 (let ((summary-buf (current-buffer))
4167 (wl-summary-set-message-buffer-or-redisplay)
4168 (if (setq message-buf (wl-message-get-original-buffer))
4169 (set-buffer message-buf))
4170 (unless (wl-message-news-p)
4171 (set-buffer summary-buf)
4172 (if (and (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
4174 (y-or-n-p "Cannot get Newsgroups. Fetch again? "))
4176 (wl-summary-redisplay t)
4177 (wl-summary-supersedes-message))
4178 (error "This is not a news article; supersedes is impossible")))
4179 (when (yes-or-no-p "Do you really want to cancel this article? ")
4180 (let (from newsgroups message-id distribution buf)
4182 (setq from (std11-field-body "from")
4183 newsgroups (std11-field-body "newsgroups")
4184 message-id (std11-field-body "message-id")
4185 distribution (std11-field-body "distribution"))
4186 ;; Make sure that this article was written by the user.
4187 (unless (wl-address-user-mail-address-p
4188 (wl-address-header-extract-address
4189 (car (wl-parse-addresses from))))
4190 (error "This article is not yours"))
4191 ;; Make control message.
4192 (setq buf (set-buffer (get-buffer-create " *message cancel*")))
4193 (setq wl-draft-buffer-cur-summary-buffer summary-buf)
4194 (buffer-disable-undo (current-buffer))
4196 (insert "Newsgroups: " newsgroups "\n"
4197 "From: " (wl-address-header-extract-address
4199 "Subject: cmsg cancel " message-id "\n"
4200 "Control: cancel " message-id "\n"
4202 (concat "Distribution: " distribution "\n")
4204 mail-header-separator "\n"
4205 wl-summary-cancel-message)
4206 (message "Canceling your message...")
4207 (wl-draft-raw-send t t) ; kill when done, force-pre-hooks.
4208 (message "Canceling your message...done")))))))
4210 (defun wl-summary-supersedes-message ()
4211 "Supersede current message."
4213 (wl-summary-toggle-disp-msg 'off)
4214 (let ((summary-buf (current-buffer))
4216 (wl-summary-set-message-buffer-or-redisplay)
4217 (if (setq message-buf (wl-message-get-original-buffer))
4218 (set-buffer message-buf))
4219 (unless (wl-message-news-p)
4220 (set-buffer summary-buf)
4221 (if (and (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
4223 (y-or-n-p "Cannot get Newsgroups. Fetch again? "))
4225 (wl-summary-redisplay t)
4226 (wl-summary-supersedes-message))
4227 (error "This is not a news article; supersedes is impossible")))
4229 (setq from (std11-field-body "from"))
4230 ;; Make sure that this article was written by the user.
4231 (unless (wl-address-user-mail-address-p
4232 (wl-address-header-extract-address
4233 (car (wl-parse-addresses from))))
4234 (error "This article is not yours"))
4235 (let* ((message-id (std11-field-body "message-id"))
4236 (followup-to (std11-field-body "followup-to"))
4237 (mail-default-headers
4238 (concat mail-default-headers
4239 "Supersedes: " message-id "\n"
4241 (concat "Followup-To: " followup-to "\n")))))
4242 (if message-buf (set-buffer message-buf))
4243 (wl-draft-edit-string (buffer-substring (point-min) (point-max)))))))
4245 (defun wl-summary-save (&optional arg wl-save-dir)
4246 "Save current message to disk."
4249 (num (wl-summary-message-number)))
4250 (if (null wl-save-dir)
4251 (setq wl-save-dir wl-temporary-file-directory))
4254 (setq filename (expand-file-name
4258 (null (file-exists-p filename))))
4260 (read-file-name "Save to file: " filename)))
4262 (wl-summary-set-message-buffer-or-redisplay)
4263 (set-buffer (wl-message-get-original-buffer))
4264 (if (and (null arg) (file-exists-p filename))
4265 (if (y-or-n-p "File already exists. override it? ")
4266 (write-region (point-min) (point-max) filename))
4267 (write-region (point-min) (point-max) filename)))
4268 (message "No message to save."))
4271 (defun wl-summary-save-region (beg end)
4275 (narrow-to-region beg end)
4276 (goto-char (point-min))
4278 (wl-read-directory-name "Save to directory: "
4279 wl-temporary-file-directory)))
4280 (if (null (file-exists-p wl-save-dir))
4281 (make-directory wl-save-dir))
4282 (if (eq wl-summary-buffer-view 'thread)
4285 (let* ((number (wl-summary-message-number))
4286 (entity (wl-thread-get-entity number)))
4287 (if (wl-thread-entity-get-opened entity)
4288 (wl-summary-save t wl-save-dir)
4290 (wl-summary-save t wl-save-dir))
4293 (wl-summary-save t wl-save-dir)
4294 (forward-line 1)))))))
4296 ;; mew-summary-pipe-message()
4297 (defun wl-summary-pipe-message (prefix command)
4298 "Send this message via pipe."
4299 (interactive (list current-prefix-arg nil))
4300 (if (null (wl-summary-message-number))
4301 (message "No message.")
4302 (setq command (read-string "Shell command on message: "
4303 wl-summary-shell-command-last))
4304 (if (y-or-n-p "Send this message to pipe? ")
4305 (wl-summary-pipe-message-subr prefix command))))
4307 (defun wl-summary-target-mark-pipe (prefix command)
4308 "Send each marked messages via pipe."
4309 (interactive (list current-prefix-arg nil))
4310 (if (null wl-summary-buffer-target-mark-list)
4311 (message "No marked message.")
4312 (setq command (read-string "Shell command on each marked message: "
4313 wl-summary-shell-command-last))
4314 (when (y-or-n-p "Send each marked message to pipe? ")
4315 (while (car wl-summary-buffer-target-mark-list)
4316 (let ((num (car wl-summary-buffer-target-mark-list)))
4317 (wl-thread-jump-to-msg num)
4318 (wl-summary-pipe-message-subr prefix command)
4319 (wl-summary-unmark))))))
4321 (defun wl-summary-pipe-message-subr (prefix command)
4323 (wl-summary-set-message-buffer-or-redisplay)
4324 (set-buffer (wl-message-get-original-buffer))
4325 (if (string= command "")
4326 (setq command wl-summary-shell-command-last))
4327 (goto-char (point-min)) ; perhaps this line won't be necessary
4329 (search-forward "\n\n"))
4330 (shell-command-on-region (point) (point-max) command nil)
4331 (setq wl-summary-shell-command-last command)))
4333 (defun wl-summary-print-message (&optional arg)
4335 (if (null (wl-summary-message-number))
4336 (message "No message.")
4338 (wl-summary-set-message-buffer-or-redisplay)
4339 (if (or (not (interactive-p))
4340 (y-or-n-p "Print ok? "))
4342 (let ((buffer (generate-new-buffer " *print*")))
4343 (copy-to-buffer buffer (point-min) (point-max))
4345 (funcall wl-print-buffer-function)
4346 (kill-buffer buffer)))
4349 (defun wl-summary-print-message-with-ps-print (&optional filename)
4350 "Print message via ps-print."
4352 (if (null (wl-summary-message-number))
4353 (message "No message.")
4354 (setq filename (ps-print-preprint current-prefix-arg))
4355 (if (or (not (interactive-p))
4356 (y-or-n-p "Print ok? "))
4357 (let ((summary-buffer (current-buffer))
4360 (wl-summary-set-message-buffer-or-redisplay)
4361 ;; (wl-summary-redisplay-internal)
4362 (let* ((buffer (generate-new-buffer " *print*"))
4364 (set-buffer summary-buffer)
4365 (elmo-message-entity
4366 wl-summary-buffer-elmo-folder
4367 (wl-summary-message-number))))
4370 (or (elmo-msgdb-overview-entity-get-subject entity)
4374 (or (elmo-msgdb-overview-entity-get-from entity) "")))
4377 (or (elmo-msgdb-overview-entity-get-date entity) ""))))
4378 (run-hooks 'wl-ps-preprint-hook)
4379 (set-buffer wl-message-buffer)
4380 (copy-to-buffer buffer (point-min) (point-max))
4383 (let ((ps-left-header
4384 (list (concat "(" wl-ps-subject ")")
4385 (concat "(" wl-ps-from ")")))
4387 (list "/pagenumberstring load"
4388 (concat "(" wl-ps-date ")"))))
4389 (run-hooks 'wl-ps-print-hook)
4390 (funcall wl-ps-print-buffer-function filename))
4391 (kill-buffer buffer)))))
4394 (if (featurep 'ps-print) ; ps-print is available.
4395 (fset 'wl-summary-print-message 'wl-summary-print-message-with-ps-print))
4397 (defun wl-summary-target-mark-print ()
4399 (if (null wl-summary-buffer-target-mark-list)
4400 (message "No marked message.")
4401 (when (y-or-n-p "Print all marked messages. OK? ")
4402 (while (car wl-summary-buffer-target-mark-list)
4403 (let ((num (car wl-summary-buffer-target-mark-list)))
4404 (wl-thread-jump-to-msg num)
4405 (wl-summary-print-message)
4406 (wl-summary-unmark))))))
4408 (defun wl-summary-folder-info-update ()
4409 (wl-folder-set-folder-updated
4410 (elmo-string (wl-summary-buffer-folder-name))
4412 (+ wl-summary-buffer-unread-count
4413 wl-summary-buffer-new-count)
4415 wl-summary-buffer-elmo-folder))))
4417 (defun wl-summary-get-original-buffer ()
4418 "Get original buffer for the current summary."
4420 (wl-summary-set-message-buffer-or-redisplay)
4421 (wl-message-get-original-buffer)))
4423 (defun wl-summary-pack-number (&optional arg)
4425 (elmo-folder-pack-numbers wl-summary-buffer-elmo-folder)
4426 (let (wl-use-scoring)
4427 (wl-summary-rescan)))
4429 (defun wl-summary-target-mark-uudecode ()
4431 (let ((mlist (reverse wl-summary-buffer-target-mark-list))
4432 (summary-buf (current-buffer))
4433 (tmp-buf (get-buffer-create "*WL UUENCODE*"))
4434 orig-buf i k filename rc errmsg)
4436 (setq k (length mlist))
4437 (set-buffer tmp-buf)
4439 (save-window-excursion
4441 (set-buffer summary-buf)
4442 (wl-summary-jump-to-msg (car mlist))
4443 (wl-summary-redisplay)
4444 (set-buffer (setq orig-buf (wl-summary-get-original-buffer)))
4445 (goto-char (point-min))
4446 (cond ((= i 1) ; first
4447 (if (setq filename (wl-message-uu-substring
4451 (error "Can't find begin line")))
4453 (wl-message-uu-substring orig-buf tmp-buf))
4455 (wl-message-uu-substring orig-buf tmp-buf nil t)))
4457 (setq mlist (cdr mlist)))
4458 (set-buffer tmp-buf)
4459 (message "Exec %s..." wl-prog-uudecode)
4461 (let ((decode-dir wl-temporary-file-directory))
4462 (if (not wl-prog-uudecode-no-stdout-option)
4463 (setq filename (read-file-name "Save to file: "
4465 (elmo-safe-filename filename)
4466 wl-temporary-file-directory)))
4468 (wl-read-directory-name "Save to directory: "
4469 wl-temporary-file-directory))
4470 (setq filename (expand-file-name filename decode-dir)))
4471 (if (file-exists-p filename)
4472 (or (yes-or-no-p (format "File %s exists. Save anyway? "
4475 (elmo-bind-directory
4479 (apply 'call-process-region (point-min) (point-max)
4480 wl-prog-uudecode t (current-buffer) nil
4481 wl-prog-uudecode-arg))))
4482 (when (not (= 0 rc))
4483 (setq errmsg (buffer-substring (point-min)(point-max)))
4484 (error "Uudecode error: %s" errmsg))
4485 (if (not wl-prog-uudecode-no-stdout-option)
4486 (let (file-name-handler-alist) ;; void jka-compr
4487 (as-binary-output-file
4488 (write-region (point-min) (point-max)
4489 filename nil 'no-msg))))
4491 (set-buffer summary-buf)
4492 (wl-summary-delete-all-temp-marks))
4493 (if (file-exists-p filename)
4494 (message "Saved as %s" filename)))
4495 (kill-buffer tmp-buf)))))
4498 ;; (defun wl-summary-drop-unsync ()
4499 ;; "Drop all unsync messages."
4501 ;; (if (elmo-folder-pipe-p (wl-summary-buffer-folder-name))
4502 ;; (error "You cannot drop unsync messages in this folder"))
4503 ;; (if (or (not (interactive-p))
4504 ;; (y-or-n-p "Drop all unsync messages? "))
4505 ;; (let* ((folder-list (elmo-folder-get-primitive-folder-list
4506 ;; (wl-summary-buffer-folder-name)))
4507 ;; (is-multi (elmo-multi-p (wl-summary-buffer-folder-name)))
4511 ;; (message "Dropping...")
4512 ;; (while folder-list
4513 ;; (setq pair (elmo-folder-message-numbers (car folder-list)))
4514 ;; (when is-multi ;; dirty hack...
4516 ;; (setcar pair (+ (* multi-num elmo-multi-divide-number)
4518 ;; (elmo-msgdb-set-number-alist
4519 ;; (wl-summary-buffer-msgdb)
4521 ;; (elmo-msgdb-get-number-alist (wl-summary-buffer-msgdb))
4522 ;; (list (cons (car pair) nil))))
4523 ;; (setq sum (+ sum (cdr pair)))
4524 ;; (setq folder-list (cdr folder-list)))
4525 ;; (wl-summary-set-message-modified)
4526 ;; (wl-folder-set-folder-updated (wl-summary-buffer-folder-name)
4528 ;; (+ wl-summary-buffer-unread-count
4529 ;; wl-summary-buffer-new-count)
4531 ;; (message "Dropping...done"))))
4533 (defun wl-summary-default-get-next-msg (msg)
4534 (or (wl-summary-next-message msg
4535 (if wl-summary-move-direction-downward 'down
4538 (cadr (memq msg (if wl-summary-move-direction-downward
4539 wl-summary-buffer-number-list
4540 (reverse wl-summary-buffer-number-list))))))
4542 (defun wl-summary-save-current-message ()
4543 "Save current message for `wl-summary-yank-saved-message'."
4545 (let ((number (wl-summary-message-number)))
4546 (setq wl-summary-buffer-saved-message number)
4547 (and number (message "No: %s is saved." number))))
4549 (defun wl-summary-yank-saved-message ()
4550 "Set current message as a parent of the saved message."
4552 (if wl-summary-buffer-saved-message
4553 (let ((number (wl-summary-message-number)))
4554 (if (eq wl-summary-buffer-saved-message number)
4555 (message "Cannot set itself as a parent.")
4557 (wl-thread-jump-to-msg wl-summary-buffer-saved-message)
4558 (wl-thread-set-parent number)
4559 (wl-summary-set-thread-modified))
4560 (setq wl-summary-buffer-saved-message nil)))
4561 (message "There's no saved message.")))
4564 (product-provide (provide 'wl-summary) (require 'wl-version))
4566 ;;; wl-summary.el ends here