X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fietf-drums.el;h=b39decb80fe311df39929e15735aac991bf26f39;hb=f9e54240fc63f1ead8962e2afbc9b75e53994cd5;hp=865ddffaaccd3ba96fd28613e963f1b4db04a3c1;hpb=5c85eb9dd8a85edecf9b9da5bfeb5ca5d754aa1b;p=elisp%2Fgnus.git- diff --git a/lisp/ietf-drums.el b/lisp/ietf-drums.el index 865ddff..b39decb 100644 --- a/lisp/ietf-drums.el +++ b/lisp/ietf-drums.el @@ -1,5 +1,6 @@ ;;; ietf-drums.el --- Functions for parsing RFC822bis headers -;; Copyright (C) 1998 Free Software Foundation, Inc. +;; Copyright (C) 1998, 1999, 2000 +;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; This file is part of GNU Emacs. @@ -28,6 +29,7 @@ ;;; Code: +(eval-when-compile (require 'cl)) (require 'time-date) (require 'mm-util) @@ -87,6 +89,8 @@ ((= i (length token)) (push (mm-make-char 'ascii c) out)) (t + (when b + (push (mm-make-char 'ascii b) out)) (setq b c)))) (nreverse out))) @@ -113,7 +117,7 @@ (buffer-string)))) (defun ietf-drums-remove-whitespace (string) - "Remove comments from STRING." + "Remove whitespace from STRING." (with-temp-buffer (ietf-drums-init string) (let (c) @@ -149,6 +153,10 @@ (forward-char 1)))) result))) +(defun ietf-drums-strip (string) + "Remove comments and whitespace from STRING." + (ietf-drums-remove-whitespace (ietf-drums-remove-comments string))) + (defun ietf-drums-parse-address (string) "Parse STRING and return a MAILBOX / DISPLAY-NAME pair." (with-temp-buffer @@ -226,8 +234,8 @@ "Narrow to the header section in the current buffer." (narrow-to-region (goto-char (point-min)) - (if (re-search-forward "^\n" nil 1) - (1- (point)) + (if (re-search-forward "^\r?$" nil 1) + (match-beginning 0) (point-max))) (goto-char (point-min)))