annotate lisp/vm/vm-summary.el @ 24:4103f0995bd7 r19-15b95

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