Function: rmail-new-summary-1
rmail-new-summary-1 is a byte-compiled function defined in
rmailsum.el.gz.
Signature
(rmail-new-summary-1 DESCRIPTION REDO FUNCTION ARGS)
Documentation
Filter messages to obtain summary lines.
DESCRIPTION is added to the mode line.
Return the summary buffer by invoking FUNCTION on each message passing the message number and ARGS.
REDO is what to put in rmail-summary-redo.
The current buffer must be a Rmail buffer either containing a collection of mbox formatted messages or displaying a single message.
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmailsum.el.gz
(defun rmail-new-summary-1 (description redo function args)
"Filter messages to obtain summary lines.
DESCRIPTION is added to the mode line.
Return the summary buffer by invoking FUNCTION on each message
passing the message number and ARGS.
REDO is what to put in `rmail-summary-redo'.
The current buffer must be a Rmail buffer either containing a
collection of mbox formatted messages or displaying a single
message."
(let ((summary-msgs ())
(rmail-new-summary-line-count 0)
(sumbuf (rmail-get-create-summary-buffer)))
;; Scan the messages, getting their summary strings
;; and putting the list of them in SUMMARY-MSGS.
(let ((msgnum 1)
(main-buffer (current-buffer))
(total rmail-total-messages)
(inhibit-read-only t))
(save-excursion
;; Go where the mbox text is.
(if (rmail-buffers-swapped-p)
(set-buffer rmail-view-buffer))
(let ((old-min (point-min-marker))
(old-max (point-max-marker)))
(unwind-protect
;; Can't use save-restriction here; that doesn't work if we
;; plan to modify text outside the original restriction.
(save-excursion
(widen)
(goto-char (point-min))
(while (>= total msgnum)
;; Go back to the Rmail buffer so FUNCTION and
;; rmail-get-summary can see its local vars.
(with-current-buffer main-buffer
;; First test whether to include this message.
(if (or (null function)
(apply function msgnum args))
(setq summary-msgs
(cons (cons msgnum (rmail-get-summary msgnum))
summary-msgs))))
(setq msgnum (1+ msgnum))
;; Provide a periodic User progress message.
(if (and (not (zerop rmail-new-summary-line-count))
(zerop (% rmail-new-summary-line-count 10)))
(message "Computing summary lines...%d"
rmail-new-summary-line-count)))
(setq summary-msgs (nreverse summary-msgs)))
(narrow-to-region old-min old-max)))))
;; Temporarily, while summary buffer is unfinished,
;; we "don't have" a summary.
(setq rmail-summary-buffer nil)
;; I have not a clue what this clause is doing. If you read this
;; chunk of code and have a clue, then please write it here.
(if rmail-enable-mime
(with-current-buffer rmail-buffer
(setq rmail-summary-buffer nil)))
(save-excursion
(let ((rbuf (current-buffer))
(total rmail-total-messages))
(set-buffer sumbuf)
;; Set up the summary buffer's contents.
(let ((buffer-read-only nil))
(erase-buffer)
(while summary-msgs
(princ (cdr (car summary-msgs)) sumbuf)
(setq summary-msgs (cdr summary-msgs)))
(goto-char (point-min)))
;; Set up the rest of its state and local variables.
(setq buffer-read-only t)
(rmail-summary-mode)
(setq-local minor-mode-alist (list (list t (concat ": " description))))
(setq rmail-buffer rbuf
rmail-summary-redo redo
rmail-total-messages total)))
sumbuf))