Function: rmail-create-summary-line

rmail-create-summary-line is a byte-compiled function defined in rmailsum.el.gz.

Signature

(rmail-create-summary-line MSGNUM)

Documentation

Return the summary line for message MSGNUM.

Obtain the message summary from the header if it is available otherwise create it and store it in the message header.

The mbox buffer must be current when you call this function even if its text is swapped.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmailsum.el.gz
(defun rmail-create-summary-line (msgnum)
  "Return the summary line for message MSGNUM.
Obtain the message summary from the header if it is available
otherwise create it and store it in the message header.

The mbox buffer must be current when you call this function
even if its text is swapped."
  (let ((beg (rmail-msgbeg msgnum))
	(end (rmail-msgend msgnum))
	(deleted (rmail-message-deleted-p msgnum))
	;; Does not work (swapped?)
;;;	(unseen (rmail-message-unseen-p msgnum))
	unseen lines)
    (save-excursion
      ;; Switch to the buffer that has the whole mbox text.
      (if (rmail-buffers-swapped-p)
	  (set-buffer rmail-view-buffer))
      ;; Now we can compute the line count.
      (if rmail-summary-line-count-flag
	  (setq lines (count-lines beg end)))
      ;; Narrow to the message header.
      (save-excursion
	(save-restriction
	  (widen)
	  (goto-char beg)
	  (if (search-forward "\n\n" end t)
	      (progn
		(narrow-to-region beg (point))
		;; Replace rmail-message-unseen-p from above.
		(goto-char beg)
		(setq unseen (and (search-forward
				   (concat rmail-attribute-header ": ") nil t)
				  (looking-at "......U")))
		;; Generate a status line from the message.
		(rmail-create-summary msgnum deleted unseen lines))
	    (rmail-error-bad-format msgnum)))))))