Function: rmail-edit-headers-alist
rmail-edit-headers-alist is a byte-compiled function defined in
rmailedit.el.gz.
Signature
(rmail-edit-headers-alist &optional WIDEN MARKERS)
Documentation
Return an alist of the headers of the message in the current buffer.
Each element has the form (HEADER-NAME . ENTIRE-STRING). ENTIRE-STRING includes the name of the header field (which is HEADER-NAME) and has a final newline. If part of the text is not valid as a header field, HEADER-NAME is an integer and we use consecutive integers.
If WIDEN is non-nil, operate on the entire buffer.
If MARKERS is non-nil, the value looks like
(HEADER-NAME ENTIRE-STRING BEG-MARKER END-MARKER).
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmailedit.el.gz
(defun rmail-edit-headers-alist (&optional widen markers)
"Return an alist of the headers of the message in the current buffer.
Each element has the form (HEADER-NAME . ENTIRE-STRING).
ENTIRE-STRING includes the name of the header field (which is HEADER-NAME)
and has a final newline.
If part of the text is not valid as a header field, HEADER-NAME
is an integer and we use consecutive integers.
If WIDEN is non-nil, operate on the entire buffer.
If MARKERS is non-nil, the value looks like
\(HEADER-NAME ENTIRE-STRING BEG-MARKER END-MARKER)."
(let (header-alist (no-good-header-count 1))
(save-excursion
(save-restriction
(if widen (widen))
(goto-char (point-min))
(search-forward "\n\n")
(narrow-to-region (point-min) (1- (point)))
(goto-char (point-min))
(while (not (eobp))
(let ((start (point))
name header)
;; Match the name.
(if (looking-at "[ \t]*\\([^:\n \t]\\(\\|[^:\n]*[^:\n \t]\\)\\)[ \t]*:")
(setq name (match-string-no-properties 1))
(setq name no-good-header-count
no-good-header-count (1+ no-good-header-count)))
(forward-line 1)
(while (looking-at "[ \t]")
(forward-line 1))
(setq header (buffer-substring-no-properties start (point)))
(if markers
(push (list header (copy-marker start) (point-marker))
header-alist)
(push (cons name header) header-alist))))))
(nreverse header-alist)))