From 2e832da51bd9415bcde6328105c8136756048c86 Mon Sep 17 00:00:00 2001 From: morioka Date: Thu, 25 Apr 1996 15:04:17 +0000 Subject: [PATCH] (rfc822/get-field-bodies): New function. --- tl-822.el | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tl-822.el b/tl-822.el index b28da33..d99c666 100644 --- a/tl-822.el +++ b/tl-822.el @@ -30,7 +30,7 @@ (defconst rfc822/RCS-ID - "$Id: tl-822.el,v 7.15 1996-04-19 19:24:32 morioka Exp $") + "$Id: tl-822.el,v 7.16 1996-04-25 15:04:17 morioka Exp $") (defconst rfc822/version (get-version-string rfc822/RCS-ID)) @@ -71,6 +71,31 @@ )) )))) +(defun rfc822/get-field-bodies (field-names &optional default-value) + (let ((case-fold-search t)) + (save-excursion + (save-restriction + (narrow-to-region + (goto-char (point-min)) + (or (and (re-search-forward "^$" nil t) (match-end 0)) + (point-max) + )) + (goto-char (point-min)) + (let* ((dest (make-list (length field-names) default-value)) + (s-rest field-names) + (d-rest dest) + field-name) + (while (setq field-name (car s-rest)) + (if (re-search-forward (concat "^" field-name ":[ \t]*") nil t) + (setcar d-rest + (buffer-substring-no-properties + (match-end 0) + (rfc822/field-end)))) + (setq s-rest (cdr s-rest) + d-rest (cdr d-rest)) + ) + dest))))) + ;;; @ header ;;; -- 1.7.10.4