annotate lisp/vm/vm-delete.el @ 76:c0c698873ce1 r20-0b33

Import from CVS: tag r20-0b33
author cvs
date Mon, 13 Aug 2007 09:05:10 +0200
parents 131b0175ea99
children 0d2f883870bc
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.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
2 ;;; Copyright (C) 1989, 1990, 1991, 1993, 1994, 1995 Kyle E. Jones
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (provide 'vm-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
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
27 COUNT - 1 messages are deleted. A negative argument means the
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
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
74 COUNT - 1 messages are undeleted. A negative argument means the
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
110 (defun vm-kill-subject ()
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
113 the variables vm-subject-ignored-prefix and vm-subject-ignored-suffix."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
114 (interactive)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (let ((subject (vm-so-sortable-subject (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (if (and (not (vm-deleted-flag (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (string-equal subject (vm-so-sortable-subject (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (vm-set-deleted-flag (car mp) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (vm-increment n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (and (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (if (zerop n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (message "No messages deleted.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (message "%d message%s deleted" n (if (= n 1) "" "s")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (vm-display nil nil '(vm-kill-subject) '(vm-kill-subject))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
136 (vm-update-summary-and-mode-line))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defun vm-expunge-folder (&optional shaddap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 "Expunge messages with the `deleted' attribute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 For normal folders this means that the deleted messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 removed from the message list and the message contents are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 removed from the folder buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 For virtual folders, messages are removed from the virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 message list. If virtual mirroring is in effect for the virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 folder, the corresponding real messages are also removed from real
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 message lists and the message contents are removed from real folders.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 When invoked on marked messages (via vm-next-command-uses-marks),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 only messages both marked and deleted are expunged, other messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ignored."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;; do this so we have a clean slate. code below depends on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;; fact that the numbering redo start point begins as nil in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;; all folder buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (if (not shaddap)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
161 (vm-unsaved-message "Expunging..."))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (let ((use-marks (eq last-command 'vm-next-command-uses-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (virtual (eq major-mode 'vm-virtual-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (buffers-altered (make-vector 29 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 prev virtual-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ((and (vm-deleted-flag (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (or (not use-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (vm-mark-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;; remove the message from the thread tree.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (if vm-thread-obarray
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (vm-unthread-message (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;; expunge from the virtual side first, removing all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; references to this message before actually removing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; the message itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ((setq virtual-messages (vm-virtual-messages-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (let (vms prev curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (if virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (setq vms (cons (vm-real-message-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (vm-virtual-messages-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (setq vms (vm-virtual-messages-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (while vms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (set-buffer (vm-buffer-of (car vms)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (setq prev (vm-reverse-link-of (car vms))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 curr (or (cdr prev) vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (intern (buffer-name) buffers-altered)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (vm-set-numbering-redo-start-point (or prev t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (vm-set-summary-redo-start-point (or prev t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (if (eq vm-message-pointer curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (setq vm-system-state nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 vm-message-pointer (or prev (cdr curr))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (if (eq vm-last-message-pointer curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (setq vm-last-message-pointer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;; lock out interrupts to preserve message-list integrity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (let ((inhibit-quit t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;; vm-clear-expunge-invalidated-undos uses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;; this to recognize expunged messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;; If this stuff is mirrored we'll be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ;; setting this value multiple times if there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;; are multiple virtual messages referencing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;; the underlying real message. Harmless.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (vm-set-deleted-flag-of (car curr) 'expunged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ;; disable summary any summary update that may have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;; already been scheduled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (vm-set-su-start-of (car curr) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (vm-increment vm-modification-counter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (if (null prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (setq vm-message-list (cdr vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (and (cdr curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (vm-set-reverse-link-of (car (cdr curr)) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (setcdr prev (cdr curr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (and (cdr curr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (vm-set-reverse-link-of (car (cdr curr)) prev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (vm-set-virtual-messages-of (car mp) (cdr vms))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (vm-set-buffer-modified-p t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (setq vms (cdr vms))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ((or (not virtual-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (not virtual))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (and (not virtual-messages) virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (vm-set-virtual-messages-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (vm-real-message-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (delq (car mp) (vm-virtual-messages-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (vm-real-message-of (car mp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (if (eq vm-message-pointer mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (setq vm-system-state nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 vm-message-pointer (or prev (cdr mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (if (eq vm-last-message-pointer mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (setq vm-last-message-pointer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (intern (buffer-name) buffers-altered)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (if (null vm-numbering-redo-start-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (vm-set-numbering-redo-start-point (or prev t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (vm-set-summary-redo-start-point (or prev t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;; lock out interrupt to preserve message list integrity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (let ((inhibit-quit t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (if (null prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (progn (setq vm-message-list (cdr vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (and (cdr mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (vm-set-reverse-link-of (car (cdr mp)) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (setcdr prev (cdr mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (and (cdr mp) (vm-set-reverse-link-of (car (cdr mp)) prev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;; vm-clear-expunge-invalidated-undos uses this to recognize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;; expunged messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (vm-set-deleted-flag-of (car mp) 'expunged)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ;; disable summary any summary update that may have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; already been scheduled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (vm-set-su-start-of (car mp) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (vm-set-buffer-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (vm-increment vm-modification-counter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (if (eq (vm-attributes-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (vm-attributes-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (set-buffer (vm-buffer-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (vm-save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (delete-region (vm-start-of (vm-real-message-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (vm-end-of (vm-real-message-of (car mp)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (t (setq prev mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (vm-display nil nil '(vm-expunge-folder) '(vm-expunge-folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (buffers-altered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (mapatoms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (lambda (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (set-buffer (symbol-name buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (if (null vm-system-state)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
276 (if (null vm-message-pointer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
277 ;; folder is now empty
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
278 (progn (setq vm-folder-type nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
279 (vm-update-summary-and-mode-line))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
280 (vm-preview-current-message))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (if (not (eq major-mode 'vm-virtual-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (setq vm-message-order-changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (or vm-message-order-changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 vm-message-order-header-present)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (vm-clear-expunge-invalidated-undos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 buffers-altered))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (if (not shaddap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (message "Deleted messages expunged.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (t (message "No messages are flagged for deletion.")))))