annotate lisp/vm/vm-motion.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 859a2309aef8
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 move around in a VM folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;; Copyright (C) 1989, 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-motion)
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-record-and-change-message-pointer (old new)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 (intern (buffer-name) vm-buffers-needing-display-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 (setq vm-last-message-pointer old
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 vm-message-pointer new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 vm-need-summary-pointer-update t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (defun vm-goto-message (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 "Go to the message numbered N.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 Interactively N is the prefix argument. If no prefix arg is provided
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 N is prompted for in the minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 If vm-follow-summary-cursor is non-nil this command will go to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 the message under the cursor in the summary buffer if the summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 window is selected. This only happens if no prefix argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 given."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (cond (current-prefix-arg (prefix-numeric-value current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ((vm-follow-summary-cursor) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (vm-read-number "Go to message: "))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (if (null n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 () ; nil means work has been done already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (vm-display nil nil '(vm-goto-message) '(vm-goto-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (let ((cons (nthcdr (1- n) vm-message-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (if (null cons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (error "No such message."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (if (eq vm-message-pointer cons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (vm-preview-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (vm-record-and-change-message-pointer vm-message-pointer cons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (vm-preview-current-message)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (defun vm-goto-message-last-seen ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "Go to the message last previewed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (vm-display nil nil '(vm-goto-message-last-seen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 '(vm-goto-message-last-seen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (if vm-last-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (vm-record-and-change-message-pointer vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 vm-last-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (vm-preview-current-message))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (defun vm-goto-parent-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "Go to the parent of the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (vm-build-threads-if-unbuilt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (vm-display nil nil '(vm-goto-parent-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 '(vm-goto-parent-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (let ((list (vm-th-thread-list (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (if (null (cdr list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (message "Message has no parent.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (while (cdr (cdr list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (setq message (car (get (car list) 'messages)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (if (null message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (message "Parent message is not in this folder.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (vm-record-and-change-message-pointer vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (memq message vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (vm-preview-current-message)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defun vm-check-count (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (if (>= count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (if (< (length vm-message-pointer) count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (signal 'end-of-folder nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (if (< (1+ (- (length vm-message-list) (length vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (vm-abs count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (signal 'beginning-of-folder nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (defun vm-move-message-pointer (direction)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (let ((mp vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (if (eq direction 'forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (setq mp (cdr mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (if (null mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (if vm-circular-folders
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (setq mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (signal 'end-of-folder nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (setq mp (vm-reverse-link-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (if (null mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (if vm-circular-folders
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (setq mp (vm-last vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (signal 'beginning-of-folder nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (setq vm-message-pointer mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (defun vm-should-skip-message (mp &optional skip-dogmatically)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (if skip-dogmatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (or (and vm-skip-deleted-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (vm-deleted-flag (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (and vm-skip-read-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (or (vm-deleted-flag (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (not (or (vm-new-flag (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (vm-unread-flag (car mp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (and (eq last-command 'vm-next-command-uses-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (null (vm-mark-of (car mp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (or (and (eq vm-skip-deleted-messages t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (vm-deleted-flag (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (and (eq vm-skip-read-messages t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (or (vm-deleted-flag (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (not (or (vm-new-flag (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (vm-unread-flag (car mp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (and (eq last-command 'vm-next-command-uses-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (null (vm-mark-of (car mp)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (defun vm-next-message (&optional count retry signal-errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 "Go forward one message and preview it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 With prefix arg (optional first argument) COUNT, go forward COUNT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 messages. A negative COUNT means go backward. If the absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 value of COUNT is greater than 1, then the values of the variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 vm-skip-deleted-messages and vm-skip-read-messages are ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 When invoked on marked messages (via vm-next-command-uses-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 this command 'sees' marked messages as it moves."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ;; second arg RETRY non-nil means retry a failed move, giving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;; not nil-or-t values of the vm-skip variables a chance to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;; work.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;; third arg SIGNAL-ERRORS non-nil means that if after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;; everything we still have bashed into the end or beginning of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;; folder before completing the move, signal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;; beginning-of-folder or end-of-folder. Otherwise no error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;; will be signaled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;; Note that interactively all args are 1, so error signaling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;; and retries apply to all interactive moves.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (interactive "p\np\np")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;; include other commands that call vm-next-message so that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; correct window configuration is applied for these particular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; non-interactive calls.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (vm-display nil nil '(vm-next-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 vm-delete-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 vm-undelete-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 vm-scroll-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (list this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (and signal-errors (vm-error-if-folder-empty))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (or count (setq count 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (let ((oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (use-marks (eq last-command 'vm-next-command-uses-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (direction (if (> count 0) 'forward 'backward))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (count (vm-abs count)))
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 ((null vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (setq vm-message-pointer vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ((/= count 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (let ((oldmp oldmp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (while (not (zerop count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (vm-move-message-pointer direction)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (if (and use-marks (null (vm-mark-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (while (and (not (eq vm-message-pointer oldmp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (null (vm-mark-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (vm-move-message-pointer direction))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (if (eq vm-message-pointer oldmp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;; terminate the loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (setq count 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;; reset for next pass
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (setq oldmp vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (vm-decrement count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (beginning-of-folder (setq error 'beginning-of-folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (end-of-folder (setq error 'end-of-folder))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (vm-move-message-pointer direction)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (while (and (not (eq oldmp vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (vm-should-skip-message vm-message-pointer t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (vm-move-message-pointer direction))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; Retry the move if we've gone a complete circle and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ;; retries are allowed and there are other messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;; besides this one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (and (eq vm-message-pointer oldmp) retry (cdr vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (vm-move-message-pointer direction)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (while (and (not (eq oldmp vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (vm-should-skip-message vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (vm-move-message-pointer direction)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (beginning-of-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; we bumped into the beginning of the folder without finding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; a suitable stopping point; retry the move if we're allowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (setq vm-message-pointer oldmp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;; if the retry fails, we make sure the message pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;; is restored to its old value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (if retry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (setq vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (let ((vm-message-pointer vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (vm-move-message-pointer direction)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (while (vm-should-skip-message vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (vm-move-message-pointer direction))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 vm-message-pointer )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (beginning-of-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (setq error 'beginning-of-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 oldmp )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (setq error 'beginning-of-folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (end-of-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; we bumped into the end of the folder without finding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ;; a suitable stopping point; retry the move if we're allowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (setq vm-message-pointer oldmp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;; if the retry fails, we make sure the message pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ;; is restored to its old value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (if retry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (setq vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (let ((vm-message-pointer vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (vm-move-message-pointer direction)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (while (vm-should-skip-message vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (vm-move-message-pointer direction))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 vm-message-pointer )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (end-of-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (setq error 'end-of-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 oldmp )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (setq error 'end-of-folder))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (if (not (eq vm-message-pointer oldmp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (vm-record-and-change-message-pointer oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (vm-preview-current-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (and error signal-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (signal error nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (defun vm-previous-message (&optional count retry signal-errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 "Go back one message and preview it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 With prefix arg COUNT, go backward COUNT messages. A negative COUNT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 means go forward. If the absolute value of COUNT > 1 the values of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 variables vm-skip-deleted-messages and vm-skip-read-messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ignored."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (interactive "p\np\np")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (or count (setq count 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (if (interactive-p)
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-display nil nil '(vm-previous-message) '(vm-previous-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (vm-next-message (- count) retry signal-errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (defun vm-next-message-no-skip (&optional count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 "Like vm-next-message but will not skip deleted or read messages."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (if (interactive-p)
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-display nil nil '(vm-Next-message) '(vm-Next-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (let ((vm-skip-deleted-messages nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (vm-skip-read-messages nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (vm-next-message count nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;; backward compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (fset 'vm-Next-message 'vm-next-message-no-skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (defun vm-previous-message-no-skip (&optional count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 "Like vm-previous-message but will not skip deleted or read messages."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (vm-display nil nil '(vm-Previous-message) '(vm-Previous-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (let ((vm-skip-deleted-messages nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (vm-skip-read-messages nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (vm-previous-message count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;; backward compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (fset 'vm-Previous-message 'vm-previous-message-no-skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (defun vm-next-unread-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 "Move forward to the nearest new or unread message, if there is one."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (vm-display nil nil '(vm-next-unread-message) '(vm-next-unread-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (let ((vm-skip-read-messages t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (oldmp vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (vm-next-message 1 nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;; in case vm-circular-folders is non-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (and (eq vm-message-pointer oldmp) (signal 'end-of-folder nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (end-of-folder (message "No next unread message"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (defun vm-previous-unread-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 "Move backward to the nearest new or unread message, if there is one."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (if (interactive-p)
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-display nil nil '(vm-previous-unread-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 '(vm-previous-unread-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (let ((vm-skip-read-messages t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (oldmp vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (vm-previous-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 ;; in case vm-circular-folders is non-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (and (eq vm-message-pointer oldmp) (signal 'beginning-of-folder nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (beginning-of-folder (message "No previous unread message"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (defun vm-next-message-same-subject ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 "Move forward to the nearest message with the same subject.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 vm-subject-ignored-prefix and vm-subject-ignored-suffix will apply
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 to the subject comparisons."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (vm-display nil nil '(vm-next-message-same-subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 '(vm-next-message-same-subject))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (let ((oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (subject (vm-so-sortable-subject (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (vm-move-message-pointer 'forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (if (eq oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (signal 'end-of-folder nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (if (equal subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (vm-so-sortable-subject (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (setq done t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (vm-record-and-change-message-pointer oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (vm-preview-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (end-of-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (setq vm-message-pointer oldmp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (message "No next message with the same subject")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (defun vm-previous-message-same-subject ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 "Move backward to the nearest message with the same subject.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 vm-subject-ignored-prefix and vm-subject-ignored-suffix will apply
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 to the subject comparisons."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (vm-display nil nil '(vm-previous-message-same-subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 '(vm-previous-message-same-subject))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (let ((oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (subject (vm-so-sortable-subject (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (vm-move-message-pointer 'backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (if (eq oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (signal 'beginning-of-folder nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (if (equal subject
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (vm-so-sortable-subject (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (setq done t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (vm-record-and-change-message-pointer oldmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (vm-preview-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (beginning-of-folder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (setq vm-message-pointer oldmp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (message "No previous message with the same subject")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (defun vm-find-first-unread-message (new)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (let (mp unread-mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (setq mp vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (if new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (if (and (vm-new-flag (car mp)) (not (vm-deleted-flag (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (setq unread-mp mp mp nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (setq mp (cdr mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (if (and (or (vm-new-flag (car mp)) (vm-unread-flag (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (not (vm-deleted-flag (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (setq unread-mp mp mp nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (setq mp (cdr mp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 unread-mp ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (defun vm-thoughtfully-select-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (let ((new (and vm-jump-to-new-messages (vm-find-first-unread-message t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (unread (and vm-jump-to-unread-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (vm-find-first-unread-message nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 fix mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (if (null vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (setq fix (vm-last vm-message-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (setq mp (or new unread fix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (if (and mp (not (eq mp vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (vm-record-and-change-message-pointer vm-message-pointer mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 mp )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 nil )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (defun vm-follow-summary-cursor ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (and vm-follow-summary-cursor (eq major-mode 'vm-summary-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (let ((point (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 message-pointer message-list mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (set-buffer vm-mail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (setq message-pointer vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 message-list vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (cond ((or (null message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (and (>= point (vm-su-start-of (car message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (< point (vm-su-end-of (car message-pointer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 nil )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 ;; the position at eob belongs to the last message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ((and (eobp) (= (vm-su-end-of (car message-pointer)) point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 nil )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 ;; make the position at eob belong to the last message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 ((eobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (setq mp (vm-last message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (set-buffer vm-mail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (vm-record-and-change-message-pointer vm-message-pointer mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (vm-preview-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ;; return non-nil so the caller will know that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ;; a new message was selected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 t ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (if (< point (vm-su-start-of (car message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (setq mp message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (setq mp (cdr message-pointer) message-pointer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (while (and (not (eq mp message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (>= point (vm-su-end-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (if (not (eq mp message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (set-buffer vm-mail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (vm-record-and-change-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 vm-message-pointer mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (vm-preview-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 ;; return non-nil so the caller will know that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 ;; a new message was selected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 t )))))))