annotate lisp/vm/vm-virtual.el @ 36:c53a95d3c46d r19-15b101

Import from CVS: tag r19-15b101
author cvs
date Mon, 13 Aug 2007 08:53:38 +0200
parents 441bb1e64a06
children 05472e90ae02
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 ;;; Virtual folders for VM
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
2 ;;; Copyright (C) 1990-1997 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-virtual)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; This function builds the virtual message list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; If the new-messages argument is nil, the message list is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; derived from the folders listed in the virtual folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; definition and selected by the various selectors. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; resulting message list is assigned to vm-message-list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; If new-messages is non-nil then it is a list of messages to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; tried against the selector parts of the virtual folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; definition. Matching messages are added to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; vm-message-list, instead of replacing it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; The messages in new-messages must all be in the same real folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (defun vm-build-virtual-message-list (new-messages)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
34 (vm-with-virtual-selector-variables
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
35 (let ((clauses (cdr vm-virtual-folder-definition))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
36 (message-set (make-vector 311 0))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
37 (vbuffer (current-buffer))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
38 (mirrored vm-virtual-mirror)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
39 (case-fold-search t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
40 (tail-cons (vm-last vm-message-list))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
41 (new-message-list nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
42 virtual location-vector
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
43 message mp folders folder
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
44 selectors sel-list selector arglist i
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
45 real-buffers-used)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
46 ;; Since there is at most one virtual message in the folder
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
47 ;; buffer of a virtual folder, the location data vector (and
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
48 ;; the markers in it) of all virtual messages in a virtual
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
49 ;; folder is shared. We initialize the vector here if it
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
50 ;; hasn't been created already.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
51 (if vm-message-list
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
52 (setq location-vector (vm-location-data-of (car vm-message-pointer)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
53 (setq i 0
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
54 location-vector (make-vector vm-location-data-vector-length nil))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
55 (while (< i vm-location-data-vector-length)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
56 (aset location-vector i (vm-marker nil))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
57 (vm-increment i)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
58 ;; To keep track of the messages in a virtual folder to
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
59 ;; prevent duplicates we create and maintain a set that
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
60 ;; contain all the real messages.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
61 (setq mp vm-message-list)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
62 (while mp
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
63 (intern (vm-message-id-number-of (vm-real-message-of (car mp)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
64 message-set)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
65 (setq mp (cdr mp)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
66 ;; now select the messages
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
67 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
68 (while clauses
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
69 (setq folders (car (car clauses))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
70 selectors (cdr (car clauses)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
71 (while folders
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
72 (setq folder (car folders))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
73 (and (stringp folder)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
74 (setq folder (expand-file-name folder vm-folder-directory)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
75 (and (listp folder)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
76 (setq folder (eval folder)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
77 (cond
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
78 ((null folder)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
79 ;; folder was a s-expr which returned nil
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
80 ;; skip it
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
81 nil )
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
82 ((and (stringp folder) (file-directory-p folder))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
83 (setq folders (nconc folders
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
84 (vm-delete-backup-file-names
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
85 (vm-delete-auto-save-file-names
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
86 (vm-delete-directory-file-names
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
87 (directory-files folder t nil)))))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
88 ((or (null new-messages)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
89 ;; If we're assimilating messages into an
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
90 ;; existing virtual folder, only allow selectors
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
91 ;; that would be normally applied to this folder.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
92 (and (bufferp folder)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
93 (eq (vm-buffer-of (car new-messages)) folder))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
94 (and (stringp folder)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
95 (eq (vm-buffer-of (car new-messages))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
96 ;; letter bomb protection
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
97 ;; set inhibit-local-variables to t for v18 Emacses
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
98 ;; set enable-local-variables to nil
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
99 ;; for newer Emacses
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
100 (let ((inhibit-local-variables t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
101 (enable-local-variables nil))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
102 (find-file-noselect folder)))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
103 (set-buffer (or (and (bufferp folder) folder)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
104 (vm-get-file-buffer folder)
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
105 (let ((inhibit-local-variables t)
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
106 (enable-local-variables nil))
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
107 (find-file-noselect folder))))
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
108 (if (eq major-mode 'vm-virtual-mode)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
109 (setq virtual t
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
110 real-buffers-used
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
111 (append vm-real-buffers real-buffers-used))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
112 (setq virtual nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
113 (if (not (memq (current-buffer) real-buffers-used))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
114 (setq real-buffers-used (cons (current-buffer)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
115 real-buffers-used)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
116 (if (not (eq major-mode 'vm-mode))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
117 (vm-mode)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
118 ;; change (sexpr) into ("/file" "/file2" ...)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
119 ;; this assumes that there will never be (sexpr sexpr2)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
120 ;; in a virtual folder spec.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
121 (if (bufferp folder)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
122 (if virtual
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
123 (setcar (car clauses)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
124 (delq nil
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
125 (mapcar 'buffer-file-name vm-real-buffers)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
126 (if buffer-file-name
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
127 (setcar (car clauses) (list buffer-file-name)))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
128 ;; if new-messages non-nil use it instead of the
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
129 ;; whole message list
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
130 (setq mp (or new-messages vm-message-list))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
131 (while mp
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
132 (if (and (not (intern-soft
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
133 (vm-message-id-number-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
134 (vm-real-message-of (car mp)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
135 message-set))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
136 (if virtual
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
137 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
138 (set-buffer
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
139 (vm-buffer-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
140 (vm-real-message-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
141 (car mp))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
142 (apply 'vm-vs-or (car mp) selectors))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
143 (apply 'vm-vs-or (car mp) selectors)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
144 (progn
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
145 (intern
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
146 (vm-message-id-number-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
147 (vm-real-message-of (car mp)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 message-set)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
149 (setq message (copy-sequence
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
150 (vm-real-message-of (car mp))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
151 (if mirrored
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
152 ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
153 (vm-set-mirror-data-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
154 message
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
155 (make-vector vm-mirror-data-vector-length nil))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
156 (vm-set-virtual-messages-sym-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
157 message (make-symbol "<v>"))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
158 (vm-set-virtual-messages-of message nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
159 (vm-set-attributes-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
160 message
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
161 (make-vector vm-attributes-vector-length nil)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
162 (vm-set-location-data-of message location-vector)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
163 (vm-set-softdata-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
164 message
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
165 (make-vector vm-softdata-vector-length nil))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
166 (vm-set-real-message-sym-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
167 message
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
168 (vm-real-message-sym-of (car mp)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
169 (vm-set-message-type-of message vm-folder-type)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
170 (vm-set-message-id-number-of message
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
171 vm-message-id-number)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
172 (vm-increment vm-message-id-number)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
173 (vm-set-buffer-of message vbuffer)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
174 (vm-set-reverse-link-sym-of message (make-symbol "<--"))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
175 (vm-set-reverse-link-of message tail-cons)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
176 (if (null tail-cons)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
177 (setq new-message-list (list message)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
178 tail-cons new-message-list)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
179 (setcdr tail-cons (list message))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
180 (if (null new-message-list)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
181 (setq new-message-list (cdr tail-cons)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
182 (setq tail-cons (cdr tail-cons)))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
183 (setq mp (cdr mp)))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
184 (setq folders (cdr folders)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
185 (setq clauses (cdr clauses))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
186 ;; this doesn't need to work currently, but it might someday
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
187 ;; (if virtual
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
188 ;; (setq real-buffers-used (vm-delete-duplicates real-buffers-used)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
189 (vm-increment vm-modification-counter)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
190 ;; Until this point the user doesn't really have a virtual
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
191 ;; folder, as the virtual messages haven't been linked to the
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
192 ;; real messages, virtual buffers to the real buffers, and no
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
193 ;; message list has been installed.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
194 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
195 ;; Now we tie it all together, with this section of code being
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
196 ;; uninterruptible.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
197 (let ((inhibit-quit t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
198 (label-obarray vm-label-obarray))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
199 (if (null vm-real-buffers)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
200 (setq vm-real-buffers real-buffers-used))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
201 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
202 (while real-buffers-used
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
203 (set-buffer (car real-buffers-used))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
204 ;; inherit the global label lists of all the associated
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
205 ;; real folders.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
206 (mapatoms (function (lambda (x) (intern (symbol-name x)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
207 label-obarray)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
208 vm-label-obarray)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
209 (if (not (memq vbuffer vm-virtual-buffers))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
210 (setq vm-virtual-buffers (cons vbuffer vm-virtual-buffers)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
211 (setq real-buffers-used (cdr real-buffers-used))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
212 (setq mp new-message-list)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
213 (while mp
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
214 (vm-set-virtual-messages-of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
215 (vm-real-message-of (car mp))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
216 (cons (car mp) (vm-virtual-messages-of (car mp))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
217 (setq mp (cdr mp)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
218 (if vm-message-list
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
219 (progn
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
220 (vm-set-summary-redo-start-point new-message-list)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
221 (vm-set-numbering-redo-start-point new-message-list))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
222 (vm-set-summary-redo-start-point t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
223 (vm-set-numbering-redo-start-point t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
224 (setq vm-message-list new-message-list))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (defun vm-create-virtual-folder (selector &optional arg read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 "Create a new virtual folder from messages in the current folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 The messages will be chosen by applying the selector you specify,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 which is normally read from the minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 Prefix arg means the new virtual folder should be visited read only."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (this-command this-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (prefix current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (nconc (vm-read-virtual-selector "Create virtual folder of messages: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (list prefix))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (let (vm-virtual-folder-alist name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (if arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (setq name (format "%s %s %s" (buffer-name) selector arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (setq name (format "%s %s" (buffer-name) selector)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (setq vm-virtual-folder-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (list name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (list (list (list 'get-buffer (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (if arg (list selector arg) (list selector))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (vm-visit-virtual-folder name read-only)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (defun vm-apply-virtual-folder (name &optional read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 "Apply the selectors of a named virtual folder to the current folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 and create a virtual folder containing the selected messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 Prefix arg means the new virtual folder should be visited read only."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (completing-read "Apply this virtual folder's selectors: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 vm-virtual-folder-alist nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (let ((vfolder (assoc name vm-virtual-folder-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 clauses vm-virtual-folder-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (or vfolder (error "No such virtual folder, %s" name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (setq vfolder (vm-copy vfolder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (setq clauses (cdr vfolder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (while clauses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (setcar (car clauses) (list (list 'get-buffer (buffer-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (setq clauses (cdr clauses)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (setcar vfolder (format "%s/%s" (buffer-name) (car vfolder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (setq vm-virtual-folder-alist (list vfolder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (vm-visit-virtual-folder (car vfolder) read-only)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (defun vm-toggle-virtual-mirror ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (if (not (eq major-mode 'vm-virtual-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (error "This is not a virtual folder."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (let ((mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (inhibit-quit t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 modified undo-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (setq undo-list vm-saved-undo-record-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 vm-saved-undo-record-list vm-undo-record-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 vm-undo-record-list undo-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 vm-undo-record-pointer undo-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (setq modified vm-saved-buffer-modified-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 vm-saved-buffer-modified-p (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (set-buffer-modified-p modified)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (if vm-virtual-mirror
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (vm-set-attributes-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (car mp) (or (vm-saved-virtual-attributes-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (make-vector vm-attributes-vector-length nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (vm-set-mirror-data-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (car mp) (or (vm-saved-virtual-mirror-data-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (make-vector vm-mirror-data-vector-length nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (vm-mark-for-summary-update (car mp) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;; mark for summary update _before_ we set this message to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ;; be mirrored. this will prevent the real message and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 ;; the other messages that will share attributes with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;; this message from having their summaries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;; updated... they don't need it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (vm-mark-for-summary-update (car mp) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (vm-set-saved-virtual-attributes-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (car mp) (vm-attributes-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (vm-set-saved-virtual-mirror-data-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (car mp) (vm-mirror-data-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (vm-set-attributes-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (car mp) (vm-attributes-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (vm-set-mirror-data-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (car mp) (vm-mirror-data-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (setq mp (cdr mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (setq vm-virtual-mirror (not vm-virtual-mirror))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (vm-increment vm-modification-counter))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (message "Virtual folder now %s the underlying real folder%s."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (if vm-virtual-mirror "mirrors" "does not mirror")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (if (cdr vm-real-buffers) "s" "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (defun vm-virtual-help ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (vm-display nil nil '(vm-virtual-help) '(vm-virtual-help))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (message "VV = visit, VA = apply selectors, VC = create, VM = toggle virtual mirror"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (defun vm-vs-or (m &rest selectors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (let ((result nil) selector arglist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (while selectors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (setq selector (car (car selectors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 arglist (cdr (car selectors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 result (apply (symbol-value selector) m arglist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 selectors (if result nil (cdr selectors))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 result ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (defun vm-vs-and (m &rest selectors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (let ((result t) selector arglist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (while selectors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (setq selector (car (car selectors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 arglist (cdr (car selectors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 result (apply (symbol-value selector) m arglist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 selectors (if (null result) nil (cdr selectors))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 result ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (defun vm-vs-not (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (let ((selector (car arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (arglist (cdr arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (not (apply (symbol-value selector) m arglist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (defun vm-vs-any (m) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (defun vm-vs-author (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (or (string-match arg (vm-su-full-name m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (string-match arg (vm-su-from m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (defun vm-vs-recipient (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (or (string-match arg (vm-su-to m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (string-match arg (vm-su-to-names m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (defun vm-vs-subject (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (string-match arg (vm-su-subject m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (defun vm-vs-sent-before (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (string< (vm-so-sortable-datestring m) (vm-timezone-make-date-sortable arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (defun vm-vs-sent-after (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (string< (vm-timezone-make-date-sortable arg) (vm-so-sortable-datestring m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (defun vm-vs-header (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (widen)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
380 (goto-char (vm-headers-of (vm-real-message-of m)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
381 (re-search-forward arg (vm-text-of (vm-real-message-of m)) t))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (defun vm-vs-label (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (vm-member arg (vm-labels-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (defun vm-vs-text (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (widen)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
390 (goto-char (vm-text-of (vm-real-message-of m)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
391 (re-search-forward arg (vm-text-end-of (vm-real-message-of m)) t))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (defun vm-vs-more-chars-than (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (> (string-to-int (vm-su-byte-count m)) arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (defun vm-vs-less-chars-than (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (< (string-to-int (vm-su-byte-count m)) arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (defun vm-vs-more-lines-than (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (> (string-to-int (vm-su-line-count m)) arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (defun vm-vs-less-lines-than (m arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (< (string-to-int (vm-su-line-count m)) arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (defun vm-vs-new (m) (vm-new-flag m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (defun vm-vs-unread (m) (vm-unread-flag m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (defun vm-vs-read (m) (not (or (vm-new-flag m) (vm-unread-flag m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (defun vm-vs-deleted (m) (vm-deleted-flag m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (defun vm-vs-replied (m) (vm-replied-flag m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (defun vm-vs-forwarded (m) (vm-forwarded-flag m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (defun vm-vs-filed (m) (vm-filed-flag m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (defun vm-vs-written (m) (vm-written-flag m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (defun vm-vs-marked (m) (vm-mark-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (defun vm-vs-edited (m) (vm-edited-flag m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (put 'header 'vm-virtual-selector-clause "with header matching")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (put 'label 'vm-virtual-selector-clause "with label of")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (put 'text 'vm-virtual-selector-clause "with text matching")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (put 'recipient 'vm-virtual-selector-clause "with recipient matching")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (put 'author 'vm-virtual-selector-clause "with author matching")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (put 'subject 'vm-virtual-selector-clause "with subject matching")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (put 'sent-before 'vm-virtual-selector-clause "sent before")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (put 'sent-after 'vm-virtual-selector-clause "sent after")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (put 'more-chars-than 'vm-virtual-selector-clause
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 "with more characters than")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (put 'less-chars-than 'vm-virtual-selector-clause
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 "with less characters than")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (put 'more-lines-than 'vm-virtual-selector-clause "with more lines than")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (put 'less-lines-than 'vm-virtual-selector-clause "with less lines than")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (defun vm-read-virtual-selector (prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (let (selector (arg nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (setq selector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (vm-read-string prompt vm-supported-interactive-virtual-selectors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 selector (intern selector))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (if (memq selector '(header label text recipient
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 author subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 sent-before sent-after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 more-chars-than more-lines-than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 less-chars-than less-lines-than))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (setq prompt (concat (substring prompt 0 -2) " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (get selector 'vm-virtual-selector-clause)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 ": "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (cond ((memq selector '(more-chars-than more-lines-than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 less-chars-than less-lines-than))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (setq arg (vm-read-number prompt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 ((eq selector 'label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (let ((vm-completion-auto-correct nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (completion-ignore-case t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (setq arg (downcase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (vm-read-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (vm-obarray-to-string-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 vm-label-obarray)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (t (setq arg (read-string prompt))))))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
458 (or (fboundp (intern (concat "vm-vs-" (symbol-name selector))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
459 (error "Invalid selector"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (list selector arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 ;; clear away links between real and virtual folders when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ;; a vm-quit is performed in either type folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (defun vm-virtual-quit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (cond ((eq major-mode 'vm-virtual-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 ;; don't trust blindly, user might have killed some of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 ;; these buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (setq vm-real-buffers (vm-delete 'buffer-name vm-real-buffers t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (let ((bp vm-real-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (b (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 ;; lock out interrupts here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (inhibit-quit t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (while bp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (set-buffer (car bp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (setq vm-virtual-buffers (delq b vm-virtual-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 bp (cdr bp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (vm-set-virtual-messages-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (vm-real-message-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (delq (car mp) (vm-virtual-messages-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (vm-real-message-of (car mp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (setq mp (cdr mp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 ((eq major-mode 'vm-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 ;; don't trust blindly, user might have killed some of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 ;; these buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (setq vm-virtual-buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (vm-delete 'buffer-name vm-virtual-buffers t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (let ((bp vm-virtual-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 vmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (b (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 ;; lock out interrupts here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (inhibit-quit t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (setq vmp (vm-virtual-messages-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (while vmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ;; we'll clear these messages from the virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 ;; folder by looking for messages that have a "Q"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ;; id number associated with them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (vm-set-message-id-number-of (car vmp) "Q")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (setq vmp (cdr vmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (vm-set-virtual-messages-of (car mp) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (while bp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (set-buffer (car bp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (setq vm-real-buffers (delq b vm-real-buffers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 ;; set the message pointer to a new value if it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 ;; now invalid.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
511 (cond
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 26
diff changeset
512 ((and vm-message-pointer
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 26
diff changeset
513 (equal "Q" (vm-message-id-number-of
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 26
diff changeset
514 (car vm-message-pointer))))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
515 (vm-garbage-collect-message)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
516 (setq vmp vm-message-pointer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
517 (while (and vm-message-pointer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
518 (equal "Q" (vm-message-id-number-of
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
519 (car vm-message-pointer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
520 (setq vm-message-pointer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
521 (cdr vm-message-pointer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
522 ;; if there were no good messages ahead, try going
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
523 ;; backward.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
524 (if (null vm-message-pointer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
525 (progn
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
526 (setq vm-message-pointer vmp)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
527 (while (and vm-message-pointer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
528 (equal "Q" (vm-message-id-number-of
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
529 (car vm-message-pointer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
530 (setq vm-message-pointer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
531 (vm-reverse-link-of
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
532 (car vm-message-pointer))))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ;; expunge the virtual messages associated with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 ;; real messages that are going away.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (setq vm-message-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (vm-delete (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (lambda (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (equal "Q" (vm-message-id-number-of m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 vm-message-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (if (null vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (setq vm-message-pointer vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ;; same for vm-last-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (if (null vm-last-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (setq vm-last-message-pointer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (vm-clear-virtual-quit-invalidated-undos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (vm-reverse-link-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (vm-set-numbering-redo-start-point t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (vm-set-summary-redo-start-point t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (if vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (vm-preview-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (setq bp (cdr bp))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (defun vm-virtual-save-folder (prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 ;; don't trust blindly, user might have killed some of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 ;; these buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (setq vm-real-buffers (vm-delete 'buffer-name vm-real-buffers t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (let ((bp vm-real-buffers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (while bp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (set-buffer (car bp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (vm-save-folder prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (setq bp (cdr bp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (vm-set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (vm-clear-modification-flag-undos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (defun vm-virtual-get-new-mail ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 ;; don't trust blindly, user might have killed some of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ;; these buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (setq vm-real-buffers (vm-delete 'buffer-name vm-real-buffers t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (let ((bp vm-real-buffers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (while bp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (set-buffer (car bp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (condition-case error-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (vm-get-new-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (folder-read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (message "Folder is read only: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (or buffer-file-name (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (sit-for 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (unrecognized-folder-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (message "Folder type is unrecognized: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (or buffer-file-name (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (sit-for 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (setq bp (cdr bp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (vm-emit-totals-blurb))
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-make-virtual-copy (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (let ((virtual-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (real-m (vm-real-message-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (modified (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (set-buffer (vm-buffer-of real-m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 ;; must reference this now so that headers will be in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 ;; their final position before the message is copied.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ;; otherwise the vheader offset computed below will be wrong.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (vm-vheaders-of real-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (copy-to-buffer virtual-buffer (vm-start-of real-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (vm-end-of real-m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (set-buffer-modified-p modified))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (set-marker (vm-start-of m) (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (set-marker (vm-headers-of m) (+ (vm-start-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (- (vm-headers-of real-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (vm-start-of real-m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (set-marker (vm-vheaders-of m) (+ (vm-start-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (- (vm-vheaders-of real-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (vm-start-of real-m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (set-marker (vm-text-of m) (+ (vm-start-of m) (- (vm-text-of real-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (vm-start-of real-m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (set-marker (vm-text-end-of m) (+ (vm-start-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (- (vm-text-end-of real-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (vm-start-of real-m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (set-marker (vm-end-of m) (+ (vm-start-of m) (- (vm-end-of real-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (vm-start-of real-m))))))