annotate lisp/vm/vm-thread.el @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents 131b0175ea99
children a145efe76779
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 ;;; Thread support for VM
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;; Copyright (C) 1994 Kyle E. Jones
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (provide 'vm-thread)
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-toggle-threads-display ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 "Toggle the threads display on and off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 When the threads display is on, the folder will be sorted by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 thread and thread indentation (via the %I summary format specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 will be visible."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (vm-set-summary-redo-start-point t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (setq vm-summary-show-threads (not vm-summary-show-threads))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (if vm-summary-show-threads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (vm-sort-messages "thread")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (vm-sort-messages "physical-order")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (defun vm-build-threads (message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (if (null vm-thread-obarray)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (setq vm-thread-obarray (make-vector 641 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 vm-thread-subject-obarray (make-vector 641 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (let ((mp (or message-list vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; Just for laughs, make the update interval vary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (modulus (+ (% (vm-abs (random)) 11) 40))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; no need to schedule reindents of reparented messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; unless there were already messages present.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (schedule-reindents message-list)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
45 parent parent-sym id id-sym date)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (while mp
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
47 (setq parent (vm-th-parent (car mp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
48 id (vm-su-message-id (car mp))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 id-sym (intern id vm-thread-obarray)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
50 date (vm-so-sortable-datestring (car mp)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
51 (put id-sym 'messages (cons (car mp) (get id-sym 'messages)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (if (and (null (cdr (get id-sym 'messages)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 schedule-reindents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (vm-thread-mark-for-summary-update (get id-sym 'children)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (if parent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (setq parent-sym (intern parent vm-thread-obarray))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
58 (if (not (boundp id-sym))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
59 (set id-sym parent-sym))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (put parent-sym 'children
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
61 (cons (car mp) (get parent-sym 'children))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
62 (set id-sym nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
63 ;; we need to make sure the asets below are an atomic group.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (if vm-thread-using-subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (let* ((inhibit-quit t)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
66 (subject (vm-so-sortable-subject (car mp)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (subject-sym (intern subject vm-thread-subject-obarray)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (if (not (boundp subject-sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (set subject-sym
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
70 (vector id-sym (vm-so-sortable-datestring (car mp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
71 nil (list (car mp))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (aset (symbol-value subject-sym) 3
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
73 (cons (car mp) (aref (symbol-value subject-sym) 3)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (if (string< date (aref (symbol-value subject-sym) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (let* ((vect (symbol-value subject-sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (i-sym (aref vect 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (if (or (not (boundp i-sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (null (symbol-value i-sym)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (aset vect 2 (append (get i-sym 'messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (aref vect 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (aset vect 0 id-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (aset vect 1 date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;; this loops _and_ recurses and I'm worried
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; about it going into a spin someday. So I
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;; unblock interrupts here. It's not critical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;; that it finish... the summary will just be out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;; of sync.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (if schedule-reindents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (let ((inhibit-quit nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (vm-thread-mark-for-summary-update (aref vect 2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (if (null parent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (aset (symbol-value subject-sym) 2
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
93 (cons (car mp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
94 (aref (symbol-value subject-sym) 2))))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (setq mp (cdr mp) n (1+ n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (if (zerop (% n modulus))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
97 (vm-unsaved-message "Building threads... %d" n)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (if (> n modulus)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
99 (vm-unsaved-message "Building threads... done"))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (defun vm-thread-mark-for-summary-update (message-list)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
102 (while message-list
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
103 (vm-mark-for-summary-update (car message-list) t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
104 (vm-set-thread-list-of (car message-list) nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
105 (vm-set-thread-indentation-of (car message-list) nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
106 (vm-thread-mark-for-summary-update
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
107 (get (intern (vm-su-message-id (car message-list))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
108 vm-thread-obarray)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
109 'children))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
110 (setq message-list (cdr message-list))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (defun vm-thread-list (message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (let ((done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (m message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 thread-list id-sym subject-sym loop-sym root-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (set-buffer (vm-buffer-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (setq id-sym (intern (vm-su-message-id m) vm-thread-obarray)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 thread-list (list id-sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (fillarray vm-thread-loop-obarray 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (setq loop-sym (intern (symbol-name id-sym) vm-thread-loop-obarray))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (if (boundp loop-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; loop detected, bail...
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
125 (setq done t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (set loop-sym t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (if (and (boundp id-sym) (symbol-value id-sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (setq id-sym (symbol-value id-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 thread-list (cons id-sym thread-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 m (car (get id-sym 'messages))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (if (null m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (setq done t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (if (null vm-thread-using-subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (setq subject-sym
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (intern (vm-so-sortable-subject m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 vm-thread-subject-obarray))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (if (or (not (boundp subject-sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (eq (aref (symbol-value subject-sym) 0) id-sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (setq done t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (setq id-sym (aref (symbol-value subject-sym) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 thread-list (cons id-sym thread-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 m (car (get id-sym 'messages)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ;; save the date of the oldest message in this thread
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (setq root-date (get id-sym 'oldest-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (if (or (null root-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (string< (vm-so-sortable-datestring message) root-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (put id-sym 'oldest-date (vm-so-sortable-datestring message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 thread-list )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;; remove message struct from thread data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;; optional second arg non-nil means forget information that
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
155 ;; might be different if the mesage contents changed.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
157 ;; message must be a real message
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defun vm-unthread-message (message &optional message-changing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (let ((mp (cons message (vm-virtual-messages-of message)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
161 id-sym subject-sym vect p-sym)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (let ((inhibit-quit t))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
164 (vm-set-thread-list-of (car mp) nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
165 (vm-set-thread-indentation-of (car mp) nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
166 (set-buffer (vm-buffer-of (car mp)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
167 (setq id-sym (intern (vm-su-message-id (car mp)) vm-thread-obarray)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
168 subject-sym (intern (vm-so-sortable-subject (car mp))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 vm-thread-subject-obarray))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (if (boundp id-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (progn
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
172 (put id-sym 'messages (delq (car mp) (get id-sym 'messages)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (vm-thread-mark-for-summary-update (get id-sym 'children))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (setq p-sym (symbol-value id-sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (and p-sym (put p-sym 'children
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
176 (delq (car mp) (get p-sym 'children))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (if message-changing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (set id-sym nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (if (and (boundp subject-sym) (setq vect (symbol-value subject-sym)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (if (not (eq id-sym (aref vect 0)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
181 (aset vect 2 (delq (car mp) (aref vect 2)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (if message-changing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (if (null (cdr (aref vect 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (makunbound subject-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (let ((p (aref vect 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 oldest-msg oldest-date children)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (setq oldest-msg (car p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 oldest-date (vm-so-sortable-datestring (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 p (cdr p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (if (and (string-lessp (vm-so-sortable-datestring (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 oldest-date)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
193 (not (eq (car mp) (car p))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (setq oldest-msg (car p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 oldest-date (vm-so-sortable-datestring (car p))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (aset vect 0 (intern (vm-su-message-id oldest-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 vm-thread-obarray))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (aset vect 1 oldest-date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (setq children (delq oldest-msg (aref vect 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (aset vect 2 children)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
202 (aset vect 3 (delq (car mp) (aref vect 3)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ;; I'm not sure there aren't situations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;; where this might loop forever.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (let ((inhibit-quit nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (vm-thread-mark-for-summary-update children))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (setq mp (cdr mp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (defun vm-th-parent (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (or (vm-parent-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (vm-set-parent-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 m
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
213 (or (let (references)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
214 (setq references (vm-get-header-contents m "References:" " "))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
215 (and references
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
216 (car (vm-last
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
217 (vm-parse references "[^<]*\\(<[^>]+>\\)")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (let (in-reply-to)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
219 (setq in-reply-to (vm-get-header-contents m "In-Reply-To:" " "))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (and in-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (car (vm-parse in-reply-to "[^<]*\\(<[^>]+>\\)"))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (defun vm-th-thread-indentation (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (or (vm-thread-indentation-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (let ((p (vm-th-thread-list m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (while (and p (null (get (car p) 'messages)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (vm-set-thread-indentation-of m (1- (length p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (vm-thread-indentation-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (defun vm-th-thread-list (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (or (vm-thread-list-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (vm-set-thread-list-of m (vm-thread-list m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (vm-thread-list-of m))))