[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New mail-related routines
From: |
Reiner Steib |
Subject: |
Re: New mail-related routines |
Date: |
Tue, 19 Oct 2004 14:32:03 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
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/
Re: New mail-related routines,
Reiner Steib <=
Re: New mail-related routines, Simon Josefsson, 2004/10/24