Mercurial > emacs
annotate lisp/gnus/ietf-drums.el @ 99150:cdad15e238e0
Add arch tagline
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 27 Oct 2008 02:05:42 +0000 |
parents | f42ef85caf91 |
children | 4c23c7ddb156 |
rev | line source |
---|---|
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1 ;;; ietf-drums.el --- Functions for parsing RFC822bis headers |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
2 |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
79708 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
31717 | 5 |
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | |
7 ;; This file is part of GNU Emacs. | |
8 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
9 ;; GNU Emacs is free software: you can redistribute it and/or modify |
31717 | 10 ;; it under the terms of the GNU General Public License as published by |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; (at your option) any later version. |
31717 | 13 |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31717 | 17 ;; GNU General Public License for more details. |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
31717 | 21 |
22 ;;; Commentary: | |
23 | |
24 ;; DRUMS is an IETF Working Group that works (or worked) on the | |
25 ;; successor to RFC822, "Standard For The Format Of Arpa Internet Text | |
26 ;; Messages". This library is based on | |
27 ;; draft-ietf-drums-msg-fmt-05.txt, released on 1998-08-05. | |
28 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
29 ;; Pending a real regression self test suite, Simon Josefsson added |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
30 ;; various self test expressions snipped from bug reports, and their |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
31 ;; expected value, below. I you believe it could be useful, please |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
32 ;; add your own test cases, or write a real self test suite, or just |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
33 ;; remove this. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
34 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
35 ;; <m3oekvfd50.fsf@whitebox.m5r.de> |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
36 ;; (ietf-drums-parse-address "'foo' <foo@example.com>") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
37 ;; => ("foo@example.com" . "'foo'") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
38 |
31717 | 39 ;;; Code: |
40 | |
32514
a8017f96379d
(mm-util): Require CL when compiling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31717
diff
changeset
|
41 (eval-when-compile (require 'cl)) |
31717 | 42 (require 'time-date) |
43 (require 'mm-util) | |
44 | |
45 (defvar ietf-drums-no-ws-ctl-token "\001-\010\013\014\016-\037\177" | |
46 "US-ASCII control characters excluding CR, LF and white space.") | |
47 (defvar ietf-drums-text-token "\001-\011\013\014\016-\177" | |
48588 | 48 "US-ASCII characters excluding CR and LF.") |
31717 | 49 (defvar ietf-drums-specials-token "()<>[]:;@\\,.\"" |
50 "Special characters.") | |
51 (defvar ietf-drums-quote-token "\\" | |
52 "Quote character.") | |
53 (defvar ietf-drums-wsp-token " \t" | |
54 "White space.") | |
55 (defvar ietf-drums-fws-regexp | |
56 (concat "[" ietf-drums-wsp-token "]*\n[" ietf-drums-wsp-token "]+") | |
57 "Folding white space.") | |
58 (defvar ietf-drums-atext-token "-^a-zA-Z0-9!#$%&'*+/=?_`{|}~" | |
59 "Textual token.") | |
60 (defvar ietf-drums-dot-atext-token "-^a-zA-Z0-9!#$%&'*+/=?_`{|}~." | |
61 "Textual token including full stop.") | |
62 (defvar ietf-drums-qtext-token | |
63 (concat ietf-drums-no-ws-ctl-token "\041\043-\133\135-\177") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
64 "Non-white-space control characters, plus the rest of ASCII excluding |
48588 | 65 backslash and doublequote.") |
31717 | 66 (defvar ietf-drums-tspecials "][()<>@,;:\\\"/?=" |
67 "Tspecials.") | |
68 | |
69 (defvar ietf-drums-syntax-table | |
70 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table))) | |
71 (modify-syntax-entry ?\\ "/" table) | |
72 (modify-syntax-entry ?< "(" table) | |
73 (modify-syntax-entry ?> ")" table) | |
74 (modify-syntax-entry ?@ "w" table) | |
75 (modify-syntax-entry ?/ "w" table) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
76 (modify-syntax-entry ?* "_" table) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
77 (modify-syntax-entry ?\; "_" table) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
78 (modify-syntax-entry ?\' "_" table) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
79 (if (featurep 'xemacs) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
80 (let ((i 128)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
81 (while (< i 256) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
82 (modify-syntax-entry i "w" table) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
83 (setq i (1+ i))))) |
31717 | 84 table)) |
85 | |
86 (defun ietf-drums-token-to-list (token) | |
87 "Translate TOKEN into a list of characters." | |
88 (let ((i 0) | |
89 b e c out range) | |
90 (while (< i (length token)) | |
91 (setq c (mm-char-int (aref token i))) | |
92 (incf i) | |
93 (cond | |
94 ((eq c (mm-char-int ?-)) | |
95 (if b | |
96 (setq range t) | |
97 (push c out))) | |
98 (range | |
99 (while (<= b c) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
100 (push (make-char 'ascii b) out) |
31717 | 101 (incf b)) |
102 (setq range nil)) | |
103 ((= i (length token)) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
104 (push (make-char 'ascii c) out)) |
31717 | 105 (t |
106 (when b | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
107 (push (make-char 'ascii b) out)) |
31717 | 108 (setq b c)))) |
109 (nreverse out))) | |
110 | |
111 (defsubst ietf-drums-init (string) | |
112 (set-syntax-table ietf-drums-syntax-table) | |
113 (insert string) | |
114 (ietf-drums-unfold-fws) | |
115 (goto-char (point-min))) | |
116 | |
117 (defun ietf-drums-remove-comments (string) | |
118 "Remove comments from STRING." | |
119 (with-temp-buffer | |
120 (let (c) | |
121 (ietf-drums-init string) | |
122 (while (not (eobp)) | |
123 (setq c (char-after)) | |
124 (cond | |
125 ((eq c ?\") | |
126 (forward-sexp 1)) | |
127 ((eq c ?\() | |
128 (delete-region (point) (progn (forward-sexp 1) (point)))) | |
129 (t | |
130 (forward-char 1)))) | |
131 (buffer-string)))) | |
132 | |
133 (defun ietf-drums-remove-whitespace (string) | |
134 "Remove whitespace from STRING." | |
135 (with-temp-buffer | |
136 (ietf-drums-init string) | |
137 (let (c) | |
138 (while (not (eobp)) | |
139 (setq c (char-after)) | |
140 (cond | |
141 ((eq c ?\") | |
142 (forward-sexp 1)) | |
143 ((eq c ?\() | |
144 (forward-sexp 1)) | |
49844
48965175c443
Fix character constant.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
145 ((memq c '(?\ ?\t ?\n)) |
31717 | 146 (delete-char 1)) |
147 (t | |
148 (forward-char 1)))) | |
149 (buffer-string)))) | |
150 | |
151 (defun ietf-drums-get-comment (string) | |
152 "Return the first comment in STRING." | |
153 (with-temp-buffer | |
154 (ietf-drums-init string) | |
155 (let (result c) | |
156 (while (not (eobp)) | |
157 (setq c (char-after)) | |
158 (cond | |
159 ((eq c ?\") | |
160 (forward-sexp 1)) | |
161 ((eq c ?\() | |
162 (setq result | |
163 (buffer-substring | |
164 (1+ (point)) | |
165 (progn (forward-sexp 1) (1- (point)))))) | |
166 (t | |
167 (forward-char 1)))) | |
168 result))) | |
169 | |
170 (defun ietf-drums-strip (string) | |
171 "Remove comments and whitespace from STRING." | |
172 (ietf-drums-remove-whitespace (ietf-drums-remove-comments string))) | |
173 | |
174 (defun ietf-drums-parse-address (string) | |
175 "Parse STRING and return a MAILBOX / DISPLAY-NAME pair." | |
176 (with-temp-buffer | |
177 (let (display-name mailbox c display-string) | |
178 (ietf-drums-init string) | |
179 (while (not (eobp)) | |
180 (setq c (char-after)) | |
181 (cond | |
182 ((or (eq c ? ) | |
183 (eq c ?\t)) | |
184 (forward-char 1)) | |
185 ((eq c ?\() | |
186 (forward-sexp 1)) | |
187 ((eq c ?\") | |
188 (push (buffer-substring | |
189 (1+ (point)) (progn (forward-sexp 1) (1- (point)))) | |
190 display-name)) | |
191 ((looking-at (concat "[" ietf-drums-atext-token "@" "]")) | |
192 (push (buffer-substring (point) (progn (forward-sexp 1) (point))) | |
193 display-name)) | |
194 ((eq c ?<) | |
195 (setq mailbox | |
196 (ietf-drums-remove-whitespace | |
197 (ietf-drums-remove-comments | |
198 (buffer-substring | |
199 (1+ (point)) | |
200 (progn (forward-sexp 1) (1- (point)))))))) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
201 (t |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
202 (message "Unknown symbol: %c" c) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
203 (forward-char 1)))) |
31717 | 204 ;; If we found no display-name, then we look for comments. |
205 (if display-name | |
206 (setq display-string | |
207 (mapconcat 'identity (reverse display-name) " ")) | |
208 (setq display-string (ietf-drums-get-comment string))) | |
209 (if (not mailbox) | |
210 (when (string-match "@" display-string) | |
211 (cons | |
212 (mapconcat 'identity (nreverse display-name) "") | |
213 (ietf-drums-get-comment string))) | |
214 (cons mailbox display-string))))) | |
215 | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
216 (defun ietf-drums-parse-addresses (string &optional rawp) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
217 "Parse STRING and return a list of MAILBOX / DISPLAY-NAME pairs. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
218 If RAWP, don't actually parse the addresses, but instead return |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
219 a list of address strings." |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
220 (if (null string) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
221 nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
222 (with-temp-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
223 (ietf-drums-init string) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
224 (let ((beg (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
225 pairs c address) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
226 (while (not (eobp)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
227 (setq c (char-after)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
228 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
229 ((memq c '(?\" ?< ?\()) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
230 (condition-case nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
231 (forward-sexp 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
232 (error |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
233 (skip-chars-forward "^,")))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
234 ((eq c ?,) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
235 (setq address |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
236 (if rawp |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
237 (buffer-substring beg (point)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
238 (condition-case nil |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
239 (ietf-drums-parse-address |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
240 (buffer-substring beg (point))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
241 (error nil)))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
242 (if address (push address pairs)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
243 (forward-char 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
244 (setq beg (point))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
245 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
246 (forward-char 1)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
247 (setq address |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
248 (if rawp |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
249 (buffer-substring beg (point)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
250 (condition-case nil |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
251 (ietf-drums-parse-address |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
252 (buffer-substring beg (point))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
253 (error nil)))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
254 (if address (push address pairs)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
255 (nreverse pairs))))) |
31717 | 256 |
257 (defun ietf-drums-unfold-fws () | |
258 "Unfold folding white space in the current buffer." | |
259 (goto-char (point-min)) | |
260 (while (re-search-forward ietf-drums-fws-regexp nil t) | |
261 (replace-match " " t t)) | |
262 (goto-char (point-min))) | |
263 | |
264 (defun ietf-drums-parse-date (string) | |
265 "Return an Emacs time spec from STRING." | |
266 (apply 'encode-time (parse-time-string string))) | |
267 | |
268 (defun ietf-drums-narrow-to-header () | |
269 "Narrow to the header section in the current buffer." | |
270 (narrow-to-region | |
271 (goto-char (point-min)) | |
272 (if (re-search-forward "^\r?$" nil 1) | |
273 (match-beginning 0) | |
274 (point-max))) | |
275 (goto-char (point-min))) | |
276 | |
277 (defun ietf-drums-quote-string (string) | |
278 "Quote string if it needs quoting to be displayed in a header." | |
279 (if (string-match (concat "[^" ietf-drums-atext-token "]") string) | |
280 (concat "\"" string "\"") | |
281 string)) | |
282 | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
283 (defun ietf-drums-make-address (name address) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
284 (if name |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
285 (concat (ietf-drums-quote-string name) " <" address ">") |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
286 address)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
287 |
31717 | 288 (provide 'ietf-drums) |
289 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
290 ;; arch-tag: 379a0191-dbae-4ca6-a0f5-d4202c209ef9 |
31717 | 291 ;;; ietf-drums.el ends here |