annotate lisp/vm/vm-summary.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 859a2309aef8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; Summary gathering and formatting routines for VM
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;; Copyright (C) 1989, 1990, 1993, 1994, 1995 Kyle E. Jones
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (provide 'vm-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (defun vm-summary-mode-internal ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 (setq mode-name "VM Summary"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 major-mode 'vm-summary-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 mode-line-format vm-mode-line-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; must come after the setting of major-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 mode-popup-menu (and vm-use-menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (vm-menu-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (vm-menu-mode-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 buffer-read-only t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 vm-summary-pointer nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 vm-summary-=> (if (stringp vm-summary-arrow) vm-summary-arrow "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 vm-summary-no-=> (make-string (length vm-summary-=>) ? )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 truncate-lines t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; horizontal scrollbar off by default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; user can turn it on in summary hook if desired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (and (fboundp 'set-specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 scrollbar-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (set-specifier scrollbar-height (cons (current-buffer) 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (use-local-map vm-summary-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (and (vm-menu-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (vm-menu-install-menus))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (and (vm-mouse-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (vm-mouse-xemacs-mouse-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (add-hook 'mode-motion-hook 'mode-motion-highlight-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (if (or vm-frame-per-folder vm-frame-per-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (vm-set-hooks-for-frame-deletion))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (run-hooks 'vm-summary-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; Lucid Emacs apparently used this name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (run-hooks 'vm-summary-mode-hooks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (fset 'vm-summary-mode 'vm-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (put 'vm-summary-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (defun vm-summarize (&optional display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 "Summarize the contents of the folder in a summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 The format is as described by the variable vm-summary-format. Generally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 one line per message is most pleasing to the eye but this is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 mandatory."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (if (null vm-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (let ((b (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (read-only vm-folder-read-only))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (setq vm-summary-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (get-buffer-create (format "%s Summary" (buffer-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (set-buffer vm-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (abbrev-mode 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (auto-fill-mode 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (if (fboundp 'buffer-disable-undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;; obfuscation to make the v19 compiler not whine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;; about obsolete functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (let ((x 'buffer-flush-undo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (funcall x (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (setq vm-mail-buffer b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 vm-folder-read-only read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (vm-summary-mode-internal))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (vm-set-summary-redo-start-point t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (if display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (if vm-frame-per-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (let ((w (vm-get-buffer-window vm-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (if (null w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (vm-goto-new-frame 'summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (vm-set-hooks-for-frame-deletion))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (select-window w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (and vm-warp-mouse-to-new-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (vm-warp-mouse-to-frame-maybe (vm-window-frame w)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (vm-display vm-summary-buffer t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 '(vm-summarize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 vm-summarize-other-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (list this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;; need to do this after any frame creation because the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;; toolbar sets frame-specific height and width specifiers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (set-buffer vm-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (and (vm-toolbar-support-possible-p) vm-use-toolbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (vm-toolbar-install-toolbar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (vm-display nil nil '(vm-summarize vm-summarize-other-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (list this-command)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (defun vm-summarize-other-frame (&optional display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 "Like vm-summarize, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (vm-goto-new-frame 'summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (vm-summarize display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (defun vm-do-summary (&optional start-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (let ((m-list (or start-point vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;; Just for laughs, make the update interval vary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (modulus (+ (% (vm-abs (random)) 11) 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (and (vm-mouse-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (vm-mouse-fsfemacs-mouse-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (function vm-mouse-set-mouse-track-highlight)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (setq mp m-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (set-buffer vm-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (let ((buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (modified (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (if start-point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (if (vm-su-start-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (goto-char (vm-su-start-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (delete-region (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (setq vm-summary-pointer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;; avoid doing long runs down the marker chain while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;; building the summary. use integers to store positions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;; and then convert them to markers after all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;; insertions are done.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (setq summary (vm-su-summary (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (vm-set-su-start-of (car mp) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (insert vm-summary-no-=>)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (vm-tokenized-summary-insert (car mp) (vm-su-summary (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (vm-set-su-end-of (car mp) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (setq mp (cdr mp) n (1+ n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (if (zerop (% n modulus))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (vm-unsaved-message "Generating summary... %d" n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;; now convert the ints to markers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (if (>= n modulus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (vm-unsaved-message "Generating summary markers... "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (setq mp m-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (and mouse-track-func (funcall mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (vm-su-start-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (vm-su-end-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (vm-set-su-start-of (car mp) (vm-marker (vm-su-start-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (vm-set-su-end-of (car mp) (vm-marker (vm-su-end-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (setq mp (cdr mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (set-buffer-modified-p modified))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (run-hooks 'vm-summary-redo-hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (if (>= n modulus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (vm-unsaved-message "Generating summary... done"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (defun vm-do-needed-summary-rebuild ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (if (and vm-summary-redo-start-point vm-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (vm-copy-local-variables vm-summary-buffer 'vm-summary-show-threads)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (vm-do-summary (and (consp vm-summary-redo-start-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 vm-summary-redo-start-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (setq vm-summary-redo-start-point nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (and vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (vm-set-summary-pointer (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (setq vm-need-summary-pointer-update nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (and vm-need-summary-pointer-update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 vm-summary-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (vm-set-summary-pointer (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (setq vm-need-summary-pointer-update nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (defun vm-update-message-summary (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (if (and (vm-su-start-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (marker-buffer (vm-su-start-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (let ((modified (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (and (vm-mouse-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (vm-mouse-fsfemacs-mouse-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (function vm-mouse-set-mouse-track-highlight)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (setq summary (vm-su-summary m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (set-buffer (marker-buffer (vm-su-start-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (let ((buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (selected nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (modified (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (goto-char (vm-su-start-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (setq selected (not (looking-at vm-summary-no-=>)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;; We do a little dance to update the text in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; order to make the markets in the text do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ;; what we want.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ;; 1. We need to avoid having the su-start-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;; and su-end-of market clumping together at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;; the start position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;; 2. We want the window point market (w->pointm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ;; in the Emacs display code) to move to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; start of the summary entry if it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; anywhere within the su-start-of to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; su-end-of region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;; We achieve (2) by deleting before inserting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;; Reversing the order of insertion/deletion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;; pushes the point marker into the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; summary entry. We achieve (1) by inserting a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; placeholder character at the end of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;; summary entry before deleting the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (goto-char (vm-su-end-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (insert-before-markers "z")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (goto-char (vm-su-start-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (delete-region (point) (1- (vm-su-end-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (if (not selected)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (insert vm-summary-no-=>)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (insert vm-summary-=>))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (vm-tokenized-summary-insert m (vm-su-summary m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (run-hooks 'vm-summary-update-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (and mouse-track-func (funcall mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (vm-su-start-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (vm-su-end-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (if (and selected vm-summary-highlight-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (vm-summary-highlight-region (vm-su-start-of m) (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 vm-summary-highlight-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (set-buffer-modified-p modified)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (defun vm-set-summary-pointer (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (if vm-summary-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (let ((w (vm-get-visible-buffer-window vm-summary-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (and (vm-mouse-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (vm-mouse-fsfemacs-mouse-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (function vm-mouse-set-mouse-track-highlight)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (old-window nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (vm-save-buffer-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (set-buffer vm-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (if w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (setq old-window (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (select-window w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (if (and vm-summary-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (vm-su-start-of vm-summary-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (goto-char (vm-su-start-of vm-summary-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (insert vm-summary-no-=>)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (delete-char (length vm-summary-=>))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (and mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (funcall mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (- (point) (length vm-summary-=>))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (setq vm-summary-pointer m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (goto-char (vm-su-start-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (let ((modified (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (insert vm-summary-=>)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (delete-char (length vm-summary-=>))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (and mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (funcall mouse-track-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (- (point) (length vm-summary-=>))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (set-buffer-modified-p modified)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (forward-char (- (length vm-summary-=>)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (if vm-summary-highlight-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (vm-summary-highlight-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (vm-su-start-of m) (vm-su-end-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 vm-summary-highlight-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (and w vm-auto-center-summary (vm-auto-center-summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (run-hooks 'vm-summary-pointer-update-hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (and old-window (select-window old-window)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (defun vm-summary-highlight-region (start end face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (cond ((fboundp 'make-overlay)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (if (and vm-summary-overlay (overlay-buffer vm-summary-overlay))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (move-overlay vm-summary-overlay start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (setq vm-summary-overlay (make-overlay start end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (overlay-put vm-summary-overlay 'evaporate nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (overlay-put vm-summary-overlay 'face face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ((fboundp 'make-extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (if (and vm-summary-overlay (extent-end-position vm-summary-overlay))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (set-extent-endpoints vm-summary-overlay start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (setq vm-summary-overlay (make-extent start end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (set-extent-property vm-summary-overlay 'detachable nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (set-extent-property vm-summary-overlay 'face face)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (defun vm-auto-center-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (if vm-auto-center-summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (if (or (eq vm-auto-center-summary t) (not (one-window-p t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (recenter '(4)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (defun vm-sprintf (format-variable message &optional tokenize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;; compile the format into an eval'able s-expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; if it hasn't been compiled already.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (if (not (eq (get format-variable 'vm-compiled-format)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (symbol-value format-variable)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (vm-compile-format format-variable tokenize))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ;; The local variable name `vm-su-message' is mandatory here for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ;; the format s-expression to work.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (let ((vm-su-message message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (eval (get format-variable 'vm-format-sexp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (defun vm-tokenized-summary-insert (message tokens)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (if (stringp tokens)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (insert tokens)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (let (token)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (while tokens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (setq token (car tokens))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (cond ((stringp token)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (insert token))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 ((eq token 'number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (insert (vm-padded-number-of message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 ((eq token 'mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (insert (vm-su-mark message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 ((eq token 'thread-indent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (if (and vm-summary-show-threads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (natnump vm-summary-thread-indent-level))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (insert-char ?\ (* vm-summary-thread-indent-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (vm-th-thread-indentation message))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (setq tokens (cdr tokens))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (defun vm-compile-format (format-variable &optional tokenize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (let ((format (symbol-value format-variable))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (sexp nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (sexp-fmt nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (last-match-end 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 token conv-spec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (store-match-data nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (setq token nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (and (not token)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (string-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 "%\\(-\\)?\\([0-9]+\\)?\\(\\.\\(-?[0-9]+\\)\\)?\\([aAcdfFhHiIlLmMnstTwyz*%]\\|U[A-Za-z]\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 format (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (setq conv-spec (aref format (match-beginning 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (if (memq conv-spec '(?a ?A ?c ?d ?f ?F ?h ?H ?i ?L ?I ?l ?M
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ?m ?n ?s ?t ?T ?U ?w ?y ?z ?* ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (cond ((= conv-spec ?a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (setq sexp (cons (list 'vm-su-attribute-indicators
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ((= conv-spec ?A)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (setq sexp (cons (list 'vm-su-attribute-indicators-long
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ((= conv-spec ?c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (setq sexp (cons (list 'vm-su-byte-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ((= conv-spec ?d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (setq sexp (cons (list 'vm-su-monthday
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 ((= conv-spec ?f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (setq sexp (cons (list 'vm-su-interesting-from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ((= conv-spec ?F)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (setq sexp (cons (list 'vm-su-interesting-full-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 ((= conv-spec ?h)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (setq sexp (cons (list 'vm-su-hour
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ((= conv-spec ?H)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (setq sexp (cons (list 'vm-su-hour-short
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 ((= conv-spec ?i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (setq sexp (cons (list 'vm-su-message-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ((= conv-spec ?I)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (if tokenize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (setq token ''thread-indent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (setq sexp (cons (list 'vm-su-thread-indent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 'vm-su-message) sexp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ((= conv-spec ?l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (setq sexp (cons (list 'vm-su-line-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ((= conv-spec ?L)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (setq sexp (cons (list 'vm-su-labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ((= conv-spec ?m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (setq sexp (cons (list 'vm-su-month
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ((= conv-spec ?M)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (setq sexp (cons (list 'vm-su-month-number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ((= conv-spec ?n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (if tokenize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (setq token ''number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (setq sexp (cons (list 'vm-padded-number-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 'vm-su-message) sexp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 ((= conv-spec ?s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (setq sexp (cons (list 'vm-su-subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ((= conv-spec ?T)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (setq sexp (cons (list 'vm-su-to-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 ((= conv-spec ?t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (setq sexp (cons (list 'vm-su-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 ((= conv-spec ?U)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (setq sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (cons (list 'vm-run-user-summary-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (list 'quote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 "vm-summary-function-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (1+ (match-beginning 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (+ 2 (match-beginning 5))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ((= conv-spec ?w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (setq sexp (cons (list 'vm-su-weekday
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 ((= conv-spec ?y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (setq sexp (cons (list 'vm-su-year
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 ((= conv-spec ?z)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (setq sexp (cons (list 'vm-su-zone
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 'vm-su-message) sexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ((= conv-spec ?*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (if tokenize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (setq token ''mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (setq sexp (cons (list 'vm-su-mark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 'vm-su-message) sexp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (cond ((and (not token) (match-beginning 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (setcar sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (list 'vm-left-justify-string (car sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (substring format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (match-end 2))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 ((and (not token) (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (setcar sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (list 'vm-right-justify-string (car sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (substring format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (match-end 2)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (cond ((and (not token) (match-beginning 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (setcar sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (list 'vm-truncate-string (car sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (substring format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (match-beginning 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (match-end 4)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (setq sexp-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (cons (if token "" "%s")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (cons (substring format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 last-match-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 sexp-fmt))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (setq sexp-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (cons "%%"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (cons (substring format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (or last-match-end 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 sexp-fmt))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (setq last-match-end (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (if (not token)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (setq sexp-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (cons (substring format last-match-end (length format))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 sexp-fmt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 done t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (setq sexp-fmt (apply 'concat (nreverse sexp-fmt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (if sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (setq sexp (cons 'format (cons sexp-fmt (nreverse sexp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (setq sexp sexp-fmt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (if tokenize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (setq list (nconc list (if (equal sexp "") nil (list sexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (and token (list token)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 sexp nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 sexp-fmt nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (put format-variable 'vm-compiled-format format)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (put format-variable 'vm-format-sexp (if list (cons 'list list) sexp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (defun vm-get-header-contents (message header-name-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (let ((contents nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (setq regexp (concat "^\\(" header-name-regexp "\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 message (vm-real-message-of message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (set-buffer (vm-buffer-of (vm-real-message-of message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (goto-char (vm-headers-of message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (while (and (re-search-forward regexp (vm-text-of message) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (save-excursion (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (vm-match-header)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (if contents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (setq contents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (concat contents ", " (vm-matched-header-contents)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (setq contents (vm-matched-header-contents))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 contents )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (defun vm-left-justify-string (string width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (if (>= (length string) width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (concat string (make-string (- width (length string)) ?\ ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (defun vm-right-justify-string (string width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (if (>= (length string) width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (concat (make-string (- width (length string)) ?\ ) string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (defun vm-truncate-string (string width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (cond ((<= (length string) width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 ((< width 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (substring string width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (substring string 0 width))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (defun vm-su-attribute-indicators (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (cond ((vm-deleted-flag m) "D")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 ((vm-new-flag m) "N")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ((vm-unread-flag m) "U")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (t " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (cond ((vm-filed-flag m) "F")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 ((vm-written-flag m) "W")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (t " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (cond ((vm-replied-flag m) "R")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ((vm-forwarded-flag m) "Z")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 ((vm-redistributed-flag m) "B")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (t " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (cond ((vm-edited-flag m) "E")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (t " "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (defun vm-su-attribute-indicators-long (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (cond ((vm-deleted-flag m) "D")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 ((vm-new-flag m) "N")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 ((vm-unread-flag m) "U")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (t " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (if (vm-replied-flag m) "r" " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (if (vm-forwarded-flag m) "z" " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (if (vm-redistributed-flag m) "b" " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (if (vm-filed-flag m) "f" " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (if (vm-written-flag m) "w" " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (if (vm-edited-flag m) "e" " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (defun vm-su-byte-count (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (or (vm-byte-count-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (vm-set-byte-count-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 m
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (int-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (- (vm-text-end-of (vm-real-message-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (vm-text-of (vm-real-message-of m)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (defun vm-su-weekday (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (or (vm-weekday-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (progn (vm-su-do-date m) (vm-weekday-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (defun vm-su-monthday (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (or (vm-monthday-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (progn (vm-su-do-date m) (vm-monthday-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (defun vm-su-month (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (or (vm-month-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (progn (vm-su-do-date m) (vm-month-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (defun vm-su-month-number (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (or (vm-month-number-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (progn (vm-su-do-date m) (vm-month-number-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (defun vm-su-year (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (or (vm-year-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (progn (vm-su-do-date m) (vm-year-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (defun vm-su-hour-short (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (let ((string (vm-su-hour m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (if (> (length string) 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (substring string 0 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (defun vm-su-hour (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (or (vm-hour-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (progn (vm-su-do-date m) (vm-hour-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (defun vm-su-zone (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (or (vm-zone-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (progn (vm-su-do-date m) (vm-zone-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (defun vm-su-mark (m) (if (vm-mark-of m) "*" " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 ;; Some yogurt-headed delivery agents don't provide a Date: header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (defun vm-grok-From_-date (message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ;; This works only on the From_ types, obviously
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (if (not (memq (vm-message-type-of message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 '(From_ From_-with-Content-Length)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (set-buffer (vm-buffer-of (vm-real-message-of message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (goto-char (vm-start-of message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (if (or (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;; special case this so that the "remote from blah"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 ;; isn't included.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 "From [^ \t\n]*[ \t]+\\([^ \t\n].*\\) remote from .*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (looking-at "From [^ \t\n]*[ \t]+\\([^ \t\n].*\\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (vm-buffer-substring-no-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (match-end 1))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (defun vm-parse-date (date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (let ((weekday "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (monthday "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (month "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (year "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (hour "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (timezone "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (start nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (if (string-match "sun\\|mon\\|tue\\|wed\\|thu\\|fri\\|sat" date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (setq weekday (substring date (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (if (string-match "jan\\|feb\\|mar\\|apr\\|may\\|jun\\|jul\\|aug\\|sep\\|oct\\|nov\\|dec" date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (setq month (substring date (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (if (string-match "[0-9]?[0-9]:[0-9][0-9]\\(:[0-9][0-9]\\)?" date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (setq hour (substring date (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (if (or (string-match "[^a-z][+---][0-9][0-9][0-9][0-9]" date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (string-match "e[ds]t\\|c[ds]t\\|p[ds]t\\|m[ds]t" date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (string-match "ast\\|nst\\|met\\|eet\\|jst\\|bst\\|ut" date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (string-match "gmt\\([+---][0-9]+\\)?" date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (setq timezone (substring date (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (while (string-match "\\(\\`\\|[^:+---0-9]\\|[a-z]-\\)[0-9]+\\(\\'\\|[^:]\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 date start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (setq string (substring date (match-end 1) (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 start (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (cond ((string-match "\\`[4-9]." string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 ;; Assume that any two digits less than 40 are a date and not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;; a year. The world will surely end soon.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (setq year (concat "19" string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ((< (length string) 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (setq monthday string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (t (setq year string))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (aset vm-parse-date-workspace 0 weekday)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (aset vm-parse-date-workspace 1 monthday)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (aset vm-parse-date-workspace 2 month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (aset vm-parse-date-workspace 3 year)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (aset vm-parse-date-workspace 4 hour)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (aset vm-parse-date-workspace 5 timezone)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 vm-parse-date-workspace))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (defun vm-su-do-date (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 vector date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (setq date (or (vm-get-header-contents m "Date:") (vm-grok-From_-date m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 ((null date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (vm-set-weekday-of m "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (vm-set-monthday-of m "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (vm-set-month-of m "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (vm-set-month-number-of m "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (vm-set-year-of m "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (vm-set-hour-of m "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (vm-set-zone-of m ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ((string-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 ;; The date format recognized here is the one specified in RFC 822.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ;; Some slop is allowed e.g. dashes between the monthday, month and year
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;; because such malformed headers have been observed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 "\\(\\([a-z][a-z][a-z]\\),\\)?[ \t\n]*\\([0-9][0-9]?\\)[ \t\n---]*\\([a-z][a-z][a-z]\\)[ \t\n---]*\\([0-9]*[0-9][0-9]\\)[ \t\n]*\\([0-9:]+\\)[ \t\n]*\\([a-z][a-z]?[a-z]?\\|[---+][0-9][0-9][0-9][0-9]\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (if (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (vm-set-weekday-of m (substring date (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (vm-set-weekday-of m ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (vm-set-monthday-of m (substring date (match-beginning 3) (match-end 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (vm-su-do-month m (substring date (match-beginning 4) (match-end 4)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (vm-set-year-of m (substring date (match-beginning 5) (match-end 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (if (= 2 (length (vm-year-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (vm-set-year-of m (concat "19" (vm-year-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (vm-set-hour-of m (substring date (match-beginning 6) (match-end 6)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (vm-set-zone-of m (substring date (match-beginning 7) (match-end 7))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 ((string-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 ;; UNIX ctime(3) format, with slop allowed in the whitespace, and we allow for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 ;; the possibility of a timezone at the end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 "\\([a-z][a-z][a-z]\\)[ \t\n]*\\([a-z][a-z][a-z]\\)[ \t\n]*\\([0-9][0-9]?\\)[ \t\n]*\\([0-9:]+\\)[ \t\n]*\\([0-9][0-9][0-9][0-9]\\)[ \t\n]*\\([a-z][a-z]?[a-z]?\\|[---+][0-9][0-9][0-9][0-9]\\)?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (vm-set-weekday-of m (substring date (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (vm-su-do-month m (substring date (match-beginning 2) (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (vm-set-monthday-of m (substring date (match-beginning 3) (match-end 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (vm-set-hour-of m (substring date (match-beginning 4) (match-end 4)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (vm-set-year-of m (substring date (match-beginning 5) (match-end 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (if (match-beginning 6)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (vm-set-zone-of m (substring date (match-beginning 6)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (match-end 6)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (setq vector (vm-parse-date date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (vm-set-weekday-of m (elt vector 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (vm-set-monthday-of m (elt vector 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (vm-su-do-month m (elt vector 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (vm-set-year-of m (elt vector 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (vm-set-hour-of m (elt vector 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (vm-set-zone-of m (elt vector 5)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 ;; Normalize all hour and date specifications to avoid jagged margins.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 ;; If the hour is " 3:..." or "3:...", turn it into "03:...".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 ;; If the date is "03", turn it into " 3".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (cond ((null (vm-hour-of m)) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 ((string-match "\\`[0-9]:" (vm-hour-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (vm-set-hour-of m (concat "0" (vm-hour-of m)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (cond ((null (vm-monthday-of m)) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 ((string-match "\\`0[0-9]\\'" (vm-monthday-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (vm-set-monthday-of m (substring (vm-monthday-of m) 1 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (defun vm-su-do-month (m month-abbrev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (let ((val (assoc (downcase month-abbrev) vm-month-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (if val
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (progn (vm-set-month-of m (nth 1 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (vm-set-month-number-of m (nth 2 val)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (vm-set-month-of m "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (vm-set-month-number-of m ""))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (defun vm-run-user-summary-function (function message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (let ((message (vm-real-message-of message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (set-buffer (vm-buffer-of message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (narrow-to-region (vm-headers-of message) (vm-text-end-of message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (funcall function message))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (defun vm-su-full-name (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (or (vm-full-name-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (progn (vm-su-do-author m) (vm-full-name-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (defun vm-su-interesting-full-name (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (if vm-summary-uninteresting-senders
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (if (string-match vm-summary-uninteresting-senders (vm-su-from m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (concat vm-summary-uninteresting-senders-arrow (vm-su-to-names m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (vm-su-full-name m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (vm-su-full-name m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (defun vm-su-from (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (or (vm-from-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (progn (vm-su-do-author m) (vm-from-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (defun vm-su-interesting-from (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (if vm-summary-uninteresting-senders
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (if (string-match vm-summary-uninteresting-senders (vm-su-from m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (concat vm-summary-uninteresting-senders-arrow (vm-su-to m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (vm-su-from m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (vm-su-from m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 ;; Some yogurt-headed delivery agents don't even provide a From: header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (defun vm-grok-From_-author (message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 ;; This works only on the From_ types, obviously
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (if (not (memq (vm-message-type-of message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 '(From_ From_-with-Content-Length)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (set-buffer (vm-buffer-of message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (goto-char (vm-start-of message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (if (looking-at "From \\([^ \t\n]+\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (vm-buffer-substring-no-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (match-end 1))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (defun vm-su-do-author (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (let ((full-name (vm-get-header-contents m "Full-Name:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (from (or (vm-get-header-contents m "From:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (vm-grok-From_-author m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 pair)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (if (and full-name (string-match "^[ \t]*$" full-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (setq full-name nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (if (null from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (setq from "???")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (if (null full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (setq full-name "???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (setq pair (funcall vm-chop-full-name-function from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 from (or (nth 1 pair) from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 full-name (or full-name (nth 0 pair) from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (if (string-match "\\`\"\\([^\"]+\\)\"\\'" full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (setq full-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (substring full-name (match-beginning 1) (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (vm-set-full-name-of m full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (vm-set-from-of m from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (defun vm-default-chop-full-name (address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (let ((from address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (full-name nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (cond ((string-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 "\\`[ \t\n]*\\([^< \t\n]+\\([ \t\n]+[^< \t\n]+\\)*\\)?[ \t\n]*<\\([^>]+\\)>[ \t\n]*\\'"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (if (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (setq full-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (substring address (match-beginning 1) (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (setq from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (substring address (match-beginning 3) (match-end 3))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 ((string-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 "\\`[ \t\n]*\\(\\(\"[^\"]+\"\\|[^\"( \t\n]\\)+\\)[ \t\n]*(\\([^ \t\n]+\\([ \t\n]+[^ \t\n]+\\)*\\)?)[ \t\n]*\\'"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (if (match-beginning 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (setq full-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (substring address (match-beginning 3) (match-end 3))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 (setq from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (substring address (match-beginning 1) (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (list full-name from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 ;; test for existence and functionality of mail-extract-address-components
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 ;; there are versions out there that don't work right, so we run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 ;; some test data through it to see if we can trust it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (defun vm-choose-chop-full-name-function (address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (let ((test-data '(("kyle@uunet.uu.net" .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (nil "kyle@uunet.uu.net"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 ("c++std=lib@inet.research.att.com" .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (nil "c++std=lib@inet.research.att.com"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 ("\"Piet.Rypens\" <rypens@reks.uia.ac.be>" .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ("Piet Rypens" "rypens@reks.uia.ac.be"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 ("makke@wins.uia.ac.be (Marc.Gemis)" .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 ("Marc Gemis" "makke@wins.uia.ac.be"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 ("" . (nil nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (failed nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (while test-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (setq result (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (mail-extract-address-components (car (car test-data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (if (not (equal result (cdr (car test-data))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 ;; failed test, use default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (setq failed t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 test-data nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (setq test-data (cdr test-data))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (if failed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ;; it failed, use default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (setq vm-chop-full-name-function 'vm-default-chop-full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 ;; it passed the tests
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (setq vm-chop-full-name-function 'mail-extract-address-components))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (funcall vm-chop-full-name-function address)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (defun vm-su-do-recipients (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (let ((mail-use-rfc822 t) names addresses to cc all list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (setq to (or (vm-get-header-contents m "To:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (vm-get-header-contents m "Apparently-To:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 ;; desperation....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (user-login-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 cc (vm-get-header-contents m "Cc:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 all to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 all (if all (concat all ", " cc) cc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 addresses (rfc822-addresses all))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (setq list (vm-parse-addresses all))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (while list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (cond ((string= (car list) ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 ((string-match "^\\(\"?\\([^<]+[^ \t\n\"]\\)\"?[ \t\n]+\\)?<\\([^>]+\\)>"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (if (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (setq names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (substring (car list) (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (match-end 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 names))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (setq names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (substring (car list) (match-beginning 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (match-end 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 names))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 ((string-match "[\000-\177]*(\\([^)]+\\))[\000-\177]*" (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (setq names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (cons (substring (car list) (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 names)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (t (setq names (cons (car list) names))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (setq names (nreverse names)) ; added by jwz for fixed vm-parse-addresses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (vm-set-to-of m (mapconcat 'identity addresses ", "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (vm-set-to-names-of m (mapconcat 'identity names ", "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (defun vm-su-to (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (or (vm-to-of m) (progn (vm-su-do-recipients m) (vm-to-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (defun vm-su-to-names (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (or (vm-to-names-of m) (progn (vm-su-do-recipients m) (vm-to-names-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (defun vm-su-message-id (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (or (vm-message-id-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (vm-set-message-id-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 m
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (or (vm-get-header-contents m "Message-Id:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 ;; try running md5 on the message body to produce an ID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ;; better than nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (set-buffer (vm-buffer-of (vm-real-message-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (concat "<fake-VM-id."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (vm-pop-md5-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (vm-text-of (vm-real-message-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (vm-text-end-of (vm-real-message-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 "@talos.iv>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (error nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (concat "<" (int-to-string (vm-abs (random))) "@toto.iv>")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (defun vm-su-line-count (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (or (vm-line-count-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (vm-set-line-count-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 m
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (set-buffer (vm-buffer-of (vm-real-message-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (int-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (count-lines (vm-text-of (vm-real-message-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (vm-text-end-of (vm-real-message-of m)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (defun vm-su-subject (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (or (vm-subject-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (vm-set-subject-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 m
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (let ((subject (or (vm-get-header-contents m "Subject:") ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (i nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (if vm-summary-subject-no-newlines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (while (setq i (string-match "\n" subject i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (aset subject i ?\ )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 subject ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (defun vm-su-summary (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (if (and (vm-virtual-message-p m) (not (vm-virtual-messages-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (or (vm-virtual-summary-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (vm-set-virtual-summary-of m (vm-sprintf 'vm-summary-format m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (vm-virtual-summary-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (or (vm-summary-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (vm-set-summary-of m (vm-sprintf 'vm-summary-format m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (vm-summary-of m)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (defun vm-fix-my-summary!!! ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (vm-unsaved-message "Fixing your summary...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (let ((mp vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (vm-set-summary-of (car mp) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (vm-mark-for-summary-update (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (vm-stuff-attributes (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (set-buffer-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (vm-unsaved-message "Fixing your summary... done"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (defun vm-su-thread-indent (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (if (natnump vm-summary-thread-indent-level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (make-string (* (vm-th-thread-indentation m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 vm-summary-thread-indent-level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 ?\ )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 "" ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (defun vm-su-labels (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (or (vm-label-string-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (vm-set-label-string-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 m
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (mapconcat 'identity (vm-labels-of m) ","))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (vm-label-string-of m)))