annotate lisp/vm/vm-motion.el @ 20:859a2309aef8 r19-15b93

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