From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.devel Subject: Re: New mail-related routines Date: Tue, 19 Oct 2004 14:32:03 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: <200410182157.i9ILvjln000739@oak.pohoyda.family> Reply-To: Reiner Steib NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1098189180 28726 80.91.229.6 (19 Oct 2004 12:33:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Oct 2004 12:33:00 +0000 (UTC) Cc: Emacs development Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 19 14:32:51 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CJtAY-00079w-00 for ; Tue, 19 Oct 2004 14:32:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJtHu-0005kP-2O for ged-emacs-devel@m.gmane.org; Tue, 19 Oct 2004 08:40:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CJtHh-0005j7-Vf for emacs-devel@gnu.org; Tue, 19 Oct 2004 08:40:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CJtHh-0005iF-5y for emacs-devel@gnu.org; Tue, 19 Oct 2004 08:40:13 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJtHg-0005iA-S2 for emacs-devel@gnu.org; Tue, 19 Oct 2004 08:40:12 -0400 Original-Received: from [134.60.1.1] (helo=mail-new.rz.uni-ulm.de) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CJtA4-0007S0-Jt for emacs-devel@gnu.org; Tue, 19 Oct 2004 08:32:21 -0400 Original-Received: from lumberjack.physik.uni-ulm.de (lumberjack.physik.uni-ulm.de [134.60.10.173]) by mail.uni-ulm.de (8.13.1/8.13.1) with ESMTP id i9JCW3Nn000848; Tue, 19 Oct 2004 14:32:03 +0200 (MEST) Original-Received: by lumberjack.physik.uni-ulm.de (Postfix, from userid 170) id 7F32C18173; Tue, 19 Oct 2004 14:32:03 +0200 (CEST) Mail-Followup-To: Alexander Pohoyda , Emacs development Original-To: Alexander Pohoyda X-Face: mtjf/D:es1T0wHO:&CJ'ZXe"l; 3C--rw\z!{`eFwL){|]RpI+4{u25L=5C /0>KuGeTsk<~<&NE-AKV1560e!+RJeyWmSskkrJm?[vUV#66{T_m|Ae<||Ku#Mk5`y&O`n~z2; n8eP J5#2h@2eQgV@E70IY_0WlEx!"&giy{+\%h1LJox$zv@/l%ZmU4^tZA>xQpnkUBVC5.jpg#0'(+2?Rs )NAr:>3<=WxHE$ktbLysDIM5TbmHu*3 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:28598 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28598 On Mon, Oct 18 2004, Alexander Pohoyda wrote: > +;;; The -hf suffix means Header Field. IIRC, the coding conventions (in Emacs Lisp) say not to abbreviate function and variable names. > +(defun mail-unfold-region (from to) > + "Unfold header fields in the region between FROM and TO, > +as defined by RFC 2822." [...] > + (while (re-search-forward > + (format "%s%s+" mail-crlf-regexp mail-wsp-regexp) nil t) > + (replace-match " " nil t)))))) I didn't look at the other functions, but this one is incorrect, AFAICS: ,----[ rfc2822 / 2.2.3. Long Header Fields ] | The process of moving from this folded multiple-line representation | of a header field to its single line representation is called | "unfolding". Unfolding is accomplished by simply removing any CRLF | that is immediately followed by WSP. Each header field should be | treated in its unfolded form for further syntactic and semantic | evaluation. `---- (with-temp-buffer (insert "Subject: foo\n bar") (mail-unfold-region (point-min) (point-max)) (buffer-string)) ==> "Subject: foo bar" Your function removes all additional spaces. The result with `rfc2047-unfold-region' is correct: (with-temp-buffer (insert "Subject: foo\n bar") (rfc2047-unfold-region (point-min) (point-max)) (buffer-string)) ==> "Subject: foo bar" Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/