annotate lisp/vm/vm-virtual.el @ 147:e186c2b7192d xemacs-20-2

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