annotate lisp/vm/vm-mark.el @ 54:05472e90ae02 r19-16-pre2

Import from CVS: tag r19-16-pre2
author cvs
date Mon, 13 Aug 2007 08:57:55 +0200
parents 441bb1e64a06
children 131b0175ea99
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 ;;; Commands for handling messages marks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;; Copyright (C) 1990, 1993, 1994 Kyle E. Jones
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (provide 'vm-mark)
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-clear-all-marks ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 "Removes all message marks in the current folder."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 (vm-error-if-folder-empty)
54
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 26
diff changeset
26 (message "Clearing all marks...")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (let ((mp vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (if (vm-mark-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (vm-set-mark-of (car mp) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (vm-mark-for-summary-update (car mp) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (setq mp (cdr mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (vm-display nil nil '(vm-clear-all-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 '(vm-clear-all-marks marking-message))
54
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 26
diff changeset
36 (vm-update-summary-and-mode-line)
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 26
diff changeset
37 (message "Clearing all marks... done"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defun vm-mark-all-messages ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "Mark all messages in the current folder."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (vm-error-if-folder-empty)
54
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 26
diff changeset
45 (message "Marking all messages...")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (let ((mp vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (vm-set-mark-of (car mp) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (vm-mark-for-summary-update (car mp) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (setq mp (cdr mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (vm-display nil nil '(vm-mark-all-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 '(vm-mark-all-messages marking-message))
54
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 26
diff changeset
53 (vm-update-summary-and-mode-line)
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 26
diff changeset
54 (message "Marking all messages... done"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (defun vm-mark-message (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 "Mark the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 Numeric prefix argument N means mark the current message and the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 N-1 messages. A negative N means mark the current message and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 previous N-1 messages."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (let ((direction (if (< count 0) 'backward 'forward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (count (vm-abs count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (vm-message-pointer vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (while (not (zerop count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (if (not (vm-mark-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (vm-set-mark-of (car vm-message-pointer) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (vm-mark-for-summary-update (car vm-message-pointer) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (vm-decrement count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (if (not (zerop count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (vm-move-message-pointer direction))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (vm-display nil nil '(vm-mark-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 '(vm-mark-message marking-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defun vm-unmark-message (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 "Remove the mark from the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 Numeric prefix argument N means unmark the current message and the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 N-1 messages. A negative N means unmark the current message and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 previous N-1 messages."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (let ((mlist (vm-select-marked-or-prefixed-messages count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (while mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (if (vm-mark-of (car mlist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (vm-set-mark-of (car mlist) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (vm-mark-for-summary-update (car mlist) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (setq mlist (cdr mlist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (vm-display nil nil '(vm-unmark-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 '(vm-unmark-message marking-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
105 (defun vm-mark-summary-region ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
106 "Mark all messages with summary lines contained in the region."
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
107 (interactive)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
108 (vm-select-folder-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
109 (vm-check-for-killed-summary)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
110 (vm-error-if-folder-empty)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
111 (if (null vm-summary-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
112 (error "No summary."))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
113 (set-buffer vm-summary-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
114 (if (not (mark))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
115 (error "The region is not active now"))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
116 (vm-mark-or-unmark-summary-region t)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
117 (vm-display nil nil '(vm-mark-summary-region)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
118 '(vm-mark-summary-region marking-message))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
119 (vm-update-summary-and-mode-line))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
120
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
121 (defun vm-unmark-summary-region ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
122 "Remove marks from messages with summary lines contained in the region."
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
123 (interactive)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
124 (vm-select-folder-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
125 (vm-check-for-killed-summary)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
126 (vm-error-if-folder-empty)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
127 (if (null vm-summary-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
128 (error "No summary."))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
129 (set-buffer vm-summary-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
130 (if (not (mark))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
131 (error "The region is not active now"))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
132 (vm-mark-or-unmark-summary-region nil)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
133 (vm-display nil nil '(vm-unmark-summary-region)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
134 '(vm-unmark-summary-region marking-message))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
135 (vm-update-summary-and-mode-line))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
136
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
137 (defun vm-mark-or-unmark-summary-region (markit)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
138 ;; The folder buffers copy of vm-message-list has already been
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
139 ;; propagated to the summary buffer.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
140 (let ((mp vm-message-list)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
141 (beg (point))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
142 (end (mark))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
143 tmp m)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
144 (if (> beg end)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
145 (setq tmp beg beg end end tmp))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
146 (while mp
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
147 (setq m (car mp))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
148 (if (not (eq (not markit) (not (vm-mark-of m))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
149 (if (or (and (> (vm-su-end-of m) beg)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
150 (< (vm-su-end-of m) end))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
151 (and (>= (vm-su-start-of m) beg)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
152 (< (vm-su-start-of m) end))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
153 (and (>= beg (vm-su-start-of m))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
154 (< beg (vm-su-end-of m))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
155 (progn
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
156 (vm-set-mark-of m markit)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
157 (vm-mark-for-summary-update m t))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
158 (setq mp (cdr mp)))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
159
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (defun vm-mark-or-unmark-messages-with-selector (val selector arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (let ((mlist vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (virtual (eq major-mode 'vm-virtual-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (arglist (if arg (list arg) nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (count 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (setq selector (intern (concat "vm-vs-" (symbol-name selector))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (while mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (if (if virtual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (set-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (vm-buffer-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (vm-real-message-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (car mlist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (apply selector (vm-real-message-of (car mlist)) arglist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (apply selector (car mlist) arglist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (vm-set-mark-of (car mlist) val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (vm-mark-for-summary-update (car mlist) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (vm-increment count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (setq mlist (cdr mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (vm-display nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 '(vm-mark-matching-messages vm-unmark-matching-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (list this-command 'marking-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (message "%d message%s %smarked"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (if (= 1 count) "" "s")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (if val "" "un"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (defun vm-mark-matching-messages (selector &optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 "Mark messages matching some criterion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 You can use any of the virtual folder selectors, except for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 `and', `or' and `not' selectors. See the documentation for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 variable vm-virtual-folder-alist for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (vm-read-virtual-selector "Mark messages: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (vm-mark-or-unmark-messages-with-selector t selector arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (defun vm-unmark-matching-messages (selector &optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 "Unmark messages matching some criterion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 You can use any of the virtual folder selectors, except for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 `and', `or' and `not' selectors. See the documentation for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 variable vm-virtual-folder-alist for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (vm-read-virtual-selector "Unmark messages: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (vm-mark-or-unmark-messages-with-selector nil selector arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (defun vm-mark-thread-subtree ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 "Mark all messages in the thread tree rooted at the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (vm-mark-or-unmark-thread-subtree t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (defun vm-unmark-thread-subtree ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 "Unmark all messages in the thread tree rooted at the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (vm-mark-or-unmark-thread-subtree nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (defun vm-mark-or-unmark-thread-subtree (mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (vm-build-threads-if-unbuilt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (let ((list (list (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (loop-obarray (make-vector 29 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 subject-sym id-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (while list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (if (not (eq (vm-mark-of (car list)) mark))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (vm-set-mark-of (car list) mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (vm-mark-for-summary-update (car list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (setq id-sym (car (vm-last (vm-th-thread-list (car list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (if (null (intern-soft (symbol-name id-sym) loop-obarray))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (intern (symbol-name id-sym) loop-obarray)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (nconc list (copy-sequence (get id-sym 'children)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (setq subject-sym (intern (vm-so-sortable-subject (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 vm-thread-subject-obarray))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (if (and (boundp subject-sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (eq id-sym (aref (symbol-value subject-sym) 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (nconc list (copy-sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (aref (symbol-value subject-sym) 2))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (setq list (cdr list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (vm-display nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 '(vm-mark-thread-subtree vm-unmark-thread-subtree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (list this-command 'marking-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (defun vm-mark-messages-same-subject ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 "Mark all messages with the same subject as the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (vm-mark-or-unmark-messages-same-subject t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (defun vm-unmark-messages-same-subject ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 "Unmark all messages with the same subject as the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (vm-mark-or-unmark-messages-same-subject nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (defun vm-mark-or-unmark-messages-same-subject (mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (let ((mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (mark-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (subject (vm-so-sortable-subject (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (if (and (not (eq (vm-mark-of (car mp)) mark))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (string-equal subject (vm-so-sortable-subject (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (vm-set-mark-of (car mp) mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (vm-increment mark-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (vm-mark-for-summary-update (car mp) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (if (zerop mark-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (message "No messages %smarked" (if mark "" "un"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (message "%d message%s %smarked"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 mark-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (if (= 1 mark-count) "" "s")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (if mark "" "un"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (vm-display nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 '(vm-mark-messages-same-subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 vm-unmark-messages-same-subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (list this-command 'marking-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (defun vm-mark-messages-same-author ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 "Mark all messages with the same author as the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (vm-mark-or-unmark-messages-same-author t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (defun vm-unmark-messages-same-author ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 "Unmark all messages with the same author as the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (vm-mark-or-unmark-messages-same-author nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (defun vm-mark-or-unmark-messages-same-author (mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (let ((mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (mark-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (author (vm-su-from (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (if (and (not (eq (vm-mark-of (car mp)) mark))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (string-equal author (vm-su-from (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (vm-set-mark-of (car mp) mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (vm-increment mark-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (vm-mark-for-summary-update (car mp) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (if (zerop mark-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (message "No messages %smarked" (if mark "" "un"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (message "%d message%s %smarked"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 mark-count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (if (= 1 mark-count) "" "s")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (if mark "" "un"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (vm-display nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 '(vm-mark-messages-same-author
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 vm-unmark-messages-same-author)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (list this-command 'marking-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (defun vm-next-command-uses-marks ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 "Does nothing except insure that the next VM command will operate only
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 20
diff changeset
350 on the marked messages in the current folder. This only works for
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 20
diff changeset
351 commands bound to key, menu or button press events. M-x vm-command will
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 20
diff changeset
352 not work."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (setq this-command 'vm-next-command-uses-marks)
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 20
diff changeset
355 (message "Next command uses marks...")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (vm-display nil nil '(vm-next-command-uses-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 '(vm-next-command-uses-marks)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (defun vm-marked-messages ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (let (list (mp vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (if (vm-mark-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (setq list (cons (car mp) list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (nreverse list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (defun vm-mark-help ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (vm-display nil nil '(vm-mark-help) '(vm-mark-help))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (message "MM = mark, MU = unmark, Mm = mark all, Mu = unmark all, MN = use marks, ..."))