annotate lisp/vm/vm-undo.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents ec9a17fef872
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 ;;; Commands to undo message attribute changes in VM
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
2 ;;; Copyright (C) 1989, 1990, 1993, 1994 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-undo)
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-set-buffer-modified-p (flag &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 (and buffer (set-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 (set-buffer-modified-p flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (vm-increment vm-modification-counter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 (intern (buffer-name) vm-buffers-needing-display-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (if (null flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (setq vm-messages-not-on-disk 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (defun vm-undo-boundary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (if (car vm-undo-record-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (setq vm-undo-record-list (cons nil vm-undo-record-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (defun vm-clear-expunge-invalidated-undos ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (let ((udp vm-undo-record-list) udp-prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (while udp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (cond ((null (car udp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (setq udp-prev udp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ((and (not (eq (car (car udp)) 'vm-set-buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; delete flag == expunged is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; indicator of an expunged message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (eq (vm-deleted-flag (car (cdr (car udp)))) 'expunged))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (cond (udp-prev (setcdr udp-prev (cdr udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (t (setq vm-undo-record-list (cdr udp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (t (setq udp-prev udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (setq udp (cdr udp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (vm-clear-modification-flag-undos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (defun vm-clear-virtual-quit-invalidated-undos ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (let ((udp vm-undo-record-list) udp-prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (while udp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (cond ((null (car udp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (setq udp-prev udp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ((and (not (eq (car (car udp)) 'vm-set-buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; message-id-number == "Q" is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; indicator of a dead message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (equal (vm-message-id-number-of (car (cdr (car udp)))) "Q"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (cond (udp-prev (setcdr udp-prev (cdr udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (t (setq vm-undo-record-list (cdr udp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (t (setq udp-prev udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (setq udp (cdr udp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (vm-clear-modification-flag-undos))
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-clear-modification-flag-undos ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (let ((udp vm-undo-record-list) udp-prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (while udp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (cond ((null (car udp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (setq udp-prev udp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ((eq (car (car udp)) 'vm-set-buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (cond (udp-prev (setcdr udp-prev (cdr udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (t (setq vm-undo-record-list (cdr udp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (t (setq udp-prev udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (setq udp (cdr udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (vm-squeeze-consecutive-undo-boundaries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;; squeeze out consecutive record separators left by record deletions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defun vm-squeeze-consecutive-undo-boundaries ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (let ((udp vm-undo-record-list) udp-prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (while udp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (cond ((and (null (car udp)) udp-prev (null (car udp-prev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (setcdr udp-prev (cdr udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (t (setq udp-prev udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (setq udp (cdr udp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (if (equal '(nil) vm-undo-record-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (setq vm-undo-record-list nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;; for the Undo button on the menubar, if present
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (and (null vm-undo-record-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (vm-menu-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (vm-menu-xemacs-menus-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (vm-menu-set-menubar-dirty-flag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (defun vm-undo-record (sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;; for the Undo button on the menubar, if present
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (and (null vm-undo-record-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (vm-menu-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (vm-menu-xemacs-menus-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (vm-menu-set-menubar-dirty-flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (setq vm-undo-record-list (cons sexp vm-undo-record-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (defun vm-undo-describe (record)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (let ((cell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (assq (car record)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 '((vm-set-new-flag "new" "old")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (vm-set-unread-flag "unread" "read")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (vm-set-deleted-flag "deleted" "undeleted")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (vm-set-forwarded-flag "forwarded" "unforwarded")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (vm-set-replied-flag "answered" "unanswered")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (vm-set-redistributed-flag "redistributed" "unredistributed")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (vm-set-filed-flag "filed" "unfiled")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (vm-set-written-flag "written" "unwritten"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (m (nth 1 record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (cond (cell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (message "VM Undo! %s/%s %s -> %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (buffer-name (vm-buffer-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (vm-number-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (if (nth 2 record)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (nth 2 cell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (nth 1 cell))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (if (nth 2 record)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (nth 1 cell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (nth 2 cell))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ((eq (car cell) 'vm-set-labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (setq labels (nth 2 record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (message "VM Undo! %s/%s %s%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (buffer-name (vm-buffer-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (vm-number-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (if (null labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 "lost all its labels"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 "labels set to ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (if (null labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (mapconcat 'identity labels ", ")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (defun vm-undo-set-message-pointer (record)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (if (and (not (eq (car record) 'vm-set-buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (not (eq (nth 1 record) vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (vm-record-and-change-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (or (cdr (vm-reverse-link-of (nth 1 record)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;; make folder read-only to avoid modifications when we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;; do this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (let ((vm-folder-read-only t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (vm-preview-current-message)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (defun vm-undo ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 "Undo last change to message attributes in the current folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 Consecutive invocations of this command cause sequentially earlier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 changes to be undone. After an intervening command between undos,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 the undos themselves become undoable."
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-display nil nil '(vm-undo) '(vm-undo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (let ((modified (buffer-modified-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (if (not (eq last-command 'vm-undo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (setq vm-undo-record-pointer vm-undo-record-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (if (not vm-undo-record-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (error "No further VM undo information available"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;; skip current record boundary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (setq vm-undo-record-pointer (cdr vm-undo-record-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (while (car vm-undo-record-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (vm-undo-set-message-pointer (car vm-undo-record-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (vm-undo-describe (car vm-undo-record-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (eval (car vm-undo-record-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (setq vm-undo-record-pointer (cdr vm-undo-record-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (and modified (not (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (delete-auto-save-file-if-necessary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (vm-update-summary-and-mode-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (defun vm-set-message-attributes (string count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 "Set message attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 Use this command to change attributes like `deleted' or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 `replied'. Interactively you will be prompted for the attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 to be changed, and only the attributes you enter will be altered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 You can use completion to expand the attribute names. The names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 should be entered as a space separated list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 A numeric prefix argument COUNT causes the current message and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 the next COUNT-1 message to have their attributes altered. A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 negative COUNT arg causes the current message and the previous
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 COUNT-1 messages to be altered. COUNT defaults to one."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; so the user can see what message they are about to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;; modify.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (vm-read-string "Set attributes: " vm-supported-attribute-names t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (vm-display nil nil '(vm-set-message-attributes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 '(vm-set-message-attributes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (let ((name-list (vm-parse string "[ \t]*\\([^ \t]+\\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (m-list (vm-select-marked-or-prefixed-messages count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 n-list name m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (while m-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (setq m (car m-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 n-list name-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (while n-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (setq name (car n-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (cond ((string= name "new")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (vm-set-new-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ((string= name "recent")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (vm-set-new-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ((string= name "unread")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (vm-set-unread-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ((string= name "unseen")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (vm-set-unread-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ((string= name "read")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (vm-set-new-flag m nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (vm-set-unread-flag m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ((string= name "deleted")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (vm-set-deleted-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ((string= name "replied")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (vm-set-replied-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ((string= name "answered")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (vm-set-replied-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ((string= name "forwarded")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (vm-set-forwarded-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ((string= name "redistributed")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (vm-set-redistributed-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ((string= name "filed")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (vm-set-filed-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ((string= name "written")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (vm-set-written-flag m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ((string= name "edited")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (vm-set-edited-flag-of m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ((string= name "undeleted")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (vm-set-deleted-flag m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ((string= name "unreplied")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (vm-set-replied-flag m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ((string= name "unanswered")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (vm-set-replied-flag m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ((string= name "unforwarded")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (vm-set-forwarded-flag m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ((string= name "unredistributed")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (vm-set-redistributed-flag m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ((string= name "unfiled")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (vm-set-filed-flag m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ((string= name "unwritten")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (vm-set-written-flag m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ((string= name "unedited")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (vm-set-edited-flag-of m nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (setq n-list (cdr n-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (setq m-list (cdr m-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (vm-update-summary-and-mode-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (defun vm-add-message-labels (string count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 "Attach some labels to a message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 These are arbitrary user-defined labels, not to be confused with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 message attributes like `new' and `deleted'. Interactively you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 will be prompted for the labels to be added. You can use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 completion to expand the label names, with the completion list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 being all the labels that have ever been used in this folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 The names should be entered as a space separated list. Label
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 names are compared case-insensitively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 A numeric prefix argument COUNT causes the current message and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 the next COUNT-1 message to have the labels added. A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 negative COUNT arg causes the current message and the previous
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 COUNT-1 messages to be altered. COUNT defaults to one."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (this-command this-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (vm-completion-auto-correct nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (completion-ignore-case t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;; so the user can see what message they are about to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ;; modify.
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 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (vm-read-string "Add labels: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (vm-obarray-to-string-list vm-label-obarray) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (vm-add-or-delete-message-labels string count t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (defun vm-delete-message-labels (string count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 "Delete some labels from a message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 These are arbitrary user-defined labels, not to be confused with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 message attributes like `new' and `deleted'. Interactively you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 will be prompted for the labels to be deleted. You can use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 completion to expand the label names, with the completion list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 being all the labels that have ever been used in this folder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 The names should be entered as a space separated list. Label
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 names are compared case-insensitively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 A numeric prefix argument COUNT causes the current message and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 the next COUNT-1 message to have the labels deleted. A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 negative COUNT arg causes the current message and the previous
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 COUNT-1 messages to be altered. COUNT defaults to one."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (this-command this-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (vm-completion-auto-correct nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (completion-ignore-case t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ;; so the user can see what message they are about to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 ;; modify.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (vm-read-string "Delete labels: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (vm-obarray-to-string-list vm-label-obarray) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (prefix-numeric-value current-prefix-arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (vm-add-or-delete-message-labels string count nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (defun vm-add-or-delete-message-labels (string count add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (vm-display nil nil '(vm-add-message-labels vm-delete-message-labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (list this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (setq string (downcase string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (let ((m-list (vm-select-marked-or-prefixed-messages count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (action-labels (vm-parse string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 "[\000-\040,\177-\377]*\\([^\000-\040,\177-\377]+\\)[\000-\040,\177-\377]*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 labels act-labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (if (and add m-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (setq act-labels action-labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (while act-labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (intern (car act-labels) vm-label-obarray)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (setq act-labels (cdr act-labels)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (while m-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (setq act-labels action-labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 labels (copy-sequence (vm-labels-of (car m-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (if add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (while act-labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (setq labels (cons (car act-labels) labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 act-labels (cdr act-labels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (while act-labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (setq labels (vm-delqual (car act-labels) labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 act-labels (cdr act-labels))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (if add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (setq labels (vm-delete-duplicates labels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (vm-set-labels (car m-list) labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (setq m-list (cdr m-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (defun vm-set-xxxx-flag (m flag norecord function attr-index)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (let ((m-list nil) vmp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 ((and (not vm-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (or (not (vm-virtual-messages-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (not (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (set-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (vm-buffer-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (vm-real-message-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 vm-folder-read-only))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
363 (aset (vm-attributes-of m) attr-index flag)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
364 (vm-mark-for-summary-update m)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ((not norecord)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
367 (if (eq vm-flush-interval t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
368 (vm-stuff-virtual-attributes m)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
369 (vm-set-modflag-of m t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (setq vmp (cons (vm-real-message-of m) (vm-virtual-messages-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (while vmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (if (eq (vm-attributes-of m) (vm-attributes-of (car vmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (setq m-list (cons (car vmp) m-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (setq vmp (cdr vmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (if (null m-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (setq m-list (cons m m-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (while m-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (set-buffer (vm-buffer-of (car m-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (cond ((not (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (vm-set-buffer-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (vm-undo-record (list 'vm-set-buffer-modified-p nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (vm-undo-record (list function (car m-list) (not flag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (vm-undo-boundary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (vm-increment vm-modification-counter))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
386 (setq m-list (cdr m-list)))))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (defun vm-set-labels (m labels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (let ((m-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (old-labels (vm-labels-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 vmp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ((and (not vm-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (or (not (vm-virtual-messages-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (not (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (set-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (vm-buffer-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (vm-real-message-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 vm-folder-read-only))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
400 (vm-set-labels-of m labels)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
401 (vm-set-label-string-of m nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
402 (vm-mark-for-summary-update m)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
403 (if (eq vm-flush-interval t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
404 (vm-stuff-virtual-attributes m)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
405 (vm-set-modflag-of m t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (setq vmp (cons (vm-real-message-of m) (vm-virtual-messages-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (while vmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (if (eq (vm-attributes-of m) (vm-attributes-of (car vmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (setq m-list (cons (car vmp) m-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (setq vmp (cdr vmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (if (null m-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (setq m-list (cons m m-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (while m-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (set-buffer (vm-buffer-of (car m-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (cond ((not (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (vm-set-buffer-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (vm-undo-record (list 'vm-set-buffer-modified-p nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (vm-undo-record (list 'vm-set-labels m old-labels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (vm-undo-boundary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (vm-increment vm-modification-counter))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
422 (setq m-list (cdr m-list)))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (defun vm-set-new-flag (m flag &optional norecord)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (vm-set-xxxx-flag m flag norecord 'vm-set-new-flag 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (defun vm-set-unread-flag (m flag &optional norecord)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (vm-set-xxxx-flag m flag norecord 'vm-set-unread-flag 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (defun vm-set-deleted-flag (m flag &optional norecord)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (vm-set-xxxx-flag m flag norecord 'vm-set-deleted-flag 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (defun vm-set-filed-flag (m flag &optional norecord)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (vm-set-xxxx-flag m flag norecord 'vm-set-filed-flag 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (defun vm-set-replied-flag (m flag &optional norecord)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (vm-set-xxxx-flag m flag norecord 'vm-set-replied-flag 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (defun vm-set-written-flag (m flag &optional norecord)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (vm-set-xxxx-flag m flag norecord 'vm-set-written-flag 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (defun vm-set-forwarded-flag (m flag &optional norecord)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (vm-set-xxxx-flag m flag norecord 'vm-set-forwarded-flag 6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (defun vm-set-redistributed-flag (m flag &optional norecord)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (vm-set-xxxx-flag m flag norecord 'vm-set-forwarded-flag 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 ;; use these to avoid undo and summary update.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (defun vm-set-new-flag-of (m flag) (aset (aref m 2) 0 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (defun vm-set-unread-flag-of (m flag) (aset (aref m 2) 1 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (defun vm-set-deleted-flag-of (m flag) (aset (aref m 2) 2 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (defun vm-set-filed-flag-of (m flag) (aset (aref m 2) 3 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (defun vm-set-replied-flag-of (m flag) (aset (aref m 2) 4 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (defun vm-set-written-flag-of (m flag) (aset (aref m 2) 5 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (defun vm-set-forwarded-flag-of (m flag) (aset (aref m 2) 6 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (defun vm-set-redistributed-flag-of (m flag) (aset (aref m 2) 8 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 ;; this is solely for the use of vm-stuff-attributes and appears here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 ;; only because this function should be grouped with others of its kind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ;; for maintenance purposes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (defun vm-set-deleted-flag-in-vector (v flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (aset v 2 flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ;; ditto. this is for vm-read-attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (defun vm-set-new-flag-in-vector (v flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (aset v 0 flag))