-(defun nnml-make-nov-line (chars)
- "Create a nov from the current headers."
- (let ((case-fold-search t)
- subject from date id references lines xref in-reply-to char)
- (save-excursion
- (save-restriction
- (goto-char (point-min))
- (narrow-to-region
- (point)
- (1- (or (search-forward "\n\n" nil t) (point-max))))
- ;; Fold continuation lines.
- (goto-char (point-min))
- (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
- (replace-match " " t t))
- (subst-char-in-region (point-min) (point-max) ?\t ? )
- ;; [number subject from date id references chars lines xref]
- (save-excursion
- (goto-char (point-min))
- (while (re-search-forward "^\\(from\\|subject\\|message-id\\|date\\|lines\\|xref\\|references\\|in-reply-to\\): "
- nil t)
- (beginning-of-line)
- (setq char (downcase (following-char)))
- (cond
- ((eq char ?s)
- (setq subject (nnml-header-value)))
- ((eq char ?f)
- (setq from (nnml-header-value)))
- ((eq char ?x)
- (setq xref (buffer-substring (match-beginning 0)
- (progn (end-of-line) (point)))))
- ((eq char ?l)
- (setq lines (nnml-header-value)))
- ((eq char ?d)
- (setq date (nnml-header-value)))
- ((eq char ?m)
- (setq id (setq id (nnml-header-value))))
- ((eq char ?r)
- (setq references (nnml-header-value)))
- ((eq char ?i)
- (setq in-reply-to (nnml-header-value))))
- (forward-line 1))
-
- (and (not references)
- in-reply-to
- (string-match "<[^>]+>" in-reply-to)
- (setq references
- (substring in-reply-to (match-beginning 0)
- (match-end 0)))))
- ;; [number subject from date id references chars lines xref]
- (format "\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t%s\t\n"
- (or subject "(none)") (or from "(nobody)") (or date "")
- (or id (nnmail-message-id))
- (or references "") (or chars 0) (or lines "0")
- (or xref ""))))))
+(defun nnml-parse-head (chars &optional number)
+ "Parse the head of the current buffer."
+ (save-excursion
+ (save-restriction
+ (goto-char (point-min))
+ (narrow-to-region
+ (point)
+ (1- (or (search-forward "\n\n" nil t) (point-max))))
+ ;; Fold continuation lines.
+ (goto-char (point-min))
+ (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
+ (replace-match " " t t))
+ ;; Remove any tabs; they are too confusing.
+ (subst-char-in-region (point-min) (point-max) ?\t ? )
+ (let ((headers (nnheader-parse-head t)))
+ (mail-header-set-chars headers chars)
+ (mail-header-set-number headers number)
+ headers))))