1 ;;; wl-summary.el --- Summary mode for Wanderlust.
3 ;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
4 ;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
5 ;; Copyright (C) 1999,2000 TSUMURA Tomoaki <tsumura@kuis.kyoto-u.ac.jp>
6 ;; Copyright (C) 1999,2000 Kenichi OKADA <okada@opaopa.org>
8 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
9 ;; Masahiro MURATA <muse@ba2.so-net.ne.jp>
10 ;; TSUMURA Tomoaki <tsumura@kuis.kyoto-u.ac.jp>
11 ;; Kenichi OKADA <okada@opaopa.org>
12 ;; Keywords: mail, net news
14 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
16 ;; This program is free software; you can redistribute it and/or modify
17 ;; it under the terms of the GNU General Public License as published by
18 ;; the Free Software Foundation; either version 2, or (at your option)
21 ;; This program is distributed in the hope that it will be useful,
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;; GNU General Public License for more details.
26 ;; You should have received a copy of the GNU General Public License
27 ;; along with GNU Emacs; see the file COPYING. If not, write to the
28 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
29 ;; Boston, MA 02111-1307, USA.
42 (require 'wl-highlight)
45 (condition-case nil (require 'timezone) (error nil))
46 (condition-case nil (require 'easymenu) (error nil))
48 (condition-case nil (require 'ps-print) (error nil))
52 (condition-case () (require 'timer) (error nil))
53 (defalias-maybe 'ps-print-buffer-with-faces 'ignore)
54 (defalias-maybe 'elmo-database-msgid-put 'ignore)
55 (defalias-maybe 'elmo-database-close 'ignore)
56 (defalias-maybe 'elmo-database-msgid-get 'ignore)
57 (defalias-maybe 'run-with-idle-timer 'ignore)
58 (defalias-maybe 'ps-print-preprint 'ignore))
60 (defvar dragdrop-drop-functions)
61 (defvar scrollbar-height)
62 (defvar mail-reply-buffer)
64 (defvar wl-summary-buffer-name "Summary")
65 (defvar wl-summary-mode-map nil)
66 (defvar wl-current-summary-buffer nil)
68 (defvar wl-summary-buffer-elmo-folder nil)
70 (defmacro wl-summary-buffer-folder-name ()
71 (` (and wl-summary-buffer-elmo-folder
72 (elmo-folder-name-internal wl-summary-buffer-elmo-folder))))
74 (defvar wl-summary-buffer-disp-msg nil)
75 (defvar wl-summary-buffer-disp-folder nil)
76 (defvar wl-summary-buffer-temp-mark-list nil)
77 (defvar wl-summary-buffer-last-displayed-msg nil)
78 (defvar wl-summary-buffer-current-msg nil)
79 (defvar wl-summary-buffer-unread-count 0)
80 (defvar wl-summary-buffer-new-count 0)
81 (defvar wl-summary-buffer-answered-count 0)
82 (defvar wl-summary-buffer-mime-charset nil)
83 (defvar wl-summary-buffer-weekday-name-lang nil)
84 (defvar wl-summary-buffer-thread-indent-set-alist nil)
85 (defvar wl-summary-buffer-view nil)
86 (defvar wl-summary-buffer-message-modified nil)
87 (defvar wl-summary-buffer-thread-modified nil)
89 (defvar wl-summary-buffer-number-column nil)
90 (defvar wl-summary-buffer-temp-mark-column nil)
91 (defvar wl-summary-buffer-persistent-mark-column nil)
93 (defvar wl-summary-buffer-persistent nil)
94 (defvar wl-summary-buffer-thread-nodes nil)
95 (defvar wl-summary-buffer-target-mark-list nil)
96 (defvar wl-summary-buffer-prev-refile-destination nil)
97 (defvar wl-summary-buffer-prev-copy-destination nil)
98 (defvar wl-summary-buffer-saved-message nil)
99 (defvar wl-summary-buffer-prev-folder-function nil)
100 (defvar wl-summary-buffer-next-folder-function nil)
101 (defvar wl-summary-buffer-exit-function nil)
102 (defvar wl-summary-buffer-next-message-function nil)
103 (defvar wl-summary-buffer-number-list nil)
104 (defvar wl-summary-buffer-folder-name nil)
105 (defvar wl-summary-buffer-line-formatter nil)
106 (defvar wl-summary-buffer-line-format nil)
107 (defvar wl-summary-buffer-mode-line-formatter nil)
108 (defvar wl-summary-buffer-mode-line nil)
110 (defvar wl-thread-indent-level-internal nil)
111 (defvar wl-thread-have-younger-brother-str-internal nil)
112 (defvar wl-thread-youngest-child-str-internal nil)
113 (defvar wl-thread-vertical-str-internal nil)
114 (defvar wl-thread-horizontal-str-internal nil)
115 (defvar wl-thread-space-str-internal nil)
116 (defvar wl-summary-last-visited-folder nil)
117 (defvar wl-read-folder-history nil)
118 (defvar wl-summary-scored nil)
119 (defvar wl-crosspost-alist-modified nil)
120 (defvar wl-summary-alike-hashtb nil)
121 (defvar wl-summary-search-buf-name " *wl-search-subject*")
122 (defvar wl-summary-delayed-update nil)
123 (defvar wl-summary-search-buf-folder-name nil)
125 (defvar wl-summary-get-petname-function 'wl-address-get-petname-1)
127 (defvar wl-summary-shell-command-last "")
129 (defvar wl-ps-preprint-hook nil)
130 (defvar wl-ps-print-hook nil)
132 (make-variable-buffer-local 'wl-summary-buffer-elmo-folder)
133 (make-variable-buffer-local 'wl-summary-search-buf-folder-name)
134 (make-variable-buffer-local 'wl-summary-buffer-disp-msg)
135 (make-variable-buffer-local 'wl-summary-buffer-disp-folder)
136 (make-variable-buffer-local 'wl-summary-buffer-target-mark-list)
137 (make-variable-buffer-local 'wl-summary-buffer-temp-mark-list)
138 (make-variable-buffer-local 'wl-summary-buffer-last-displayed-msg)
139 (make-variable-buffer-local 'wl-summary-buffer-unread-count)
140 (make-variable-buffer-local 'wl-summary-buffer-new-count)
141 (make-variable-buffer-local 'wl-summary-buffer-answered-count)
142 (make-variable-buffer-local 'wl-summary-buffer-mime-charset)
143 (make-variable-buffer-local 'wl-summary-buffer-weekday-name-lang)
144 (make-variable-buffer-local 'wl-summary-buffer-thread-indent-set)
145 (make-variable-buffer-local 'wl-summary-buffer-view)
146 (make-variable-buffer-local 'wl-summary-buffer-message-modified)
147 (make-variable-buffer-local 'wl-summary-buffer-thread-modified)
148 (make-variable-buffer-local 'wl-summary-buffer-number-column)
149 (make-variable-buffer-local 'wl-summary-buffer-temp-mark-column)
150 (make-variable-buffer-local 'wl-summary-buffer-persistent-mark-column)
151 (make-variable-buffer-local 'wl-summary-buffer-persistent)
152 (make-variable-buffer-local 'wl-summary-buffer-thread-nodes)
153 (make-variable-buffer-local 'wl-summary-buffer-prev-refile-destination)
154 (make-variable-buffer-local 'wl-summary-buffer-saved-message)
155 (make-variable-buffer-local 'wl-summary-scored)
156 (make-variable-buffer-local 'wl-summary-default-score)
157 (make-variable-buffer-local 'wl-summary-move-direction-downward)
158 (make-variable-buffer-local 'wl-summary-important-above)
159 (make-variable-buffer-local 'wl-summary-target-above)
160 (make-variable-buffer-local 'wl-summary-mark-below)
161 (make-variable-buffer-local 'wl-summary-expunge-below)
162 (make-variable-buffer-local 'wl-thread-indent-level-internal)
163 (make-variable-buffer-local 'wl-thread-have-younger-brother-str-internal)
164 (make-variable-buffer-local 'wl-thread-youngest-child-str-internal)
165 (make-variable-buffer-local 'wl-thread-vertical-str-internal)
166 (make-variable-buffer-local 'wl-thread-horizontal-str-internal)
167 (make-variable-buffer-local 'wl-thread-space-str-internal)
168 (make-variable-buffer-local 'wl-summary-buffer-prev-folder-function)
169 (make-variable-buffer-local 'wl-summary-buffer-next-folder-function)
170 (make-variable-buffer-local 'wl-summary-buffer-exit-function)
171 (make-variable-buffer-local 'wl-summary-buffer-next-message-function)
172 (make-variable-buffer-local 'wl-summary-buffer-number-list)
173 (make-variable-buffer-local 'wl-summary-buffer-folder-name)
174 (make-variable-buffer-local 'wl-summary-buffer-line-formatter)
175 (make-variable-buffer-local 'wl-summary-buffer-line-format)
176 (make-variable-buffer-local 'wl-summary-buffer-mode-line-formatter)
177 (make-variable-buffer-local 'wl-summary-buffer-mode-line)
180 (defvar wl-thr-indent-string)
181 (defvar wl-thr-children-number)
182 (defvar wl-thr-linked)
183 (defvar wl-message-entity)
184 (defvar wl-parent-message-entity)
185 (defvar wl-temp-mark)
186 (defvar wl-persistent-mark)
188 (defmacro wl-summary-sticky-buffer-name (name)
189 (` (concat wl-summary-buffer-name ":" (, name))))
191 (defun wl-summary-default-subject (subject-string)
192 (if (string-match "^[ \t]*\\[[^:]+[,: ][0-9]+\\][ \t]*" subject-string)
193 (substring subject-string (match-end 0))
196 (defun wl-summary-default-from (from)
197 "Instance of `wl-summary-from-function'.
198 Ordinarily returns the sender name. Returns recipient names if (1)
199 summary's folder name matches with `wl-summary-showto-folder-regexp'
200 and (2) sender address is yours.
202 See also variable `wl-use-petname'."
205 (and (eq major-mode 'wl-summary-mode)
206 (stringp wl-summary-showto-folder-regexp)
207 (string-match wl-summary-showto-folder-regexp
208 (wl-summary-buffer-folder-name))
209 (wl-address-user-mail-address-p from)
211 ((and (setq tos (elmo-message-entity-field
212 wl-message-entity 'to t))
213 (not (string= "" tos)))
223 wl-summary-get-petname-function to)
225 (std11-extract-address-components to))
228 (wl-parse-addresses tos)
230 ((setq ng (elmo-message-entity-field
231 wl-message-entity 'newsgroups))
232 (setq retval (concat "Ng:" ng)))))
234 (setq retval (or (funcall wl-summary-get-petname-function from)
235 (car (std11-extract-address-components from))
240 (defun wl-summary-simple-from (string)
242 (or (funcall wl-summary-get-petname-function string)
243 (car (std11-extract-address-components string))
247 (defvar wl-summary-sort-specs '(number date subject from list-info))
248 (defvar wl-summary-default-sort-spec 'date)
250 (defvar wl-summary-mode-menu-spec
252 ["Read" wl-summary-read t]
253 ["Prev page" wl-summary-prev-page t]
254 ["Next page" wl-summary-next-page t]
255 ["Top" wl-summary-display-top t]
256 ["Bottom" wl-summary-display-bottom t]
257 ["Prev" wl-summary-prev t]
258 ["Next" wl-summary-next t]
259 ["Up" wl-summary-up t]
260 ["Down" wl-summary-down t]
261 ["Parent message" wl-summary-jump-to-parent-message t]
263 ["Sync" wl-summary-sync t]
264 ["Execute" wl-summary-exec t]
265 ["Go to other folder" wl-summary-goto-folder t]
266 ["Pick" wl-summary-pick t]
267 ["Mark as read all" wl-summary-mark-as-read-all t]
268 ["Unmark all" wl-summary-unmark-all t]
269 ["Toggle display message" wl-summary-toggle-disp-msg t]
270 ["Display folder" wl-summary-toggle-disp-folder t]
271 ["Toggle threading" wl-summary-toggle-thread t]
272 ["Stick" wl-summary-stick t]
274 ["By Number" wl-summary-sort-by-number t]
275 ["By Date" wl-summary-sort-by-date t]
276 ["By From" wl-summary-sort-by-from t]
277 ["By Subject" wl-summary-sort-by-subject t]
278 ["By List Info" wl-summary-sort-by-list-info t])
281 ["Mark as read" wl-summary-mark-as-read t]
282 ["Mark as important" wl-summary-mark-as-important t]
283 ["Mark as unread" wl-summary-mark-as-unread t]
284 ["Set dispose mark" wl-summary-dispose t]
285 ["Set refile mark" wl-summary-refile t]
286 ["Set copy mark" wl-summary-copy t]
287 ["Set resend mark" wl-summary-resend t]
288 ["Prefetch" wl-summary-prefetch t]
289 ["Set target mark" wl-summary-target-mark t]
290 ["Unmark" wl-summary-unmark t]
291 ["Save" wl-summary-save t]
292 ["Cancel posted news" wl-summary-cancel-message t]
293 ["Supersedes message" wl-summary-supersedes-message t]
294 ["Resend bounced mail" wl-summary-resend-bounced-mail t]
295 ["Enter the message" wl-summary-jump-to-current-message t]
296 ["Pipe message" wl-summary-pipe-message t]
297 ["Print message" wl-summary-print-message t])
299 ["Open or Close" wl-thread-open-close (eq wl-summary-buffer-view 'thread)]
300 ["Open all" wl-thread-open-all (eq wl-summary-buffer-view 'thread)]
301 ["Close all" wl-thread-close-all (eq wl-summary-buffer-view 'thread)]
302 ["Mark as read" wl-thread-mark-as-read (eq wl-summary-buffer-view 'thread)]
303 ["Mark as important" wl-thread-mark-as-important (eq wl-summary-buffer-view 'thread)]
304 ["Mark as unread" wl-thread-mark-as-unread (eq wl-summary-buffer-view 'thread)]
305 ["Set delete mark" wl-thread-delete (eq wl-summary-buffer-view 'thread)]
306 ["Set refile mark" wl-thread-refile (eq wl-summary-buffer-view 'thread)]
307 ["Set copy mark" wl-thread-copy (eq wl-summary-buffer-view 'thread)]
308 ["Prefetch" wl-thread-prefetch (eq wl-summary-buffer-view 'thread)]
309 ["Set target mark" wl-thread-target-mark (eq wl-summary-buffer-view 'thread)]
310 ["Unmark" wl-thread-unmark (eq wl-summary-buffer-view 'thread)]
311 ["Save" wl-thread-save (eq wl-summary-buffer-view 'thread)]
312 ["Execute" wl-thread-exec (eq wl-summary-buffer-view 'thread)])
314 ["Mark as read" wl-summary-mark-as-read-region t]
315 ["Mark as important" wl-summary-mark-as-important-region t]
316 ["Mark as unread" wl-summary-mark-as-unread-region t]
317 ["Set dispose mark" wl-summary-dispose-region t]
318 ["Set refile mark" wl-summary-refile-region t]
319 ["Set copy mark" wl-summary-copy-region t]
320 ["Prefetch" wl-summary-prefetch-region t]
321 ["Set target mark" wl-summary-target-mark-region t]
322 ["Unmark" wl-summary-unmark-region t]
323 ["Save" wl-summary-save-region t]
324 ["Execute" wl-summary-exec-region t])
326 ["Mark as read" wl-summary-target-mark-mark-as-read t]
327 ["Mark as important" wl-summary-target-mark-mark-as-important t]
328 ["Mark as unread" wl-summary-target-mark-mark-as-unread t]
329 ["Set delete mark" wl-summary-target-mark-delete t]
330 ["Set refile mark" wl-summary-target-mark-refile t]
331 ["Set copy mark" wl-summary-target-mark-copy t]
332 ["Prefetch" wl-summary-target-mark-prefetch t]
333 ["Save" wl-summary-target-mark-save t]
334 ["Reply with citation" wl-summary-target-mark-reply-with-citation t]
335 ["Forward" wl-summary-target-mark-forward t]
336 ["uudecode" wl-summary-target-mark-uudecode t])
338 ["Switch current score file" wl-score-change-score-file t]
339 ["Edit current score file" wl-score-edit-current-scores t]
340 ["Edit score file" wl-score-edit-file t]
341 ["Set mark below" wl-score-set-mark-below t]
342 ["Set expunge below" wl-score-set-expunge-below t]
343 ["Rescore buffer" wl-summary-rescore t]
344 ["Increase score" wl-summary-increase-score t]
345 ["Lower score" wl-summary-lower-score t])
348 ["Write a message" wl-summary-write t]
349 ["Write for current folder" wl-summary-write-current-folder t]
350 ["Reply" wl-summary-reply t]
351 ["Reply with citation" wl-summary-reply-with-citation t]
352 ["Forward" wl-summary-forward t])
354 ["Toggle Plug Status" wl-toggle-plugged t]
355 ["Change Plug Status" wl-plugged-change t]
357 ["Exit Current Folder" wl-summary-exit t]))
360 (defun wl-summary-setup-mouse ()
361 (define-key wl-summary-mode-map 'button4 'wl-summary-prev)
362 (define-key wl-summary-mode-map 'button5 'wl-summary-next)
363 (define-key wl-summary-mode-map [(shift button4)]
365 (define-key wl-summary-mode-map [(shift button5)]
367 (define-key wl-summary-mode-map 'button2 'wl-summary-click))
368 (defun wl-summary-setup-mouse ()
369 (define-key wl-summary-mode-map [mouse-4] 'wl-summary-prev)
370 (define-key wl-summary-mode-map [mouse-5] 'wl-summary-next)
371 (define-key wl-summary-mode-map [S-mouse-4] 'wl-summary-up)
372 (define-key wl-summary-mode-map [S-mouse-5] 'wl-summary-down)
373 (define-key wl-summary-mode-map [mouse-2] 'wl-summary-click)))
375 (if wl-summary-mode-map
377 (setq wl-summary-mode-map (make-sparse-keymap))
378 (define-key wl-summary-mode-map " " 'wl-summary-read)
379 (define-key wl-summary-mode-map "." 'wl-summary-redisplay)
380 (define-key wl-summary-mode-map "<" 'wl-summary-display-top)
381 (define-key wl-summary-mode-map ">" 'wl-summary-display-bottom)
382 (define-key wl-summary-mode-map "\177" 'wl-summary-prev-page)
383 (define-key wl-summary-mode-map [backspace] 'wl-summary-prev-page)
384 (define-key wl-summary-mode-map "\r" 'wl-summary-next-line-content)
385 (define-key wl-summary-mode-map "\C-m" 'wl-summary-next-line-content)
386 (define-key wl-summary-mode-map "/" 'wl-thread-open-close)
387 (define-key wl-summary-mode-map "[" 'wl-thread-open-all)
388 (define-key wl-summary-mode-map "]" 'wl-thread-close-all)
389 (define-key wl-summary-mode-map "-" 'wl-summary-prev-line-content)
390 (define-key wl-summary-mode-map "\e\r" 'wl-summary-prev-line-content)
391 (define-key wl-summary-mode-map "g" 'wl-summary-goto-folder)
392 (define-key wl-summary-mode-map "G" 'wl-summary-goto-folder-sticky)
393 (define-key wl-summary-mode-map "c" 'wl-summary-mark-as-read-all)
395 (define-key wl-summary-mode-map "a" 'wl-summary-reply)
396 (define-key wl-summary-mode-map "A" 'wl-summary-reply-with-citation)
397 (define-key wl-summary-mode-map "C" 'wl-summary-cancel-message)
398 (define-key wl-summary-mode-map "E" 'wl-summary-reedit)
399 (define-key wl-summary-mode-map "\eE" 'wl-summary-resend-bounced-mail)
400 (define-key wl-summary-mode-map "f" 'wl-summary-forward)
401 (define-key wl-summary-mode-map "$" 'wl-summary-mark-as-important)
402 (define-key wl-summary-mode-map "&" 'wl-summary-mark-as-answered)
403 (define-key wl-summary-mode-map "@" 'wl-summary-edit-addresses)
405 (define-key wl-summary-mode-map "y" 'wl-summary-save)
406 (define-key wl-summary-mode-map "n" 'wl-summary-next)
407 (define-key wl-summary-mode-map "p" 'wl-summary-prev)
408 (define-key wl-summary-mode-map "N" 'wl-summary-down)
409 (define-key wl-summary-mode-map "P" 'wl-summary-up)
410 (define-key wl-summary-mode-map "w" 'wl-summary-write)
411 (define-key wl-summary-mode-map "W" 'wl-summary-write-current-folder)
412 (define-key wl-summary-mode-map "e" 'wl-summary-save)
413 (define-key wl-summary-mode-map "\C-c\C-o" 'wl-jump-to-draft-buffer)
414 (define-key wl-summary-mode-map "\C-c\C-a" 'wl-addrmgr)
415 (define-key wl-summary-mode-map "\C-c\C-p" 'wl-summary-previous-buffer)
416 (define-key wl-summary-mode-map "\C-c\C-n" 'wl-summary-next-buffer)
417 (define-key wl-summary-mode-map "H" 'wl-summary-redisplay-all-header)
418 (define-key wl-summary-mode-map "M" 'wl-summary-redisplay-no-mime)
419 (define-key wl-summary-mode-map "B" 'wl-summary-burst)
420 (define-key wl-summary-mode-map "Z" 'wl-status-update)
421 (define-key wl-summary-mode-map "#" 'wl-summary-print-message)
422 (define-key wl-summary-mode-map "|" 'wl-summary-pipe-message)
423 (define-key wl-summary-mode-map "z" 'wl-summary-suspend)
424 (define-key wl-summary-mode-map "q" 'wl-summary-exit)
425 (define-key wl-summary-mode-map "Q" 'wl-summary-force-exit)
427 (define-key wl-summary-mode-map "j" 'wl-summary-jump-to-current-message)
428 (define-key wl-summary-mode-map "J" 'wl-thread-jump-to-msg)
429 (define-key wl-summary-mode-map "I" 'wl-summary-incorporate)
430 (define-key wl-summary-mode-map "\M-j" 'wl-summary-jump-to-msg-by-message-id)
431 (define-key wl-summary-mode-map "^" 'wl-summary-jump-to-parent-message)
432 (define-key wl-summary-mode-map "!" 'wl-summary-mark-as-unread)
434 (define-key wl-summary-mode-map "s" 'wl-summary-sync)
435 (define-key wl-summary-mode-map "S" 'wl-summary-sort)
436 (define-key wl-summary-mode-map "\M-s" 'wl-summary-stick)
437 (define-key wl-summary-mode-map "T" 'wl-summary-toggle-thread)
439 (define-key wl-summary-mode-map "l" 'wl-summary-toggle-disp-folder)
440 (define-key wl-summary-mode-map "v" 'wl-summary-toggle-disp-msg)
441 (define-key wl-summary-mode-map "V" 'wl-summary-virtual)
443 (define-key wl-summary-mode-map "\C-i" 'wl-summary-goto-last-displayed-msg)
444 (define-key wl-summary-mode-map "?" 'wl-summary-pick)
445 (define-key wl-summary-mode-map "\ee" 'wl-summary-expire)
448 (define-key wl-summary-mode-map "\ew" 'wl-summary-save-current-message)
449 (define-key wl-summary-mode-map "\C-y" 'wl-summary-yank-saved-message)
452 (define-key wl-summary-mode-map "R" 'wl-summary-mark-as-read)
453 (define-key wl-summary-mode-map "i" 'wl-summary-prefetch)
454 (define-key wl-summary-mode-map "x" 'wl-summary-exec)
455 (define-key wl-summary-mode-map "*" 'wl-summary-target-mark)
456 (define-key wl-summary-mode-map "o" 'wl-summary-refile)
457 (define-key wl-summary-mode-map "O" 'wl-summary-copy)
458 (define-key wl-summary-mode-map "\M-o" 'wl-summary-refile-prev-destination)
459 (define-key wl-summary-mode-map "\C-o" 'wl-summary-auto-refile)
460 (define-key wl-summary-mode-map "d" 'wl-summary-dispose)
461 (define-key wl-summary-mode-map "u" 'wl-summary-unmark)
462 (define-key wl-summary-mode-map "U" 'wl-summary-unmark-all)
463 (define-key wl-summary-mode-map "D" 'wl-summary-delete)
464 (define-key wl-summary-mode-map "~" 'wl-summary-resend)
467 (define-key wl-summary-mode-map "t" (make-sparse-keymap))
468 (define-key wl-summary-mode-map "tR" 'wl-thread-mark-as-read)
469 (define-key wl-summary-mode-map "ti" 'wl-thread-prefetch)
470 (define-key wl-summary-mode-map "tx" 'wl-thread-exec)
471 (define-key wl-summary-mode-map "t*" 'wl-thread-target-mark)
472 (define-key wl-summary-mode-map "to" 'wl-thread-refile)
473 (define-key wl-summary-mode-map "tO" 'wl-thread-copy)
474 (define-key wl-summary-mode-map "td" 'wl-thread-dispose)
475 (define-key wl-summary-mode-map "tD" 'wl-thread-delete)
476 (define-key wl-summary-mode-map "t~" 'wl-thread-resend)
477 (define-key wl-summary-mode-map "tu" 'wl-thread-unmark)
478 (define-key wl-summary-mode-map "t!" 'wl-thread-mark-as-unread)
479 (define-key wl-summary-mode-map "t$" 'wl-thread-mark-as-important)
480 (define-key wl-summary-mode-map "ty" 'wl-thread-save)
481 (define-key wl-summary-mode-map "ts" 'wl-thread-set-parent)
483 ;; target-mark commands
484 (define-key wl-summary-mode-map "m" (make-sparse-keymap))
485 (define-key wl-summary-mode-map "mi" 'wl-summary-target-mark-prefetch)
486 (define-key wl-summary-mode-map "mo" 'wl-summary-target-mark-refile)
487 (define-key wl-summary-mode-map "mO" 'wl-summary-target-mark-copy)
488 (define-key wl-summary-mode-map "md" 'wl-summary-target-mark-dispose)
489 (define-key wl-summary-mode-map "mD" 'wl-summary-target-mark-delete)
490 (define-key wl-summary-mode-map "m~" 'wl-summary-target-mark-resend)
492 (define-key wl-summary-mode-map "mu" 'wl-summary-delete-all-temp-marks)
494 (define-key wl-summary-mode-map "my" 'wl-summary-target-mark-save)
495 (define-key wl-summary-mode-map "mR" 'wl-summary-target-mark-mark-as-read)
496 (define-key wl-summary-mode-map "m!" 'wl-summary-target-mark-mark-as-unread)
497 (define-key wl-summary-mode-map "m$" 'wl-summary-target-mark-mark-as-important)
498 (define-key wl-summary-mode-map "mU" 'wl-summary-target-mark-uudecode)
499 (define-key wl-summary-mode-map "ma" 'wl-summary-target-mark-all)
500 (define-key wl-summary-mode-map "mt" 'wl-summary-target-mark-thread)
501 (define-key wl-summary-mode-map "mA" 'wl-summary-target-mark-reply-with-citation)
502 (define-key wl-summary-mode-map "mf" 'wl-summary-target-mark-forward)
503 (define-key wl-summary-mode-map "m?" 'wl-summary-target-mark-pick)
504 (define-key wl-summary-mode-map "m#" 'wl-summary-target-mark-print)
505 (define-key wl-summary-mode-map "m|" 'wl-summary-target-mark-pipe)
508 (define-key wl-summary-mode-map "r" (make-sparse-keymap))
509 (define-key wl-summary-mode-map "rR" 'wl-summary-mark-as-read-region)
510 (define-key wl-summary-mode-map "ri" 'wl-summary-prefetch-region)
511 (define-key wl-summary-mode-map "rx" 'wl-summary-exec-region)
512 (define-key wl-summary-mode-map "mr" 'wl-summary-target-mark-region)
513 (define-key wl-summary-mode-map "r*" 'wl-summary-target-mark-region)
514 (define-key wl-summary-mode-map "ro" 'wl-summary-refile-region)
515 (define-key wl-summary-mode-map "rO" 'wl-summary-copy-region)
516 (define-key wl-summary-mode-map "rd" 'wl-summary-dispose-region)
517 (define-key wl-summary-mode-map "rD" 'wl-summary-delete-region)
518 (define-key wl-summary-mode-map "r~" 'wl-summary-resend-region)
519 (define-key wl-summary-mode-map "ru" 'wl-summary-unmark-region)
520 (define-key wl-summary-mode-map "r!" 'wl-summary-mark-as-unread-region)
521 (define-key wl-summary-mode-map "r$" 'wl-summary-mark-as-important-region)
522 (define-key wl-summary-mode-map "ry" 'wl-summary-save-region)
525 (define-key wl-summary-mode-map "K" 'wl-summary-increase-score)
526 (define-key wl-summary-mode-map "L" 'wl-summary-lower-score)
527 (define-key wl-summary-mode-map "h" (make-sparse-keymap))
528 (define-key wl-summary-mode-map "hR" 'wl-summary-rescore)
529 (define-key wl-summary-mode-map "hc" 'wl-score-change-score-file)
530 (define-key wl-summary-mode-map "he" 'wl-score-edit-current-scores)
531 (define-key wl-summary-mode-map "hf" 'wl-score-edit-file)
532 (define-key wl-summary-mode-map "hF" 'wl-score-flush-cache)
533 (define-key wl-summary-mode-map "hm" 'wl-score-set-mark-below)
534 (define-key wl-summary-mode-map "hx" 'wl-score-set-expunge-below)
537 (define-key wl-summary-mode-map "\C-c\C-f" 'wl-summary-toggle-header-narrowing)
538 (define-key wl-summary-mode-map "\M-t" 'wl-toggle-plugged)
539 (define-key wl-summary-mode-map "\C-t" 'wl-plugged-change)
541 (define-key wl-summary-mode-map "\C-x\C-s" 'wl-summary-save-status)
542 (wl-summary-setup-mouse)
546 "Menu used in Summary mode."
547 wl-summary-mode-menu-spec))
549 (defsubst wl-summary-message-visible-p (number)
550 "Return non-nil if the message with NUMBER is visible."
551 (or (eq wl-summary-buffer-view 'sequence)
552 (not (wl-thread-entity-parent-invisible-p
553 (wl-thread-get-entity number)))))
555 (defun wl-status-update ()
559 (defun wl-summary-display-top ()
561 (goto-char (point-min))
562 (when wl-summary-lazy-highlight
563 (wl-highlight-summary-window))
564 (if wl-summary-buffer-disp-msg
565 (wl-summary-redisplay)))
567 (defun wl-summary-display-bottom ()
569 (goto-char (point-max))
571 (when wl-summary-lazy-highlight
572 (wl-highlight-summary-window))
573 (if wl-summary-buffer-disp-msg
574 (wl-summary-redisplay)))
576 (defun wl-summary-count-unread ()
577 (let ((lst (elmo-folder-count-flags wl-summary-buffer-elmo-folder)))
578 (if (eq major-mode 'wl-summary-mode)
579 (setq wl-summary-buffer-new-count (car lst)
580 wl-summary-buffer-unread-count (nth 1 lst)
581 wl-summary-buffer-answered-count (nth 2 lst)))
584 (defun wl-summary-message-string (&optional use-cache)
585 "Return full body string of current message.
586 If optional USE-CACHE is non-nil, use cache if exists."
587 (let ((number (wl-summary-message-number))
588 (folder wl-summary-buffer-elmo-folder))
590 (message "No message.")
592 (elmo-message-fetch folder
594 (elmo-make-fetch-strategy
596 use-cache ; use cache
597 nil ; save cache (should `t'?)
600 (elmo-file-cache-get-path
601 (elmo-message-field folder number 'message-id))))
607 (defun wl-summary-reedit (&optional arg)
608 "Re-edit current message.
609 If ARG is non-nil, Supersedes message"
611 (wl-summary-toggle-disp-msg 'off)
613 ((not (wl-summary-message-number))
614 (message "No message."))
616 (wl-summary-supersedes-message))
617 ((string= (wl-summary-buffer-folder-name) wl-draft-folder)
618 (wl-draft-reedit (wl-summary-message-number))
619 (if (wl-message-news-p)
620 (mail-position-on-field "Newsgroups")
621 (mail-position-on-field "To")))
623 (wl-draft-edit-string (wl-summary-message-string)))))
625 (defun wl-summary-resend-bounced-mail ()
626 "Re-mail the current message.
627 This only makes sense if the current message is a bounce message which
628 contains some mail you have written but has been bounced back to
631 (wl-summary-toggle-disp-msg 'off)
633 (wl-summary-set-message-buffer-or-redisplay)
634 (set-buffer (wl-message-get-original-buffer))
635 (goto-char (point-min))
636 (let ((case-fold-search nil))
640 (concat "^\\($\\|[Cc]ontent-[Tt]ype:[ \t]+multipart/\\(report\\|mixed\\)\\)") nil t)
642 (re-search-forward "boundary=\"\\([^\"]+\\)\"" nil t))
643 (let ((boundary (buffer-substring (match-beginning 1) (match-end 1)))
646 ((and (setq start (re-search-forward
647 (concat "^--" boundary "\n"
648 "\\([Cc]ontent-[Dd]escription:.*\n\\)?"
649 "[Cc]ontent-[Tt]ype:[ \t]+"
650 "\\(message/rfc822\\|text/rfc822-headers\\).*\n"
651 "\\(.+\n\\)*\n") nil t))
653 (concat "\n\\(--" boundary "\\)--\n") nil t))
654 (wl-draft-edit-string (buffer-substring start (match-beginning 1))))
656 (message "Seems no message/rfc822 part.")))))
657 ((let ((case-fold-search t))
658 (re-search-forward wl-rejected-letter-start nil t))
659 (skip-chars-forward " \t\n")
660 (wl-draft-edit-string (buffer-substring (point) (point-max))))
662 (message "Does not appear to be a rejected letter."))))))
664 (defun wl-summary-detect-mark-position ()
665 (let ((column wl-summary-buffer-number-column)
666 (formatter wl-summary-buffer-line-formatter)
667 (dummy-temp (char-to-string 200))
668 (wl-summary-new-mark (char-to-string 201)) ; bind only for the check.
669 (wl-summary-flag-priority-list '(new)) ; ditto.
673 (setq wl-summary-buffer-number-column column
674 wl-summary-buffer-line-formatter formatter)
676 (wl-summary-create-line
677 (elmo-msgdb-make-message-entity
678 (luna-make-entity 'modb-generic)
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 wl-summary-new-mark 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 (setq wl-summary-buffer-persistent
732 (wl-folder-persistent-p (elmo-folder-name-internal folder)))
733 (elmo-folder-set-persistent-internal folder wl-summary-buffer-persistent)
734 ;; process duplicates.
735 (elmo-folder-set-process-duplicates-internal
736 folder (cdr (elmo-string-matched-assoc
737 (elmo-folder-name-internal folder)
738 wl-folder-process-duplicates-alist)))
740 wl-thread-indent-level-internal
741 (or (nth 0 wl-summary-buffer-thread-indent-set)
742 wl-thread-indent-level)
743 wl-thread-have-younger-brother-str-internal
744 (or (nth 1 wl-summary-buffer-thread-indent-set)
745 wl-thread-have-younger-brother-str)
746 wl-thread-youngest-child-str-internal
747 (or (nth 2 wl-summary-buffer-thread-indent-set)
748 wl-thread-youngest-child-str)
749 wl-thread-vertical-str-internal
750 (or (nth 3 wl-summary-buffer-thread-indent-set)
751 wl-thread-vertical-str)
752 wl-thread-horizontal-str-internal
753 (or (nth 4 wl-summary-buffer-thread-indent-set)
754 wl-thread-horizontal-str)
755 wl-thread-space-str-internal
756 (or (nth 5 wl-summary-buffer-thread-indent-set)
757 wl-thread-space-str))
758 (run-hooks 'wl-summary-buffer-set-folder-hook))
760 (defun wl-summary-mode ()
761 "Major mode for reading threaded messages.
762 See Info under Wanderlust for full documentation.
765 \\{wl-summary-mode-map}
767 Entering Folder mode calls the value of `wl-summary-mode-hook'."
769 (unless (interactive-p) (kill-all-local-variables))
770 (setq major-mode 'wl-summary-mode)
771 (setq mode-name "Summary")
772 (use-local-map wl-summary-mode-map)
773 ;;;(setq default-directory (or wl-tmp-dir (expand-file-name "~/")))
774 (setq buffer-read-only t)
775 (setq truncate-lines t)
776 ;;;(make-local-variable 'tab-width)
777 ;;;(setq tab-width 1)
778 (buffer-disable-undo (current-buffer))
779 (setq selective-display t
780 selective-display-ellipses nil)
781 (wl-mode-line-buffer-identification '(wl-summary-buffer-mode-line))
782 (easy-menu-add wl-summary-mode-menu)
783 (when wl-summary-lazy-highlight
786 (make-local-variable 'pre-idle-hook)
787 (add-hook 'pre-idle-hook 'wl-highlight-summary-window))
788 (make-local-variable 'window-scroll-functions)
789 (add-hook 'window-scroll-functions 'wl-highlight-summary-window)))
790 ;; This hook may contain the function `wl-setup-summary' for reasons
791 ;; of system internal to accord facilities for the Emacs variants.
792 (run-hooks 'wl-summary-mode-hook))
795 (defun wl-summary-overview-entity-compare-by-date (x y)
796 "Compare entity X and Y by date."
799 (timezone-make-date-sortable
800 (elmo-message-entity-field x 'date))
801 (timezone-make-date-sortable
802 (elmo-message-entity-field y 'date)))
803 (error))) ;; ignore error.
805 (defun wl-summary-overview-entity-compare-by-number (x y)
806 "Compare entity X and Y by number."
808 (elmo-message-entity-number x)
809 (elmo-message-entity-number y)))
811 (defun wl-summary-overview-entity-compare-by-from (x y)
812 "Compare entity X and Y by from."
814 (wl-address-header-extract-address
815 (or (elmo-message-entity-field x 'from)
816 wl-summary-no-from-message))
817 (wl-address-header-extract-address
818 (or (elmo-message-entity-field y 'from)
819 wl-summary-no-from-message))))
821 (defun wl-summary-overview-entity-compare-by-subject (x y)
822 "Compare entity X and Y by subject."
823 (string< (elmo-message-entity-field x 'subject)
824 (elmo-message-entity-field y 'subject)))
826 (defun wl-summary-get-list-info (entity)
827 "Returns (\"ML-name\" . ML-count) of ENTITY."
828 (let (sequence ml-name ml-count subject return-path delivered-to mailing-list)
829 (setq sequence (elmo-message-entity-field entity 'x-sequence)
830 ml-name (or (elmo-message-entity-field entity 'x-ml-name)
832 (car (split-string sequence " "))))
833 ml-count (or (elmo-message-entity-field entity 'x-mail-count)
834 (elmo-message-entity-field entity 'x-ml-count)
836 (cadr (split-string sequence " ")))))
837 (and (setq subject (elmo-message-entity-field entity 'subject t))
838 (setq subject (elmo-delete-char ?\n subject))
839 (string-match "^\\s(\\(\\S)+\\)[ :]\\([0-9]+\\)\\s)[ \t]*" subject)
841 (or ml-name (setq ml-name (match-string 1 subject)))
842 (or ml-count (setq ml-count (match-string 2 subject)))))
843 (and (setq return-path
844 (elmo-message-entity-field entity 'return-path))
845 (string-match "^<\\([^@>]+\\)-return-\\([0-9]+\\)-" return-path)
847 (or ml-name (setq ml-name (match-string 1 return-path)))
848 (or ml-count (setq ml-count (match-string 2 return-path)))))
849 (and (setq delivered-to
850 (elmo-message-entity-field entity 'delivered-to))
851 (string-match "^mailing list \\([^@]+\\)@" delivered-to)
852 (or ml-name (setq ml-name (match-string 1 delivered-to))))
853 (and (setq mailing-list
854 (elmo-message-entity-field entity 'mailing-list))
855 ;; *-help@, *-owner@, etc.
856 (string-match "\\(^\\|; \\)contact \\([^@]+\\)-[^-@]+@" mailing-list)
857 (or ml-name (setq ml-name (match-string 2 mailing-list))))
858 (cons (and ml-name (car (split-string ml-name " ")))
859 (and ml-count (string-to-int ml-count)))))
861 (defun wl-summary-overview-entity-compare-by-list-info (x y)
862 "Compare entity X and Y by mailing-list info."
863 (let* ((list-info-x (wl-summary-get-list-info x))
864 (list-info-y (wl-summary-get-list-info y)))
865 (if (equal (car list-info-x) (car list-info-y))
866 (if (equal (cdr list-info-x) (cdr list-info-y))
867 (wl-summary-overview-entity-compare-by-date x y)
868 (< (or (cdr list-info-x) 0)
869 (or (cdr list-info-y) 0)))
870 (string< (or (car list-info-x) "")
871 (or (car list-info-y) "")))))
873 (defun wl-summary-sort-by-date ()
875 (wl-summary-rescan "date"))
876 (defun wl-summary-sort-by-number ()
878 (wl-summary-rescan "number"))
879 (defun wl-summary-sort-by-subject ()
881 (wl-summary-rescan "subject"))
882 (defun wl-summary-sort-by-from ()
884 (wl-summary-rescan "from"))
885 (defun wl-summary-sort-by-list-info ()
887 (wl-summary-rescan "list-info"))
889 (defun wl-summary-rescan (&optional sort-by disable-killed)
890 "Rescan current folder without updating."
892 (let ((elmo-mime-charset wl-summary-buffer-mime-charset)
896 (inhibit-read-only t)
897 (buffer-read-only nil)
898 (numbers (elmo-folder-list-messages wl-summary-buffer-elmo-folder
899 (not disable-killed) t)) ; in-msgdb
902 (message "Re-scanning...")
905 (message "Sorting by %s..." sort-by)
910 (intern (format "wl-summary-overview-entity-compare-by-%s"
912 (elmo-message-entity wl-summary-buffer-elmo-folder x)
913 (elmo-message-entity wl-summary-buffer-elmo-folder y)))))
914 (message "Sorting by %s...done" sort-by))
915 (setq num (length numbers))
916 (setq wl-thread-entity-hashtb (elmo-make-hash (* num 2))
917 wl-thread-entity-list nil
918 wl-thread-entities nil
919 wl-summary-scored nil
920 wl-summary-buffer-number-list nil
921 wl-summary-buffer-target-mark-list nil
922 wl-summary-buffer-temp-mark-list nil
923 wl-summary-delayed-update nil)
924 (elmo-kill-buffer wl-summary-search-buf-name)
926 (setq entity (elmo-message-entity wl-summary-buffer-elmo-folder
928 (wl-summary-insert-message entity
929 wl-summary-buffer-elmo-folder
931 (setq numbers (cdr numbers))
932 (when (> num elmo-display-progress-threshold)
934 (if (or (zerop (% i 5)) (= i num))
935 (elmo-display-progress
936 'wl-summary-rescan "Constructing summary structure..."
937 (/ (* i 100) num)))))
938 (when wl-summary-delayed-update
939 (while wl-summary-delayed-update
940 (message "Parent (%d) of message %d is no entity"
941 (caar wl-summary-delayed-update)
942 (elmo-message-entity-number
943 (cdar wl-summary-delayed-update)))
944 (wl-summary-insert-message
945 (cdar wl-summary-delayed-update)
946 wl-summary-buffer-elmo-folder nil t)
947 (setq wl-summary-delayed-update (cdr wl-summary-delayed-update))))
948 (message "Constructing summary structure...done")
949 (if (eq wl-summary-buffer-view 'thread)
951 (message "Inserting thread...")
952 (wl-thread-insert-top)
953 (message "Inserting thread...done")))
955 (wl-summary-score-headers (wl-summary-rescore-msgs
956 wl-summary-buffer-number-list)
958 (when (and wl-summary-scored
959 (setq expunged (wl-summary-score-update-all-lines)))
960 (message "%d message(s) are expunged by scoring." (length expunged))))
961 (wl-summary-set-message-modified)
962 (wl-summary-count-unread)
963 (wl-summary-update-modeline)
964 (goto-char (point-max))
966 (set-buffer-modified-p nil)))
968 (defun wl-summary-next-folder-or-exit (&optional next-entity upward)
972 (wl-summary-toggle-disp-msg 'off)
975 (wl-summary-goto-folder-subr next-entity
981 (wl-folder-set-current-entity-id (wl-folder-get-entity-id next-entity))
982 (if (and (eq retval 'more-next)
983 (memq wl-auto-select-next '(unread skip-no-unread))
984 (memq this-command wl-summary-next-no-unread-command))
987 t (eq wl-auto-select-next 'skip-no-unread))
988 (goto-char (point-max))
991 t (eq wl-auto-select-next 'skip-no-unread))))))
994 (defun wl-summary-entity-info-msg (entity finfo)
997 (if (memq 'ask-folder wl-use-folder-petname)
998 (wl-folder-get-petname entity)
1000 (if (null (car finfo))
1003 " (%d new/%d unread)"
1009 (defun wl-summary-set-message-modified ()
1010 (elmo-folder-set-message-modified
1011 wl-summary-buffer-elmo-folder t)
1012 (setq wl-summary-buffer-message-modified t)
1013 (wl-summary-set-mark-modified))
1014 (defun wl-summary-message-modified-p ()
1015 wl-summary-buffer-message-modified)
1016 (defun wl-summary-set-mark-modified ()
1017 (elmo-folder-set-flag-modified-internal
1018 wl-summary-buffer-elmo-folder t))
1019 (defun wl-summary-mark-modified-p ()
1020 (elmo-folder-flag-modified-internal
1021 wl-summary-buffer-elmo-folder))
1022 (defun wl-summary-set-thread-modified ()
1023 (setq wl-summary-buffer-thread-modified t))
1024 (defun wl-summary-thread-modified-p ()
1025 wl-summary-buffer-thread-modified)
1027 (defsubst wl-summary-cleanup-temp-marks (&optional sticky)
1028 (when wl-summary-buffer-temp-mark-list
1029 (if (y-or-n-p (format "Execute remaining marks in %s? "
1030 (wl-summary-buffer-folder-name)))
1033 (if wl-summary-buffer-temp-mark-list
1034 (error "Some execution was failed")))
1035 ;; temp-mark-list is remained.
1037 (wl-summary-delete-all-temp-marks 'no-msg)
1038 (setq wl-summary-scored nil))
1040 ;; a subroutine for wl-summary-exit/wl-save-status
1041 ;; Note that folder is not commited here.
1042 (defun wl-summary-save-view ()
1043 ;; already in summary buffer.
1044 (when wl-summary-buffer-persistent
1045 ;; save the current summary buffer view.
1046 (if (and wl-summary-cache-use
1047 (or (wl-summary-message-modified-p)
1048 (wl-summary-mark-modified-p)
1049 (wl-summary-thread-modified-p)))
1050 (wl-summary-save-view-cache))))
1052 (defun wl-summary-save-status ()
1053 "Save summary view and msgdb."
1055 (if (interactive-p) (message "Saving summary status..."))
1056 (wl-summary-save-view)
1057 (elmo-folder-commit wl-summary-buffer-elmo-folder)
1058 (elmo-folder-check wl-summary-buffer-elmo-folder)
1059 (if wl-use-scoring (wl-score-save))
1060 (if (interactive-p) (message "Saving summary status...done")))
1062 (defun wl-summary-force-exit ()
1063 "Exit current summary. Buffer is deleted even the buffer is sticky."
1065 (wl-summary-exit 'force-exit))
1067 (defun wl-summary-exit (&optional force-exit)
1068 "Exit current summary. if FORCE-EXIT, exits even the summary is sticky."
1070 (let ((summary-buf (current-buffer))
1071 (sticky (wl-summary-sticky-p))
1073 message-buf message-win
1074 folder-buf folder-win)
1075 (run-hooks 'wl-summary-exit-pre-hook)
1076 (if wl-summary-buffer-exit-function
1077 (funcall wl-summary-buffer-exit-function)
1078 (if (or force-exit (not sticky))
1079 (wl-summary-cleanup-temp-marks sticky))
1081 ;; save summary status
1083 (wl-summary-save-view)
1084 (if (or force-exit (not sticky))
1085 (elmo-folder-close wl-summary-buffer-elmo-folder)
1086 (elmo-folder-commit wl-summary-buffer-elmo-folder)
1087 (elmo-folder-check wl-summary-buffer-elmo-folder))
1088 (if wl-use-scoring (wl-score-save)))
1089 ;; for sticky summary
1090 (wl-delete-all-overlays)
1091 (setq wl-summary-buffer-disp-msg nil)
1092 (elmo-kill-buffer wl-summary-search-buf-name)
1093 ;; delete message window if displayed.
1094 (if (and wl-message-buffer (get-buffer-window wl-message-buffer))
1095 (delete-window (get-buffer-window wl-message-buffer)))
1096 (if (and wl-summary-use-frame
1097 (> (length (visible-frame-list)) 1))
1099 (if (setq folder-buf (get-buffer wl-folder-buffer-name))
1100 (if wl-summary-use-frame
1102 (save-selected-window
1103 (dolist (frame (visible-frame-list))
1104 (select-frame frame)
1105 (if (get-buffer-window folder-buf)
1106 (setq select-frame frame))))
1108 (select-frame select-frame)
1109 (switch-to-buffer folder-buf)))
1110 (if (setq folder-win (get-buffer-window folder-buf))
1111 ;; folder win is already displayed.
1112 (select-window folder-win)
1113 ;; folder win is not displayed.
1114 (switch-to-buffer folder-buf)))
1115 ;; currently no folder buffer
1117 (and wl-folder-move-cur-folder
1118 wl-folder-buffer-cur-point
1119 (goto-char wl-folder-buffer-cur-point))
1120 (setq wl-folder-buffer-cur-path nil)
1121 (setq wl-folder-buffer-cur-entity-id nil)
1122 (wl-delete-all-overlays)
1123 (if wl-summary-exit-next-move
1124 (wl-folder-next-unsync t)
1125 (beginning-of-line))
1126 (if (setq summary-win (get-buffer-window summary-buf))
1127 (delete-window summary-win))
1131 (set-buffer summary-buf)
1132 (kill-buffer summary-buf)))
1133 (run-hooks 'wl-summary-exit-hook)))))
1135 (defun wl-summary-suspend ()
1138 (wl-folder-suspend))
1140 (defun wl-summary-sync-force-update (&optional unset-cursor no-check)
1142 (wl-summary-sync-update unset-cursor nil nil no-check))
1144 (defsubst wl-summary-sync-all-init ()
1145 (wl-summary-cleanup-temp-marks)
1147 (wl-summary-set-message-modified)
1148 (setq wl-thread-entity-hashtb (elmo-make-hash
1149 (* (elmo-folder-length
1150 wl-summary-buffer-elmo-folder)
1152 (setq wl-thread-entity-list nil)
1153 (setq wl-thread-entities nil)
1154 (setq wl-summary-buffer-number-list nil)
1155 (setq wl-summary-buffer-target-mark-list nil)
1156 (setq wl-summary-buffer-temp-mark-list nil))
1158 (defun wl-summary-sync (&optional unset-cursor force-range)
1160 (let* ((folder wl-summary-buffer-elmo-folder)
1161 (inhibit-read-only t)
1162 (buffer-read-only nil)
1163 (msgdb-dir (elmo-folder-msgdb-path folder))
1164 (range (or force-range (wl-summary-input-range
1165 (elmo-folder-name-internal folder)))))
1166 (cond ((string-match "rescan" range)
1167 (let ((msg (wl-summary-message-number))
1168 (wl-use-scoring (if (string-match "noscore" range)
1171 (wl-summary-rescan nil
1172 (string-match "noscore" range))
1173 (and msg (wl-summary-jump-to-msg msg))))
1174 ((string= range "mark")
1175 (let ((msg (wl-summary-message-number)))
1176 (call-interactively 'wl-summary-sync-marks)
1177 (and msg (wl-summary-jump-to-msg msg))))
1178 ((string= range "cache-status")
1179 (let ((msg (wl-summary-message-number)))
1180 (wl-summary-resume-cache-status)
1181 (and msg (wl-summary-jump-to-msg msg))))
1182 ((string= range "no-sync"))
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 (defsubst wl-summary-narrow-to-region (beg end)
1391 (if (eq (current-column) 0) (beginning-of-line) (end-of-line))
1394 (defun wl-summary-prefetch-region-no-mark (beg end &optional prefetch-marks)
1402 (setq start-pos (point))
1404 (wl-summary-narrow-to-region beg end)
1405 ;; collect prefetch targets.
1406 (message "Collecting marks...")
1407 (goto-char (point-min))
1409 (setq mark (wl-summary-persistent-mark)
1410 msg (wl-summary-message-number))
1411 (if (or (and (null prefetch-marks)
1413 (null (elmo-file-cache-exists-p
1415 wl-summary-buffer-elmo-folder
1418 (member mark prefetch-marks))
1419 (setq targets (nconc targets (list msg))))
1420 (setq entity (wl-thread-get-entity msg))
1421 (if (or (not (eq wl-summary-buffer-view 'thread))
1422 (wl-thread-entity-get-opened entity))
1423 (); opened. no hidden children.
1424 (setq targets (nconc
1426 (wl-thread-get-children-msgs-uncached
1427 msg prefetch-marks))))
1429 (setq length (length targets))
1430 (message "Prefetching...")
1432 (when (if (not (wl-thread-entity-parent-invisible-p
1433 (wl-thread-get-entity (car targets))))
1435 (wl-summary-jump-to-msg (car targets))
1436 (wl-summary-prefetch-msg
1437 (wl-summary-message-number)))
1438 (wl-summary-prefetch-msg (car targets)))
1439 (message "Prefetching... %d/%d message(s)"
1440 (setq count (+ 1 count)) length))
1441 (setq targets (cdr targets)))
1442 (message "Prefetched %d/%d message(s)" count length)
1443 (cons count length)))))
1445 (defun wl-summary-delete-marks-on-buffer (marks)
1447 (wl-summary-unmark (pop marks))))
1449 (defun wl-summary-delete-copy-marks-on-buffer (copies)
1450 (wl-summary-delete-marks-on-buffer copies))
1453 (defun wl-summary-delete-all-target-marks ()
1454 (wl-summary-delete-marks-on-buffer wl-summary-buffer-target-mark-list))
1456 (defun wl-summary-mark-as-read-region (beg end)
1460 (wl-summary-narrow-to-region beg end)
1461 (goto-char (point-min))
1462 (if (eq wl-summary-buffer-view 'thread)
1465 (let* ((number (wl-summary-message-number))
1466 (entity (wl-thread-get-entity number)))
1467 (if (wl-thread-entity-get-opened entity)
1468 (setq number-list (append number-list (list number)))
1471 (wl-thread-get-children-msgs number))))
1473 (wl-summary-mark-as-read number-list))
1477 (append number-list (list (wl-summary-message-number))))
1479 (wl-summary-mark-as-read number-list))))))
1481 (defun wl-summary-mark-as-unread-region (beg end)
1485 (wl-summary-narrow-to-region beg end)
1486 (goto-char (point-min))
1487 (if (eq wl-summary-buffer-view 'thread)
1490 (let* ((number (wl-summary-message-number))
1491 (entity (wl-thread-get-entity number)))
1492 (if (wl-thread-entity-get-opened entity)
1493 (setq number-list (append number-list (list number)))
1496 (wl-thread-get-children-msgs number))))
1498 (wl-summary-mark-as-unread number-list))
1502 (append number-list (list (wl-summary-message-number))))
1504 (wl-summary-mark-as-unread number-list))))))
1506 (defun wl-summary-mark-as-important-region (beg end)
1510 (wl-summary-narrow-to-region beg end)
1511 (goto-char (point-min))
1512 (if (eq wl-summary-buffer-view 'thread)
1515 (let* ((number (wl-summary-message-number))
1516 (entity (wl-thread-get-entity number))
1518 (if (wl-thread-entity-get-opened entity)
1519 ;; opened...mark line.
1520 ;; Crossposts are not processed
1521 (wl-summary-mark-as-important)
1523 (wl-summary-mark-as-important) ; mark itself.
1525 (delq number (wl-thread-get-children-msgs number)))
1527 (wl-summary-mark-as-important (car children))
1528 (setq children (cdr children))))
1531 (wl-summary-mark-as-important)
1532 (forward-line 1)))))
1533 (wl-summary-count-unread)
1534 (wl-summary-update-modeline))
1536 (defun wl-summary-mark-as-read-all ()
1538 (if (or (not (interactive-p))
1539 (y-or-n-p "Mark all messages as read? "))
1540 (let ((folder wl-summary-buffer-elmo-folder)
1541 (cur-buf (current-buffer)))
1542 (message "Setting all msgs as read...")
1543 (elmo-folder-flag-as-read folder
1544 (elmo-folder-list-unreads
1547 (goto-char (point-min))
1549 (wl-summary-update-persistent-mark)
1551 (wl-folder-update-unread (wl-summary-buffer-folder-name) 0)
1552 (setq wl-summary-buffer-unread-count 0)
1553 (setq wl-summary-buffer-new-count 0)
1554 (wl-summary-update-modeline)
1555 (message "Setting all msgs as read...done"))))
1557 (defun wl-summary-delete-cache ()
1558 "Delete cache of current message."
1561 (let* ((folder wl-summary-buffer-elmo-folder)
1563 (setq number (wl-summary-message-number))
1564 (elmo-message-set-cached folder number nil)
1565 (when (wl-summary-update-persistent-mark)
1566 (elmo-file-cache-delete
1567 (elmo-file-cache-get-path
1568 (elmo-message-field wl-summary-buffer-elmo-folder
1572 (defun wl-summary-resume-cache-status ()
1573 "Resume the cache status of all messages in the current folder."
1575 (let ((folder wl-summary-buffer-elmo-folder)
1577 (message "Resuming cache status...")
1579 (goto-char (point-min))
1581 (setq number (wl-summary-message-number))
1582 (setq msgid (elmo-message-field folder number 'message-id))
1583 (elmo-message-set-cached folder number
1584 (elmo-file-cache-exists-p msgid))
1585 (wl-summary-update-persistent-mark)
1587 (wl-summary-count-unread)
1588 (wl-summary-update-modeline)
1589 (message "Resuming cache status...done"))))
1591 (defun wl-summary-delete-messages-on-buffer (msgs &optional deleting-info)
1594 (let ((inhibit-read-only t)
1595 (buffer-read-only nil)
1599 ;(deleting-info (or deleting-info "Deleting..."))
1601 (elmo-kill-buffer wl-summary-search-buf-name)
1603 (if (eq wl-summary-buffer-view 'thread)
1605 ;; don't use wl-append(nconc), because list is broken. ...why?
1608 (wl-thread-delete-message (car msgs))))
1609 (setq update-list (delq (car msgs) update-list)))
1610 (goto-char (point-min))
1611 (if (wl-summary-jump-to-msg (car msgs))
1613 (delete-region (point-at-bol) (point-at-eol))
1614 (delete-char 1) ; delete '\n'
1615 (setq wl-summary-buffer-number-list
1616 (delq (car msgs) wl-summary-buffer-number-list)))))
1617 ; (when (> len elmo-display-progress-threshold)
1619 ; (if (or (zerop (% i 5)) (= i len))
1620 ; (elmo-display-progress
1621 ; 'wl-summary-delete-messages-on-buffer deleting-info
1622 ; (/ (* i 100) len))))
1623 (setq msgs (cdr msgs)))
1624 (when (eq wl-summary-buffer-view 'thread)
1625 (wl-thread-update-line-msgs (elmo-uniq-list update-list))
1626 (wl-thread-cleanup-symbols msgs2))
1627 ;;(message (concat deleting-info "done"))
1628 (wl-summary-count-unread)
1629 (wl-summary-update-modeline)
1630 (wl-folder-set-folder-updated
1631 (elmo-folder-name-internal wl-summary-buffer-elmo-folder)
1633 (+ wl-summary-buffer-unread-count wl-summary-buffer-new-count)
1634 (elmo-folder-length wl-summary-buffer-elmo-folder))))))
1636 (defun wl-summary-update-status-marks ()
1637 "Synchronize status marks on current buffer to the msgdb."
1640 (goto-char (point-min))
1642 (wl-summary-update-persistent-mark)
1645 (defun wl-summary-insert-message (&rest args)
1646 (if (eq wl-summary-buffer-view 'thread)
1647 (apply 'wl-summary-insert-thread args)
1648 (apply 'wl-summary-insert-sequential args)))
1650 (defun wl-summary-sort ()
1654 (format "Sort by (%s): " (symbol-name wl-summary-default-sort-spec))
1655 (mapcar (lambda (spec)
1656 (list (symbol-name spec)))
1657 wl-summary-sort-specs)
1658 nil t nil nil (symbol-name wl-summary-default-sort-spec))))
1660 (defun wl-summary-sync-marks ()
1661 "Update persistent marks in summary."
1663 (let ((last-progress 0)
1664 (folder wl-summary-buffer-elmo-folder)
1666 answereds importants unreads diff diffs
1668 ;; synchronize marks.
1669 (when (not (eq (elmo-folder-type-internal
1670 wl-summary-buffer-elmo-folder)
1672 (message "Updating marks...")
1673 (setq importants (elmo-uniq-list
1674 (nconc (elmo-folder-list-importants
1675 wl-summary-buffer-elmo-folder)
1676 ;; XXX Temporal implementation.
1677 ;; It should be merged to the
1678 ;; elmo-folder-list-flagged.
1679 (elmo-folder-list-global-flag-messages
1680 wl-summary-buffer-elmo-folder
1682 unreads (elmo-folder-list-unreads
1683 wl-summary-buffer-elmo-folder)
1684 answereds (elmo-folder-list-answereds
1685 wl-summary-buffer-elmo-folder))
1686 (setq diff (elmo-list-diff importants
1687 (elmo-folder-list-flagged
1688 wl-summary-buffer-elmo-folder
1689 'important 'in-msgdb)))
1690 (setq diffs (cadr diff)) ; important-deletes
1691 (setq mes (format "Updated (-%d" (length diffs)))
1693 (wl-summary-mark-as-important (car diffs)
1694 wl-summary-important-mark
1696 (setq diffs (cdr diffs)))
1697 (setq diffs (car diff)) ; important-appends
1698 (setq mes (concat mes (format "/+%d) important," (length diffs))))
1700 (wl-summary-mark-as-important (car diffs) " " 'no-server)
1701 (setq diffs (cdr diffs)))
1703 (setq diff (elmo-list-diff answereds
1704 (elmo-folder-list-flagged
1705 wl-summary-buffer-elmo-folder
1706 'answered 'in-msgdb)))
1707 (setq diffs (cadr diff))
1708 (setq mes (concat mes (format "(-%d" (length diffs))))
1710 (wl-summary-mark-as-unanswered (car diffs) 'no-modeline)
1711 (setq diffs (cdr diffs)))
1712 (setq diffs (car diff)) ; unread-appends
1713 (setq mes (concat mes (format "/+%d) answered mark(s)," (length diffs))))
1715 (wl-summary-mark-as-answered (car diffs) 'no-modeline)
1716 (setq diffs (cdr diffs)))
1718 (setq diff (elmo-list-diff unreads
1719 (elmo-folder-list-flagged
1720 wl-summary-buffer-elmo-folder
1721 'unread 'in-msgdb)))
1722 (setq diffs (cadr diff))
1723 (setq mes (concat mes (format "(-%d" (length diffs))))
1725 (wl-summary-mark-as-read (car diffs) 'no-folder 'no-modeline)
1726 (setq diffs (cdr diffs)))
1727 (setq diffs (car diff)) ; unread-appends
1728 (setq mes (concat mes (format "/+%d) unread mark(s)." (length diffs))))
1730 (wl-summary-mark-as-unread (car diffs) 'no-folder 'no-modeline)
1731 (setq diffs (cdr diffs)))
1732 (if (interactive-p) (message "%s" mes)))))
1734 (defun wl-summary-sync-update (&optional unset-cursor
1738 "Update the summary view to the newest folder status."
1740 (let* ((folder wl-summary-buffer-elmo-folder)
1741 (elmo-mime-charset wl-summary-buffer-mime-charset)
1742 (inhibit-read-only t)
1743 (buffer-read-only nil)
1747 append-list delete-list crossed
1748 update-thread update-top-list
1749 expunged mes entity)
1752 (unless wl-summary-buffer-elmo-folder
1753 (error "(Internal error) Folder is not set:%s" (buffer-name
1755 ;; Flush pending append operations (disconnected operation).
1757 ;;(wl-summary-flush-pending-append-operations seen-list))
1758 (goto-char (point-max))
1759 (wl-folder-confirm-existence folder (elmo-folder-plugged-p folder))
1760 (setq crossed (elmo-folder-synchronize folder
1767 (if sync-all (wl-summary-sync-all-init))
1768 (setq diff (elmo-list-diff (elmo-folder-list-messages
1770 (not disable-killed)
1772 wl-summary-buffer-number-list))
1773 (setq append-list (car diff))
1774 (setq delete-list (cadr diff))
1777 (wl-summary-delete-messages-on-buffer delete-list))
1778 (wl-summary-update-status-marks)
1779 (setq num (length append-list))
1781 (setq wl-summary-delayed-update nil)
1782 (elmo-kill-buffer wl-summary-search-buf-name)
1783 (dolist (number append-list)
1784 (setq entity (elmo-message-entity folder number))
1785 (when (setq update-thread
1786 (wl-summary-insert-message
1789 (wl-append update-top-list update-thread))
1790 (if elmo-use-database
1791 (elmo-database-msgid-put
1792 (car entity) (elmo-folder-name-internal folder)
1793 (elmo-message-entity-number entity)))
1794 (when (> num elmo-display-progress-threshold)
1796 (if (or (zerop (% i 5)) (= i num))
1797 (elmo-display-progress
1798 'wl-summary-sync-update
1799 (if (eq wl-summary-buffer-view 'thread)
1801 "Inserting message...")
1802 (/ (* i 100) num)))))
1803 (when wl-summary-delayed-update
1804 (while wl-summary-delayed-update
1805 (message "Parent (%d) of message %d is no entity"
1806 (caar wl-summary-delayed-update)
1807 (elmo-message-entity-number
1808 (cdar wl-summary-delayed-update)))
1809 (when (setq update-thread
1810 (wl-summary-insert-message
1811 (cdar wl-summary-delayed-update)
1812 wl-summary-buffer-elmo-folder
1814 (wl-append update-top-list update-thread))
1815 (setq wl-summary-delayed-update
1816 (cdr wl-summary-delayed-update))))
1817 (when (and (eq wl-summary-buffer-view 'thread)
1819 (wl-thread-update-indent-string-thread
1820 (elmo-uniq-list update-top-list)))
1821 (message (if (eq wl-summary-buffer-view 'thread)
1822 "Making thread...done"
1823 "Inserting message...done"))
1824 (when (or delete-list append-list)
1825 (wl-summary-set-message-modified))
1826 (when (and sync-all (eq wl-summary-buffer-view 'thread))
1827 (elmo-kill-buffer wl-summary-search-buf-name)
1828 (message "Inserting message...")
1829 (wl-thread-insert-top)
1830 (message "Inserting message...done"))
1831 (if elmo-use-database
1832 (elmo-database-close))
1833 (run-hooks 'wl-summary-sync-updated-hook)
1835 (if (and (eq (length delete-list) 0)
1838 "No updates for \"%s\"" (elmo-folder-name-internal
1840 (format "Updated (-%d/+%d) message(s)"
1841 (length delete-list) num))))
1842 (setq mes "Quit updating.")))
1843 ;; synchronize marks.
1844 (if (and crossed wl-summary-auto-sync-marks)
1845 (wl-summary-sync-marks))
1847 (when wl-use-scoring
1848 (setq wl-summary-scored nil)
1849 (wl-summary-score-headers (and sync-all
1850 (wl-summary-rescore-msgs
1851 wl-summary-buffer-number-list))
1853 (when (and wl-summary-scored
1854 (setq expunged (wl-summary-score-update-all-lines)))
1855 (setq mes (concat mes
1856 (format " (%d expunged)"
1857 (length expunged))))))
1858 (if (and crossed (> crossed 0))
1862 (format " (%d crosspost)" crossed))
1863 (format "%d crosspost message(s)" crossed)))
1864 (and mes (setq mes (concat mes "."))))
1865 ;; Update Folder mode
1866 (wl-folder-set-folder-updated
1867 (elmo-folder-name-internal folder)
1869 (let ((lst (wl-summary-count-unread)))
1870 (+ (car lst) (nth 1 lst)))
1871 (elmo-folder-length folder)))
1872 (wl-summary-update-modeline)
1874 (unless unset-cursor
1875 (goto-char (point-min))
1876 (if (not (wl-summary-cursor-down t))
1878 (goto-char (point-max))
1880 (if (and wl-summary-highlight
1881 (not wl-summary-lazy-highlight)
1882 (not (get-text-property (point) 'face)))
1886 wl-summary-partial-highlight-above-lines
1887 wl-summary-highlight-partial-threshold)))
1888 (wl-highlight-summary (point) (point-max))))))
1889 (wl-delete-all-overlays)
1890 (set-buffer-modified-p nil)
1891 (if mes (message "%s" mes)))))
1893 (defun wl-summary-set-score-mark (mark)
1896 (let ((cur-mark (wl-summary-temp-mark)))
1897 (when (member cur-mark (list " "
1898 wl-summary-score-below-mark
1899 wl-summary-score-over-mark))
1900 (wl-summary-put-temp-mark mark)
1901 (if wl-summary-highlight
1902 (wl-highlight-summary-current-line))
1903 (set-buffer-modified-p nil)))))
1905 (defun wl-summary-get-score-mark (msg-num)
1906 (let ((score (cdr (assq msg-num wl-summary-scored))))
1908 (cond ((< score wl-summary-default-score)
1910 ((> score wl-summary-default-score)
1913 (defun wl-summary-update-modeline ()
1914 (setq wl-summary-buffer-mode-line
1915 (funcall wl-summary-buffer-mode-line-formatter)))
1917 (defun wl-summary-jump-to-msg (&optional number)
1919 (let ((num (or number
1921 (read-from-minibuffer "Jump to Message(No.): ")))))
1922 (setq num (int-to-string num))
1924 (if (or (and (re-search-forward (concat "\r" num "[^0-9]") nil t)
1925 (progn (backward-char 1) t))
1926 (re-search-backward (concat "\r" num "[^0-9]") nil t))
1927 (progn (beginning-of-line) t)
1930 (defun wl-summary-highlight-msgs (msgs)
1932 (let ((len (length msgs))
1934 (message "Hilighting...")
1937 (if (wl-summary-jump-to-msg (car msgs))
1938 (wl-highlight-summary-current-line))
1939 (setq msgs (cdr msgs))
1940 (when (> len elmo-display-progress-threshold)
1942 (if (or (zerop (% i 5)) (= i len))
1943 (elmo-display-progress
1944 'wl-summary-highlight-msgs "Highlighting..."
1945 (/ (* i 100) len)))))
1946 (message "Highlighting...done"))))
1948 (defun wl-summary-message-number ()
1951 (if (or (re-search-forward "\r\\(-?[0-9]+\\)" (point-at-eol) t)
1952 (re-search-forward "^ *\\(-?[0-9]+\\)" (point-at-eol) t))
1953 (string-to-int (wl-match-buffer 1))
1956 (defun wl-summary-delete-all-msgs ()
1958 (let ((cur-buf (current-buffer))
1959 (dels (elmo-folder-list-messages wl-summary-buffer-elmo-folder)))
1960 (set-buffer cur-buf)
1962 (message "No message to delete.")
1963 (if (y-or-n-p (format "%s has %d message(s). Delete all? "
1964 (wl-summary-buffer-folder-name)
1967 (message "Deleting...")
1968 (elmo-folder-move-messages wl-summary-buffer-elmo-folder dels
1970 (wl-summary-set-message-modified)
1971 (wl-folder-set-folder-updated (wl-summary-buffer-folder-name)
1974 ;;; (setq wl-thread-top-entity '(nil t nil nil))
1975 (setq wl-summary-buffer-unread-count 0)
1976 (setq wl-summary-buffer-new-count 0)
1977 (wl-summary-update-modeline)
1978 (set-buffer cur-buf)
1979 (let ((inhibit-read-only t)
1980 (buffer-read-only nil))
1982 ;;; (if wl-summary-cache-use (wl-summary-save-view-cache))
1983 (message "Deleting...done")
1987 (defun wl-summary-toggle-thread (&optional arg)
1988 "Toggle thread status (T)hread and (S)equential.
1989 If ARG, without confirm."
1992 (y-or-n-p (format "Toggle threading? (y=%s): "
1993 (if (eq wl-summary-buffer-view 'thread)
1994 "\"off\"" "\"on\""))))
1995 (if (eq wl-summary-buffer-view 'thread)
1996 (setq wl-summary-buffer-view 'sequence)
1997 (setq wl-summary-buffer-view 'thread))
1998 (wl-summary-update-modeline)
1999 (force-mode-line-update)
2000 (wl-summary-rescan)))
2002 (defun wl-summary-load-file-object (filename)
2003 "Load lisp object from dir."
2005 (let ((tmp-buffer (get-buffer-create " *wl-summary-load-file-object*"))
2006 insert-file-contents-pre-hook ; To avoid autoconv-xmas...
2007 insert-file-contents-post-hook
2009 (if (not (file-readable-p filename))
2011 (set-buffer tmp-buffer)
2012 (as-binary-input-file (insert-file-contents filename))
2015 (read (current-buffer))
2016 (error (error "Reading failed")))))
2017 (kill-buffer tmp-buffer)
2020 (defun wl-summary-goto-folder (&optional arg)
2022 (wl-summary-goto-folder-subr nil nil nil nil t nil arg))
2024 (defun wl-summary-goto-folder-sticky ()
2026 (wl-summary-goto-folder-subr nil nil nil t t))
2028 (defun wl-summary-goto-last-visited-folder ()
2031 (wl-folder-search-entity-by-name wl-summary-last-visited-folder
2034 (if entity (wl-folder-set-current-entity-id
2035 (wl-folder-get-entity-id entity))))
2036 (wl-summary-goto-folder-subr wl-summary-last-visited-folder nil nil nil t))
2038 (defun wl-summary-sticky-p (&optional folder)
2040 (get-buffer (wl-summary-sticky-buffer-name
2041 (elmo-folder-name-internal folder)))
2042 (not (string= wl-summary-buffer-name (buffer-name)))))
2044 (defun wl-summary-always-sticky-folder-p (folder)
2045 (or (eq t wl-summary-always-sticky-folder-list)
2046 (wl-string-match-member
2047 (elmo-folder-name-internal folder)
2048 wl-summary-always-sticky-folder-list)))
2050 (defun wl-summary-stick (&optional force)
2051 "Make current summary buffer sticky."
2053 (if (wl-summary-sticky-p)
2054 (message "Current summary buffer is already sticky.")
2055 (when (or force (y-or-n-p "Stick current summary buffer? "))
2056 (wl-summary-toggle-disp-msg 'off)
2057 (wl-summary-switch-to-clone-buffer
2058 (wl-summary-sticky-buffer-name
2059 (wl-summary-buffer-folder-name)))
2061 ;;; (rename-buffer (wl-summary-sticky-buffer-name
2062 ;;; (wl-summary-buffer-folder-name))))
2063 (message "Folder `%s' is now sticky." (wl-summary-buffer-folder-name)))))
2065 (defun wl-summary-switch-to-clone-buffer (buffer-name)
2066 (let ((cur-buf (current-buffer))
2067 (msg (wl-summary-message-number))
2068 (buf (get-buffer-create buffer-name))
2069 (folder wl-summary-buffer-elmo-folder)
2071 (append '(wl-summary-buffer-view
2072 wl-summary-buffer-temp-mark-list
2073 wl-summary-buffer-target-mark-list
2074 wl-summary-buffer-elmo-folder
2075 wl-summary-buffer-number-column
2076 wl-summary-buffer-temp-mark-column
2077 wl-summary-buffer-persistent-mark-column
2078 wl-summary-buffer-message-modified
2079 wl-summary-buffer-thread-modified
2080 wl-summary-buffer-number-list
2081 wl-summary-buffer-folder-name
2082 wl-summary-buffer-line-formatter)
2083 (and (eq wl-summary-buffer-view 'thread)
2084 '(wl-thread-entity-hashtb
2086 wl-thread-entity-list))
2089 wl-summary-default-score
2090 wl-summary-important-above
2091 wl-summary-target-above
2092 wl-summary-mark-below
2093 wl-summary-expunge-below))
2094 (and (featurep 'wl-score)
2095 '(wl-current-score-file
2099 (wl-summary-buffer-set-folder folder)
2100 (let ((buffer-read-only nil))
2101 (insert-buffer cur-buf))
2102 (set-buffer-modified-p nil)
2103 (while copy-variables
2104 (set (car copy-variables)
2106 (set-buffer cur-buf)
2107 (symbol-value (car copy-variables))))
2108 (setq copy-variables (cdr copy-variables)))
2109 (switch-to-buffer buf)
2110 (kill-buffer cur-buf)
2111 (wl-summary-count-unread)
2112 (wl-summary-update-modeline)
2114 (if (eq wl-summary-buffer-view 'thread)
2115 (wl-thread-jump-to-msg msg)
2116 (wl-summary-jump-to-msg msg))
2117 (goto-char (point-max))
2118 (beginning-of-line))))
2120 (defun wl-summary-get-buffer (folder)
2122 (get-buffer (wl-summary-sticky-buffer-name folder)))
2123 (get-buffer wl-summary-buffer-name)))
2125 (defun wl-summary-get-buffer-create (name &optional force-sticky)
2128 (wl-summary-sticky-buffer-name name))
2129 (or (get-buffer (wl-summary-sticky-buffer-name name))
2130 (get-buffer-create wl-summary-buffer-name))))
2132 (defun wl-summary-make-number-list ()
2134 (goto-char (point-min))
2135 (setq wl-summary-buffer-number-list nil)
2137 (setq wl-summary-buffer-number-list
2138 (cons (wl-summary-message-number)
2139 wl-summary-buffer-number-list))
2141 (setq wl-summary-buffer-number-list
2142 (nreverse wl-summary-buffer-number-list))))
2144 (defun wl-summary-auto-select-msg-p (unread-msg)
2146 (not (elmo-message-flagged-p wl-summary-buffer-elmo-folder
2150 (defsubst wl-summary-open-folder (folder)
2152 (let ((elmo-mime-charset wl-summary-buffer-mime-charset))
2154 (elmo-folder-open folder 'load-msgdb)
2155 ;; For compatibility
2156 (setq wl-summary-buffer-folder-name (elmo-folder-name-internal
2159 (defun wl-summary-goto-folder-subr (&optional name scan-type other-window
2160 sticky interactive scoring
2162 "Display target folder on summary."
2164 (let* ((keep-cursor (memq this-command
2165 wl-summary-keep-cursor-command))
2166 (name (or name (wl-summary-read-folder wl-default-folder)))
2167 (cur-fld wl-summary-buffer-elmo-folder)
2168 folder buf mes hilit reuse-buf
2170 (if (string= name "")
2171 (setq name wl-default-folder))
2172 (setq folder (wl-folder-get-elmo-folder name))
2173 (when (and (not (string=
2174 (and cur-fld (elmo-folder-name-internal cur-fld))
2175 (elmo-folder-name-internal folder))) ; folder is moved.
2176 (eq major-mode 'wl-summary-mode)) ; called in summary.
2177 (setq wl-summary-last-visited-folder (wl-summary-buffer-folder-name))
2178 (run-hooks 'wl-summary-exit-pre-hook)
2179 (if (or force-exit (not (wl-summary-sticky-p)))
2180 (wl-summary-cleanup-temp-marks (wl-summary-sticky-p)))
2181 (wl-summary-save-view)
2182 (elmo-folder-commit wl-summary-buffer-elmo-folder)
2183 (if (and (wl-summary-sticky-p) force-exit)
2184 (kill-buffer (current-buffer))))
2185 (setq buf (wl-summary-get-buffer-create (elmo-folder-name-internal folder)
2190 (string= (elmo-folder-name-internal folder)
2191 (wl-summary-buffer-folder-name))))
2195 (switch-to-buffer buf)
2198 (delete-other-windows))
2200 (unless (eq major-mode 'wl-summary-mode)
2202 (wl-summary-buffer-set-folder folder)
2203 (setq wl-summary-buffer-disp-msg nil)
2204 (setq wl-summary-buffer-last-displayed-msg nil)
2205 (setq wl-summary-buffer-current-msg nil)
2206 (let ((inhibit-read-only t)
2207 (buffer-read-only nil))
2209 ;; Resume summary view
2210 (if wl-summary-cache-use
2211 (let* ((dir (elmo-folder-msgdb-path folder))
2212 (cache (expand-file-name wl-summary-cache-file dir))
2213 (view (expand-file-name wl-summary-view-file dir)))
2214 (when (file-exists-p cache)
2215 (insert-file-contents-as-binary cache)
2216 (elmo-set-buffer-multibyte
2217 default-enable-multibyte-characters)
2218 (decode-mime-charset-region
2219 (point-min)(point-max)
2220 wl-summary-buffer-mime-charset 'LF))
2221 (if (file-exists-p view)
2222 (setq wl-summary-buffer-view
2223 (wl-summary-load-file-object view))
2224 (setq wl-summary-buffer-view
2225 (or (wl-get-assoc-list-value
2226 wl-summary-default-view-alist
2227 (elmo-folder-name-internal folder))
2228 wl-summary-default-view)))
2229 (wl-thread-resume-entity folder)
2230 (wl-summary-open-folder folder)
2231 (wl-summary-detect-mark-position))
2232 (setq wl-summary-buffer-view
2233 (wl-summary-load-file-object
2234 (expand-file-name wl-summary-view-file
2235 (elmo-folder-msgdb-path folder))))
2236 (wl-summary-open-folder folder)
2237 (wl-summary-detect-mark-position)
2238 (wl-summary-rescan))
2239 (wl-summary-count-unread)
2240 (wl-summary-update-modeline)))
2241 (unless (eq wl-summary-buffer-view 'thread)
2242 (wl-summary-make-number-list))
2243 (when (and wl-summary-cache-use
2244 (or (and wl-summary-check-line-format
2245 (wl-summary-line-format-changed-p))
2246 (wl-summary-view-old-p)))
2247 (wl-summary-rescan))
2248 (wl-summary-toggle-disp-msg (if wl-summary-buffer-disp-msg 'on 'off))
2249 (unless (and reuse-buf keep-cursor)
2251 (let ((wl-use-scoring
2252 (if (or scoring interactive) wl-use-scoring)))
2253 (if (and (not scan-type)
2256 (setq scan-type (wl-summary-get-sync-range folder)))
2259 (wl-summary-sync 'unset-cursor))
2260 ((eq scan-type 'all)
2261 (wl-summary-sync 'unset-cursor "all"))
2262 ((eq scan-type 'no-sync))
2263 ((eq scan-type 'rescan)
2264 (wl-summary-rescan))
2265 ((or (eq scan-type 'force-update)
2266 (eq scan-type 'update))
2267 (setq mes (wl-summary-sync-force-update
2268 'unset-cursor 'no-check)))))
2270 (switch-to-buffer buf)
2272 ;; stick always-sticky-folder
2273 (when (wl-summary-always-sticky-folder-p folder)
2274 (or (wl-summary-sticky-p) (wl-summary-stick t)))
2275 (run-hooks 'wl-summary-prepared-pre-hook)
2276 (set-buffer-modified-p nil)
2277 (goto-char (point-min))
2278 (if (wl-summary-cursor-down t)
2279 (let ((unreadp (wl-summary-next-message
2280 (wl-summary-message-number)
2282 (cond ((and wl-auto-select-first
2283 (wl-summary-auto-select-msg-p unreadp))
2284 ;; wl-auto-select-first is non-nil and
2285 ;; unreadp is non-nil but not important
2286 (setq retval 'disp-msg))
2287 ((and wl-auto-prefetch-first
2288 (wl-summary-auto-select-msg-p unreadp))
2289 ;; wl-auto-select-first is non-nil and
2290 ;; unreadp is non-nil but not important
2291 (setq retval 'prefetch-msg))
2292 ((not (wl-summary-auto-select-msg-p unreadp))
2293 ;; unreadp is nil or important
2294 (setq retval 'more-next))))
2295 (goto-char (point-max))
2296 (if (elmo-folder-plugged-p folder)
2299 (setq retval 'more-next))
2300 (if (and wl-summary-highlight
2301 (not wl-summary-lazy-highlight)
2303 (if (and wl-summary-highlight-partial-threshold
2304 (> (count-lines (point-min) (point-max))
2305 wl-summary-highlight-partial-threshold))
2310 wl-summary-partial-highlight-above-lines
2311 wl-summary-highlight-partial-threshold)))
2312 (wl-highlight-summary (point) (point-max)))
2313 (wl-highlight-summary (point-min) (point-max))))
2314 (if (eq retval 'disp-msg)
2315 (wl-summary-redisplay))
2316 (if (eq retval 'prefetch-msg)
2317 (wl-message-buffer-prefetch
2319 (wl-summary-message-number)
2320 wl-message-buffer-prefetch-depth
2322 wl-summary-buffer-mime-charset))
2323 (if mes (message "%s" mes))
2324 (if (and interactive wl-summary-recenter)
2325 (recenter (/ (- (window-height) 2) 2))))))
2326 ;; set current entity-id
2329 (wl-folder-search-entity-by-name
2330 (elmo-folder-name-internal folder)
2333 ;; entity-id is unknown.
2334 (wl-folder-set-current-entity-id
2335 (wl-folder-get-entity-id entity)))
2336 (when (and wl-summary-lazy-highlight
2340 (run-hooks 'wl-summary-prepared-hook)
2341 (set-buffer-modified-p nil))
2344 (defun wl-summary-goto-previous-message-beginning ()
2346 (re-search-backward "\r\\(-?[0-9]+\\)" nil t)
2347 (beginning-of-line))
2349 (defun wl-summary-goto-top-of-current-thread ()
2350 (wl-summary-jump-to-msg
2351 (wl-thread-entity-get-number
2352 (wl-thread-entity-get-top-entity (wl-thread-get-entity
2353 (wl-summary-message-number))))))
2355 (defun wl-summary-goto-bottom-of-sub-thread (&optional depth)
2357 (let ((depth (or depth
2358 (wl-thread-get-depth-of-current-line))))
2360 (while (and (not (eobp))
2361 (>= (wl-thread-get-depth-of-current-line)
2364 (beginning-of-line)))
2366 (defun wl-summary-insert-line (line)
2367 "Insert LINE in the Summary."
2368 (if wl-use-highlight-mouse-line
2369 ;; remove 'mouse-face of current line.
2371 (save-excursion (beginning-of-line)(point))
2372 (save-excursion (end-of-line)(point))
2375 (if wl-use-highlight-mouse-line
2376 ;; remove 'mouse-face of current line.
2378 (save-excursion (beginning-of-line)(point))
2379 (save-excursion (end-of-line)(point))
2382 (run-hooks 'wl-summary-line-inserted-hook)))
2384 (defun wl-summary-insert-sequential (entity folder &rest args)
2385 (let ((inhibit-read-only t)
2386 (number (elmo-message-entity-number entity))
2388 (goto-char (point-max))
2389 (wl-summary-insert-line
2390 (wl-summary-create-line entity nil nil
2392 wl-summary-buffer-elmo-folder
2394 (elmo-message-cached-p
2395 wl-summary-buffer-elmo-folder
2397 (setq wl-summary-buffer-number-list
2398 (wl-append wl-summary-buffer-number-list
2399 (list (elmo-message-entity-number entity))))
2402 (defun wl-summary-default-subject-filter (subject)
2403 (setq subject (elmo-replace-in-string subject "[ \t]*\\(re\\|was\\)[:>]" ""))
2404 (setq subject (elmo-replace-in-string subject "[ \t]" ""))
2405 (elmo-replace-in-string subject "^\\[.*\\]" ""))
2407 (defun wl-summary-subject-equal (subject1 subject2)
2408 (string= (funcall wl-summary-subject-filter-function subject1)
2409 (funcall wl-summary-subject-filter-function subject2)))
2411 (defmacro wl-summary-put-alike (alike)
2412 (` (elmo-set-hash-val (format "#%d" (wl-count-lines))
2414 wl-summary-alike-hashtb)))
2416 (defmacro wl-summary-get-alike ()
2417 (` (elmo-get-hash-val (format "#%d" (wl-count-lines))
2418 wl-summary-alike-hashtb)))
2420 (defun wl-summary-insert-headers (folder func mime-decode)
2421 (let ((numbers (elmo-folder-list-messages folder nil t))
2423 (buffer-disable-undo (current-buffer))
2424 (make-local-variable 'wl-summary-alike-hashtb)
2425 (setq wl-summary-alike-hashtb (elmo-make-hash (* (length numbers) 2)))
2427 (elmo-set-buffer-multibyte default-enable-multibyte-characters))
2428 (while (setq ov (elmo-message-entity folder (pop numbers)))
2429 (setq this (funcall func ov))
2430 (and this (setq this (std11-unfold-string this)))
2431 (if (equal last this)
2432 (setq alike (cons ov alike))
2434 (wl-summary-put-alike alike)
2436 (setq alike (list ov)
2439 (wl-summary-put-alike alike)
2442 (decode-mime-charset-region (point-min) (point-max)
2444 (when (eq mime-decode 'mime)
2445 (eword-decode-region (point-min) (point-max))))
2446 (run-hooks 'wl-summary-insert-headers-hook)))
2448 (defun wl-summary-search-by-subject (entity folder)
2449 (let ((summary-buf (current-buffer))
2450 (buf (get-buffer-create wl-summary-search-buf-name))
2451 (folder-name (wl-summary-buffer-folder-name))
2452 match founds cur result)
2453 (with-current-buffer buf
2454 (let ((case-fold-search t))
2455 (when (or (not (string= wl-summary-search-buf-folder-name folder-name))
2456 (zerop (buffer-size)))
2457 (setq wl-summary-search-buf-folder-name folder-name)
2458 (message "Creating subject cache...")
2459 (wl-summary-insert-headers
2463 (funcall wl-summary-subject-filter-function
2464 (elmo-message-entity-field x 'subject))))
2466 (message "Creating subject cache...done"))
2467 (setq match (funcall wl-summary-subject-filter-function
2468 (elmo-message-entity-field entity 'subject
2470 (if (string= match "")
2472 (goto-char (point-max))
2473 (while (and (null result)
2474 (not (= (point) (point-min)))
2475 (search-backward match nil t))
2476 ;; check exactly match
2477 (when (and (bolp) (= (point-at-eol)(match-end 0)))
2478 (setq founds (wl-summary-get-alike))
2479 (with-current-buffer summary-buf
2482 ;; the first element of found-entity list exists on
2484 (wl-thread-get-entity
2485 (elmo-message-entity-number (car founds)))
2486 ;; message id is not same as myself.
2488 (elmo-message-entity-field entity 'message-id)
2489 (elmo-message-entity-field (car founds)
2491 ;; not a descendant.
2492 (not (wl-thread-descendant-p
2493 (elmo-message-entity-number entity)
2494 (elmo-message-entity-number (car founds)))))
2495 (setq result (car founds)
2497 (setq founds (cdr founds))))))
2500 (defun wl-summary-insert-thread (entity folder update
2501 &optional force-insert)
2503 this-id parent-entity parent-number relatives anumber
2504 cur number cur-entity linked retval delayed-entity
2505 update-list entity-stack)
2507 (setq this-id (elmo-message-entity-field entity 'message-id)
2509 (elmo-message-entity-parent folder entity)
2510 parent-number (elmo-message-entity-number parent-entity))
2511 (setq number (elmo-message-entity-number entity))
2513 ;; If thread loop detected, set parent as nil.
2516 (elmo-message-entity-number
2517 (setq cur (elmo-message-entity-parent folder cur))))
2518 (if (memq anumber relatives)
2519 (setq parent-number nil
2521 (setq relatives (cons
2522 (elmo-message-entity-number cur)
2524 (if (and parent-number
2525 (not (wl-thread-get-entity parent-number))
2527 ;; parent exists in overview, but not in wl-thread-entities
2529 (wl-append wl-summary-delayed-update
2530 (list (cons parent-number entity)))
2531 (setq entity nil)) ;; exit loop
2532 ;; Search parent by subject.
2533 (when (and (null parent-number)
2534 wl-summary-search-parent-by-subject-regexp
2536 wl-summary-search-parent-by-subject-regexp
2537 (elmo-message-entity-field entity 'subject)))
2538 (let ((found (wl-summary-search-by-subject entity folder)))
2540 (not (member found wl-summary-delayed-update)))
2541 (setq parent-entity found)
2543 (elmo-message-entity-number parent-entity))
2545 ;; If subject is change, divide thread.
2546 (if (and parent-number
2547 wl-summary-divide-thread-when-subject-changed
2548 (not (wl-summary-subject-equal
2549 (or (elmo-message-entity-field entity
2551 (or (elmo-message-entity-field parent-entity
2553 (setq parent-number nil))
2555 (wl-thread-insert-message entity
2556 number parent-number update linked))
2558 (wl-append update-list (list retval)))
2559 (setq entity nil) ; exit loop
2560 (while (setq delayed-entity (assq number wl-summary-delayed-update))
2561 (setq wl-summary-delayed-update
2562 (delq delayed-entity wl-summary-delayed-update))
2563 ;; update delayed message
2564 (wl-append entity-stack (list (cdr delayed-entity)))))
2565 (if (and (not entity)
2567 (setq entity (pop entity-stack))))
2570 (defun wl-summary-update-thread (entity
2573 (let* ((this-id (elmo-message-entity-field entity 'message-id))
2574 (overview-entity entity)
2575 (parent-id (elmo-message-entity-field parent-entity 'message-id))
2576 (number (elmo-message-entity-number entity))
2577 (parent-number (elmo-message-entity-number parent-entity))
2580 ((or (not parent-id)
2581 (string= this-id parent-id))
2582 (goto-char (point-max))
2584 (setq insert-line t))
2585 ;; parent already exists in buffer.
2586 ((wl-summary-jump-to-msg parent-number)
2587 (wl-thread-goto-bottom-of-sub-thread)
2588 (setq insert-line t)))
2590 (let (buffer-read-only)
2591 (wl-summary-insert-line
2592 (wl-summary-create-line
2596 (elmo-message-flags wl-summary-buffer-elmo-folder number)
2597 (elmo-message-cached-p wl-summary-buffer-elmo-folder number)
2598 (wl-thread-maybe-get-children-num number)
2599 (wl-thread-make-indent-string thr-entity)
2600 (wl-thread-entity-get-linked thr-entity)))))))
2602 (defun wl-summary-target-mark-msgs (msgs)
2603 "Return the number of marked messages."
2605 (dolist (number msgs)
2606 (when (wl-summary-target-mark number)
2610 (defun wl-summary-pick (&optional from-list delete-marks)
2613 (let* ((condition (car (elmo-parse-search-condition
2614 (elmo-read-search-condition
2615 wl-summary-pick-field-default))))
2616 (result (elmo-folder-search wl-summary-buffer-elmo-folder
2621 (let ((mlist wl-summary-buffer-target-mark-list))
2623 (when (wl-summary-jump-to-msg (car mlist))
2624 (wl-summary-unmark))
2625 (setq mlist (cdr mlist)))
2626 (setq wl-summary-buffer-target-mark-list nil)))
2628 (setq num (wl-summary-target-mark-msgs result))
2630 (if (= num (length result))
2631 (message "%d message(s) are picked." num)
2632 (message "%d(%d) message(s) are picked." num
2633 (- (length result) num)))
2634 (message "No message was picked.")))))
2636 (defun wl-summary-unvirtual ()
2637 "Exit from current virtual folder."
2640 (elmo-folder-type-internal wl-summary-buffer-elmo-folder))
2641 (wl-summary-goto-folder-subr
2642 (elmo-folder-name-internal
2643 (elmo-filter-folder-target-internal
2644 wl-summary-buffer-elmo-folder))
2646 (error "This folder is not filtered")))
2648 (defun wl-summary-virtual (&optional arg)
2649 "Goto virtual folder.
2650 If ARG, exit virtual folder."
2653 (wl-summary-unvirtual)
2654 (wl-summary-goto-folder-subr (concat "/"
2655 (elmo-read-search-condition
2656 wl-summary-pick-field-default)
2658 (wl-summary-buffer-folder-name))
2660 (run-hooks 'wl-summary-virtual-hook)))
2662 (defun wl-summary-delete-all-temp-marks (&optional no-msg force)
2663 "Erase all temp marks from buffer."
2665 (when (or wl-summary-buffer-target-mark-list
2666 wl-summary-buffer-temp-mark-list
2669 (goto-char (point-min))
2671 (message "Unmarking..."))
2673 (wl-summary-unset-mark nil nil force)
2676 (message "Unmarking...done"))
2677 (setq wl-summary-buffer-target-mark-list nil)
2678 (setq wl-summary-buffer-temp-mark-list nil))))
2680 (defsubst wl-summary-temp-mark ()
2681 "Return temp-mark string of current line."
2682 (let ((number (wl-summary-message-number))
2684 (or (and (wl-summary-have-target-mark-p number)
2686 (and (setq info (wl-summary-registered-temp-mark number))
2688 (wl-summary-get-score-mark number)
2691 (defsubst wl-summary-persistent-mark-string (folder flags cached)
2692 "Return the persistent mark string.
2693 The mark is decided according to the FOLDER, FLAGS and CACHED."
2694 (let ((priorities wl-summary-flag-priority-list)
2696 (while (and (null mark) priorities)
2697 (when (memq (car priorities) flags)
2699 (case (car priorities)
2701 wl-summary-new-mark)
2703 wl-summary-important-mark)
2706 wl-summary-answered-cached-mark
2707 wl-summary-answered-uncached-mark))
2710 wl-summary-unread-cached-mark
2711 wl-summary-unread-uncached-mark)))))
2712 (setq priorities (cdr priorities)))
2714 (if (or cached (elmo-folder-local-p folder))
2716 wl-summary-read-uncached-mark))))
2718 (defsubst wl-summary-message-mark (folder number)
2719 "Return mark of the message."
2721 (wl-summary-persistent-mark-string
2723 (elmo-message-flags folder number)
2724 (elmo-message-cached-p folder number))))
2726 (defsubst wl-summary-persistent-mark ()
2727 "Return persistent-mark string of current line."
2728 (or (wl-summary-message-mark wl-summary-buffer-elmo-folder
2729 (wl-summary-message-number))
2732 (defun wl-summary-put-temp-mark (mark)
2733 "Put temp MARK on current line."
2734 (when wl-summary-buffer-temp-mark-column
2737 (let ((inhibit-read-only t)
2738 (buffer-read-only nil))
2739 (move-to-column wl-summary-buffer-temp-mark-column)
2740 (delete-backward-char 1)
2743 (defun wl-summary-next-buffer ()
2744 "Switch to next summary buffer."
2746 (let ((buffers (sort (wl-collect-summary)
2747 (lambda (buffer1 buffer2)
2748 (string-lessp (buffer-name buffer1)
2749 (buffer-name buffer2))))))
2751 (or (cadr (memq (current-buffer) buffers))
2754 (defun wl-summary-previous-buffer ()
2755 "Switch to previous summary buffer."
2757 (let ((buffers (sort (wl-collect-summary)
2758 (lambda (buffer1 buffer2)
2759 (not (string-lessp (buffer-name buffer1)
2760 (buffer-name buffer2)))))))
2762 (or (cadr (memq (current-buffer) buffers))
2765 (defun wl-summary-target-mark-mark-as-read ()
2768 (goto-char (point-min))
2769 (let ((inhibit-read-only t)
2770 (buffer-read-only nil)
2771 wl-summary-buffer-disp-msg)
2772 (wl-summary-mark-as-read wl-summary-buffer-target-mark-list)
2773 (dolist (number wl-summary-buffer-target-mark-list)
2774 (wl-summary-unset-mark number)))))
2776 (defun wl-summary-target-mark-mark-as-unread ()
2779 (goto-char (point-min))
2780 (let ((inhibit-read-only t)
2781 (buffer-read-only nil)
2782 wl-summary-buffer-disp-msg)
2783 (wl-summary-mark-as-unread wl-summary-buffer-target-mark-list)
2784 (dolist (number wl-summary-buffer-target-mark-list)
2785 (wl-summary-unset-mark number)))))
2787 (defun wl-summary-target-mark-mark-as-important ()
2790 (goto-char (point-min))
2791 (let ((inhibit-read-only t)
2792 (buffer-read-only nil)
2793 wl-summary-buffer-disp-msg)
2794 (dolist (number wl-summary-buffer-target-mark-list)
2795 (wl-summary-unset-mark number)
2796 (wl-summary-mark-as-important number))
2797 (wl-summary-count-unread)
2798 (wl-summary-update-modeline))))
2800 (defun wl-summary-target-mark-save ()
2803 (wl-read-directory-name "Save to directory: "
2804 wl-temporary-file-directory))
2806 (if (null (file-exists-p wl-save-dir))
2807 (make-directory wl-save-dir))
2808 (while (setq number (car wl-summary-buffer-target-mark-list))
2809 (wl-thread-jump-to-msg number)
2810 (wl-summary-save t wl-save-dir)
2811 (wl-summary-unmark))))
2813 (defun wl-summary-target-mark-pick ()
2815 (wl-summary-pick wl-summary-buffer-target-mark-list 'delete))
2817 (defun wl-summary-update-persistent-mark ()
2818 "Synch up persistent mark of current line with msgdb's.
2819 Return non-nil if the mark is updated"
2820 (if wl-summary-buffer-persistent-mark-column
2822 (move-to-column wl-summary-buffer-persistent-mark-column)
2823 (let ((inhibit-read-only t)
2824 (buffer-read-only nil)
2825 (mark (buffer-substring (- (point) 1) (point)))
2826 (new-mark (wl-summary-persistent-mark)))
2827 (unless (string= new-mark mark)
2828 (delete-backward-char 1)
2830 (when wl-summary-highlight
2831 (wl-highlight-summary-current-line))
2832 (set-buffer-modified-p nil)
2834 (when wl-summary-highlight
2835 (wl-highlight-summary-current-line))
2836 (set-buffer-modified-p nil)))
2838 (defsubst wl-summary-mark-as-read-internal (inverse
2843 (let ((folder wl-summary-buffer-elmo-folder)
2844 unread-message number
2845 number-list visible)
2846 (setq number-list (cond ((numberp number-or-numbers)
2847 (setq unread-message
2848 (elmo-message-flagged-p
2852 (list number-or-numbers))
2853 ((and (not (null number-or-numbers))
2854 (listp number-or-numbers))
2856 ((setq number (wl-summary-message-number))
2858 (setq unread-message
2859 (elmo-message-flagged-p
2864 (if (null number-list)
2865 (message "No message.")
2867 (elmo-folder-unflag-read folder number-list no-folder-mark)
2868 (elmo-folder-flag-as-read folder number-list no-folder-mark))
2869 (dolist (number number-list)
2870 (setq visible (wl-summary-jump-to-msg number))
2872 (when unread-message
2873 (run-hooks 'wl-summary-unread-message-hook)))
2874 ;; set mark on buffer
2876 (wl-summary-update-persistent-mark)))
2877 (unless no-modeline-update
2878 ;; Update unread numbers.
2879 ;; should elmo-folder-flag-as-read return unread numbers?
2880 (wl-summary-count-unread)
2881 (wl-summary-update-modeline)
2882 (wl-folder-update-unread
2883 (wl-summary-buffer-folder-name)
2884 (+ wl-summary-buffer-unread-count
2885 wl-summary-buffer-new-count)))))))
2887 (defun wl-summary-mark-as-read (&optional number-or-numbers
2891 (wl-summary-mark-as-read-internal nil
2894 no-modeline-update))
2896 (defun wl-summary-mark-as-unread (&optional number-or-numbers
2900 (wl-summary-mark-as-read-internal 'inverse
2903 no-modeline-update))
2905 (defsubst wl-summary-mark-as-answered-internal (inverse
2909 (let ((folder wl-summary-buffer-elmo-folder)
2910 number number-list visible)
2911 (setq number-list (cond ((numberp number-or-numbers)
2912 (list number-or-numbers))
2913 ((and (not (null number-or-numbers))
2914 (listp number-or-numbers))
2916 ((setq number (wl-summary-message-number))
2919 (if (null number-list)
2920 (message "No message.")
2922 (elmo-folder-unflag-answered folder number-list)
2923 (elmo-folder-flag-as-answered folder number-list))
2924 (dolist (number number-list)
2925 (setq visible (wl-summary-jump-to-msg number))
2926 ;; set mark on buffer
2928 (wl-summary-update-persistent-mark)))
2929 (unless no-modeline-update
2930 ;; Update unread numbers.
2931 ;; should elmo-flag-mark-as-read return unread numbers?
2932 (wl-summary-count-unread)
2933 (wl-summary-update-modeline)
2934 (wl-folder-update-unread
2935 (wl-summary-buffer-folder-name)
2936 (+ wl-summary-buffer-unread-count
2937 wl-summary-buffer-new-count)))))))
2939 (defun wl-summary-mark-as-answered (&optional number-or-numbers
2942 (wl-summary-mark-as-answered-internal
2943 (and (interactive-p)
2944 (elmo-message-flagged-p wl-summary-buffer-elmo-folder
2945 (wl-summary-message-number)
2948 no-modeline-update))
2950 (defun wl-summary-mark-as-unanswered (&optional number-or-numbers
2952 (wl-summary-mark-as-answered-internal 'inverse
2954 no-modeline-update))
2956 (defun wl-summary-mark-as-important (&optional number
2960 (if (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
2962 (error "Cannot process mark in this folder"))
2964 (let* ((folder wl-summary-buffer-elmo-folder)
2965 message-id visible cur-mark)
2967 (setq visible (wl-summary-jump-to-msg number))
2968 (setq cur-mark (or mark
2969 (wl-summary-message-mark
2970 wl-summary-buffer-elmo-folder number)
2972 ((setq number (wl-summary-message-number))
2974 (setq cur-mark (or mark (wl-summary-persistent-mark))))
2976 (error "No message")))
2978 ;; already exists in msgdb.
2979 (elmo-message-entity wl-summary-buffer-elmo-folder
2981 (setq message-id (elmo-message-field
2982 wl-summary-buffer-elmo-folder
2985 (if (string= cur-mark wl-summary-important-mark)
2989 (elmo-folder-unflag-important folder (list number)
2991 ;; Remove cache if local folder.
2992 (if (and (elmo-folder-local-p folder)
2994 (elmo-folder-type-internal folder))))
2995 (elmo-file-cache-delete
2996 (elmo-file-cache-get-path message-id)))))
2998 (elmo-folder-flag-as-important folder (list number)
3001 (wl-summary-update-persistent-mark))))
3005 (defvar wl-summary-line-formatter nil)
3007 (defun wl-summary-view-old-p ()
3008 "Return non-nil when summary view cache has old format."
3010 (goto-char (point-min))
3011 (and wl-summary-buffer-number-list
3012 (not (re-search-forward "\r-?[0-9]+" (point-at-eol) t)))))
3014 (defun wl-summary-line-format-changed-p ()
3015 "Return non-nil when summary line format is changed."
3017 wl-summary-buffer-line-format
3018 (or (elmo-object-load (expand-file-name
3019 wl-summary-line-format-file
3020 (elmo-folder-msgdb-path
3021 wl-summary-buffer-elmo-folder))
3022 wl-summary-buffer-mime-charset)
3023 wl-summary-buffer-line-format))))
3025 (defun wl-summary-line-format-save ()
3026 "Save current summary line format."
3028 (expand-file-name wl-summary-line-format-file
3029 (elmo-folder-msgdb-path
3030 wl-summary-buffer-elmo-folder))
3031 wl-summary-buffer-line-format
3032 wl-summary-buffer-mime-charset))
3034 (defun wl-summary-line-number ()
3035 (wl-set-string-width
3036 (- wl-summary-buffer-number-column)
3038 (elmo-message-entity-number wl-message-entity))))
3040 (defun wl-summary-line-year ()
3041 (aref wl-datevec 0))
3042 (defun wl-summary-line-month ()
3043 (format "%02d" (aref wl-datevec 1)))
3044 (defun wl-summary-line-day ()
3045 (format "%02d" (aref wl-datevec 2)))
3046 (defun wl-summary-line-day-of-week ()
3048 (elmo-date-get-week (aref wl-datevec 0)
3050 (aref wl-datevec 2))
3052 (defun wl-summary-line-hour ()
3053 (format "%02d" (aref wl-datevec 3)))
3054 (defun wl-summary-line-minute ()
3055 (format "%02d" (aref wl-datevec 4)))
3057 (defun wl-summary-line-size ()
3058 (let ((size (elmo-message-entity-field wl-message-entity 'size)))
3061 ((<= 1 (/ size 1048576))
3062 (format "%.0fM" (/ size 1048576.0)))
3063 ((<= 1 (/ size 1024))
3064 (format "%.0fK" (/ size 1024.0)))
3065 (t (format "%dB" size)))
3068 (defun wl-summary-line-subject ()
3069 (let (no-parent subject parent-raw-subject parent-subject)
3070 (if (string= wl-thr-indent-string "")
3071 (setq no-parent t)) ; no parent
3073 (elmo-delete-char ?\n
3074 (or (elmo-message-entity-field
3077 wl-summary-no-subject-message)))
3078 (setq parent-raw-subject
3079 (elmo-message-entity-field wl-parent-message-entity
3081 (setq parent-subject
3082 (if parent-raw-subject
3083 (elmo-delete-char ?\n parent-raw-subject)))
3085 (null parent-subject)
3086 (not (wl-summary-subject-equal
3087 subject parent-subject)))
3088 (funcall wl-summary-subject-function subject)
3091 (defun wl-summary-line-from ()
3092 (elmo-delete-char ?\n
3093 (funcall wl-summary-from-function
3094 (elmo-message-entity-field
3098 (defun wl-summary-line-list-info ()
3099 (let ((list-info (wl-summary-get-list-info wl-message-entity)))
3101 (format (if (cdr list-info) "(%s %05.0f)" "(%s)")
3102 (car list-info) (cdr list-info))
3105 (defun wl-summary-line-list-count ()
3106 (let ((ml-count (cdr (wl-summary-get-list-info wl-message-entity))))
3108 (format "%.0f" ml-count)
3111 (defun wl-summary-line-attached ()
3112 (let ((content-type (elmo-message-entity-field
3113 wl-message-entity 'content-type))
3114 (case-fold-search t))
3115 (if (and content-type
3116 (string-match "multipart/mixed" content-type))
3121 ;;(defun wl-summary-line-cached ()
3122 ;; (if (elmo-message-cached-p wl-summary-buffer-elmo-folder
3123 ;; (elmo-message-entity-number wl-message-entity))
3127 (defun wl-summary-create-line (wl-message-entity
3128 wl-parent-message-entity
3133 wl-thr-children-number
3134 wl-thr-indent-string
3136 "Create a summary line."
3137 (let ((wl-mime-charset wl-summary-buffer-mime-charset)
3138 (wl-persistent-mark (wl-summary-persistent-mark-string
3139 wl-summary-buffer-elmo-folder
3142 (elmo-mime-charset wl-summary-buffer-mime-charset)
3143 (elmo-lang wl-summary-buffer-weekday-name-lang)
3144 (wl-datevec (or (ignore-errors (timezone-fix-time
3145 (elmo-message-entity-field
3149 wl-summary-fix-timezone))
3151 (entity wl-message-entity) ; backward compatibility.
3153 (if (and wl-thr-indent-string
3154 wl-summary-indent-length-limit
3155 (< wl-summary-indent-length-limit
3156 (string-width wl-thr-indent-string)))
3157 (setq wl-thr-indent-string (wl-set-string-width
3158 wl-summary-indent-length-limit
3159 wl-thr-indent-string)))
3160 (setq line (funcall wl-summary-buffer-line-formatter))
3161 (if wl-summary-width (setq line
3162 (wl-set-string-width
3163 (- wl-summary-width 1) line nil
3165 (setq line (concat line
3168 (elmo-message-entity-number
3169 wl-message-entity))))
3170 (if wl-summary-highlight
3171 (wl-highlight-summary-line-string
3172 (elmo-message-entity-number wl-message-entity)
3176 wl-thr-indent-string))
3179 (defsubst wl-summary-proc-wday (wday-str year month mday)
3181 (if (string-match "\\([A-Z][a-z][a-z]\\).*" wday-str)
3182 (wl-match-string 1 wday-str)
3183 (elmo-date-get-week year month mday))))
3185 (defvar wl-summary-move-spec-alist
3190 (unread . ((t . nil)
3194 (defsubst wl-summary-next-message (num direction hereto)
3195 (if wl-summary-buffer-next-message-function
3196 (funcall wl-summary-buffer-next-message-function num direction hereto)
3197 (let ((cur-spec (cdr (assq wl-summary-move-order
3198 wl-summary-move-spec-alist)))
3199 (nums (memq num (if (eq direction 'up)
3200 (reverse wl-summary-buffer-number-list)
3201 wl-summary-buffer-number-list)))
3203 (unless hereto (setq nums (cdr nums)))
3209 (cond ((eq (car (car cur-spec)) 'p)
3210 (if (setq flagged-list
3211 (elmo-folder-list-flagged
3212 wl-summary-buffer-elmo-folder
3213 (cdr (car cur-spec))))
3215 (if (and (memq (car nums) flagged-list)
3216 (elmo-message-accessible-p
3217 wl-summary-buffer-elmo-folder
3219 (throw 'done (car nums)))
3220 (setq nums (cdr nums)))))
3221 ((eq (car (car cur-spec)) 't)
3222 (if wl-summary-buffer-target-mark-list
3224 (if (memq (car nums)
3225 wl-summary-buffer-target-mark-list)
3226 (throw 'done (car nums)))
3227 (setq nums (cdr nums))))))
3228 (setq cur-spec (cdr cur-spec))))
3231 (defsubst wl-summary-cursor-move (direction hereto)
3232 (when (and (eq direction 'up)
3237 (when (setq num (wl-summary-next-message (wl-summary-message-number)
3240 (wl-thread-jump-to-msg num))
3243 ;; Goto unread or important
3244 ;; returns t if next message exists in this folder.
3245 (defun wl-summary-cursor-down (&optional hereto)
3247 (wl-summary-cursor-move 'down hereto))
3249 (defun wl-summary-cursor-up (&optional hereto)
3251 (wl-summary-cursor-move 'up hereto))
3253 (defun wl-summary-save-view-cache ()
3255 (let* ((dir (elmo-folder-msgdb-path wl-summary-buffer-elmo-folder))
3256 (cache (expand-file-name wl-summary-cache-file dir))
3257 (view (expand-file-name wl-summary-view-file dir))
3258 (save-view wl-summary-buffer-view)
3259 (mark-list (copy-sequence wl-summary-buffer-target-mark-list))
3260 (temp-list (copy-sequence wl-summary-buffer-temp-mark-list))
3261 (tmp-buffer (get-buffer-create " *wl-summary-save-view-cache*"))
3262 (temp-column wl-summary-buffer-temp-mark-column)
3263 (charset wl-summary-buffer-mime-charset))
3264 (if (file-directory-p dir)
3266 (if (file-exists-p dir)
3267 (error "File %s already exists" dir)
3268 (elmo-make-directory dir)))
3269 (if (eq save-view 'thread)
3270 (wl-thread-save-entity dir))
3271 (when wl-summary-check-line-format
3272 (wl-summary-line-format-save))
3275 (when (file-writable-p cache)
3276 (copy-to-buffer tmp-buffer (point-min) (point-max))
3277 (with-current-buffer tmp-buffer
3279 (make-local-variable 'wl-summary-highlight)
3280 (setq wl-summary-highlight nil
3281 wl-summary-buffer-target-mark-list mark-list
3282 wl-summary-buffer-temp-mark-list temp-list
3283 wl-summary-buffer-temp-mark-column temp-column)
3284 (wl-summary-delete-all-temp-marks 'no-msg 'force)
3285 (encode-coding-region
3286 (point-min) (point-max)
3288 ;; one in mcs-ltn1(apel<10.4) cannot take 2 arg.
3289 (mime-charset-to-coding-system charset 'LF))
3290 ;; Mule 2 doesn't have `*ctext*unix'.
3291 (mime-charset-to-coding-system charset)))
3292 (write-region-as-binary (point-min)(point-max)
3293 cache nil 'no-msg)))
3294 (when (file-writable-p view) ; 'thread or 'sequence
3296 (set-buffer tmp-buffer)
3298 (prin1 save-view tmp-buffer)
3299 (princ "\n" tmp-buffer)
3300 (write-region (point-min) (point-max) view nil 'no-msg))))
3302 (kill-buffer tmp-buffer)))))
3304 (defsubst wl-summary-get-sync-range (folder)
3306 (elmo-folder-plugged-p folder)
3307 (wl-get-assoc-list-value
3308 wl-folder-sync-range-alist
3309 (elmo-folder-name-internal folder)))
3310 wl-default-sync-range)))
3312 ;; redefined for wl-summary-sync-update
3313 (defun wl-summary-input-range (folder)
3314 "returns update or all or rescan."
3315 ;; for the case when parts are expanded in the bottom of the folder
3316 (let ((input-range-list '("no-sync"
3327 (default (or (wl-get-assoc-list-value
3328 wl-folder-sync-range-alist
3330 wl-default-sync-range))
3333 (completing-read (format "Range (%s): " default)
3335 (function (lambda (x) (cons x x)))
3337 (if (string= range "")
3341 (defun wl-summary-toggle-disp-folder (&optional arg)
3343 (let ((cur-buf (current-buffer))
3344 (summary-win (get-buffer-window (current-buffer)))
3348 (setq wl-summary-buffer-disp-folder t)
3349 ;; hide your folder window
3350 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3351 (if (setq fld-win (get-buffer-window fld-buf))
3352 (delete-window fld-win))))
3354 (setq wl-summary-buffer-disp-folder nil)
3355 ;; hide your wl-message window!
3356 (when (buffer-live-p wl-message-buffer)
3357 (wl-message-select-buffer wl-message-buffer)
3359 (select-window (get-buffer-window cur-buf))
3360 ;; display wl-folder window!!
3361 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3362 (if (setq fld-win (get-buffer-window fld-buf))
3363 ;; folder win is already displayed.
3364 (select-window fld-win)
3365 ;; folder win is not displayed.
3366 (switch-to-buffer fld-buf))
3369 ;; temporarily delete summary-win.
3371 (delete-window summary-win))
3372 (split-window-horizontally wl-folder-window-width)
3374 (switch-to-buffer cur-buf))
3376 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3377 (if (setq fld-win (get-buffer-window fld-buf))
3378 (setq wl-summary-buffer-disp-folder nil)
3379 (setq wl-summary-buffer-disp-folder t)))
3380 (if (not wl-summary-buffer-disp-folder)
3381 ;; hide message window
3382 (let ((mes-win (and wl-message-buffer
3383 (get-buffer-window wl-message-buffer)))
3384 (wl-stay-folder-window t))
3385 (if mes-win (delete-window mes-win))
3386 ;; hide your folder window
3387 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3388 (if (setq fld-win (get-buffer-window fld-buf))
3390 (delete-window (get-buffer-window cur-buf))
3391 (select-window fld-win)
3392 (switch-to-buffer cur-buf))))
3393 (run-hooks 'wl-summary-toggle-disp-folder-off-hook)
3394 ;; resume message window.
3396 (wl-message-select-buffer wl-message-buffer)
3397 (run-hooks 'wl-summary-toggle-disp-folder-message-resumed-hook)
3398 (select-window (get-buffer-window cur-buf))))
3399 ;; hide message window
3400 (let ((wl-stay-folder-window t)
3401 (mes-win (and wl-message-buffer
3402 (get-buffer-window wl-message-buffer))))
3403 (if mes-win (delete-window mes-win))
3404 (select-window (get-buffer-window cur-buf))
3405 ;; display wl-folder window!!
3406 (if (setq fld-buf (get-buffer wl-folder-buffer-name))
3407 (if (setq fld-win (get-buffer-window fld-buf))
3408 ;; folder win is already displayed.
3409 (select-window fld-win)
3410 ;; folder win is not displayed...occupy all.
3411 (switch-to-buffer fld-buf))
3414 (split-window-horizontally wl-folder-window-width)
3416 (switch-to-buffer cur-buf)
3417 ;; resume message window.
3418 (run-hooks 'wl-summary-toggle-disp-folder-on-hook)
3420 (wl-message-select-buffer wl-message-buffer)
3421 (run-hooks 'wl-summary-toggle-disp-folder-message-resumed-hook)
3422 (select-window (get-buffer-window cur-buf))))))))
3423 (run-hooks 'wl-summary-toggle-disp-folder-hook))
3425 (defun wl-summary-toggle-disp-msg (&optional arg)
3427 (let ((cur-buf (current-buffer))
3432 (setq wl-summary-buffer-disp-msg t)
3434 ;; hide your folder window
3435 (if (and (not wl-stay-folder-window)
3436 (setq fld-buf (get-buffer wl-folder-buffer-name)))
3437 (if (setq fld-win (get-buffer-window fld-buf))
3438 (unless (one-window-p fld-win)
3439 (delete-window fld-win))))))
3441 (wl-delete-all-overlays)
3442 (setq wl-summary-buffer-disp-msg nil)
3444 (when (buffer-live-p wl-message-buffer)
3445 (wl-message-select-buffer wl-message-buffer)
3447 (and (get-buffer-window cur-buf)
3448 (select-window (get-buffer-window cur-buf))))
3449 (run-hooks 'wl-summary-toggle-disp-off-hook)))
3451 (if (and wl-message-buffer
3452 (get-buffer-window wl-message-buffer)) ; already displayed
3453 (setq wl-summary-buffer-disp-msg nil)
3454 (setq wl-summary-buffer-disp-msg t))
3455 (if wl-summary-buffer-disp-msg
3457 (wl-summary-redisplay)
3458 ;;; hide your folder window
3459 ;;; (setq fld-buf (get-buffer wl-folder-buffer-name))
3460 ;;; (if (setq fld-win (get-buffer-window fld-buf))
3461 ;;; (delete-window fld-win)))
3462 (run-hooks 'wl-summary-toggle-disp-on-hook))
3463 (wl-delete-all-overlays)
3465 (wl-message-select-buffer wl-message-buffer)
3467 (select-window (get-buffer-window cur-buf))
3468 (setq wl-message-buffer nil)
3469 (run-hooks 'wl-summary-toggle-disp-off-hook))
3470 ;;; (switch-to-buffer cur-buf)
3472 (when wl-summary-lazy-highlight
3473 (wl-highlight-summary-window))))
3475 (defun wl-summary-next-line-content ()
3476 "Show next line of the message."
3478 (let ((cur-buf (current-buffer)))
3479 (wl-summary-toggle-disp-msg 'on)
3480 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3481 (set-buffer cur-buf)
3482 (wl-message-next-page 1))))
3484 (defun wl-summary-prev-line-content ()
3486 (let ((cur-buf (current-buffer)))
3487 (wl-summary-toggle-disp-msg 'on)
3488 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3489 (set-buffer cur-buf)
3490 (wl-message-prev-page 1))))
3492 (defun wl-summary-next-page ()
3494 (let ((cur-buf (current-buffer)))
3495 (wl-summary-toggle-disp-msg 'on)
3496 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3497 (set-buffer cur-buf)
3498 (wl-message-next-page))))
3500 (defun wl-summary-prev-page ()
3502 (let ((cur-buf (current-buffer)))
3503 (wl-summary-toggle-disp-msg 'on)
3504 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3505 (set-buffer cur-buf)
3506 (wl-message-prev-page))))
3508 (defsubst wl-summary-no-mime-p (folder)
3509 (wl-string-match-member (elmo-folder-name-internal folder)
3510 wl-summary-no-mime-folder-list))
3512 (defun wl-summary-set-message-buffer-or-redisplay (&rest args)
3513 "Set message buffer.
3514 If message is not displayed yet, display it.
3515 Return t if message exists."
3516 (let ((folder wl-summary-buffer-elmo-folder)
3517 (number (wl-summary-message-number))
3518 cur-folder cur-number message-last-pos)
3519 (when (buffer-live-p wl-message-buffer)
3520 (save-window-excursion
3521 (wl-message-select-buffer wl-message-buffer)
3522 (setq cur-folder wl-message-buffer-cur-folder)
3523 (setq cur-number wl-message-buffer-cur-number)))
3524 (if (and (string= (elmo-folder-name-internal folder) (or cur-folder ""))
3525 (eq number (or cur-number 0)))
3527 (set-buffer wl-message-buffer)
3529 (if (wl-summary-no-mime-p folder)
3530 (wl-summary-redisplay-no-mime-internal folder number)
3531 (wl-summary-redisplay-internal folder number))
3532 (when (buffer-live-p wl-message-buffer)
3533 (set-buffer wl-message-buffer))
3536 (defun wl-summary-target-mark-forward (&optional arg)
3538 (let ((mlist (nreverse wl-summary-buffer-target-mark-list))
3539 (summary-buf (current-buffer))
3540 (wl-draft-forward t)
3543 (wl-summary-jump-to-msg (car mlist))
3544 (wl-summary-forward t)
3545 (setq start-point (point))
3546 (setq draft-buf (current-buffer))
3547 (setq mlist (cdr mlist))
3548 (save-window-excursion
3551 (set-buffer summary-buf)
3552 (wl-summary-jump-to-msg (car mlist))
3553 (wl-summary-redisplay)
3554 (set-buffer draft-buf)
3555 (goto-char (point-max))
3556 (wl-draft-insert-message)
3557 (setq mlist (cdr mlist)))
3558 (wl-draft-body-goto-top)
3559 (wl-draft-enclose-digest-region (point) (point-max)))
3560 (goto-char start-point)
3562 (set-buffer summary-buf)
3563 (wl-summary-delete-all-temp-marks)))
3564 (run-hooks 'wl-mail-setup-hook)))
3566 (defun wl-summary-target-mark-reply-with-citation (&optional arg)
3568 (let ((mlist (nreverse wl-summary-buffer-target-mark-list))
3569 (summary-buf (current-buffer))
3570 change-major-mode-hook
3573 (wl-summary-jump-to-msg (car mlist))
3574 (when (wl-summary-reply arg t)
3575 (goto-char (point-max))
3576 (setq start-point (point-marker))
3577 (setq draft-buf (current-buffer))
3578 (save-window-excursion
3580 (set-buffer summary-buf)
3581 (delete-other-windows)
3582 (wl-summary-jump-to-msg (car mlist))
3583 (wl-summary-redisplay)
3584 (set-buffer draft-buf)
3585 (goto-char (point-max))
3586 (wl-draft-yank-original)
3587 (setq mlist (cdr mlist)))
3588 (goto-char start-point)
3590 (set-buffer summary-buf)
3591 (wl-summary-delete-all-temp-marks)))
3592 (wl-draft-reply-position wl-draft-reply-default-position)
3593 (run-hooks 'wl-mail-setup-hook))))
3595 (defun wl-summary-reply-with-citation (&optional arg)
3597 (when (wl-summary-reply arg t)
3598 (goto-char (point-max))
3599 (wl-draft-yank-original)
3600 (wl-draft-reply-position wl-draft-reply-default-position)
3601 (run-hooks 'wl-mail-setup-hook)))
3603 (defun wl-summary-jump-to-msg-by-message-id (&optional id)
3605 (let* ((original (wl-summary-message-number))
3606 (msgid (elmo-string (or id (read-from-minibuffer "Message-ID: "))))
3607 (entity (elmo-message-entity wl-summary-buffer-elmo-folder msgid))
3609 (errmsg (format "No message with id \"%s\" in the folder." msgid)))
3610 (if (setq msg (elmo-message-entity-number entity))
3612 (wl-thread-jump-to-msg msg)
3615 (if (and elmo-use-database
3618 "No message with id \"%s\" in the database." msgid))
3619 (setq otherfld (elmo-database-msgid-get msgid)))
3620 (if (cdr (wl-summary-jump-to-msg-internal
3621 (car otherfld) (nth 1 otherfld) 'no-sync))
3623 ;; Back to original.
3624 (wl-summary-jump-to-msg-internal
3625 (wl-summary-buffer-folder-name) original 'no-sync))
3626 (cond ((eq wl-summary-search-via-nntp 'confirm)
3627 (require 'elmo-nntp)
3628 (message "Search message in nntp server \"%s\" <y/n/s(elect)>? "
3629 elmo-nntp-default-server)
3630 (setq schar (let ((cursor-in-echo-area t)) (read-char)))
3631 (cond ((eq schar ?y)
3632 (wl-summary-jump-to-msg-by-message-id-via-nntp msgid))
3634 (wl-summary-jump-to-msg-by-message-id-via-nntp
3636 (read-from-minibuffer "NNTP Server: ")))
3638 (message "%s" errmsg)
3640 ((or (eq wl-summary-search-via-nntp 'force)
3642 (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
3644 wl-summary-search-via-nntp))
3645 (wl-summary-jump-to-msg-by-message-id-via-nntp msgid))
3647 (message "%s" errmsg)
3650 (defun wl-summary-jump-to-msg-by-message-id-via-nntp (&optional id server-spec)
3652 (let* ((msgid (elmo-string (or id (read-from-minibuffer "Message-ID: "))))
3653 newsgroups folder ret
3654 user server port type spec)
3656 (if (string-match "^-" server-spec)
3657 (setq spec (wl-folder-get-elmo-folder server-spec)
3658 user (elmo-net-folder-user-internal spec)
3659 server (elmo-net-folder-server-internal spec)
3660 port (elmo-net-folder-port-internal spec)
3661 type (elmo-net-folder-stream-type-internal spec))
3662 (setq server server-spec)))
3663 (when (setq ret (elmo-nntp-get-newsgroup-by-msgid
3665 (or server elmo-nntp-default-server)
3666 (or user elmo-nntp-default-user)
3667 (or port elmo-nntp-default-port)
3668 (or type elmo-nntp-default-stream-type)))
3669 (setq newsgroups (elmo-nntp-parse-newsgroups ret))
3670 (setq folder (concat "-" (car newsgroups)
3671 (elmo-nntp-folder-postfix user server port type)))
3674 (if (wl-folder-entity-exists-p (car newsgroups)
3675 wl-folder-newsgroups-hashtb)
3677 (setq folder (concat "-" (car newsgroups)
3678 (elmo-nntp-folder-postfix
3679 user server port type)))))
3680 (setq newsgroups (cdr newsgroups)))))
3682 (wl-summary-jump-to-msg-internal folder nil 'update msgid)
3683 (message "No message id \"%s\" in nntp server \"%s\"."
3684 msgid (or server elmo-nntp-default-server))
3687 (defun wl-summary-jump-to-msg-internal (folder msg scan-type &optional msgid)
3688 (let (wl-auto-select-first entity)
3689 (if (or (string= folder (wl-summary-buffer-folder-name))
3692 "Message was found in the folder \"%s\". Jump to it? "
3696 (wl-summary-goto-folder-subr
3697 folder scan-type nil nil t)
3700 (elmo-message-entity-number
3701 (elmo-message-entity
3702 wl-summary-buffer-elmo-folder
3704 (setq entity (wl-folder-search-entity-by-name folder
3708 (wl-folder-set-current-entity-id
3709 (wl-folder-get-entity-id entity))))
3711 (message "Message was not found currently in this folder.")
3712 (setq msg (and (wl-thread-jump-to-msg msg) msg)))
3713 (cons folder msg)))))
3715 (defun wl-summary-jump-to-parent-message (arg)
3717 (let ((cur-buf (current-buffer))
3718 (disp-msg wl-summary-buffer-disp-msg)
3719 (number (wl-summary-message-number))
3720 (regexp "\\(<[^<>]*>\\)[ \t]*$")
3722 msg-id msg-num ref-list ref irt)
3724 (message "No message.")
3725 (when (eq wl-summary-buffer-view 'thread)
3726 (cond ((and arg (not (numberp arg)))
3728 (wl-thread-entity-get-number
3729 (wl-thread-entity-get-top-entity
3730 (wl-thread-get-entity number)))))
3731 ((and arg (numberp arg))
3733 (setq msg-num number)
3736 (wl-thread-entity-get-number
3737 (wl-thread-entity-get-parent-entity
3738 (wl-thread-get-entity msg-num))))
3741 (wl-thread-entity-get-number
3742 (wl-thread-entity-get-parent-entity
3743 (wl-thread-get-entity number)))))))
3744 (when (null msg-num)
3745 (wl-summary-set-message-buffer-or-redisplay)
3746 (set-buffer (wl-message-get-original-buffer))
3747 (message "Searching parent message...")
3748 (setq ref (std11-field-body "References")
3749 irt (std11-field-body "In-Reply-To"))
3751 ((and arg (not (numberp arg)) ref (not (string= ref ""))
3752 (string-match regexp ref))
3753 ;; The first message of the thread.
3754 (setq msg-id (wl-match-string 1 ref)))
3755 ;; "In-Reply-To:" has only one msg-id.
3756 ((and (null arg) irt (not (string= irt ""))
3757 (string-match regexp irt))
3758 (setq msg-id (wl-match-string 1 irt)))
3759 ((and (or (null arg) (numberp arg)) ref (not (string= ref ""))
3760 (string-match regexp ref))
3761 ;; "^" searching parent, "C-u 2 ^" looking for grandparent.
3762 (while (string-match regexp ref)
3765 (wl-match-string 1 ref))
3767 (setq ref (substring ref (match-end 0)))
3770 (if (null arg) (nth 0 ref-list) ;; previous
3771 (if (<= arg i) (nth (1- arg) ref-list)
3772 (nth i ref-list))))))
3773 (set-buffer cur-buf)
3774 (or disp-msg (wl-summary-toggle-disp-msg 'off)))
3775 (cond ((and (null msg-id) (null msg-num))
3776 (message "No parent message!")
3778 ((and msg-id (wl-summary-jump-to-msg-by-message-id msg-id))
3779 (if wl-summary-buffer-disp-msg (wl-summary-redisplay))
3780 (message "Searching parent message...done")
3782 ((and msg-num (wl-summary-jump-to-msg msg-num))
3783 (if wl-summary-buffer-disp-msg (wl-summary-redisplay))
3784 (message "Searching parent message...done")
3787 (message "Parent message was not found.")
3790 (defun wl-summary-reply (&optional arg without-setup-hook)
3791 "Reply to current message. Default is \"wide\" reply.
3792 Reply to author if invoked with ARG."
3794 (let ((folder wl-summary-buffer-elmo-folder)
3795 (number (wl-summary-message-number))
3796 (summary-buf (current-buffer))
3797 (winconf (current-window-configuration))
3801 (wl-summary-redisplay-internal folder number))
3802 (setq mes-buf wl-message-buffer)
3803 (wl-message-select-buffer wl-message-buffer)
3804 (set-buffer mes-buf)
3805 (goto-char (point-min))
3807 (when (setq mes-buf (wl-message-get-original-buffer))
3808 (wl-draft-reply mes-buf arg summary-buf number)
3809 (wl-draft-reply-position wl-draft-reply-default-position)
3810 (unless without-setup-hook
3811 (run-hooks 'wl-mail-setup-hook)))
3812 (error (set-window-configuration winconf)
3813 (signal (car err)(cdr err))))
3814 (with-current-buffer summary-buf
3815 (elmo-folder-flag-as-answered folder (list number))
3816 (wl-summary-update-persistent-mark))
3819 (defun wl-summary-write ()
3820 "Write a new draft from Summary."
3822 (wl-draft (list (cons 'To ""))
3823 nil nil nil nil (wl-summary-buffer-folder-name))
3824 (run-hooks 'wl-mail-setup-hook)
3825 (mail-position-on-field "To"))
3827 (defvar wl-summary-write-current-folder-functions
3828 '(wl-folder-get-newsgroups
3829 wl-folder-guess-mailing-list-by-refile-rule
3830 wl-folder-guess-mailing-list-by-folder-name)
3831 "Newsgroups or Mailing List address guess functions list.
3832 Call from `wl-summary-write-current-folder'.
3833 When guess function return nil, challenge next guess-function.")
3835 (defun wl-summary-write-current-folder (&optional folder)
3836 "Write message to current FOLDER's newsgroup or mailing-list.
3837 Use function list is `wl-summary-write-current-folder-functions'."
3839 ;; default FOLDER is current buffer folder
3840 (setq folder (or folder (wl-summary-buffer-folder-name)))
3841 (let ((func-list wl-summary-write-current-folder-functions)
3842 guess-list guess-func)
3844 (setq guess-list (funcall (car func-list) folder))
3845 (if (null guess-list)
3846 (setq func-list (cdr func-list))
3847 (setq guess-func (car func-list))
3848 (setq func-list nil)))
3849 (if (null guess-func)
3851 (unless (or (stringp (nth 0 guess-list))
3852 (stringp (nth 1 guess-list))
3853 (stringp (nth 2 guess-list)))
3854 (error "Invalid value return guess function `%s'"
3855 (symbol-name guess-func)))
3856 (wl-draft (list (cons 'To (nth 0 guess-list))
3857 (cons 'Cc (nth 1 guess-list))
3858 (cons 'Newsgroups (nth 2 guess-list)))
3859 nil nil nil nil folder)
3860 (run-hooks 'wl-mail-setup-hook)
3861 (mail-position-on-field "Subject"))))
3863 (defun wl-summary-forward (&optional without-setup-hook)
3866 (let ((folder wl-summary-buffer-elmo-folder)
3867 (number (wl-summary-message-number))
3868 (summary-buf (current-buffer))
3869 (wl-draft-forward t)
3873 (message "No message.")
3874 (if (and (elmo-message-use-cache-p folder number)
3875 (eq (elmo-file-cache-status
3876 (elmo-file-cache-get
3877 (elmo-message-field folder number 'message-id)))
3880 (wl-summary-redisplay-internal nil nil 'force-reload)
3881 (wl-summary-redisplay-internal folder number))
3882 (setq mes-buf wl-message-buffer)
3883 (wl-message-select-buffer mes-buf)
3884 ;; get original subject.
3887 (set-buffer summary-buf)
3889 (or (elmo-message-field folder number 'subject) ""))))
3890 (set-buffer mes-buf)
3891 (wl-draft-forward subject summary-buf)
3892 (unless without-setup-hook
3893 (run-hooks 'wl-mail-setup-hook)))))
3895 (defun wl-summary-click (e)
3900 (defun wl-summary-read ()
3901 "Proceed reading message in the summary buffer."
3903 (let ((cur-buf (current-buffer)))
3904 (wl-summary-toggle-disp-msg 'on)
3905 (when (wl-summary-set-message-buffer-or-redisplay 'ignore-original)
3906 (set-buffer cur-buf)
3907 (if (wl-message-next-page)
3908 (wl-summary-down t)))))
3910 (defsubst wl-summary-cursor-move-surface (downward interactive)
3911 (if wl-summary-move-direction-toggle
3912 (setq wl-summary-move-direction-downward downward))
3913 (let ((start (point))
3914 (skip-tmark-regexp (wl-regexp-opt wl-summary-skip-mark-list))
3916 (column (current-column))
3917 goto-next next-entity finfo)
3920 (not (if downward (eobp) (bobp))))
3924 (setq skip (or (string-match skip-tmark-regexp
3925 (wl-summary-temp-mark))
3926 (not (elmo-message-accessible-p
3927 wl-summary-buffer-elmo-folder
3928 (wl-summary-message-number))))))
3929 (if (if downward (eobp) (and (bobp) skip)) (setq goto-next t))
3930 (if (or (eobp) (and (bobp) skip))
3932 (move-to-column column)
3935 (if wl-summary-buffer-disp-msg
3936 (wl-summary-redisplay))
3939 ((and (not downward) wl-summary-buffer-prev-folder-function)
3940 (funcall wl-summary-buffer-prev-folder-function))
3941 ((and downward wl-summary-buffer-next-folder-function)
3942 (funcall wl-summary-buffer-next-folder-function))
3944 (when wl-auto-select-next
3947 (wl-summary-get-next-folder)
3948 (wl-summary-get-prev-folder)))
3950 (setq finfo (wl-folder-get-entity-info next-entity))))
3952 '(lambda () (wl-summary-next-folder-or-exit next-entity))
3954 "No more messages. Type SPC to go to %s."
3955 (wl-summary-entity-info-msg next-entity finfo)))))))))
3957 (defun wl-summary-prev (&optional interactive)
3959 (wl-summary-cursor-move-surface nil (or interactive (interactive-p))))
3961 (defun wl-summary-next (&optional interactive)
3963 (wl-summary-cursor-move-surface t (or interactive (interactive-p))))
3965 (defun wl-summary-up (&optional interactive skip-no-unread)
3968 (if wl-summary-move-direction-toggle
3969 (setq wl-summary-move-direction-downward nil))
3970 (if (wl-summary-cursor-up)
3971 (if wl-summary-buffer-disp-msg
3972 (wl-summary-redisplay))
3975 (if wl-summary-buffer-prev-folder-function
3976 (funcall wl-summary-buffer-prev-folder-function)
3977 (let (next-entity finfo)
3978 (when wl-auto-select-next
3980 (setq next-entity (wl-summary-get-prev-unread-folder))
3982 (setq finfo (wl-folder-get-entity-info next-entity)))))
3983 (if (and skip-no-unread
3984 (eq wl-auto-select-next 'skip-no-unread))
3985 (wl-summary-next-folder-or-exit next-entity t)
3987 '(lambda () (wl-summary-next-folder-or-exit next-entity t))
3989 "No more unread messages. Type SPC to go to %s."
3990 (wl-summary-entity-info-msg next-entity finfo)))))))))
3992 (defun wl-summary-get-prev-folder ()
3993 (let ((folder-buf (get-buffer wl-folder-buffer-name))
3996 (setq cur-id (save-excursion (set-buffer folder-buf)
3997 wl-folder-buffer-cur-entity-id))
3998 (wl-folder-get-prev-folder cur-id))))
4000 (defun wl-summary-get-next-folder ()
4001 (let ((folder-buf (get-buffer wl-folder-buffer-name))
4004 (setq cur-id (save-excursion (set-buffer folder-buf)
4005 wl-folder-buffer-cur-entity-id))
4006 (wl-folder-get-next-folder cur-id))))
4008 (defun wl-summary-get-next-unread-folder ()
4009 (let ((folder-buf (get-buffer wl-folder-buffer-name))
4012 (setq cur-id (save-excursion (set-buffer folder-buf)
4013 wl-folder-buffer-cur-entity-id))
4014 (wl-folder-get-next-folder cur-id 'unread))))
4016 (defun wl-summary-get-prev-unread-folder ()
4017 (let ((folder-buf (get-buffer wl-folder-buffer-name))
4020 (setq cur-id (save-excursion (set-buffer folder-buf)
4021 wl-folder-buffer-cur-entity-id))
4022 (wl-folder-get-prev-folder cur-id 'unread))))
4024 (defun wl-summary-down (&optional interactive skip-no-unread)
4026 (if wl-summary-move-direction-toggle
4027 (setq wl-summary-move-direction-downward t))
4028 (if (wl-summary-cursor-down)
4029 (if wl-summary-buffer-disp-msg
4030 (wl-summary-redisplay))
4033 (if wl-summary-buffer-next-folder-function
4034 (funcall wl-summary-buffer-next-folder-function)
4035 (let (next-entity finfo)
4036 (when wl-auto-select-next
4037 (setq next-entity (wl-summary-get-next-unread-folder)))
4039 (setq finfo (wl-folder-get-entity-info next-entity)))
4040 (if (and skip-no-unread
4041 (eq wl-auto-select-next 'skip-no-unread))
4042 (wl-summary-next-folder-or-exit next-entity)
4044 '(lambda () (wl-summary-next-folder-or-exit next-entity))
4046 "No more unread messages. Type SPC to go to %s."
4047 (wl-summary-entity-info-msg next-entity finfo)))))))))
4049 (defun wl-summary-goto-last-displayed-msg ()
4051 (unless wl-summary-buffer-last-displayed-msg
4052 (setq wl-summary-buffer-last-displayed-msg
4053 wl-summary-buffer-current-msg))
4054 (if wl-summary-buffer-last-displayed-msg
4056 (wl-summary-jump-to-msg wl-summary-buffer-last-displayed-msg)
4057 (if wl-summary-buffer-disp-msg
4058 (wl-summary-redisplay)))
4059 (message "No last message.")))
4061 (defun wl-summary-redisplay (&optional arg)
4064 (wl-summary-no-mime-p wl-summary-buffer-elmo-folder))
4065 (wl-summary-redisplay-no-mime)
4066 (wl-summary-redisplay-internal nil nil arg)))
4068 (defsubst wl-summary-redisplay-internal (&optional folder number force-reload)
4070 (let* ((folder (or folder wl-summary-buffer-elmo-folder))
4071 (num (or number (wl-summary-message-number)))
4072 (wl-mime-charset wl-summary-buffer-mime-charset)
4073 (default-mime-charset wl-summary-buffer-mime-charset)
4074 no-folder-mark fld-buf fld-win thr-entity)
4075 (if (and wl-thread-open-reading-thread
4076 (eq wl-summary-buffer-view 'thread)
4077 (not (wl-thread-entity-get-opened
4078 (setq thr-entity (wl-thread-get-entity
4080 (wl-thread-entity-get-children thr-entity))
4081 (wl-thread-force-open))
4084 (setq wl-summary-buffer-disp-msg t)
4085 (setq wl-summary-buffer-last-displayed-msg
4086 wl-summary-buffer-current-msg)
4087 ;; hide folder window
4088 (if (and (not wl-stay-folder-window)
4089 (setq fld-buf (get-buffer wl-folder-buffer-name)))
4090 (if (setq fld-win (get-buffer-window fld-buf))
4091 (delete-window fld-win)))
4092 (setq wl-current-summary-buffer (current-buffer))
4093 (setq no-folder-mark
4094 ;; If cache is used, change folder-mark.
4095 (if (wl-message-redisplay folder num
4099 (string= (elmo-folder-name-internal
4103 ;; plugged, then leave folder-mark.
4104 (if (and (not (elmo-folder-local-p
4105 wl-summary-buffer-elmo-folder))
4106 (elmo-folder-plugged-p
4107 wl-summary-buffer-elmo-folder))
4109 (when (elmo-message-use-cache-p folder num)
4110 (elmo-message-set-cached folder num t))
4112 (if (elmo-message-flagged-p wl-summary-buffer-elmo-folder
4115 (wl-summary-mark-as-read num no-folder-mark)
4116 (wl-summary-update-persistent-mark)))
4117 (setq wl-summary-buffer-current-msg num)
4118 (when wl-summary-recenter
4119 (recenter (/ (- (window-height) 2) 2))
4120 (if (not wl-summary-indent-length-limit)
4121 (wl-horizontal-recenter)))
4122 (wl-highlight-summary-displaying)
4123 (wl-message-buffer-prefetch-next folder num
4124 wl-message-buffer-prefetch-depth
4126 wl-summary-buffer-mime-charset)
4127 (run-hooks 'wl-summary-redisplay-hook))
4128 (message "No message to display."))))
4130 (defun wl-summary-redisplay-no-mime (&optional ask-coding)
4131 "Display message without MIME decoding.
4132 If ASK-CODING is non-nil, coding-system for the message is asked."
4134 (let ((elmo-mime-display-as-is-coding-system
4136 (or (read-coding-system "Coding system: ")
4137 elmo-mime-display-as-is-coding-system)
4138 elmo-mime-display-as-is-coding-system)))
4139 (wl-summary-redisplay-no-mime-internal)))
4141 (defun wl-summary-redisplay-no-mime-internal (&optional folder number)
4142 (let* ((fld (or folder wl-summary-buffer-elmo-folder))
4143 (num (or number (wl-summary-message-number)))
4147 (setq wl-summary-buffer-disp-msg t)
4148 (setq wl-summary-buffer-last-displayed-msg
4149 wl-summary-buffer-current-msg)
4150 (setq wl-current-summary-buffer (current-buffer))
4151 (wl-message-redisplay fld num 'as-is
4152 (string= (elmo-folder-name-internal fld)
4155 (if (elmo-message-flagged-p fld num 'unread)
4156 (wl-summary-mark-as-read num); no-folder-mark)
4157 (wl-summary-update-persistent-mark)))
4158 (setq wl-summary-buffer-current-msg num)
4159 (when wl-summary-recenter
4160 (recenter (/ (- (window-height) 2) 2))
4161 (if (not wl-summary-indent-length-limit)
4162 (wl-horizontal-recenter)))
4163 (wl-highlight-summary-displaying)
4164 (run-hooks 'wl-summary-redisplay-hook))
4165 (message "No message to display.")
4166 (wl-ask-folder 'wl-summary-exit
4167 "No more messages. Type SPC to go to folder mode."))))
4169 (defun wl-summary-redisplay-all-header (&optional folder number)
4171 (let* ((fld (or folder wl-summary-buffer-elmo-folder))
4172 (num (or number (wl-summary-message-number)))
4173 (wl-mime-charset wl-summary-buffer-mime-charset)
4174 (default-mime-charset wl-summary-buffer-mime-charset))
4177 (setq wl-summary-buffer-disp-msg t)
4178 (setq wl-summary-buffer-last-displayed-msg
4179 wl-summary-buffer-current-msg)
4180 (setq wl-current-summary-buffer (current-buffer))
4181 (if (wl-message-redisplay fld num 'all-header
4182 (string= (elmo-folder-name-internal fld)
4184 (wl-summary-mark-as-read num))
4185 (setq wl-summary-buffer-current-msg num)
4186 (when wl-summary-recenter
4187 (recenter (/ (- (window-height) 2) 2))
4188 (if (not wl-summary-indent-length-limit)
4189 (wl-horizontal-recenter)))
4190 (wl-highlight-summary-displaying)
4191 (run-hooks 'wl-summary-redisplay-hook))
4192 (message "No message to display."))))
4194 (defun wl-summary-jump-to-current-message ()
4195 "Jump into Message buffer."
4197 (let (message-buf message-win)
4198 (if (setq message-buf wl-message-buffer)
4199 (if (setq message-win (get-buffer-window message-buf))
4200 (select-window message-win)
4201 (wl-message-select-buffer wl-message-buffer))
4202 (wl-summary-redisplay)
4203 (wl-message-select-buffer wl-message-buffer))))
4205 (defun wl-summary-cancel-message ()
4206 "Cancel an article on news."
4208 (if (null (wl-summary-message-number))
4209 (message "No message.")
4210 (let ((summary-buf (current-buffer))
4212 (wl-summary-set-message-buffer-or-redisplay)
4213 (if (setq message-buf (wl-message-get-original-buffer))
4214 (set-buffer message-buf))
4215 (unless (wl-message-news-p)
4216 (set-buffer summary-buf)
4217 (if (and (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
4219 (y-or-n-p "Cannot get Newsgroups. Fetch again? "))
4221 (wl-summary-redisplay t)
4222 (wl-summary-supersedes-message))
4223 (error "This is not a news article; supersedes is impossible")))
4224 (when (yes-or-no-p "Do you really want to cancel this article? ")
4225 (let (from newsgroups message-id distribution buf)
4227 (setq from (std11-field-body "from")
4228 newsgroups (std11-field-body "newsgroups")
4229 message-id (std11-field-body "message-id")
4230 distribution (std11-field-body "distribution"))
4231 ;; Make sure that this article was written by the user.
4232 (unless (wl-address-user-mail-address-p
4233 (wl-address-header-extract-address
4234 (car (wl-parse-addresses from))))
4235 (error "This article is not yours"))
4236 ;; Make control message.
4237 (setq buf (set-buffer (get-buffer-create " *message cancel*")))
4238 (setq wl-draft-buffer-cur-summary-buffer summary-buf)
4239 (buffer-disable-undo (current-buffer))
4241 (insert "Newsgroups: " newsgroups "\n"
4242 "From: " (wl-address-header-extract-address
4244 "Subject: cmsg cancel " message-id "\n"
4245 "Control: cancel " message-id "\n"
4247 (concat "Distribution: " distribution "\n")
4249 mail-header-separator "\n"
4250 wl-summary-cancel-message)
4251 (message "Canceling your message...")
4252 (wl-draft-raw-send t t) ; kill when done, force-pre-hooks.
4253 (message "Canceling your message...done")))))))
4255 (defun wl-summary-supersedes-message ()
4256 "Supersede current message."
4258 (wl-summary-toggle-disp-msg 'off)
4259 (let ((summary-buf (current-buffer))
4261 (wl-summary-set-message-buffer-or-redisplay)
4262 (if (setq message-buf (wl-message-get-original-buffer))
4263 (set-buffer message-buf))
4264 (unless (wl-message-news-p)
4265 (set-buffer summary-buf)
4266 (if (and (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
4268 (y-or-n-p "Cannot get Newsgroups. Fetch again? "))
4270 (wl-summary-redisplay t)
4271 (wl-summary-supersedes-message))
4272 (error "This is not a news article; supersedes is impossible")))
4274 (setq from (std11-field-body "from"))
4275 ;; Make sure that this article was written by the user.
4276 (unless (wl-address-user-mail-address-p
4277 (wl-address-header-extract-address
4278 (car (wl-parse-addresses from))))
4279 (error "This article is not yours"))
4280 (let* ((message-id (std11-field-body "message-id"))
4281 (followup-to (std11-field-body "followup-to"))
4282 (mail-default-headers
4283 (concat mail-default-headers
4284 "Supersedes: " message-id "\n"
4286 (concat "Followup-To: " followup-to "\n")))))
4287 (if message-buf (set-buffer message-buf))
4288 (wl-draft-edit-string (buffer-substring (point-min) (point-max)))))))
4290 (defun wl-summary-save (&optional arg wl-save-dir)
4291 "Save current message to disk."
4294 (num (wl-summary-message-number)))
4295 (if (null wl-save-dir)
4296 (setq wl-save-dir wl-temporary-file-directory))
4299 (setq filename (expand-file-name
4303 (null (file-exists-p filename))))
4305 (read-file-name "Save to file: " filename)))
4307 (wl-summary-set-message-buffer-or-redisplay)
4308 (set-buffer (wl-message-get-original-buffer))
4309 (if (and (null arg) (file-exists-p filename))
4310 (if (y-or-n-p "File already exists. override it? ")
4311 (write-region (point-min) (point-max) filename))
4312 (write-region (point-min) (point-max) filename)))
4313 (message "No message to save."))
4316 (defun wl-summary-save-region (beg end)
4320 (wl-summary-narrow-to-region beg end)
4321 (goto-char (point-min))
4323 (wl-read-directory-name "Save to directory: "
4324 wl-temporary-file-directory)))
4325 (if (null (file-exists-p wl-save-dir))
4326 (make-directory wl-save-dir))
4327 (if (eq wl-summary-buffer-view 'thread)
4330 (let* ((number (wl-summary-message-number))
4331 (entity (wl-thread-get-entity number)))
4332 (if (wl-thread-entity-get-opened entity)
4333 (wl-summary-save t wl-save-dir)
4335 (wl-summary-save t wl-save-dir))
4338 (wl-summary-save t wl-save-dir)
4339 (forward-line 1)))))))
4341 ;; mew-summary-pipe-message()
4342 (defun wl-summary-pipe-message (prefix command)
4343 "Send this message via pipe."
4344 (interactive (list current-prefix-arg nil))
4345 (if (null (wl-summary-message-number))
4346 (message "No message.")
4347 (setq command (read-string "Shell command on message: "
4348 wl-summary-shell-command-last))
4349 (if (y-or-n-p "Send this message to pipe? ")
4350 (wl-summary-pipe-message-subr prefix command))))
4352 (defun wl-summary-target-mark-pipe (prefix command)
4353 "Send each marked messages via pipe."
4354 (interactive (list current-prefix-arg nil))
4355 (if (null wl-summary-buffer-target-mark-list)
4356 (message "No marked message.")
4357 (setq command (read-string "Shell command on each marked message: "
4358 wl-summary-shell-command-last))
4359 (when (y-or-n-p "Send each marked message to pipe? ")
4360 (while (car wl-summary-buffer-target-mark-list)
4361 (let ((num (car wl-summary-buffer-target-mark-list)))
4362 (wl-thread-jump-to-msg num)
4363 (wl-summary-pipe-message-subr prefix command)
4364 (wl-summary-unmark))))))
4366 (defun wl-summary-pipe-message-subr (prefix command)
4368 (wl-summary-set-message-buffer-or-redisplay)
4369 (set-buffer (wl-message-get-original-buffer))
4370 (if (string= command "")
4371 (setq command wl-summary-shell-command-last))
4372 (goto-char (point-min)) ; perhaps this line won't be necessary
4374 (search-forward "\n\n"))
4375 (shell-command-on-region (point) (point-max) command nil)
4376 (setq wl-summary-shell-command-last command)))
4378 (defun wl-summary-print-message (&optional arg)
4380 (if (null (wl-summary-message-number))
4381 (message "No message.")
4383 (wl-summary-set-message-buffer-or-redisplay)
4384 (if (or (not (interactive-p))
4385 (y-or-n-p "Print ok? "))
4387 (let ((buffer (generate-new-buffer " *print*")))
4388 (copy-to-buffer buffer (point-min) (point-max))
4390 (funcall wl-print-buffer-function)
4391 (kill-buffer buffer)))
4394 (defun wl-summary-print-message-with-ps-print (&optional filename)
4395 "Print message via ps-print."
4397 (if (null (wl-summary-message-number))
4398 (message "No message.")
4399 (setq filename (ps-print-preprint current-prefix-arg))
4400 (if (or (not (interactive-p))
4401 (y-or-n-p "Print ok? "))
4402 (let ((summary-buffer (current-buffer))
4405 (wl-summary-set-message-buffer-or-redisplay)
4406 ;; (wl-summary-redisplay-internal)
4407 (let* ((buffer (generate-new-buffer " *print*"))
4409 (set-buffer summary-buffer)
4410 (elmo-message-entity
4411 wl-summary-buffer-elmo-folder
4412 (wl-summary-message-number))))
4415 (or (elmo-message-entity-field entity 'subject)
4419 (or (elmo-message-entity-field entity 'from) "")))
4422 (or (elmo-message-entity-field entity 'date) ""))))
4423 (run-hooks 'wl-ps-preprint-hook)
4424 (set-buffer wl-message-buffer)
4425 (copy-to-buffer buffer (point-min) (point-max))
4428 (let ((ps-left-header
4429 (list (concat "(" wl-ps-subject ")")
4430 (concat "(" wl-ps-from ")")))
4432 (list "/pagenumberstring load"
4433 (concat "(" wl-ps-date ")"))))
4434 (run-hooks 'wl-ps-print-hook)
4435 (funcall wl-ps-print-buffer-function filename))
4436 (kill-buffer buffer)))))
4439 (if (featurep 'ps-print) ; ps-print is available.
4440 (fset 'wl-summary-print-message 'wl-summary-print-message-with-ps-print))
4442 (defun wl-summary-target-mark-print ()
4444 (if (null wl-summary-buffer-target-mark-list)
4445 (message "No marked message.")
4446 (when (y-or-n-p "Print all marked messages. OK? ")
4447 (while (car wl-summary-buffer-target-mark-list)
4448 (let ((num (car wl-summary-buffer-target-mark-list)))
4449 (wl-thread-jump-to-msg num)
4450 (wl-summary-print-message)
4451 (wl-summary-unmark))))))
4453 (defun wl-summary-folder-info-update ()
4454 (wl-folder-set-folder-updated
4455 (elmo-string (wl-summary-buffer-folder-name))
4457 (+ wl-summary-buffer-unread-count
4458 wl-summary-buffer-new-count)
4460 wl-summary-buffer-elmo-folder))))
4462 (defun wl-summary-get-original-buffer ()
4463 "Get original buffer for the current summary."
4465 (wl-summary-set-message-buffer-or-redisplay)
4466 (wl-message-get-original-buffer)))
4468 (defun wl-summary-pack-number (&optional arg)
4470 (elmo-folder-pack-numbers wl-summary-buffer-elmo-folder)
4471 (let (wl-use-scoring)
4472 (wl-summary-rescan)))
4474 (defun wl-summary-target-mark-uudecode ()
4476 (let ((mlist (reverse wl-summary-buffer-target-mark-list))
4477 (summary-buf (current-buffer))
4478 (tmp-buf (get-buffer-create "*WL UUENCODE*"))
4479 orig-buf i k filename rc errmsg)
4481 (setq k (length mlist))
4482 (set-buffer tmp-buf)
4484 (save-window-excursion
4486 (set-buffer summary-buf)
4487 (wl-summary-jump-to-msg (car mlist))
4488 (wl-summary-redisplay)
4489 (set-buffer (setq orig-buf (wl-summary-get-original-buffer)))
4490 (goto-char (point-min))
4491 (cond ((= i 1) ; first
4492 (if (setq filename (wl-message-uu-substring
4496 (error "Can't find begin line")))
4498 (wl-message-uu-substring orig-buf tmp-buf))
4500 (wl-message-uu-substring orig-buf tmp-buf nil t)))
4502 (setq mlist (cdr mlist)))
4503 (set-buffer tmp-buf)
4504 (message "Exec %s..." wl-prog-uudecode)
4506 (let ((decode-dir wl-temporary-file-directory))
4507 (if (not wl-prog-uudecode-no-stdout-option)
4508 (setq filename (read-file-name "Save to file: "
4510 (elmo-safe-filename filename)
4511 wl-temporary-file-directory)))
4513 (wl-read-directory-name "Save to directory: "
4514 wl-temporary-file-directory))
4515 (setq filename (expand-file-name filename decode-dir)))
4516 (if (file-exists-p filename)
4517 (or (yes-or-no-p (format "File %s exists. Save anyway? "
4520 (elmo-bind-directory
4524 (apply 'call-process-region (point-min) (point-max)
4525 wl-prog-uudecode t (current-buffer) nil
4526 wl-prog-uudecode-arg))))
4527 (when (not (= 0 rc))
4528 (setq errmsg (buffer-substring (point-min)(point-max)))
4529 (error "Uudecode error: %s" errmsg))
4530 (if (not wl-prog-uudecode-no-stdout-option)
4531 (let (file-name-handler-alist) ;; void jka-compr
4532 (as-binary-output-file
4533 (write-region (point-min) (point-max)
4534 filename nil 'no-msg))))
4536 (set-buffer summary-buf)
4537 (wl-summary-delete-all-temp-marks))
4538 (if (file-exists-p filename)
4539 (message "Saved as %s" filename)))
4540 (kill-buffer tmp-buf)))))
4543 ;; (defun wl-summary-drop-unsync ()
4544 ;; "Drop all unsync messages."
4546 ;; (if (elmo-folder-pipe-p (wl-summary-buffer-folder-name))
4547 ;; (error "You cannot drop unsync messages in this folder"))
4548 ;; (if (or (not (interactive-p))
4549 ;; (y-or-n-p "Drop all unsync messages? "))
4550 ;; (let* ((folder-list (elmo-folder-get-primitive-folder-list
4551 ;; (wl-summary-buffer-folder-name)))
4552 ;; (is-multi (elmo-multi-p (wl-summary-buffer-folder-name)))
4556 ;; (message "Dropping...")
4557 ;; (while folder-list
4558 ;; (setq pair (elmo-folder-message-numbers (car folder-list)))
4559 ;; (when is-multi ;; dirty hack...
4561 ;; (setcar pair (+ (* multi-num elmo-multi-divide-number)
4563 ;; (elmo-msgdb-set-number-alist
4564 ;; (wl-summary-buffer-msgdb)
4566 ;; (elmo-msgdb-get-number-alist (wl-summary-buffer-msgdb))
4567 ;; (list (cons (car pair) nil))))
4568 ;; (setq sum (+ sum (cdr pair)))
4569 ;; (setq folder-list (cdr folder-list)))
4570 ;; (wl-summary-set-message-modified)
4571 ;; (wl-folder-set-folder-updated (wl-summary-buffer-folder-name)
4573 ;; (+ wl-summary-buffer-unread-count
4574 ;; wl-summary-buffer-new-count)
4576 ;; (message "Dropping...done"))))
4578 (defun wl-summary-default-get-next-msg (msg)
4579 (or (wl-summary-next-message msg
4580 (if wl-summary-move-direction-downward 'down
4583 (cadr (memq msg (if wl-summary-move-direction-downward
4584 wl-summary-buffer-number-list
4585 (reverse wl-summary-buffer-number-list))))))
4587 (defun wl-summary-save-current-message ()
4588 "Save current message for `wl-summary-yank-saved-message'."
4590 (let ((number (wl-summary-message-number)))
4591 (setq wl-summary-buffer-saved-message number)
4592 (and number (message "No: %s is saved." number))))
4594 (defun wl-summary-yank-saved-message ()
4595 "Set current message as a parent of the saved message."
4597 (if wl-summary-buffer-saved-message
4598 (let ((number (wl-summary-message-number)))
4599 (if (eq wl-summary-buffer-saved-message number)
4600 (message "Cannot set itself as a parent.")
4602 (wl-thread-jump-to-msg wl-summary-buffer-saved-message)
4603 (wl-thread-set-parent number)
4604 (wl-summary-set-thread-modified))
4605 (setq wl-summary-buffer-saved-message nil)))
4606 (message "There's no saved message.")))
4608 (defun wl-summary-toggle-header-narrowing ()
4609 "Toggle message header narrowing."
4611 (when wl-message-use-header-narrowing
4612 (save-selected-window
4613 (let* ((mbuf wl-message-buffer)
4614 (mwin (when mbuf (get-buffer-window mbuf)))
4615 (wpos (when mwin (window-start mwin))))
4618 (wl-message-header-narrowing-toggle)
4619 (and wpos (set-window-start mwin wpos)))))))
4621 (autoload 'elmo-folder-list-global-flag-messages "elmo-flag")
4624 (product-provide (provide 'wl-summary) (require 'wl-version))
4626 ;;; wl-summary.el ends here