annotate lisp/mail/rfc822.el @ 68478:61b78b1445bf

(org-allow-space-in-links, org-closed-string, org-quote-string, org-calendar-to-agenda-key, org-agenda-sorting-strategy, org-agenda-use-time-grid, org-show-following-heading, org-tags-column, org-use-tag-inheritance, org, org-allow-space-in-links, org-usenet-links-prefer-google, org-file-apps-defaults-gnu, org-enable-table-editor, org-calc-default-modes, org-export-html-style, org-table-allow-automatic-line-recalculation, org-export-with-fixed-width, org-export-with-sub-superscripts, org-special-keyword, org-formula, org-time-grid, org-table-may-need-update, org-mode, org-goto-ret, org-goto-left, org-goto-right, org-goto-quit, org-get-indentation, org-end-of-item, org-move-item-down, org-move-item-up, org-renumber-ordered-list, org-todo, org-log-done, org-occur, org-remove-occur-highlights, org-read-date, org-goto-calendar, org-agenda, org-agenda-day-view, org-agenda-previous-date-line, org-agenda-log-mode, org-agenda-toggle-diary, org-agenda-toggle-time-grid, org-agenda-cleanup-fancy-diary, org-agenda-file-to-end, org-agenda-no-heading-message, org-agenda-get-closed, org-format-agenda-item, org-cmp-priority, org-cmp-category, org-cmp-time, org-agenda-change-all-lines, org-agenda-diary-entry, org-scan-tags, org-after-todo-state-change-hook, org-tags-view, org-link-search, org-camel-to-words, org-open-file, org-remember-handler, org-table-convert-region, org-table-move-row-down, org-table-move-row-up, org-table-copy-region, org-table-wrap-region, org-table-toggle-vline-visibility, org-table-get-vertical-vector, org-table-modify-formulas, org-table-get-specials, org-recalc-commands, org-table-rotate-recalc-marks, org-table-eval-formula, orgtbl-make-binding, org-in-invisibility-spec-p, org-cycle, org-level-color-stars-only, org-insert-heading): Fix typos in docstrings. (last-arg): Add defvar.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 30 Jan 2006 02:03:21 +0000
parents fafd692d1e40
children 067115a6e738 2d92f5c9d6ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; rfc822.el --- hairy rfc822 parser for mail and news and suchlike
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 1986, 1987, 1990, 2002, 2003, 2004,
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
4 ;; 2005 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
5
789
71d052f72ac1 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
6 ;; Author: Richard Mlynarik <mly@eddie.mit.edu>
71d052f72ac1 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
7 ;; Maintainer: FSF
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 804
diff changeset
8 ;; Keywords: mail
789
71d052f72ac1 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
9
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
804
33aaf4b71a1d *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 789
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 2315
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 53414
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 53414
diff changeset
25 ;; Boston, MA 02110-1301, USA.
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
27 ;;; Commentary:
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
28
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
29 ;; Support functions for parsing RFC-822 headers, used by mail and news
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 21165
diff changeset
30 ;; modes.
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
31
789
71d052f72ac1 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
32 ;;; Code:
71d052f72ac1 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
33
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
34 (defvar rfc822-address-start)
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
35
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
36 ;; uses rfc822-address-start free, throws to address
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 (defun rfc822-bad-address (reason)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 (save-restriction
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 (insert "_^_")
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
40 (narrow-to-region rfc822-address-start
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 (if (re-search-forward "[,;]" nil t)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 (max (point-min) (1- (point)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 (point-max)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; make the error string be suitable for inclusion in (...)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 (let ((losers '("\\" "(" ")" "\n")))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 (while losers
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 (goto-char (point-min))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 (while (search-forward (car losers) nil t)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 (backward-char 1)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 (insert ?\\)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 (forward-char 1))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 (setq losers (cdr losers))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 (goto-char (point-min)) (insert "(Unparsable address -- "
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 reason
15882
874f0cc6c431 (rfc822-bad-address): Don't put a newline into the
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
55 ": \"")
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 (goto-char (point-max)) (insert "\")"))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 (rfc822-nuke-whitespace)
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
58 (throw 'address (buffer-substring rfc822-address-start (point))))
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 (defun rfc822-nuke-whitespace (&optional leave-space)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 (let (ch)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (while (cond ((eobp)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 nil)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ((= (setq ch (following-char)) ?\()
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 (forward-char 1)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 (while (if (eobp)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (rfc822-bad-address "Unbalanced comment (...)")
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (/= (setq ch (following-char)) ?\)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (cond ((looking-at "[^()\\]+")
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 (replace-match ""))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ((= ch ?\()
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 (rfc822-nuke-whitespace))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ((< (point) (1- (point-max)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 (delete-char 2))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 (rfc822-bad-address "orphaned backslash"))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;; delete remaining "()"
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (forward-char -1)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (delete-char 2)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 t)
49846
7e279209f48b (rfc822-nuke-whitespace): Fix character constant.
Juanma Barranquero <lekktu@gmail.com>
parents: 49598
diff changeset
81 ((memq ch '(?\ ?\t ?\n))
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (delete-region (point)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (progn (skip-chars-forward " \t\n") (point)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 t)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 nil)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (or (not leave-space)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (eobp)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (bobp)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (= (preceding-char) ?\ )
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (insert ?\ ))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (defun rfc822-looking-at (regex &optional leave-space)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (if (cond ((stringp regex)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (if (looking-at regex)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (progn (goto-char (match-end 0))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 t)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (if (and (not (eobp))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (= (following-char) regex))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (progn (forward-char 1)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 t))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (let ((tem (match-data)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (rfc822-nuke-whitespace leave-space)
21165
480d7479ccac (rfc822-looking-at): store-match-data => set-match-data.
Richard M. Stallman <rms@gnu.org>
parents: 20683
diff changeset
105 (set-match-data tem)
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 t)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (defun rfc822-snarf-word ()
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;; word is atom | quoted-string
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (cond ((= (following-char) ?\")
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;; quoted-string
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (or (rfc822-looking-at "\"\\([^\"\\\n]\\|\\\\.\\|\\\\\n\\)*\"")
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (rfc822-bad-address "Unterminated quoted string")))
20683
5623c78a31e5 (rfc822-snarf-word): Don't reject non-ASCII chars.
Richard M. Stallman <rms@gnu.org>
parents: 15882
diff changeset
114 ((rfc822-looking-at "[^][\000-\037 ()<>@,;:\\\".]+")
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ;; atom
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 )
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (rfc822-bad-address "Rubbish in address"))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (defun rfc822-snarf-words ()
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 (rfc822-snarf-word)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (while (rfc822-looking-at ?.)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (rfc822-snarf-word)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (defun rfc822-snarf-subdomain ()
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;; sub-domain is domain-ref | domain-literal
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (cond ((= (following-char) ?\[)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 ;; domain-ref
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (or (rfc822-looking-at "\\[\\([^][\\\n]\\|\\\\.\\|\\\\\n\\)*\\]")
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (rfc822-bad-address "Unterminated domain literal [...]")))
20683
5623c78a31e5 (rfc822-snarf-word): Don't reject non-ASCII chars.
Richard M. Stallman <rms@gnu.org>
parents: 15882
diff changeset
131 ((rfc822-looking-at "[^][\000-\037 ()<>@,;:\\\".]+")
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 ;; domain-literal = atom
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 )
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (rfc822-bad-address "Rubbish in host/domain specification"))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 (defun rfc822-snarf-domain ()
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (rfc822-snarf-subdomain)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (while (rfc822-looking-at ?.)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (rfc822-snarf-subdomain)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (defun rfc822-snarf-frob-list (name separator terminator snarfer
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 &optional return)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (let ((first t)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (list ())
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 tem)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 (while (cond ((eobp)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (rfc822-bad-address
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (format "End of addresses in middle of %s" name)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 ((rfc822-looking-at terminator)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 nil)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 ((rfc822-looking-at separator)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 ;; multiple separators are allowed and do nothing.
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (while (rfc822-looking-at separator))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 t)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (first
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 t)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (rfc822-bad-address
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (format "Gubbish in middle of %s" name))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (setq tem (funcall snarfer)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 first nil)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (and return tem
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (setq list (if (listp tem)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (nconc (reverse tem) list)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (cons tem list)))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (nreverse list)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 ;; return either an address (a string) or a list of addresses
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 (defun rfc822-addresses-1 (&optional allow-groups)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 ;; Looking for an rfc822 `address'
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 ;; Either a group (1*word ":" [#mailbox] ";")
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 ;; or a mailbox (addr-spec | 1*word route-addr)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 ;; addr-spec is (local-part "@" domain)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 ;; route-addr is ("<" [1#("@" domain) ":"] addr-spec ">")
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 ;; local-part is (word *("." word))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 ;; word is (atom | quoted-string)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 ;; quoted-string is ("\([^\"\\n]\|\\.\|\\\n\)")
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 ;; atom is [^\000-\037\177 ()<>@,;:\".[]]+
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 ;; domain is sub-domain *("." sub-domain)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 ;; sub-domain is domain-ref | domain-literal
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 ;; domain-literal is "[" *(dtext | quoted-pair) "]"
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 ;; dtext is "[^][\\n"
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 ;; domain-ref is atom
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
185 (let ((rfc822-address-start (point))
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 (n 0))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (catch 'address
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 ;; optimize common cases:
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 ;; foo
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 ;; foo.bar@bar.zap
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 ;; followed by "\\'\\|,\\|([^()\\]*)\\'"
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 ;; other common cases are:
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 ;; foo bar <foo.bar@baz.zap>
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 ;; "foo bar" <foo.bar@baz.zap>
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 ;; those aren't hacked yet.
20683
5623c78a31e5 (rfc822-snarf-word): Don't reject non-ASCII chars.
Richard M. Stallman <rms@gnu.org>
parents: 15882
diff changeset
196 (if (and (rfc822-looking-at "[^][\000-\037 ()<>@,;:\\\"]+\\(\\|@[^][\000-\037 ()<>@,;:\\\"]+\\)" t)
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (progn (or (eobp)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (rfc822-looking-at ?,))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (progn
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 ;; rfc822-looking-at may have inserted a space
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 (or (bobp) (/= (preceding-char) ?\ ) (delete-char -1))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 ;; relying on the fact that rfc822-looking-at <char>
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 ;; doesn't mung match-data
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
204 (throw 'address (buffer-substring rfc822-address-start (match-end 0)))))
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
205 (goto-char rfc822-address-start)
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 (while t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 (cond ((and (= n 1) (rfc822-looking-at ?@))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 ;; local-part@domain
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 (rfc822-snarf-domain)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 (throw 'address
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
211 (buffer-substring rfc822-address-start (point))))
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 ((rfc822-looking-at ?:)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (cond ((not allow-groups)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 (rfc822-bad-address "A group name may not appear here"))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 ((= n 0)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 (rfc822-bad-address "No name for :...; group")))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 ;; group
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 (throw 'address
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 ;; return a list of addresses
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 (rfc822-snarf-frob-list ":...; group" ?\, ?\;
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 'rfc822-addresses-1 t)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 ((rfc822-looking-at ?<)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 (let ((start (point))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 (strip t))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 (cond ((rfc822-looking-at ?>)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 ;; empty path
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 ())
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 ((and (not (eobp)) (= (following-char) ?\@))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 ;; <@foo.bar,@baz:quux@abcd.efg>
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 (rfc822-snarf-frob-list "<...> address" ?\, ?\:
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 (function (lambda ()
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (if (rfc822-looking-at ?\@)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 (rfc822-snarf-domain)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 (rfc822-bad-address
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 "Gubbish in route-addr")))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 (rfc822-snarf-words)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 (or (rfc822-looking-at ?@)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 (rfc822-bad-address "Malformed <..@..> address"))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 (rfc822-snarf-domain)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (setq strip nil))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 ((progn (rfc822-snarf-words) (rfc822-looking-at ?@))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ; allow <foo> (losing unix seems to do this)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 (rfc822-snarf-domain)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 (let ((end (point)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (if (rfc822-looking-at ?\>)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 (throw 'address
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (buffer-substring (if strip start (1- start))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 (if strip end (1+ end))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 (rfc822-bad-address "Unterminated <...> address")))))
20683
5623c78a31e5 (rfc822-snarf-word): Don't reject non-ASCII chars.
Richard M. Stallman <rms@gnu.org>
parents: 15882
diff changeset
250 ((looking-at "[^][\000-\037 ()<>@,;:\\.]")
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 ;; this allows "." to be part of the words preceding
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 ;; an addr-spec, since many broken mailers output
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 ;; "Hern K. Herklemeyer III
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 ;; <yank@megadeath.dod.gods-own-country>"
125
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
255 (let ((again t))
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
256 (while again
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
257 (or (= n 0) (bobp) (= (preceding-char) ?\ )
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
258 (insert ?\ ))
126
f46f3b32950b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 125
diff changeset
259 (rfc822-snarf-words)
125
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
260 (setq n (1+ n))
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
261 (setq again (or (rfc822-looking-at ?.)
20683
5623c78a31e5 (rfc822-snarf-word): Don't reject non-ASCII chars.
Richard M. Stallman <rms@gnu.org>
parents: 15882
diff changeset
262 (looking-at "[^][\000-\037 ()<>@,;:\\.]"))))))
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 ((= n 0)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 (throw 'address nil))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 ((= n 1) ; allow "foo" (losing unix seems to do this)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (throw 'address
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
267 (buffer-substring rfc822-address-start (point))))
125
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
268 ((> n 1)
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
269 (rfc822-bad-address "Missing comma between addresses or badly-formatted address"))
59aa7f7963b9 *** empty log message ***
root <root>
parents: 122
diff changeset
270 ((or (eobp) (= (following-char) ?,))
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 (rfc822-bad-address "Missing comma or route-spec"))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (rfc822-bad-address "Strange character or missing comma")))))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 21165
diff changeset
275
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 (defun rfc822-addresses (header-text)
20683
5623c78a31e5 (rfc822-snarf-word): Don't reject non-ASCII chars.
Richard M. Stallman <rms@gnu.org>
parents: 15882
diff changeset
277 (if (string-match "\\`[ \t]*\\([^][\000-\037 ()<>@,;:\\\".]+\\)[ \t]*\\'"
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 header-text)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 ;; Make very simple case moderately fast.
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 (list (substring header-text (match-beginning 1) (match-end 1)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 (let ((buf (generate-new-buffer " rfc822")))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (unwind-protect
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (save-excursion
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (set-buffer buf)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (make-local-variable 'case-fold-search)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (setq case-fold-search nil) ;For speed(?)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (insert header-text)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 ;; unfold continuation lines
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (goto-char (point-min))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (replace-match "\\1 " t))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (goto-char (point-min))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (let ((list ())
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 tem
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
297 rfc822-address-start); this is for rfc822-bad-address
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
298 (rfc822-nuke-whitespace)
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (while (not (eobp))
53414
a2ead0e84644 (rfc822-address-start): Declare variable.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
300 (setq rfc822-address-start (point))
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (setq tem
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (catch 'address ; this is for rfc822-bad-address
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (cond ((rfc822-looking-at ?\,)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 nil)
20683
5623c78a31e5 (rfc822-snarf-word): Don't reject non-ASCII chars.
Richard M. Stallman <rms@gnu.org>
parents: 15882
diff changeset
305 ((looking-at "[][\000-\037@;:\\.>)]")
43
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 (forward-char)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (rfc822-bad-address
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 (format "Strange character \\%c found"
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 (preceding-char))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 (rfc822-addresses-1 t)))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (cond ((null tem))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 ((stringp tem)
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (setq list (cons tem list)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (t
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (setq list (nconc (nreverse tem) list)))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (nreverse list)))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (and buf (kill-buffer buf))))))
3e1aeff0200f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 126
diff changeset
320 (provide 'rfc822)
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 126
diff changeset
321
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49846
diff changeset
322 ;;; arch-tag: 5d388a24-e173-40fb-9b8e-85269de44b37
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
323 ;;; rfc822.el ends here