Function: rmail-set-message-counters-counter

rmail-set-message-counters-counter is a byte-compiled function defined in rmail.el.gz.

Signature

(rmail-set-message-counters-counter &optional SPOT-TO-FIND)

Documentation

Collect the start positions of messages in list messages-head.

Return the number of messages after the one containing SPOT-TO-FIND.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-set-message-counters-counter (&optional spot-to-find)
  "Collect the start positions of messages in list `messages-head'.
Return the number of messages after the one containing SPOT-TO-FIND."
  (let ((start (point))
	messages-after-spot)
    (while (search-backward "\n\nFrom " nil t)
      (forward-char 2)
      (when (looking-at rmail-unix-mail-delimiter)
	(if (and (<= (point) spot-to-find)
		 (null messages-after-spot))
	    (setq messages-after-spot total-messages))
	(rmail-collect-deleted start)
	(setq messages-head (cons (point-marker) messages-head)
	      total-messages (1+ total-messages)
	      start (point))
	;; Show progress after every 20 messages or so.
	(if (zerop (% total-messages 20))
	    (message "Counting messages...%d" total-messages))))
    ;; Handle the first message, maybe.
    (goto-char (point-min))
    (unless (not (looking-at rmail-unix-mail-delimiter))
      (if (and (<= (point) spot-to-find)
	       (null messages-after-spot))
	  (setq messages-after-spot total-messages))
      (rmail-collect-deleted start)
      (setq messages-head (cons (point-marker) messages-head)
	    total-messages (1+ total-messages)))
    messages-after-spot))