Function: mh-previous-unread-msg

mh-previous-unread-msg is an autoloaded, interactive and byte-compiled function defined in mh-folder.el.gz.

Signature

(mh-previous-unread-msg &optional COUNT)

Documentation

Display previous unread message.

This command can be given a prefix argument COUNT to specify how many unread messages to skip.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-folder.el.gz
;;;###mh-autoload
(defun mh-previous-unread-msg (&optional count)
  "Display previous unread message.

This command can be given a prefix argument COUNT to specify how
many unread messages to skip."
  (interactive "p")
  (unless (> count 0)
    (error "The function `mh-previous-unread-msg' expects positive argument"))
  (setq count (1- count))
  (let ((unread-sequence (cdr (assoc mh-unseen-seq mh-seq-list)))
        (cur-msg (mh-get-msg-num nil)))
    (cond ((and (not cur-msg) (not (bobp))
                ;; If we are at the end of the buffer back up one line and go
                ;; to unread message after that.
                (progn
                  (forward-line -1)
                  (setq cur-msg (mh-get-msg-num nil)))
                nil))
          ((or (null unread-sequence) (not cur-msg))
           ;; No unread message or there aren't any messages in buffer...
           (message "No more unread messages"))
          ((progn
             ;; Skip count messages...
             (while (and unread-sequence (>= (car unread-sequence) cur-msg))
               (setq unread-sequence (cdr unread-sequence)))
             (while (> count 0)
               (setq unread-sequence (cdr unread-sequence))
               (setq count (1- count)))
             (not (car unread-sequence)))
           (message "No more unread messages"))
          (t (cl-loop for msg in unread-sequence
                      when (mh-goto-msg msg t) return nil
                      finally (message "No more unread messages"))))))