Function: rmail-next-labeled-message

rmail-next-labeled-message is an autoloaded, interactive and byte-compiled function defined in rmailkwd.el.gz.

Signature

(rmail-next-labeled-message N LABELS)

Documentation

Show next message with one of the labels LABELS.

LABELS should be a comma-separated list of label names. If LABELS is empty, the last set of labels specified is used. With prefix argument N moves forward N messages with these labels.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmailkwd.el.gz
;;;###autoload
(defun rmail-next-labeled-message (n labels)
  "Show next message with one of the labels LABELS.
LABELS should be a comma-separated list of label names.
If LABELS is empty, the last set of labels specified is used.
With prefix argument N moves forward N messages with these labels."
  ;; FIXME show the default in the prompt.
  (interactive "p\nsMove to next msg with labels: ")
  (if (string= labels "")
      (setq labels rmail-last-multi-labels))
  (or labels
      (error "No labels to find have been specified previously"))
  (set-buffer rmail-buffer)
  (setq rmail-last-multi-labels labels)
  (rmail-maybe-set-message-counters)
  (let ((lastwin rmail-current-message)
	(current rmail-current-message)
	(regexp (concat " \\("
			(mail-comma-list-regexp labels)
			"\\)\\(,\\|\\'\\)")))
    (while (and (> n 0) (< current rmail-total-messages))
      (setq current (1+ current))
      (if (string-match regexp (rmail-get-labels current))
	  (setq lastwin current n (1- n))))
    (while (and (< n 0) (> current 1))
      (setq current (1- current))
      (if (string-match regexp (rmail-get-labels current))
	  (setq lastwin current n (1+ n))))
    (if (< n 0)
	(error "No previous message with labels %s" labels)
      (if (> n 0)
	  (error "No following message with labels %s" labels)
	(rmail-show-message-1 lastwin)))))