Function: mh-iterate-on-messages-in-region

mh-iterate-on-messages-in-region is an autoloaded macro defined in mh-acros.el.

Signature

(mh-iterate-on-messages-in-region VAR BEGIN END &rest BODY)

Documentation

Iterate over region.

VAR is bound to the message on the current line as we loop starting from BEGIN till END. In each step BODY is executed.

If VAR is nil then the loop is executed without any binding.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-acros.el
;;;###mh-autoload
(defmacro mh-iterate-on-messages-in-region (var begin end &rest body)
  "Iterate over region.

VAR is bound to the message on the current line as we loop
starting from BEGIN till END.  In each step BODY is executed.

If VAR is nil then the loop is executed without any binding."
  (declare (debug (symbolp body)) (indent defun))
  (unless (symbolp var)
    (error "Can not bind the non-symbol %s" var))
  (let ((binding-needed-flag var))
    `(save-excursion
       (goto-char ,begin)
       (beginning-of-line)
       (while (and (<= (point) ,end) (not (eobp)))
         (when (looking-at mh-scan-valid-regexp)
           (let ,(if binding-needed-flag `((,var (mh-get-msg-num t))) ())
             ,@body))
         (forward-line 1)))))