annotate lisp/vm/vm-delete.el @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents a145efe76779
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 ;;; Delete and expunge commands for VM.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
2 ;;; Copyright (C) 1989-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-delete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (defun vm-delete-message (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 "Add the `deleted' attribute to the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 The message will be physically deleted from the current folder the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 time the current folder is expunged.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 With a prefix argument COUNT, the current message and the next
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
27 COUNT - 1 messages are deleted. A negative argument means
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 the current message and the previous |COUNT| - 1 messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 When invoked on marked messages (via vm-next-command-uses-marks),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 only marked messages are deleted, other messages are ignored."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (let ((used-marks (eq last-command 'vm-next-command-uses-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (mlist (vm-select-marked-or-prefixed-messages count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (del-count 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (while mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (if (not (vm-deleted-flag (car mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (vm-set-deleted-flag (car mlist) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (vm-increment del-count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (setq mlist (cdr mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (vm-display nil nil '(vm-delete-message vm-delete-message-backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (list this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (if (and used-marks (interactive-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (if (zerop del-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (message "No messages deleted")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (message "%d message%s deleted"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 del-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (if (= 1 del-count) "" "s"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (if (and vm-move-after-deleting (not used-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (let ((vm-circular-folders (and vm-circular-folders
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (eq vm-move-after-deleting t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (vm-next-message count t executing-kbd-macro)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defun vm-delete-message-backward (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "Like vm-delete-message, except the deletion direction is reversed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (vm-delete-message (- count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defun vm-undelete-message (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "Remove the `deleted' attribute from the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 With a prefix argument COUNT, the current message and the next
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
74 COUNT - 1 messages are undeleted. A negative argument means
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 the current message and the previous |COUNT| - 1 messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 When invoked on marked messages (via vm-next-command-uses-marks),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 only marked messages are undeleted, other messages are ignored."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (let ((used-marks (eq last-command 'vm-next-command-uses-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (mlist (vm-select-marked-or-prefixed-messages count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (undel-count 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (while mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (if (vm-deleted-flag (car mlist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (vm-set-deleted-flag (car mlist) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (vm-increment undel-count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (setq mlist (cdr mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (if (and used-marks (interactive-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (if (zerop undel-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (message "No messages undeleted")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (message "%d message%s undeleted"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 undel-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (if (= 1 undel-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 "" "s"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (vm-display nil nil '(vm-undelete-message) '(vm-undelete-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (if (and vm-move-after-undeleting (not used-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (let ((vm-circular-folders (and vm-circular-folders
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (eq vm-move-after-undeleting t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (vm-next-message count t executing-kbd-macro)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
110 (defun vm-kill-subject (&optional arg)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 "Delete all messages with the same subject as the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 Message subjects are compared after ignoring parts matched by
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
113 the variables vm-subject-ignored-prefix and vm-subject-ignored-suffix.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
114
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
115 The optional prefix argument ARG specifies the direction to move
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
116 if vm-move-after-killing is non-nil. The default direction is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
117 forward. A positive prefix argument means move forward, a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
118 negative arugment means move backward, a zero argument means
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
119 don't move at all."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
120 (interactive "p")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (let ((subject (vm-so-sortable-subject (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (if (and (not (vm-deleted-flag (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (string-equal subject (vm-so-sortable-subject (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (vm-set-deleted-flag (car mp) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (vm-increment n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (and (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (if (zerop n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (message "No messages deleted.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (message "%d message%s deleted" n (if (= n 1) "" "s")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (vm-display nil nil '(vm-kill-subject) '(vm-kill-subject))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
142 (vm-update-summary-and-mode-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
143 (cond ((or (not (numberp arg)) (> arg 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
144 (setq arg 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
145 ((< arg 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
146 (setq arg -1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
147 (t (setq arg 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
148 (if vm-move-after-killing
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
149 (let ((vm-circular-folders (and vm-circular-folders
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
150 (eq vm-move-after-killing t))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
151 (vm-next-message arg t executing-kbd-macro))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (defun vm-expunge-folder (&optional shaddap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "Expunge messages with the `deleted' attribute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 For normal folders this means that the deleted messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 removed from the message list and the message contents are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 removed from the folder buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 For virtual folders, messages are removed from the virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 message list. If virtual mirroring is in effect for the virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 folder, the corresponding real messages are also removed from real
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 message lists and the message contents are removed from real folders.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 When invoked on marked messages (via vm-next-command-uses-marks),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 only messages both marked and deleted are expunged, other messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ignored."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ;; do this so we have a clean slate. code below depends on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;; fact that the numbering redo start point begins as nil in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;; all folder buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (if (not shaddap)
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 100
diff changeset
176 (message "Expunging..."))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (let ((use-marks (eq last-command 'vm-next-command-uses-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (virtual (eq major-mode 'vm-virtual-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (buffers-altered (make-vector 29 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 prev virtual-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ((and (vm-deleted-flag (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (or (not use-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (vm-mark-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; remove the message from the thread tree.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (if vm-thread-obarray
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (vm-unthread-message (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;; expunge from the virtual side first, removing all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;; references to this message before actually removing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;; the message itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ((setq virtual-messages (vm-virtual-messages-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (let (vms prev curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (if virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (setq vms (cons (vm-real-message-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (vm-virtual-messages-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (setq vms (vm-virtual-messages-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (while vms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (set-buffer (vm-buffer-of (car vms)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (setq prev (vm-reverse-link-of (car vms))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 curr (or (cdr prev) vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (intern (buffer-name) buffers-altered)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (vm-set-numbering-redo-start-point (or prev t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (vm-set-summary-redo-start-point (or prev t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (if (eq vm-message-pointer curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (setq vm-system-state nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 vm-message-pointer (or prev (cdr curr))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (if (eq vm-last-message-pointer curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (setq vm-last-message-pointer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;; lock out interrupts to preserve message-list integrity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (let ((inhibit-quit t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; vm-clear-expunge-invalidated-undos uses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; this to recognize expunged messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; If this stuff is mirrored we'll be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;; setting this value multiple times if there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;; are multiple virtual messages referencing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;; the underlying real message. Harmless.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (vm-set-deleted-flag-of (car curr) 'expunged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; disable summary any summary update that may have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; already been scheduled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (vm-set-su-start-of (car curr) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (vm-increment vm-modification-counter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (if (null prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (setq vm-message-list (cdr vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (and (cdr curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (vm-set-reverse-link-of (car (cdr curr)) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (setcdr prev (cdr curr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (and (cdr curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (vm-set-reverse-link-of (car (cdr curr)) prev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (vm-set-virtual-messages-of (car mp) (cdr vms))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (vm-set-buffer-modified-p t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (setq vms (cdr vms))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ((or (not virtual-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (not virtual))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (and (not virtual-messages) virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (vm-set-virtual-messages-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (vm-real-message-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (delq (car mp) (vm-virtual-messages-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (vm-real-message-of (car mp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (if (eq vm-message-pointer mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (setq vm-system-state nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 vm-message-pointer (or prev (cdr mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (if (eq vm-last-message-pointer mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (setq vm-last-message-pointer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (intern (buffer-name) buffers-altered)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (if (null vm-numbering-redo-start-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (vm-set-numbering-redo-start-point (or prev t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (vm-set-summary-redo-start-point (or prev t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 ;; lock out interrupt to preserve message list integrity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (let ((inhibit-quit t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (if (null prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (progn (setq vm-message-list (cdr vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (and (cdr mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (vm-set-reverse-link-of (car (cdr mp)) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (setcdr prev (cdr mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (and (cdr mp) (vm-set-reverse-link-of (car (cdr mp)) prev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;; vm-clear-expunge-invalidated-undos uses this to recognize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;; expunged messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (vm-set-deleted-flag-of (car mp) 'expunged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ;; disable summary any summary update that may have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;; already been scheduled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (vm-set-su-start-of (car mp) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (vm-set-buffer-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (vm-increment vm-modification-counter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (if (eq (vm-attributes-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (vm-attributes-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (set-buffer (vm-buffer-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (vm-save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (delete-region (vm-start-of (vm-real-message-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (vm-end-of (vm-real-message-of (car mp)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (t (setq prev mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (vm-display nil nil '(vm-expunge-folder) '(vm-expunge-folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (buffers-altered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (mapatoms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (lambda (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (set-buffer (symbol-name buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (if (null vm-system-state)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
291 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
292 (vm-garbage-collect-message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
293 (if (null vm-message-pointer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
294 ;; folder is now empty
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
295 (progn (setq vm-folder-type nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
296 (vm-update-summary-and-mode-line))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
297 (vm-preview-current-message)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (if (not (eq major-mode 'vm-virtual-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (setq vm-message-order-changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (or vm-message-order-changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 vm-message-order-header-present)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (vm-clear-expunge-invalidated-undos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 buffers-altered))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (if (not shaddap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (message "Deleted messages expunged.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (t (message "No messages are flagged for deletion.")))))