From: morioka Date: Wed, 28 Aug 1996 13:03:23 +0000 (+0000) Subject: (std11-field-names): New function. X-Git-Tag: XEmacs-20_3-b27-viet~82 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55a4fd50dc793f7da056c33056caedf3853d4fa1;p=elisp%2Fmu-cite.git (std11-field-names): New function. --- diff --git a/std11.el b/std11.el index fef8ca0..36ffe43 100644 --- a/std11.el +++ b/std11.el @@ -4,7 +4,7 @@ ;; Author: MORIOKA Tomohiko ;; Keywords: mail, news, RFC 822, STD 11 -;; Version: $Id: std11.el,v 0.3 1996-08-28 12:41:58 morioka Exp $ +;; Version: $Id: std11.el,v 0.4 1996-08-28 13:03:23 morioka Exp $ ;; This file is part of tl (Tiny Library). @@ -25,7 +25,8 @@ ;;; Code: -(require 'emu) +(autoload 'buffer-substring-no-properties "emu") +(autoload 'member "emu") ;;; @ field @@ -33,9 +34,9 @@ (defconst std11-field-name-regexp "[!-9;-~]+") (defconst std11-field-head-regexp - (concat "\\(" std11-field-name-regexp "\\):")) + (concat "^" std11-field-name-regexp ":")) (defconst std11-next-field-head-regexp - (concat "\n" std11-field-head-regexp)) + (concat "\n" std11-field-name-regexp ":")) (defun std11-field-body (name &optional boundary) (save-excursion @@ -61,6 +62,16 @@ ;;; @ header ;;; +(defun std11-narrow-to-header (&optional boundary) + (narrow-to-region + (goto-char (point-min)) + (if (re-search-forward + (concat "^\\(" (regexp-quote (or boundary "")) "\\)?$") + nil t) + (match-beginning 0) + (point-max) + ))) + (defun std11-header-string (pat &optional boundary) (let ((case-fold-search t)) (save-excursion @@ -93,15 +104,20 @@ header) )))) -(defun std11-narrow-to-header (&optional boundary) - (narrow-to-region - (goto-char (point-min)) - (if (re-search-forward - (concat "^\\(" (regexp-quote (or boundary "")) "\\)?$") - nil t) - (match-beginning 0) - (point-max) - ))) +(defun std11-field-names (&optional boundary) + (save-excursion + (save-restriction + (std11-narrow-to-header boundary) + (goto-char (point-min)) + (let (dest name) + (while (re-search-forward std11-field-head-regexp nil t) + (setq name (buffer-substring-no-properties + (match-beginning 0)(1- (match-end 0)))) + (or (member name dest) + (setq dest (cons name dest)) + ) + ) + dest)))) ;;; @ end