(wl-summary-previous-message-number): New function.
authorokazaki <okazaki>
Sun, 15 Mar 2009 22:34:33 +0000 (22:34 +0000)
committerokazaki <okazaki>
Sun, 15 Mar 2009 22:34:33 +0000 (22:34 +0000)
(wl-summary-next-message-number): Ditto.
(wl-summary-default-get-next-msg): Use `wl-summary-previous-message-number' and
`wl-summary-next-message-number'.

wl/wl-summary.el

index 6d03019..8ea2d49 100644 (file)
@@ -5028,14 +5028,27 @@ If ARG is numeric number, decode message as following:
 ;;                                         sum))
 ;;     (message "Dropping...done"))))
 
+(defun wl-summary-previous-message-number (msg)
+  "Return a message number previous to the message specified by MSG."
+  (let ((list wl-summary-buffer-number-list)
+       previous)
+    (while (and list (not (eq msg (car list))))
+      (setq previous (car list))
+      (setq list (cdr list)))
+    previous))
+
+(defun wl-summary-next-message-number (msg)
+  "Return a message number next to the message specified by MSG."
+  (cadr (memq msg wl-summary-buffer-number-list)))
+
 (defun wl-summary-default-get-next-msg (msg)
   (or (wl-summary-next-message msg
                               (if wl-summary-move-direction-downward 'down
                                 'up)
                               nil)
-      (cadr (memq msg (if wl-summary-move-direction-downward
-                         wl-summary-buffer-number-list
-                       (reverse wl-summary-buffer-number-list))))))
+      (if wl-summary-move-direction-downward
+         (wl-summary-next-message-number msg)
+       (wl-summary-previous-message-number msg))))
 
 (defun wl-summary-save-current-message ()
   "Save current message for `wl-summary-yank-saved-message'."