annotate lisp/mail/mail-extr.el @ 94837:55eb2a3c59b4

Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1153
author Miles Bader <miles@gnu.org>
date Sat, 10 May 2008 05:34:55 +0000
parents ef65fa4dca3b
children a9dc0e7c3f2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51081
a4bb96832880 Use explicit coding tag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47939
diff changeset
1 ;;; mail-extr.el --- extract full name and address from RFC 822 mail header -*- coding: utf-8 -*-
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1997, 2001, 2002, 2003, 2004,
79712
de499b20517a Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79435
diff changeset
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 809
diff changeset
5
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
6 ;; Author: Joe Wells <jbw@cs.bu.edu>
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
7 ;; Maintainer: FSF
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
8 ;; Keywords: mail
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
24
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
25 ;;; Commentary:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
26
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
27 ;; The entry point of this code is
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
28 ;;
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
29 ;; mail-extract-address-components: (address &optional all)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
30 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
31 ;; Given an RFC-822 ADDRESS, extract full name and canonical address.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
32 ;; Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
33 ;; If no name can be extracted, FULL-NAME will be nil.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
34 ;; ADDRESS may be a string or a buffer. If it is a buffer, the visible
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
35 ;; (narrowed) portion of the buffer will be interpreted as the address.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
36 ;; (This feature exists so that the clever caller might be able to avoid
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
37 ;; consing a string.)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
38 ;; If ADDRESS contains more than one RFC-822 address, only the first is
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
39 ;; returned.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
40 ;;
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
41 ;; If ALL is non-nil, that means return info about all the addresses
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
42 ;; that are found in ADDRESS. The value is a list of elements of
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
43 ;; the form (FULL-NAME CANONICAL-ADDRESS), one per address.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
44 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
45 ;; This code is more correct (and more heuristic) parser than the code in
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
46 ;; rfc822.el. And despite its size, it's fairly fast.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
47 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
48 ;; There are two main benefits:
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
49 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50 ;; 1. Higher probability of getting the correct full name for a human than
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
51 ;; any other package we know of. (On the other hand, it will cheerfully
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
52 ;; mangle non-human names/comments.)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
53 ;; 2. Address part is put in a canonical form.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
54 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
55 ;; The interface is not yet carved in stone; please give us suggestions.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
56 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
57 ;; We have an extensive test-case collection of funny addresses if you want to
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
58 ;; work with the code. Developing this code requires frequent testing to
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
59 ;; make sure you're not breaking functionality. The test cases aren't included
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
60 ;; because they are over 100K.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
61 ;;
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
62 ;; If you find an address that mail-extr fails on, please send it to the
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
63 ;; maintainer along with what you think the correct results should be. We do
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
64 ;; not consider it a bug if mail-extr mangles a comment that does not
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
65 ;; correspond to a real human full name, although we would prefer that
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
66 ;; mail-extr would return the comment as-is.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
67 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
68 ;; Features:
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
69 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
70 ;; * Full name handling:
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
71 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
72 ;; * knows where full names can be found in an address.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
73 ;; * avoids using empty comments and quoted text.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
74 ;; * extracts full names from mailbox names.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
75 ;; * recognizes common formats for comments after a full name.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
76 ;; * puts a period and a space after each initial.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
77 ;; * understands & referring to the mailbox name, capitalized.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
78 ;; * strips name prefixes like "Prof.", etc.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
79 ;; * understands what characters can occur in names (not just letters).
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
80 ;; * figures out middle initial from mailbox name.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
81 ;; * removes funny nicknames.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
82 ;; * keeps suffixes such as Jr., Sr., III, etc.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
83 ;; * reorders "Last, First" type names.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
84 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
85 ;; * Address handling:
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
86 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
87 ;; * parses rfc822 quoted text, comments, and domain literals.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
88 ;; * parses rfc822 multi-line headers.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
89 ;; * does something reasonable with rfc822 GROUP addresses.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
90 ;; * handles many rfc822 noncompliant and garbage addresses.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
91 ;; * canonicalizes addresses (after stripping comments/phrases outside <>).
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
92 ;; * converts ! addresses into .UUCP and %-style addresses.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
93 ;; * converts rfc822 ROUTE addresses to %-style addresses.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
94 ;; * truncates %-style addresses at leftmost fully qualified domain name.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
95 ;; * handles local relative precedence of ! vs. % and @ (untested).
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
96 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
97 ;; It does almost no string creation. It primarily uses the built-in
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
98 ;; parsing routines with the appropriate syntax tables. This should
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
99 ;; result in greater speed.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
100 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
101 ;; TODO:
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
102 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
103 ;; * handle all test cases. (This will take forever.)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
104 ;; * software to pick the correct header to use (eg., "Senders-Name:").
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
105 ;; * multiple addresses in the "From:" header (almost all of the necessary
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
106 ;; code is there).
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
107 ;; * flag to not treat `,' as an address separator. (This is useful when
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
108 ;; there is a "From:" header but no "Sender:" header, because then there
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
109 ;; is only allowed to be one address.)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
110 ;; * mailbox name does not necessarily contain full name.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
111 ;; * fixing capitalization when it's all upper or lowercase. (Hard!)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
112 ;; * some of the domain literal handling is missing. (But I've never even
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
113 ;; seen one of these in a mail address, so maybe no big deal.)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
114 ;; * arrange to have syntax tables byte-compiled.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
115 ;; * speed hacks.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
116 ;; * delete unused variables.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
117 ;; * arrange for testing with different relative precedences of ! vs. @
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
118 ;; and %.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
119 ;; * insert documentation strings!
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
120 ;; * handle X.400-gatewayed addresses according to RFC 1148.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
121
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
122 ;;; Change Log:
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
123 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
124 ;; Thu Feb 17 17:57:33 1994 Jamie Zawinski (jwz@lucid.com)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
125 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
126 ;; * merged with jbw's latest version
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
127 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
128 ;; Wed Feb 9 21:56:27 1994 Jamie Zawinski (jwz@lucid.com)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
129 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
130 ;; * high-bit chars in comments weren't treated as word syntax
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
131 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
132 ;; Sat Feb 5 03:13:40 1994 Jamie Zawinski (jwz@lucid.com)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
133 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
134 ;; * call replace-match with fixed-case arg
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
135 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
136 ;; Thu Dec 16 21:56:45 1993 Jamie Zawinski (jwz@lucid.com)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
137 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
138 ;; * some more cleanup, doc, added provide
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
139 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
140 ;; Tue Mar 23 21:23:18 1993 Joe Wells (jbw at csd.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
141 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
142 ;; * Made mail-full-name-prefixes a user-customizable variable.
46255
503a8e2a9054 Fix typo in comments, not worthy of a changelog entry.
Simon Josefsson <jas@extundo.com>
parents: 41300
diff changeset
143 ;; Allow passing the address as a buffer as well as a string.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
144 ;; Allow [ and ] as name characters (Finnish character set).
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
145 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
146 ;; Mon Mar 22 21:20:56 1993 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
147 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
148 ;; * Handle "null" addresses. Handle = used for spacing in mailbox
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
149 ;; name. Fix bug in handling of ROUTE-ADDR-type addresses that are
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
150 ;; missing their brackets. Handle uppercase "JR". Extract full
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
151 ;; names from X.400 addresses encoded in RFC-822. Fix bug in
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
152 ;; handling of multiple addresses where first has trailing comment.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
153 ;; Handle more kinds of telephone extension lead-ins.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
154 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
155 ;; Mon Mar 22 20:16:57 1993 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
156 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
157 ;; * Handle HZ encoding for embedding GB encoded chinese characters.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
158 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
159 ;; Mon Mar 22 00:46:12 1993 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
160 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
161 ;; * Fixed too broad matching of ham radio call signs. Fixed bug in
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
162 ;; handling an unmatched ' in a name string. Enhanced recognition
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
163 ;; of when . in the mailbox name terminates the name portion.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
164 ;; Narrowed conversion of . to space to only the necessary
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
165 ;; situation. Deal with VMS's stupid date stamps. Handle a unique
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
166 ;; way of introducing an alternate address. Fixed spacing bug I
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
167 ;; introduced in switching last name order. Fixed bug in handling
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
168 ;; address with ! and % but no @. Narrowed the cases in which
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
169 ;; certain trailing words are discarded.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
170 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
171 ;; Sun Mar 21 21:41:06 1993 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
172 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
173 ;; * Fixed bugs in handling GROUP addresses. Certain words in the
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
174 ;; middle of a name no longer terminate it. Handle LISTSERV list
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
175 ;; names. Ignore comment field containing mailbox name.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
176 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
177 ;; Sun Mar 21 14:39:38 1993 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
178 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
179 ;; * Moved variant-method code back into main function. Handle
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
180 ;; underscores as spaces in comments. Handle leading nickname. Add
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
181 ;; flag to ignore single-word names. Other changes.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
182 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
183 ;; Mon Feb 1 22:23:31 1993 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
184 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
185 ;; * Added in changes by Rod Whitby and Jamie Zawinski. This
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
186 ;; includes the flag mail-extr-guess-middle-initial and the fix for
7133
9367067ee736 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 7060
diff changeset
187 ;; handling multiple addresses correctly. (Whitby just changed
9367067ee736 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 7060
diff changeset
188 ;; a > to a <.)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
189 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
190 ;; Mon Apr 6 23:59:09 1992 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
191 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
192 ;; * Cleaned up some more. Release version 1.0 to world.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
193 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
194 ;; Sun Apr 5 19:39:08 1992 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
195 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
196 ;; * Cleaned up full name extraction extensively.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
197 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
198 ;; Sun Feb 2 14:45:24 1992 Joe Wells (jbw at bigbird.bu.edu)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
199 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
200 ;; * Total rewrite. Integrated mail-canonicalize-address into
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
201 ;; mail-extract-address-components. Now handles GROUP addresses more
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
202 ;; or less correctly. Better handling of lots of different cases.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
203 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
204 ;; Fri Jun 14 19:39:50 1991
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
205 ;; * Created.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
206
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
207 ;;; Code:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
208
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
209
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
210 (defgroup mail-extr nil
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
211 "Extract full name and address from RFC 822 mail header."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
212 :prefix "mail-extr-"
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
213 :group 'mail)
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
214
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
215 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
216 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
217 ;; User configuration variable definitions.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
218 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
219
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
220 (defcustom mail-extr-guess-middle-initial nil
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
221 "*Whether to try to guess middle initial from mail address.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
222 If true, then when we see an address like \"John Smith <jqs@host.com>\"
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
223 we will assume that \"John Q. Smith\" is the fellow's name."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
224 :type 'boolean
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
225 :group 'mail-extr)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
226
47615
a298684644ca (mail-extr-ignore-single-names): Change default.
Simon Josefsson <jas@extundo.com>
parents: 46273
diff changeset
227 (defcustom mail-extr-ignore-single-names nil
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
228 "*Whether to ignore a name that is just a single word.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
229 If true, then when we see an address like \"Idiot <dumb@stupid.com>\"
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
230 we will act as though we couldn't find a full name in the address."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
231 :type 'boolean
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 57391
diff changeset
232 :version "22.1"
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
233 :group 'mail-extr)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
234
57391
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
235 (defcustom mail-extr-ignore-realname-equals-mailbox-name t
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
236 "*Whether to ignore a name that is equal to the mailbox name.
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
237 If true, then when the address is like \"Single <single@address.com>\"
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
238 we will act as though we couldn't find a full name in the address."
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
239 :type 'boolean
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
240 :group 'mail-extr)
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
241
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
242 ;; Matches a leading title that is not part of the name (does not
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
243 ;; contribute to uniquely identifying the person).
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
244 (defcustom mail-extr-full-name-prefixes
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
245 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
246 "\\(Prof\\|D[Rr]\\|Mrs?\\|Rev\\|Rabbi\\|SysOp\\|LCDR\\)\\.?[ \t\n]")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
247 "*Matches prefixes to the full name that identify a person's position.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
248 These are stripped from the full name because they do not contribute to
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
249 uniquely identifying the person."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
250 :type 'regexp
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
251 :group 'mail-extr)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
252
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
253 (defcustom mail-extr-@-binds-tighter-than-! nil
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
254 "*Whether the local mail transport agent looks at ! before @."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
255 :type 'boolean
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
256 :group 'mail-extr)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
257
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
258 (defcustom mail-extr-mangle-uucp nil
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
259 "*Whether to throw away information in UUCP addresses
20962
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
260 by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"."
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
261 :type 'boolean
54413501e4a9 Customized.
Stephen Eglen <stephen@gnu.org>
parents: 20828
diff changeset
262 :group 'mail-extr)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
263
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
264 ;;----------------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
265 ;; what orderings are meaningful?????
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
266 ;;(defvar mail-operator-precedence-list '(?! ?% ?@))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
267 ;; Right operand of a % or a @ must be a domain name, period. No other
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
268 ;; operators allowed. Left operand of a @ is an address relative to that
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
269 ;; site.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
270
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
271 ;; Left operand of a ! must be a domain name. Right operand is an
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
272 ;; arbitrary address.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
273 ;;----------------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
274
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
275
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
276
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
278 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
279 ;; Constant definitions.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
280 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
281
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
282 ;; Any character that can occur in a name, not counting characters that
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
283 ;; separate parts of a multipart name (hyphen and period).
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
284 ;; Yes, there are weird people with digits in their names.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
285 ;; You will also notice the consideration for the
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
286 ;; Swedish/Finnish/Norwegian character set.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
287 (defconst mail-extr-all-letters-but-separators
25439
f597d85734d7 (mail-extr-all-letters-but-separators)
Richard M. Stallman <rms@gnu.org>
parents: 21477
diff changeset
288 (purecopy "][[:alnum:]{|}'~`"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
289
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
290 ;; Any character that can occur in a name in an RFC822 address including
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
291 ;; the separator (hyphen and possibly period) for multipart names.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
292 ;; #### should . be in here?
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
293 (defconst mail-extr-all-letters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
294 (purecopy (concat mail-extr-all-letters-but-separators "---")))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
295
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
296 ;; Any character that can start a name.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
297 ;; Keep this set as minimal as possible.
25439
f597d85734d7 (mail-extr-all-letters-but-separators)
Richard M. Stallman <rms@gnu.org>
parents: 21477
diff changeset
298 (defconst mail-extr-first-letters (purecopy "[:alpha:]"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
299
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
300 ;; Any character that can end a name.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
301 ;; Keep this set as minimal as possible.
25439
f597d85734d7 (mail-extr-all-letters-but-separators)
Richard M. Stallman <rms@gnu.org>
parents: 21477
diff changeset
302 (defconst mail-extr-last-letters (purecopy "[:alpha:]`'."))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
303
41159
5f754d04a4d0 (mail-extr-voodoo): Treat a number as a word
Richard M. Stallman <rms@gnu.org>
parents: 38412
diff changeset
304 (defconst mail-extr-leading-garbage "\\W+")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
305
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
306 ;; (defconst mail-extr-non-name-chars
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
307 ;; (purecopy (concat "^" mail-extr-all-letters ".")))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
308 ;; (defconst mail-extr-non-begin-name-chars
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
309 ;; (purecopy (concat "^" mail-extr-first-letters)))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
310 ;; (defconst mail-extr-non-end-name-chars
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
311 ;; (purecopy (concat "^" mail-extr-last-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
312
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
313 ;; Matches an initial not followed by both a period and a space.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
314 ;; (defconst mail-extr-bad-initials-pattern
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
315 ;; (purecopy
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
316 ;; (format "\\(\\([^%s]\\|\\`\\)[%s]\\)\\(\\.\\([^ ]\\)\\| \\|\\([^%s .]\\)\\|\\'\\)"
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
317 ;; mail-extr-all-letters mail-extr-first-letters mail-extr-all-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
318
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
319 ;; Matches periods used instead of spaces. Must not match the period
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
320 ;; following an initial.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
321 (defconst mail-extr-bad-dot-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
322 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
323 (format "\\([%s][%s]\\)\\.+\\([%s]\\)"
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
324 mail-extr-all-letters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
325 mail-extr-last-letters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
326 mail-extr-first-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
327
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
328 ;; Matches an embedded or leading nickname that should be removed.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
329 ;; (defconst mail-extr-nickname-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
330 ;; (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
331 ;; (format "\\([ .]\\|\\`\\)[\"'`\[\(]\\([ .%s]+\\)[\]\"'\)] "
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
332 ;; mail-extr-all-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
333
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
334 ;; Matches the occurrence of a generational name suffix, and the last
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
335 ;; character of the preceding name. This is important because we want to
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
336 ;; keep such suffixes: they help to uniquely identify the person.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
337 ;; *** Perhaps this should be a user-customizable variable. However, the
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
338 ;; *** regular expression is fairly tricky to alter, so maybe not.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
339 (defconst mail-extr-full-name-suffix-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
340 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
341 (format
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
342 "\\(,? ?\\([JjSs][Rr]\\.?\\|V?I+V?\\)\\)\\([^%s]\\([^%s]\\|\\'\\)\\|\\'\\)"
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
343 mail-extr-all-letters mail-extr-all-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
344
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
345 (defconst mail-extr-roman-numeral-pattern (purecopy "V?I+V?\\b"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
346
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
347 ;; Matches a trailing uppercase (with other characters possible) acronym.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
348 ;; Must not match a trailing uppercase last name or trailing initial
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
349 (defconst mail-extr-weird-acronym-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
350 (purecopy "\\([A-Z]+[-_/]\\|[A-Z][A-Z][A-Z]?\\b\\)"))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
351
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
352 ;; Matches a mixed-case or lowercase name (not an initial).
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
353 ;; #### Match Latin1 lower case letters here too?
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
354 ;; (defconst mail-extr-mixed-case-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
355 ;; (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
356 ;; (format
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
357 ;; "\\b\\([a-z][%s]*[%s]\\|[%s][%s]*[a-z][%s]*[%s]\\|[%s][%s]*[a-z]\\)"
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
358 ;; mail-extr-all-letters mail-extr-last-letters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
359 ;; mail-extr-first-letters mail-extr-all-letters mail-extr-all-letters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
360 ;; mail-extr-last-letters mail-extr-first-letters mail-extr-all-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
361
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
362 ;; Matches a trailing alternative address.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
363 ;; #### Match Latin1 letters here too?
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
364 ;; #### Match _ before @ here too?
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
365 (defconst mail-extr-alternative-address-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
366 (purecopy "\\(aka *\\)?[a-zA-Z.]+[!@][a-zA-Z.]"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
367
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
368 ;; Matches a variety of trailing comments not including comma-delimited
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
369 ;; comments.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
370 (defconst mail-extr-trailing-comment-start-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
371 (purecopy " [-{]\\|--\\|[+@#></\;]"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
372
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
373 ;; Matches a name (not an initial).
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
374 ;; This doesn't force a word boundary at the end because sometimes a
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
375 ;; comment is separated by a `-' with no preceding space.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
376 (defconst mail-extr-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
377 (purecopy (format "\\b[%s][%s]*[%s]"
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
378 mail-extr-first-letters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
379 mail-extr-all-letters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
380 mail-extr-last-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
381
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
382 (defconst mail-extr-initial-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
383 (purecopy (format "\\b[%s]\\([. ]\\|\\b\\)" mail-extr-first-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
384
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
385 ;; Matches a single name before a comma.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
386 ;; (defconst mail-extr-last-name-first-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
387 ;; (purecopy (concat "\\`" mail-extr-name-pattern ",")))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
388
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
389 ;; Matches telephone extensions.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
390 (defconst mail-extr-telephone-extension-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
391 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
392 "\\(\\([Ee]xt\\|\\|[Tt]ph\\|[Tt]el\\|[Xx]\\).?\\)? *\\+?[0-9][- 0-9]+"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
393
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
394 ;; Matches ham radio call signs.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
395 ;; Help from: Mat Maessen N2NJZ <maessm@rpi.edu>, Mark Feit
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
396 ;; <mark@era.com>, Michael Covington <mcovingt@ai.uga.edu>.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
397 ;; Examples: DX504 DX515 K5MRU K8DHK KA9WGN KA9WGN KD3FU KD6EUI KD6HBW
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
398 ;; KE9TV KF0NV N1API N3FU N3GZE N3IGS N4KCC N7IKQ N9HHU W4YHF W6ANK WA2SUH
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
399 ;; WB7VZI N2NJZ NR3G KJ4KK AB4UM AL7NI KH6OH WN3KBT N4TMI W1A N0NZO
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
400 (defconst mail-extr-ham-call-sign-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
401 (purecopy "\\b\\(DX[0-9]+\\|[AKNW][A-Z]?[0-9][A-Z][A-Z]?[A-Z]?\\)"))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
402
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
403 ;; Possible trailing suffixes: "\\(/\\(KT\\|A[AEG]\\|[R0-9]\\)\\)?"
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
404 ;; /KT == Temporary Technician (has CSC but not "real" license)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
405 ;; /AA == Temporary Advanced
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
406 ;; /AE == Temporary Extra
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
407 ;; /AG == Temporary General
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
408 ;; /R == repeater
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
409 ;; /# == stations operating out of home district
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
410 ;; I don't include these in the regexp above because I can't imagine
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
411 ;; anyone putting them with their name in an e-mail address.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
412
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
413 ;; Matches normal single-part name
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
414 (defconst mail-extr-normal-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
415 (purecopy (format "\\b[%s][%s]+[%s]"
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
416 mail-extr-first-letters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
417 mail-extr-all-letters-but-separators
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
418 mail-extr-last-letters)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
419
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
420 ;; Matches a single word name.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
421 ;; (defconst mail-extr-one-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
422 ;; (purecopy (concat "\\`" mail-extr-normal-name-pattern "\\'")))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
423
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
424 ;; Matches normal two names with missing middle initial
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
425 ;; The first name is not allowed to have a hyphen because this can cause
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
426 ;; false matches where the "middle initial" is actually the first letter
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
427 ;; of the second part of the first name.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
428 (defconst mail-extr-two-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
429 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
430 (concat "\\`\\(" mail-extr-normal-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
431 "\\|" mail-extr-initial-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
432 "\\) +\\(" mail-extr-name-pattern "\\)\\(,\\|\\'\\)")))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
433
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
434 (defconst mail-extr-listserv-list-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
435 (purecopy "Multiple recipients of list \\([-A-Z]+\\)"))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
436
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
437 (defconst mail-extr-stupid-vms-date-stamp-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
438 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
439 "[0-9][0-9]-[JFMASOND][aepuco][nbrylgptvc]-[0-9][0-9][0-9][0-9] [0-9]+ *"))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
440
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
441 ;;; HZ -- GB (PRC Chinese character encoding) in ASCII embedding protocol
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
442 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
443 ;; In ASCII mode, a byte is interpreted as an ASCII character, unless a '~' is
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
444 ;; encountered. The character '~' is an escape character. By convention, it
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
445 ;; must be immediately followed ONLY by '~', '{' or '\n' (<LF>), with the
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
446 ;; following special meaning.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
447 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
448 ;; o The escape sequence '~~' is interpreted as a '~'.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
449 ;; o The escape-to-GB sequence '~{' switches the mode from ASCII to GB.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
450 ;; o The escape sequence '~\n' is a line-continuation marker to be consumed
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
451 ;; with no output produced.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
452 ;;
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
453 ;; In GB mode, characters are interpreted two bytes at a time as (pure) GB
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
454 ;; codes until the escape-from-GB code '~}' is read. This code switches the
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
455 ;; mode from GB back to ASCII. (Note that the escape-from-GB code '~}'
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
456 ;; ($7E7D) is outside the defined GB range.)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
457 (defconst mail-extr-hz-embedded-gb-encoded-chinese-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
458 (purecopy "~{\\([^~].\\|~[^\}]\\)+~}"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
459
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
460 ;; The leading optional lowercase letters are for a bastardized version of
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
461 ;; the encoding, as is the optional nature of the final slash.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
462 (defconst mail-extr-x400-encoded-address-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
463 (purecopy "[a-z]?[a-z]?\\(/[A-Za-z]+\\(\\.[A-Za-z]+\\)?=[^/]+\\)+/?\\'"))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
464
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
465 (defconst mail-extr-x400-encoded-address-field-pattern-format
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
466 (purecopy "/%s=\\([^/]+\\)\\(/\\|\\'\\)"))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
467
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
468 (defconst mail-extr-x400-encoded-address-surname-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
469 ;; S stands for Surname (family name).
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
470 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
471 (format mail-extr-x400-encoded-address-field-pattern-format "[Ss]")))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
472
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
473 (defconst mail-extr-x400-encoded-address-given-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
474 ;; G stands for Given name.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
475 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
476 (format mail-extr-x400-encoded-address-field-pattern-format "[Gg]")))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
477
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
478 (defconst mail-extr-x400-encoded-address-full-name-pattern
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
479 ;; PN stands for Personal Name. When used it represents the combination
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
480 ;; of the G and S fields.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
481 ;; "The one system I used having this field asked it with the prompt
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
482 ;; `Personal Name'. But they mapped it into G and S on outgoing real
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
483 ;; X.400 addresses. As they mapped G and S into PN on incoming..."
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
484 (purecopy
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
485 (format mail-extr-x400-encoded-address-field-pattern-format "[Pp][Nn]")))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
486
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
487
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
488
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
489 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
490 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
491 ;; Syntax tables used for quick parsing.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
492 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
493
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
494 (defconst mail-extr-address-syntax-table (make-syntax-table))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
495 (defconst mail-extr-address-comment-syntax-table (make-syntax-table))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
496 (defconst mail-extr-address-domain-literal-syntax-table (make-syntax-table))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
497 (defconst mail-extr-address-text-comment-syntax-table (make-syntax-table))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
498 (defconst mail-extr-address-text-syntax-table (make-syntax-table))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
499 (mapc
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
500 (lambda (pair)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
501 (let ((syntax-table (symbol-value (car pair))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
502 (dolist (item (cdr pair))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
503 (if (eq 2 (length item))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
504 ;; modifying syntax of a single character
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
505 (modify-syntax-entry (car item) (car (cdr item)) syntax-table)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
506 ;; modifying syntax of a range of characters
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
507 (let ((char (nth 0 item))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
508 (bound (nth 1 item))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
509 (syntax (nth 2 item)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
510 (while (<= char bound)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
511 (modify-syntax-entry char syntax syntax-table)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
512 (setq char (1+ char))))))))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
513 '((mail-extr-address-syntax-table
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
514 (?\000 ?\037 "w") ;control characters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
515 (?\040 " ") ;SPC
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
516 (?! ?~ "w") ;printable characters
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
517 (?\177 "w") ;DEL
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
518 (?\t " ")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
519 (?\r " ")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
520 (?\n " ")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
521 (?\( ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
522 (?\) ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
523 (?< ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
524 (?> ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
525 (?@ ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
526 (?, ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
527 (?\; ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
528 (?: ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
529 (?\\ "\\")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
530 (?\" "\"")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
531 (?. ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
532 (?\[ ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
533 (?\] ".")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
534 ;; % and ! aren't RFC822 characters, but it is convenient to pretend
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
535 (?% ".")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
536 (?! ".") ;; this needs to be word-constituent when not in .UUCP mode
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
537 )
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
538 (mail-extr-address-comment-syntax-table
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
539 (?\000 ?\377 "w")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
540 (?\040 " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
541 (?\240 " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
542 (?\t " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
543 (?\r " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
544 (?\n " ")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
545 (?\( "\(\)")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
546 (?\) "\)\(")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
547 (?\\ "\\"))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
548 (mail-extr-address-domain-literal-syntax-table
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
549 (?\000 ?\377 "w")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
550 (?\040 " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
551 (?\240 " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
552 (?\t " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
553 (?\r " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
554 (?\n " ")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
555 (?\[ "\(\]") ;??????
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
556 (?\] "\)\[") ;??????
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
557 (?\\ "\\"))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
558 (mail-extr-address-text-comment-syntax-table
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
559 (?\000 ?\377 "w")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
560 (?\040 " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
561 (?\240 " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
562 (?\t " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
563 (?\r " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
564 (?\n " ")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
565 (?\( "\(\)")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
566 (?\) "\)\(")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
567 (?\[ "\(\]")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
568 (?\] "\)\[")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
569 (?\{ "\(\}")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
570 (?\} "\)\{")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
571 (?\\ "\\")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
572 (?\" "\"")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
573 ;; (?\' "\)\`")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
574 ;; (?\` "\(\'")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
575 )
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
576 (mail-extr-address-text-syntax-table
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
577 (?\000 ?\177 ".")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
578 (?\200 ?\377 "w")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
579 (?\040 " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
580 (?\t " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
581 (?\r " ")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
582 (?\n " ")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
583 (?A ?Z "w")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
584 (?a ?z "w")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
585 (?- "w")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
586 (?\} "w")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
587 (?\{ "w")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
588 (?| "w")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
589 (?\' "w")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
590 (?~ "w")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
591 (?0 ?9 "w"))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
592 ))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
593
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
594
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
595 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
596 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
597 ;; Utility functions and macros.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
598 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
599
52916
7302d194fccb (mail-extr-ignore-single-names): Add :version.
Dave Love <fx@gnu.org>
parents: 52401
diff changeset
600 ;; Fixme: There are Latin-1 nbsp below. If such characters should be
7302d194fccb (mail-extr-ignore-single-names): Add :version.
Dave Love <fx@gnu.org>
parents: 52401
diff changeset
601 ;; included, this is the wrong thing to do -- it should use syntax (or
7302d194fccb (mail-extr-ignore-single-names): Add :version.
Dave Love <fx@gnu.org>
parents: 52401
diff changeset
602 ;; regexp char classes).
7302d194fccb (mail-extr-ignore-single-names): Add :version.
Dave Love <fx@gnu.org>
parents: 52401
diff changeset
603
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
604 (defsubst mail-extr-skip-whitespace-forward ()
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
605 ;; v19 fn skip-syntax-forward is more tasteful, but not byte-coded.
51081
a4bb96832880 Use explicit coding tag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47939
diff changeset
606 (skip-chars-forward " \t\n\r "))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
607
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
608 (defsubst mail-extr-skip-whitespace-backward ()
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
609 ;; v19 fn skip-syntax-backward is more tasteful, but not byte-coded.
51081
a4bb96832880 Use explicit coding tag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47939
diff changeset
610 (skip-chars-backward " \t\n\r "))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
611
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
612
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
613 (defsubst mail-extr-undo-backslash-quoting (beg end)
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
614 (save-excursion
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
615 (save-restriction
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
616 (narrow-to-region beg end)
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
617 (goto-char (point-min))
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
618 ;; undo \ quoting
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
619 (while (search-forward "\\" nil t)
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
620 (delete-char -1)
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
621 (or (eobp)
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
622 (forward-char 1))))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
623
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
624 (defsubst mail-extr-nuke-char-at (pos)
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
625 (save-excursion
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
626 (goto-char pos)
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
627 (delete-char 1)
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
628 (insert ?\ )))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
629
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
630 (put 'mail-extr-nuke-outside-range
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
631 'edebug-form-spec '(symbolp &optional form form atom))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
632
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
633 (defmacro mail-extr-nuke-outside-range (list-symbol
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
634 beg-symbol end-symbol
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
635 &optional no-replace)
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
636 "Delete all elements outside BEG..END in LIST.
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
637 LIST-SYMBOL names a variable holding a list of buffer positions
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
638 BEG-SYMBOL and END-SYMBOL name variables delimiting a range
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
639 Each element of LIST-SYMBOL which lies outside of the range is
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
640 deleted from the list.
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
641 Unless NO-REPLACE is true, at each of the positions in LIST-SYMBOL
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
642 which lie outside of the range, one character at that position is
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
643 replaced with a SPC."
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
644 (or (memq no-replace '(t nil))
14029
8812f5ef65db (mail-extr-nuke-outside-range): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents: 13959
diff changeset
645 (error "no-replace must be t or nil, evaluable at macroexpand-time"))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
646 `(let ((temp ,list-symbol)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
647 ch)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
648 (while temp
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
649 (setq ch (car temp))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
650 (when (or (> ch ,end-symbol)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
651 (< ch ,beg-symbol))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
652 ,@(if no-replace
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
653 nil
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
654 `((mail-extr-nuke-char-at ch)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
655 (setcar temp nil))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
656 (setq temp (cdr temp)))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
657 (setq ,list-symbol (delq nil ,list-symbol))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
658
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
659 (defun mail-extr-demarkerize (marker)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
660 ;; if arg is a marker, destroys the marker, then returns the old value.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
661 ;; otherwise returns the arg.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
662 (if (markerp marker)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
663 (let ((temp (marker-position marker)))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
664 (set-marker marker nil)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
665 temp)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
666 marker))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
667
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
668 (defun mail-extr-markerize (pos)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
669 ;; coerces pos to a marker if non-nil.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
670 (if (or (markerp pos) (null pos))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
671 pos
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
672 (copy-marker pos)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
673
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
674 (defsubst mail-extr-safe-move-sexp (arg)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
675 ;; Safely skip over one balanced sexp, if there is one. Return t if success.
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
676 (condition-case error
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
677 (progn
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
678 (goto-char (or (scan-sexps (point) arg) (point)))
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
679 t)
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
680 (error
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
681 ;; #### kludge kludge kludge kludge kludge kludge kludge !!!
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
682 (if (string-equal (nth 1 error) "Unbalanced parentheses")
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
683 nil
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
684 (while t
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
685 (signal (car error) (cdr error)))))))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
686
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
687 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
688 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
689 ;; The main function to grind addresses
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
690 ;;
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
691
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
692 (defvar disable-initial-guessing-flag) ; dynamic assignment
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
693 (defvar cbeg) ; dynamic assignment
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
694 (defvar cend) ; dynamic assignment
56764
57c8c9029251 (mail-extr-all-top-level-domains): Add forward defvar.
Richard M. Stallman <rms@gnu.org>
parents: 56600
diff changeset
695 (defvar mail-extr-all-top-level-domains) ; Defined below.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
696
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
697 ;;;###autoload
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
698 (defun mail-extract-address-components (address &optional all)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
699 "Given an RFC-822 address ADDRESS, extract full name and canonical address.
67435
f245bb6e08da * files.el (save-buffer):
Reiner Steib <Reiner.Steib@gmx.de>
parents: 64754
diff changeset
700 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS). If no
f245bb6e08da * files.el (save-buffer):
Reiner Steib <Reiner.Steib@gmx.de>
parents: 64754
diff changeset
701 name can be extracted, FULL-NAME will be nil. Also see
f245bb6e08da * files.el (save-buffer):
Reiner Steib <Reiner.Steib@gmx.de>
parents: 64754
diff changeset
702 `mail-extr-ignore-single-names' and
f245bb6e08da * files.el (save-buffer):
Reiner Steib <Reiner.Steib@gmx.de>
parents: 64754
diff changeset
703 `mail-extr-ignore-realname-equals-mailbox-name'.
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
704
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
705 If the optional argument ALL is non-nil, then ADDRESS can contain zero
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
706 or more recipients, separated by commas, and we return a list of
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
707 the form ((FULL-NAME CANONICAL-ADDRESS) ...) with one element for
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
708 each recipient. If ALL is nil, then if ADDRESS contains more than
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
709 one recipients, all but the first is ignored.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
710
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
711 ADDRESS may be a string or a buffer. If it is a buffer, the visible
47615
a298684644ca (mail-extr-ignore-single-names): Change default.
Simon Josefsson <jas@extundo.com>
parents: 46273
diff changeset
712 \(narrowed) portion of the buffer will be interpreted as the address.
a298684644ca (mail-extr-ignore-single-names): Change default.
Simon Josefsson <jas@extundo.com>
parents: 46273
diff changeset
713 \(This feature exists so that the clever caller might be able to avoid
a298684644ca (mail-extr-ignore-single-names): Change default.
Simon Josefsson <jas@extundo.com>
parents: 46273
diff changeset
714 consing a string.)"
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
715 (let ((canonicalization-buffer (get-buffer-create " *canonical address*"))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
716 (extraction-buffer (get-buffer-create " *extract address components*"))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
717 value-list)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
718
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
719 (with-current-buffer (get-buffer-create extraction-buffer)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
720 (fundamental-mode)
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 846
diff changeset
721 (buffer-disable-undo extraction-buffer)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
722 (set-syntax-table mail-extr-address-syntax-table)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
723 (widen)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
724 (erase-buffer)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
725 (setq case-fold-search nil)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
726
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
727 ;; Insert extra space at beginning to allow later replacement with <
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
728 ;; without having to move markers.
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
729 (insert ?\ )
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
730
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
731 ;; Insert the address itself.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
732 (cond ((stringp address)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
733 (insert address))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
734 ((bufferp address)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
735 (insert-buffer-substring address))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
736 (t
14029
8812f5ef65db (mail-extr-nuke-outside-range): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents: 13959
diff changeset
737 (error "Invalid address: %s" address)))
16727
45d9891b03b2 (mail-extract-address-components): Clear text props
Richard M. Stallman <rms@gnu.org>
parents: 16699
diff changeset
738
45d9891b03b2 (mail-extract-address-components): Clear text props
Richard M. Stallman <rms@gnu.org>
parents: 16699
diff changeset
739 (set-text-properties (point-min) (point-max) nil)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
740
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
741 (with-current-buffer (get-buffer-create canonicalization-buffer)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
742 (fundamental-mode)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
743 (buffer-disable-undo canonicalization-buffer)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
744 (setq case-fold-search nil))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
745
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
746
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
747 ;; Unfold multiple lines.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
748 (goto-char (point-min))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
749 (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
750 (replace-match "\\1 " t))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
751
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
752 ;; Loop over addresses until we have as many as we want.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
753 (while (and (or all (null value-list))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
754 (progn (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
755 (skip-chars-forward " \t")
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
756 (not (eobp))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
757 (let (char
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
758 end-of-address
21477
a61dfbd23534 (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20962
diff changeset
759 <-pos >-pos @-pos colon-pos comma-pos !-pos %-pos \;-pos
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
760 group-:-pos group-\;-pos route-addr-:-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
761 record-pos-symbol
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
762 first-real-pos last-real-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
763 phrase-beg phrase-end
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
764 cbeg cend ; dynamically set from -voodoo
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
765 quote-beg quote-end
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
766 atom-beg atom-end
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
767 mbox-beg mbox-end
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
768 \.-ends-name
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
769 temp
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
770 ;; name-suffix
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
771 fi mi li ; first, middle, last initial
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
772 saved-%-pos saved-!-pos saved-@-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
773 domain-pos \.-pos insert-point
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
774 ;; mailbox-name-processed-flag
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
775 disable-initial-guessing-flag) ; dynamically set from -voodoo
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
776
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
777 (set-syntax-table mail-extr-address-syntax-table)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
778 (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
779
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
780 ;; Insert extra space at beginning to allow later replacement with <
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
781 ;; without having to move markers.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
782 (or (eq (following-char) ?\ )
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
783 (insert ?\ ))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
784
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
785 ;; First pass grabs useful information about address.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
786 (while (progn
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
787 (mail-extr-skip-whitespace-forward)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
788 (not (eobp)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
789 (setq char (char-after (point)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
790 (or first-real-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
791 (if (not (eq char ?\())
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
792 (setq first-real-pos (point))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
793 (cond
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
794 ;; comment
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
795 ((eq char ?\()
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
796 (set-syntax-table mail-extr-address-comment-syntax-table)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
797 ;; only record the first non-empty comment's position
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
798 (if (and (not cbeg)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
799 (save-excursion
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
800 (forward-char 1)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
801 (mail-extr-skip-whitespace-forward)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
802 (not (eq ?\) (char-after (point))))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
803 (setq cbeg (point)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
804 ;; TODO: don't record if unbalanced
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
805 (or (mail-extr-safe-move-sexp 1)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
806 (forward-char 1))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
807 (set-syntax-table mail-extr-address-syntax-table)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
808 (if (and cbeg
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
809 (not cend))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
810 (setq cend (point))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
811 ;; quoted text
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
812 ((eq char ?\")
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
813 ;; only record the first non-empty quote's position
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
814 (if (and (not quote-beg)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
815 (save-excursion
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
816 (forward-char 1)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
817 (mail-extr-skip-whitespace-forward)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
818 (not (eq ?\" (char-after (point))))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
819 (setq quote-beg (point)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
820 ;; TODO: don't record if unbalanced
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
821 (or (mail-extr-safe-move-sexp 1)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
822 (forward-char 1))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
823 (if (and quote-beg
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
824 (not quote-end))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
825 (setq quote-end (point))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
826 ;; domain literals
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
827 ((eq char ?\[)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
828 (set-syntax-table mail-extr-address-domain-literal-syntax-table)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
829 (or (mail-extr-safe-move-sexp 1)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
830 (forward-char 1))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
831 (set-syntax-table mail-extr-address-syntax-table))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
832 ;; commas delimit addresses when outside < > pairs.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
833 ((and (eq char ?,)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
834 (or (and (null <-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
835 ;; Handle ROUTE-ADDR address that is missing its <.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
836 (not (eq ?@ (char-after (1+ (point))))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
837 (and >-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
838 ;; handle weird munged addresses
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
839 ;; BUG FIX: This test was reversed. Thanks to the
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
840 ;; brilliant Rod Whitby <rwhitby@research.canon.oz.au>
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
841 ;; for discovering this!
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
842 (< (car (last <-pos)) (car >-pos)))))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
843 ;; The argument contains more than one address.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
844 ;; Temporarily hide everything after this one.
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
845 (setq end-of-address (copy-marker (1+ (point)) t))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
846 (narrow-to-region (point-min) (1+ (point)))
37148
aca2b7839d21 (mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25439
diff changeset
847 (delete-char 1)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
848 (setq char ?\() ; HAVE I NO SHAME??
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
849 )
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
850 ;; record the position of various interesting chars, determine
80051
86418444e2d1 *** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents: 79712
diff changeset
851 ;; validity later.
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
852 ((setq record-pos-symbol
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
853 (cdr (assq char
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
854 '((?< . <-pos) (?> . >-pos) (?@ . @-pos)
21477
a61dfbd23534 (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20962
diff changeset
855 (?: . colon-pos) (?, . comma-pos) (?! . !-pos)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
856 (?% . %-pos) (?\; . \;-pos)))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
857 (set record-pos-symbol
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
858 (cons (point) (symbol-value record-pos-symbol)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
859 (forward-char 1))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
860 ((eq char ?.)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
861 (forward-char 1))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
862 ((memq char '(
80051
86418444e2d1 *** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents: 79712
diff changeset
863 ;; comment terminator invalid
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
864 ?\)
80051
86418444e2d1 *** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents: 79712
diff changeset
865 ;; domain literal terminator invalid
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
866 ?\]
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
867 ;; \ allowed only within quoted strings,
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
868 ;; domain literals, and comments
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
869 ?\\
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
870 ))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
871 (mail-extr-nuke-char-at (point))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
872 (forward-char 1))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
873 (t
77894
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
874 ;; Do `(forward-word 1)', recognizing non-ASCII characters
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
875 ;; except Latin-1 nbsp as words.
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
876 (while (progn
81020
6e1a357362af (mail-extract-address-components): Recognize
Kenichi Handa <handa@m17n.org>
parents: 75347
diff changeset
877 (skip-chars-forward "^\000-\177 ")
77894
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
878 (and (not (eobp))
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
879 (eq ?w (char-syntax (char-after)))
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
880 (progn
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
881 (forward-word 1)
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
882 (and (not (eobp))
d3e947ea638f (mail-extract-address-components): Recognize non-ASCII characters
Chong Yidong <cyd@stupidchicken.com>
parents: 75347
diff changeset
883 (> (char-after) ?\177)
81020
6e1a357362af (mail-extract-address-components): Recognize
Kenichi Handa <handa@m17n.org>
parents: 75347
diff changeset
884 (not (eq (char-after) ? )))))))))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
885 (or (eq char ?\()
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
886 ;; At the end of first address of a multiple address header.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
887 (and (eq char ?,)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
888 (eobp))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
889 (setq last-real-pos (point))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
890
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
891 ;; Use only the leftmost <, if any. Replace all others with spaces.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
892 (while (cdr <-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
893 (mail-extr-nuke-char-at (car <-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
894 (setq <-pos (cdr <-pos)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
895
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
896 ;; Use only the rightmost >, if any. Replace all others with spaces.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
897 (while (cdr >-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
898 (mail-extr-nuke-char-at (nth 1 >-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
899 (setcdr >-pos (nthcdr 2 >-pos)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
900
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
901 ;; If multiple @s and a :, but no < and >, insert around buffer.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
902 ;; Example: @foo.bar.dom,@xxx.yyy.zzz:mailbox@aaa.bbb.ccc
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
903 ;; This commonly happens on the UUCP "From " line. Ugh.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
904 (when (and (> (length @-pos) 1)
21477
a61dfbd23534 (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20962
diff changeset
905 (eq 1 (length colon-pos)) ;TODO: check if between last two @s
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
906 (not \;-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
907 (not <-pos))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
908 (goto-char (point-min))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
909 (delete-char 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
910 (setq <-pos (list (point)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
911 (insert ?<))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
912
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
913 ;; If < but no >, insert > in rightmost possible position
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
914 (when (and <-pos (null >-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
915 (goto-char (point-max))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
916 (setq >-pos (list (point)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
917 (insert ?>))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
918
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
919 ;; If > but no <, replace > with space.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
920 (when (and >-pos (null <-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
921 (mail-extr-nuke-char-at (car >-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
922 (setq >-pos nil))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
923
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
924 ;; Turn >-pos and <-pos into non-lists
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
925 (setq >-pos (car >-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
926 <-pos (car <-pos))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
927
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
928 ;; Trim other punctuation lists of items outside < > pair to handle
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
929 ;; stupid MTAs.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
930 (when <-pos ; don't need to check >-pos also
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
931 ;; handle bozo software that violates RFC 822 by sticking
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
932 ;; punctuation marks outside of a < > pair
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
933 (mail-extr-nuke-outside-range @-pos <-pos >-pos t)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
934 ;; RFC 822 says nothing about these two outside < >, but
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
935 ;; remove those positions from the lists to make things
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
936 ;; easier.
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
937 (mail-extr-nuke-outside-range !-pos <-pos >-pos t)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
938 (mail-extr-nuke-outside-range %-pos <-pos >-pos t))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
939
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
940 ;; Check for : that indicates GROUP list and for : part of
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
941 ;; ROUTE-ADDR spec.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
942 ;; Can't possibly be more than two :. Nuke any extra.
21477
a61dfbd23534 (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20962
diff changeset
943 (while colon-pos
a61dfbd23534 (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20962
diff changeset
944 (setq temp (car colon-pos)
a61dfbd23534 (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20962
diff changeset
945 colon-pos (cdr colon-pos))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
946 (cond ((and <-pos >-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
947 (> temp <-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
948 (< temp >-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
949 (if (or route-addr-:-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
950 (< (length @-pos) 2)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
951 (> temp (car @-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
952 (< temp (nth 1 @-pos)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
953 (mail-extr-nuke-char-at temp)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
954 (setq route-addr-:-pos temp)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
955 ((or (not <-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
956 (and <-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
957 (< temp <-pos)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
958 (setq group-:-pos temp))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
959
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
960 ;; Nuke any ; that is in or to the left of a < > pair or to the left
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
961 ;; of a GROUP starting :. Also, there may only be one ;.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
962 (while \;-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
963 (setq temp (car \;-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
964 \;-pos (cdr \;-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
965 (cond ((and <-pos >-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
966 (> temp <-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
967 (< temp >-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
968 (mail-extr-nuke-char-at temp))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
969 ((and (or (not group-:-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
970 (> temp group-:-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
971 (not group-\;-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
972 (setq group-\;-pos temp))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
973
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
974 ;; Nuke unmatched GROUP syntax characters.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
975 (when (and group-:-pos (not group-\;-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
976 ;; *** Do I really need to erase it?
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
977 (mail-extr-nuke-char-at group-:-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
978 (setq group-:-pos nil))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
979 (when (and group-\;-pos (not group-:-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
980 ;; *** Do I really need to erase it?
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
981 (mail-extr-nuke-char-at group-\;-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
982 (setq group-\;-pos nil))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
983
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
984 ;; Handle junk like ";@host.company.dom" that sendmail adds.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
985 ;; **** should I remember comment positions?
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
986 (when group-\;-pos
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
987 ;; this is fine for now
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
988 (mail-extr-nuke-outside-range !-pos group-:-pos group-\;-pos t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
989 (mail-extr-nuke-outside-range @-pos group-:-pos group-\;-pos t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
990 (mail-extr-nuke-outside-range %-pos group-:-pos group-\;-pos t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
991 (mail-extr-nuke-outside-range comma-pos group-:-pos group-\;-pos t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
992 (and last-real-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
993 (> last-real-pos (1+ group-\;-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
994 (setq last-real-pos (1+ group-\;-pos)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
995 ;; *** This may be wrong:
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
996 (and cend
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
997 (> cend group-\;-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
998 (setq cend nil
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
999 cbeg nil))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1000 (and quote-end
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1001 (> quote-end group-\;-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1002 (setq quote-end nil
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1003 quote-beg nil))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1004 ;; This was both wrong and unnecessary:
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1005 ;;(narrow-to-region (point-min) group-\;-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1006
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1007 ;; *** The entire handling of GROUP addresses seems rather lame.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1008 ;; *** It deserves a complete rethink, except that these addresses
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1009 ;; *** are hardly ever seen.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1010 )
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1011
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1012 ;; Any commas must be between < and : of ROUTE-ADDR. Nuke any
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1013 ;; others.
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
1014 ;; Hell, go ahead and nuke all of the commas.
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1015 ;; **** This will cause problems when we start handling commas in
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1016 ;; the PHRASE part .... no it won't ... yes it will ... ?????
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1017 (mail-extr-nuke-outside-range comma-pos 1 1)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1018
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1019 ;; can only have multiple @s inside < >. The fact that some MTAs
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1020 ;; put de-bracketed ROUTE-ADDRs in the UUCP-style "From " line is
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1021 ;; handled above.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1022
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1023 ;; Locate PHRASE part of ROUTE-ADDR.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1024 (when <-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1025 (goto-char <-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1026 (mail-extr-skip-whitespace-backward)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1027 (setq phrase-end (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1028 (goto-char (or ;;group-:-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1029 (point-min)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1030 (mail-extr-skip-whitespace-forward)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1031 (if (< (point) phrase-end)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1032 (setq phrase-beg (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1033 (setq phrase-end nil)))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1034
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1035 ;; handle ROUTE-ADDRS with real ROUTEs.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1036 ;; If there are multiple @s, then we assume ROUTE-ADDR syntax, and
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1037 ;; any % or ! must be semantically meaningless.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1038 ;; TODO: do this processing into canonicalization buffer
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1039 (when route-addr-:-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1040 (setq !-pos nil
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1041 %-pos nil
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1042 >-pos (copy-marker >-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1043 route-addr-:-pos (copy-marker route-addr-:-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1044 (goto-char >-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1045 (insert-before-markers ?X)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1046 (goto-char (car @-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1047 (while (setq @-pos (cdr @-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1048 (delete-char 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1049 (setq %-pos (cons (point-marker) %-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1050 (insert "%")
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1051 (goto-char (1- >-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1052 (save-excursion
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1053 (insert-buffer-substring extraction-buffer
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1054 (car @-pos) route-addr-:-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1055 (delete-region (car @-pos) route-addr-:-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1056 (or (cdr @-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1057 (setq saved-@-pos (list (point)))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1058 (setq @-pos saved-@-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1059 (goto-char >-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1060 (delete-char -1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1061 (mail-extr-nuke-char-at route-addr-:-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1062 (mail-extr-demarkerize route-addr-:-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1063 (setq route-addr-:-pos nil
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1064 >-pos (mail-extr-demarkerize >-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1065 %-pos (mapcar 'mail-extr-demarkerize %-pos)))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1066
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1067 ;; de-listify @-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1068 (setq @-pos (car @-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1069
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1070 ;; TODO: remove comments in the middle of an address
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1071
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1072 (with-current-buffer canonicalization-buffer
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1073 (widen)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1074 (erase-buffer)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1075 (insert-buffer-substring extraction-buffer)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1076
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1077 (if <-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1078 (narrow-to-region (progn
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1079 (goto-char (1+ <-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1080 (mail-extr-skip-whitespace-forward)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1081 (point))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1082 >-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1083 (if (and first-real-pos last-real-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1084 (narrow-to-region first-real-pos last-real-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1085 ;; ****** Oh no! What if the address is completely empty!
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1086 ;; *** Is this correct?
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1087 (narrow-to-region (point-max) (point-max))))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1088
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1089 (and @-pos %-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1090 (mail-extr-nuke-outside-range %-pos (point-min) @-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1091 (and %-pos !-pos
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1092 (mail-extr-nuke-outside-range !-pos (point-min) (car %-pos)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1093 (and @-pos !-pos (not %-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1094 (mail-extr-nuke-outside-range !-pos (point-min) @-pos))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1095
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1096 ;; Error condition:?? (and %-pos (not @-pos))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1097
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1098 ;; WARNING: THIS CODE IS DUPLICATED BELOW.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1099 (when (and %-pos (not @-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1100 (goto-char (car %-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1101 (delete-char 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1102 (setq @-pos (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1103 (insert "@")
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1104 (setq %-pos (cdr %-pos)))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1105
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1106 (when (and mail-extr-mangle-uucp !-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1107 ;; **** I don't understand this save-restriction and the
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1108 ;; narrow-to-region inside it. Why did I do that?
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1109 (save-restriction
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1110 (cond ((and @-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1111 mail-extr-@-binds-tighter-than-!)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1112 (goto-char @-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1113 (setq %-pos (cons (point) %-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1114 @-pos nil)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1115 (delete-char 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1116 (insert "%")
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1117 (setq insert-point (point-max)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1118 (mail-extr-@-binds-tighter-than-!
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1119 (setq insert-point (point-max)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1120 (%-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1121 (setq insert-point (car (last %-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1122 saved-%-pos (mapcar 'mail-extr-markerize %-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1123 %-pos nil
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1124 @-pos (mail-extr-markerize @-pos)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1125 (@-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1126 (setq insert-point @-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1127 (setq @-pos (mail-extr-markerize @-pos)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1128 (t
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1129 (setq insert-point (point-max))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1130 (narrow-to-region (point-min) insert-point)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1131 (setq saved-!-pos (car !-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1132 (while !-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1133 (goto-char (point-max))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1134 (cond ((and (not @-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1135 (not (cdr !-pos)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1136 (setq @-pos (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1137 (insert-before-markers "@ "))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1138 (t
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1139 (setq %-pos (cons (point) %-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1140 (insert-before-markers "% ")))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1141 (backward-char 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1142 (insert-buffer-substring
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1143 (current-buffer)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1144 (if (nth 1 !-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1145 (1+ (nth 1 !-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1146 (point-min))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1147 (car !-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1148 (delete-char 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1149 (or (save-excursion
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1150 (mail-extr-safe-move-sexp -1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1151 (mail-extr-skip-whitespace-backward)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1152 (eq ?. (preceding-char)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1153 (insert-before-markers
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1154 (if (save-excursion
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1155 (mail-extr-skip-whitespace-backward)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1156 (eq ?. (preceding-char)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1157 ""
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1158 ".")
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1159 "uucp"))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1160 (setq !-pos (cdr !-pos))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1161 (and saved-%-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1162 (setq %-pos (append (mapcar 'mail-extr-demarkerize
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1163 saved-%-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1164 %-pos)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1165 (setq @-pos (mail-extr-demarkerize @-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1166 (narrow-to-region (1+ saved-!-pos) (point-max)))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1167
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1168 ;; WARNING: THIS CODE IS DUPLICATED ABOVE.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1169 (when (and %-pos (not @-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1170 (goto-char (car %-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1171 (delete-char 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1172 (setq @-pos (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1173 (insert "@")
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1174 (setq %-pos (cdr %-pos)))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1175
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1176 (when (setq %-pos (nreverse %-pos)) ; implies @-pos valid
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1177 (setq temp %-pos)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1178 (catch 'truncated
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1179 (while temp
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1180 (goto-char (or (nth 1 temp)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1181 @-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1182 (mail-extr-skip-whitespace-backward)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1183 (save-excursion
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1184 (mail-extr-safe-move-sexp -1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1185 (setq domain-pos (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1186 (mail-extr-skip-whitespace-backward)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1187 (setq \.-pos (eq ?. (preceding-char))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1188 (when (and \.-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1189 ;; #### string consing
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1190 (let ((s (intern-soft
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1191 (buffer-substring domain-pos (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1192 mail-extr-all-top-level-domains)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1193 (and s (get s 'domain-name))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1194 (narrow-to-region (point-min) (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1195 (goto-char (car temp))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1196 (delete-char 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1197 (setq @-pos (point))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1198 (setcdr temp nil)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1199 (setq %-pos (delq @-pos %-pos))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1200 (insert "@")
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1201 (throw 'truncated t))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1202 (setq temp (cdr temp)))))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1203 (setq mbox-beg (point-min)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1204 mbox-end (if %-pos (car %-pos)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1205 (or @-pos
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1206 (point-max))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1207
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1208 (when @-pos
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1209 ;; Make the domain-name part lowercase since it's case
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1210 ;; insensitive anyway.
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1211 (downcase-region (1+ @-pos) (point-max))))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1212
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1213 ;; Done canonicalizing address.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1214 ;; We are now back in extraction-buffer.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1215
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1216 ;; Decide what part of the address to search to find the full name.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1217 (cond (
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1218 ;; Example: "First M. Last" <fml@foo.bar.dom>
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1219 (and phrase-beg
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1220 (eq quote-beg phrase-beg)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1221 (<= quote-end phrase-end))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1222 (narrow-to-region (1+ quote-beg) (1- quote-end))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1223 (mail-extr-undo-backslash-quoting (point-min) (point-max)))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1224
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1225 ;; Example: First Last <fml@foo.bar.dom>
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1226 (phrase-beg
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1227 (narrow-to-region phrase-beg phrase-end))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1228
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1229 ;; Example: fml@foo.bar.dom (First M. Last)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1230 (cbeg
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1231 (narrow-to-region (1+ cbeg) (1- cend))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1232 (mail-extr-undo-backslash-quoting (point-min) (point-max))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1233
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1234 ;; Deal with spacing problems
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1235 (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1236 ;;; (cond ((not (search-forward " " nil t))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1237 ;;; (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1238 ;;; (cond ((search-forward "_" nil t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1239 ;;; ;; Handle the *idiotic* use of underlines as spaces.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1240 ;;; ;; Example: fml@foo.bar.dom (First_M._Last)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1241 ;;; (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1242 ;;; (while (search-forward "_" nil t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1243 ;;; (replace-match " " t)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1244 ;;; ((search-forward "." nil t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1245 ;;; ;; Fix . used as space
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1246 ;;; ;; Example: danj1@cb.att.com (daniel.jacobson)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1247 ;;; (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1248 ;;; (while (re-search-forward mail-extr-bad-dot-pattern nil t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1249 ;;; (replace-match "\\1 \\2" t))))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1250 )
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1251
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1252 ;; Otherwise we try to get the name from the mailbox portion
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1253 ;; of the address.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1254 ;; Example: First_M_Last@foo.bar.dom
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1255 (t
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1256 ;; *** Work in canon buffer instead? No, can't. Hmm.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1257 (goto-char (point-max))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1258 (narrow-to-region (point) (point))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1259 (insert-buffer-substring canonicalization-buffer
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1260 mbox-beg mbox-end)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1261 (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1262
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1263 ;; Example: First_Last.XXX@foo.bar.dom
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1264 (setq \.-ends-name (re-search-forward "[_0-9]" nil t))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1265
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1266 (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1267
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1268 (if (not mail-extr-mangle-uucp)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1269 (modify-syntax-entry ?! "w" (syntax-table)))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1270
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1271 (while (progn
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1272 (mail-extr-skip-whitespace-forward)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1273 (not (eobp)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1274 (setq char (char-after (point)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1275 (cond
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1276 ((eq char ?\")
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1277 (setq quote-beg (point))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1278 (or (mail-extr-safe-move-sexp 1)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1279 ;; TODO: handle this error condition!!!!!
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1280 (forward-char 1))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1281 ;; take into account deletions
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1282 (setq quote-end (- (point) 2))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1283 (save-excursion
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1284 (backward-char 1)
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1285 (delete-char 1)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1286 (goto-char quote-beg)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1287 (or (eobp)
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1288 (delete-char 1)))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1289 (mail-extr-undo-backslash-quoting quote-beg quote-end)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1290 (or (eq ?\ (char-after (point)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1291 (insert " "))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1292 ;; (setq mailbox-name-processed-flag t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1293 (setq \.-ends-name t))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1294 ((eq char ?.)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1295 (if (memq (char-after (1+ (point))) '(?_ ?=))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1296 (progn
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1297 (forward-char 1)
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1298 (delete-char 1)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1299 (insert ?\ ))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1300 (if \.-ends-name
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1301 (narrow-to-region (point-min) (point))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1302 (delete-char 1)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1303 (insert " ")))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1304 ;; (setq mailbox-name-processed-flag t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1305 )
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1306 ((memq (char-syntax char) '(?. ?\\))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1307 (delete-char 1)
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1308 (insert " ")
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1309 ;; (setq mailbox-name-processed-flag t)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1310 )
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1311 (t
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1312 (setq atom-beg (point))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1313 (forward-word 1)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1314 (setq atom-end (point))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1315 (goto-char atom-beg)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1316 (save-restriction
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1317 (narrow-to-region atom-beg atom-end)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1318 (cond
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1319
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1320 ;; Handle X.400 addresses encoded in RFC-822.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1321 ;; *** Shit! This has to handle the case where it is
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1322 ;; *** embedded in a quote too!
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1323 ;; *** Shit! The input is being broken up into atoms
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1324 ;; *** by periods!
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1325 ((looking-at mail-extr-x400-encoded-address-pattern)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1326
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1327 ;; Copy the contents of the individual fields that
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1328 ;; might hold name data to the beginning.
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1329 (mapc
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1330 (lambda (field-pattern)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1331 (when
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1332 (save-excursion
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1333 (re-search-forward field-pattern nil t))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1334 (insert-buffer-substring (current-buffer)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1335 (match-beginning 1)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1336 (match-end 1))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1337 (insert " ")))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1338 (list mail-extr-x400-encoded-address-given-name-pattern
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1339 mail-extr-x400-encoded-address-surname-pattern
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1340 mail-extr-x400-encoded-address-full-name-pattern))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1341
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1342 ;; Discard the rest, since it contains stuff like
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1343 ;; routing information, not part of a name.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1344 (mail-extr-skip-whitespace-backward)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1345 (delete-region (point) (point-max))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1346
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1347 ;; Handle periods used for spacing.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1348 (while (re-search-forward mail-extr-bad-dot-pattern nil t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1349 (replace-match "\\1 \\2" t))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1350
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1351 ;; (setq mailbox-name-processed-flag t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1352 )
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1353
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1354 ;; Handle normal addresses.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1355 (t
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1356 (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1357 ;; Handle _ and = used for spacing.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1358 (while (re-search-forward "\\([^_=]+\\)[_=]" nil t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1359 (replace-match "\\1 " t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1360 ;; (setq mailbox-name-processed-flag t)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1361 )
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1362 (goto-char (point-max))))))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1363
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1364 ;; undo the dirty deed
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1365 (if (not mail-extr-mangle-uucp)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1366 (modify-syntax-entry ?! "." (syntax-table)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1367 ;;
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1368 ;; If we derived the name from the mailbox part of the address,
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1369 ;; and we only got one word out of it, don't treat that as a
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1370 ;; name. "foo@bar" --> (nil "foo@bar"), not ("foo" "foo@bar")
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1371 ;; (if (not mailbox-name-processed-flag)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1372 ;; (delete-region (point-min) (point-max)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1373 ))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1374
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1375 (set-syntax-table mail-extr-address-text-syntax-table)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1376
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1377 (mail-extr-voodoo mbox-beg mbox-end canonicalization-buffer)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1378 (goto-char (point-min))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1379
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1380 ;; If name is "First Last" and userid is "F?L", then assume
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1381 ;; the middle initial is the second letter in the userid.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1382 ;; Initial code by Jamie Zawinski <jwz@lucid.com>
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1383 ;; *** Make it work when there's a suffix as well.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1384 (goto-char (point-min))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1385 (when (and mail-extr-guess-middle-initial
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1386 (not disable-initial-guessing-flag)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1387 (eq 3 (- mbox-end mbox-beg))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1388 (progn
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1389 (goto-char (point-min))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1390 (looking-at mail-extr-two-name-pattern)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1391 (setq fi (char-after (match-beginning 0))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1392 li (char-after (match-beginning 3)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1393 (with-current-buffer canonicalization-buffer
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1394 ;; char-equal is ignoring case here, so no need to upcase
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1395 ;; or downcase.
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1396 (let ((case-fold-search t))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1397 (and (char-equal fi (char-after mbox-beg))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1398 (char-equal li (char-after (1- mbox-end)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1399 (setq mi (char-after (1+ mbox-beg))))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1400 (when (and mi
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1401 ;; TODO: use better table than syntax table
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1402 (eq ?w (char-syntax mi)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1403 (goto-char (match-beginning 3))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1404 (insert (upcase mi) ". ")))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1405
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1406 ;; Nuke name if it is the same as mailbox name.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1407 (let ((buffer-length (- (point-max) (point-min)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1408 (i 0)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1409 (names-match-flag t))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1410 (when (and (> buffer-length 0)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1411 (eq buffer-length (- mbox-end mbox-beg)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1412 (goto-char (point-max))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1413 (insert-buffer-substring canonicalization-buffer
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1414 mbox-beg mbox-end)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1415 (while (and names-match-flag
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1416 (< i buffer-length))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1417 (or (eq (downcase (char-after (+ i (point-min))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1418 (downcase
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1419 (char-after (+ i buffer-length (point-min)))))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1420 (setq names-match-flag nil))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1421 (setq i (1+ i)))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1422 (delete-region (+ (point-min) buffer-length) (point-max))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 57391
diff changeset
1423 (and names-match-flag
57391
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
1424 mail-extr-ignore-realname-equals-mailbox-name
dd2896f4c2b7 (mail-extr-ignore-realname-equals-mailbox-name): New defcustom.
Eli Zaretskii <eliz@gnu.org>
parents: 56764
diff changeset
1425 (narrow-to-region (point) (point)))))
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1426
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1427 ;; Nuke name if it's just one word.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1428 (goto-char (point-min))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1429 (and mail-extr-ignore-single-names
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1430 (not (re-search-forward "[- ]" nil t))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1431 (narrow-to-region (point) (point)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1432
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1433 ;; Record the result
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1434 (setq value-list
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1435 (cons (list (if (not (= (point-min) (point-max)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1436 (buffer-string))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1437 (with-current-buffer canonicalization-buffer
20285
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1438 (if (not (= (point-min) (point-max)))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1439 (buffer-string))))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1440 value-list))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1441
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1442 ;; Unless one address is all we wanted,
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1443 ;; delete this one from extraction-buffer
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1444 ;; and get ready to extract the next address.
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1445 (when all
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1446 (if end-of-address
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1447 (narrow-to-region 1 end-of-address)
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1448 (widen))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1449 (delete-region (point-min) (point-max))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1450 (widen))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1451 )))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1452 (if all (nreverse value-list) (car value-list))
3b0ad3d46bde (mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents: 20242
diff changeset
1453 ))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1454
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1455 (defcustom mail-extr-disable-voodoo "\\cj"
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1456 "*If it is a regexp, names matching it will never be modified.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1457 If it is neither nil nor a string, modifying of names will never take
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1458 place. It affects how `mail-extract-address-components' works."
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1459 :type '(choice (regexp :size 0)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1460 (const :tag "Always enabled" nil)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1461 (const :tag "Always disabled" t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1462 :group 'mail-extr)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1463
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1464 (defun mail-extr-voodoo (mbox-beg mbox-end canonicalization-buffer)
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1465 (unless (and mail-extr-disable-voodoo
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1466 (or (not (stringp mail-extr-disable-voodoo))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1467 (progn
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1468 (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1469 (re-search-forward mail-extr-disable-voodoo nil t))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1470 (let ((word-count 0)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1471 (case-fold-search nil)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1472 mixed-case-flag lower-case-flag ;;upper-case-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1473 suffix-flag last-name-comma-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1474 ;;cbeg cend
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1475 initial
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1476 begin-again-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1477 drop-this-word-if-trailing-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1478 drop-last-word-if-trailing-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1479 word-found-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1480 this-word-beg last-word-beg
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1481 name-beg name-end
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1482 name-done-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1483 )
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1484 (save-excursion
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1485 (set-syntax-table mail-extr-address-text-syntax-table)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1486
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1487 ;; Get rid of comments.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1488 (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1489 (while (not (eobp))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1490 ;; Initialize for this iteration of the loop.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1491 (skip-chars-forward "^({[\"'`")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1492 (let ((cbeg (point)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1493 (set-syntax-table mail-extr-address-text-comment-syntax-table)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1494 (if (memq (following-char) '(?\' ?\`))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1495 (search-forward "'" nil 'move
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1496 (if (eq ?\' (following-char)) 2 1))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1497 (or (mail-extr-safe-move-sexp 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1498 (goto-char (point-max))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1499 (set-syntax-table mail-extr-address-text-syntax-table)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1500 (when (eq (char-after cbeg) ?\()
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1501 ;; Delete the comment itself.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1502 (delete-region cbeg (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1503 ;; Canonicalize whitespace where the comment was.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1504 (skip-chars-backward " \t")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1505 (if (looking-at "\\([ \t]+$\\|[ \t]+,\\)")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1506 (replace-match "")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1507 (setq cbeg (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1508 (skip-chars-forward " \t")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1509 (if (bobp)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1510 (delete-region (point) cbeg)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1511 (just-one-space))))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1512
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1513 ;; This was moved above.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1514 ;; Fix . used as space
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1515 ;; But it belongs here because it occurs not only as
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1516 ;; rypens@reks.uia.ac.be (Piet.Rypens)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1517 ;; but also as
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1518 ;; "Piet.Rypens" <rypens@reks.uia.ac.be>
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1519 ;;(goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1520 ;;(while (re-search-forward mail-extr-bad-dot-pattern nil t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1521 ;; (replace-match "\\1 \\2" t))
18816
92913b38a478 (mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents: 16727
diff changeset
1522
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1523 (unless (search-forward " " nil t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1524 (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1525 (cond ((search-forward "_" nil t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1526 ;; Handle the *idiotic* use of underlines as spaces.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1527 ;; Example: fml@foo.bar.dom (First_M._Last)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1528 (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1529 (while (search-forward "_" nil t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1530 (replace-match " " t)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1531 ((search-forward "." nil t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1532 ;; Fix . used as space
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1533 ;; Example: danj1@cb.att.com (daniel.jacobson)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1534 (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1535 (while (re-search-forward mail-extr-bad-dot-pattern nil t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1536 (replace-match "\\1 \\2" t)))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1537
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1538 ;; Loop over the words (and other junk) in the name.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1539 (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1540 (while (not name-done-flag)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1541
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1542 (when word-found-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1543 ;; Last time through this loop we skipped over a word.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1544 (setq last-word-beg this-word-beg)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1545 (setq drop-last-word-if-trailing-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1546 drop-this-word-if-trailing-flag)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1547 (setq word-found-flag nil))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1548
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1549 (when begin-again-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1550 ;; Last time through the loop we found something that
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1551 ;; indicates we should pretend we are beginning again from
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1552 ;; the start.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1553 (setq word-count 0)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1554 (setq last-word-beg nil)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1555 (setq drop-last-word-if-trailing-flag nil)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1556 (setq mixed-case-flag nil)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1557 (setq lower-case-flag nil)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1558 ;; (setq upper-case-flag nil)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1559 (setq begin-again-flag nil))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1560
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1561 ;; Initialize for this iteration of the loop.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1562 (mail-extr-skip-whitespace-forward)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1563 (if (eq word-count 0) (narrow-to-region (point) (point-max)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1564 (setq this-word-beg (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1565 (setq drop-this-word-if-trailing-flag nil)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1566
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1567 ;; Decide what to do based on what we are looking at.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1568 (cond
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1569
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1570 ;; Delete title
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1571 ((and (eq word-count 0)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1572 (looking-at mail-extr-full-name-prefixes))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1573 (goto-char (match-end 0))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1574 (narrow-to-region (point) (point-max)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1575
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1576 ;; Stop after name suffix
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1577 ((and (>= word-count 2)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1578 (looking-at mail-extr-full-name-suffix-pattern))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1579 (mail-extr-skip-whitespace-backward)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1580 (setq suffix-flag (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1581 (if (eq ?, (following-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1582 (forward-char 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1583 (insert ?,))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1584 ;; Enforce at least one space after comma
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1585 (or (eq ?\ (following-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1586 (insert ?\ ))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1587 (mail-extr-skip-whitespace-forward)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1588 (cond ((memq (following-char) '(?j ?J ?s ?S))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1589 (capitalize-word 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1590 (if (eq (following-char) ?.)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1591 (forward-char 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1592 (insert ?.)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1593 (t
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1594 (upcase-word 1)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1595 (setq word-found-flag t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1596 (setq name-done-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1597
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1598 ;; Handle SCA names
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1599 ((looking-at "MKA \\(.+\\)") ; "Mundanely Known As"
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1600 (goto-char (match-beginning 1))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1601 (narrow-to-region (point) (point-max))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1602 (setq begin-again-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1603
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1604 ;; Check for initial last name followed by comma
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1605 ((and (eq ?, (following-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1606 (eq word-count 1))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1607 (forward-char 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1608 (setq last-name-comma-flag t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1609 (or (eq ?\ (following-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1610 (insert ?\ )))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1611
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1612 ;; Stop before trailing comma-separated comment
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1613 ;; THIS CASE MUST BE AFTER THE PRECEDING CASES.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1614 ;; *** This case is redundant???
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1615 ;;((eq ?, (following-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1616 ;; (setq name-done-flag t))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
1617
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1618 ;; Delete parenthesized/quoted comment/nickname
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1619 ((memq (following-char) '(?\( ?\{ ?\[ ?\" ?\' ?\`))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1620 (setq cbeg (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1621 (set-syntax-table mail-extr-address-text-comment-syntax-table)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1622 (cond ((memq (following-char) '(?\' ?\`))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1623 (or (search-forward "'" nil t
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1624 (if (eq ?\' (following-char)) 2 1))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1625 (delete-char 1)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1626 (t
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1627 (or (mail-extr-safe-move-sexp 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1628 (goto-char (point-max)))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1629 (set-syntax-table mail-extr-address-text-syntax-table)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1630 (setq cend (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1631 (cond
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1632 ;; Handle case of entire name being quoted
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1633 ((and (eq word-count 0)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1634 (looking-at " *\\'")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1635 (>= (- cend cbeg) 2))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1636 (narrow-to-region (1+ cbeg) (1- cend))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1637 (goto-char (point-min)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1638 (t
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1639 ;; Handle case of quoted initial
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1640 (if (and (or (= 3 (- cend cbeg))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1641 (and (= 4 (- cend cbeg))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1642 (eq ?. (char-after (+ 2 cbeg)))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1643 (not (looking-at " *\\'")))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1644 (setq initial (char-after (1+ cbeg)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1645 (setq initial nil))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1646 (delete-region cbeg cend)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1647 (if initial
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1648 (insert initial ". ")))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1649
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1650 ;; Handle *Stupid* VMS date stamps
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1651 ((looking-at mail-extr-stupid-vms-date-stamp-pattern)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1652 (replace-match "" t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1653
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1654 ;; Handle Chinese characters.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1655 ((looking-at mail-extr-hz-embedded-gb-encoded-chinese-pattern)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1656 (goto-char (match-end 0))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1657 (setq word-found-flag t))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1658
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1659 ;; Skip initial garbage characters.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1660 ;; THIS CASE MUST BE AFTER THE PRECEDING CASES.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1661 ((and (eq word-count 0)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1662 (looking-at mail-extr-leading-garbage))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1663 (goto-char (match-end 0))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1664 ;; *** Skip backward over these???
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1665 ;; (skip-chars-backward "& \"")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1666 (narrow-to-region (point) (point-max)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1667
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1668 ;; Various stopping points
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1669 ((or
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1670
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1671 ;; Stop before ALL CAPS acronyms, if preceded by mixed-case
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1672 ;; words. Example: XT-DEM.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1673 (and (>= word-count 2)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1674 mixed-case-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1675 (looking-at mail-extr-weird-acronym-pattern)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1676 (not (looking-at mail-extr-roman-numeral-pattern)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1677
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1678 ;; Stop before trailing alternative address
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1679 (looking-at mail-extr-alternative-address-pattern)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1680
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1681 ;; Stop before trailing comment not introduced by comma
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1682 ;; THIS CASE MUST BE AFTER AN EARLIER CASE.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1683 (looking-at mail-extr-trailing-comment-start-pattern)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1684
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1685 ;; Stop before telephone numbers
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1686 (and (>= word-count 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1687 (looking-at mail-extr-telephone-extension-pattern)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1688 (setq name-done-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1689
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1690 ;; Delete ham radio call signs
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1691 ((looking-at mail-extr-ham-call-sign-pattern)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1692 (delete-region (match-beginning 0) (match-end 0)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1693
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1694 ;; Fixup initials
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1695 ((looking-at mail-extr-initial-pattern)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1696 (or (eq (following-char) (upcase (following-char)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1697 (setq lower-case-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1698 (forward-char 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1699 (if (eq ?. (following-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1700 (forward-char 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1701 (insert ?.))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1702 (or (eq ?\ (following-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1703 (insert ?\ ))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1704 (setq word-found-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1705
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1706 ;; Handle BITNET LISTSERV list names.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1707 ((and (eq word-count 0)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1708 (looking-at mail-extr-listserv-list-name-pattern))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1709 (narrow-to-region (match-beginning 1) (match-end 1))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1710 (setq word-found-flag t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1711 (setq name-done-flag t))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
1712
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1713 ;; Handle & substitution, when & is last and is not first.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1714 ((and (> word-count 0)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1715 (eq ?\ (preceding-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1716 (eq (following-char) ?&)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1717 (eq (1+ (point)) (point-max)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1718 (delete-char 1)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1719 (capitalize-region
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1720 (point)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1721 (progn
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1722 (insert-buffer-substring canonicalization-buffer
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1723 mbox-beg mbox-end)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1724 (point)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1725 (setq disable-initial-guessing-flag t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1726 (setq word-found-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1727
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1728 ;; Handle & between names, as in "Bob & Susie".
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1729 ((and (> word-count 0) (eq (following-char) ?\&))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1730 (setq name-beg (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1731 (setq name-end (1+ name-beg))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1732 (setq word-found-flag t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1733 (goto-char name-end))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1734
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1735 ;; Regular name words
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1736 ((looking-at mail-extr-name-pattern)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1737 (setq name-beg (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1738 (setq name-end (match-end 0))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1739
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1740 ;; Certain words will be dropped if they are at the end.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1741 (and (>= word-count 2)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1742 (not lower-case-flag)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1743 (or
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1744 ;; Trailing 4-or-more letter lowercase words preceded by
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1745 ;; mixed case or uppercase words will be dropped.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1746 (looking-at "[[:lower:]]\\{4,\\}[ \t]*\\'")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1747 ;; Drop a trailing word which is terminated with a period.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1748 (eq ?. (char-after (1- name-end))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1749 (setq drop-this-word-if-trailing-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1750
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1751 ;; Set the flags that indicate whether we have seen a lowercase
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1752 ;; word, a mixed case word, and an uppercase word.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1753 (if (re-search-forward "[[:lower:]]" name-end t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1754 (if (progn
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1755 (goto-char name-beg)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1756 (re-search-forward "[[:upper:]]" name-end t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1757 (setq mixed-case-flag t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1758 (setq lower-case-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1759 ;; (setq upper-case-flag t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1760 )
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1761
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1762 (goto-char name-end)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1763 (setq word-found-flag t))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1764
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1765 ;; Allow a number as a word, if it doesn't mean anything else.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1766 ((looking-at "[0-9]+\\>")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1767 (setq name-beg (point))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1768 (setq name-end (match-end 0))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1769 (goto-char name-end)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1770 (setq word-found-flag t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1771
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1772 (t
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1773 (setq name-done-flag t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1774 ))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1775
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1776 ;; Count any word that we skipped over.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1777 (if word-found-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1778 (setq word-count (1+ word-count))))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1779
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1780 ;; If the last thing in the name is 2 or more periods, or one or more
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1781 ;; other sentence terminators (but not a single period) then keep them
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1782 ;; and the preceding word. This is for the benefit of whole sentences
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1783 ;; in the name field: it's better behavior than dropping the last word
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1784 ;; of the sentence...
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1785 (if (and (not suffix-flag)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1786 (looking-at "\\(\\.+\\|[?!;:.][?!;:.]+\\|[?!;:][?!;:.]*\\)\\'"))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1787 (goto-char (setq suffix-flag (point-max))))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
1788
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1789 ;; Drop everything after point and certain trailing words.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1790 (narrow-to-region (point-min)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1791 (or (and drop-last-word-if-trailing-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1792 last-word-beg)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1793 (point)))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
1794
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1795 ;; Xerox's mailers SUCK!!!!!!
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1796 ;; We simply refuse to believe that any last name is PARC or ADOC.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1797 ;; If it looks like that is the last name, that there is no meaningful
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1798 ;; here at all. Actually I guess it would be best to map patterns
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1799 ;; like foo.hoser@xerox.com into foo@hoser.xerox.com, but I don't
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1800 ;; actually know that that is what's going on.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1801 (unless suffix-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1802 (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1803 (let ((case-fold-search t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1804 (if (looking-at "[-A-Za-z_]+[. ]\\(PARC\\|ADOC\\)\\'")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1805 (erase-buffer))))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
1806
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1807 ;; If last name first put it at end (but before suffix)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1808 (when last-name-comma-flag
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1809 (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1810 (search-forward ",")
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1811 (setq name-end (1- (point)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1812 (goto-char (or suffix-flag (point-max)))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1813 (or (eq ?\ (preceding-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1814 (insert ?\ ))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1815 (insert-buffer-substring (current-buffer) (point-min) name-end)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1816 (goto-char name-end)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1817 (skip-chars-forward "\t ,")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1818 (narrow-to-region (point) (point-max)))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
1819
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1820 ;; Delete leading and trailing junk characters.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1821 ;; *** This is probably completely unneeded now.
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1822 ;;(goto-char (point-max))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1823 ;;(skip-chars-backward mail-extr-non-end-name-chars)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1824 ;;(if (eq ?. (following-char))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1825 ;; (forward-char 1))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1826 ;;(narrow-to-region (point)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1827 ;; (progn
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1828 ;; (goto-char (point-min))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1829 ;; (skip-chars-forward mail-extr-non-begin-name-chars)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1830 ;; (point)))
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
1831
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1832 ;; Compress whitespace
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1833 (goto-char (point-min))
56600
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1834 (while (re-search-forward "[ \t\n]+" nil t)
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1835 (replace-match (if (eobp) "" " ") t))
3e6748f33315 (mail-extr-disable-voodoo): New variable.
Kenichi Handa <handa@m17n.org>
parents: 52916
diff changeset
1836 ))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1837
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1838
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1839
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1840 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1841 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1842 ;; Table of top-level domain names.
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1843 ;;
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1844 ;; This is used during address canonicalization; be careful of format changes.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1845 ;; Keep in mind that the country abbreviations follow ISO-3166. There is
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1846 ;; a U.S. FIPS that specifies a different set of two-letter country
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1847 ;; abbreviations.
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1848 ;;
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1849 ;; Updated by the RIPE Network Coordination Centre.
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1850 ;;
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1851 ;; Source: ISO 3166 Maintenance Agency
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1852 ;; http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1-semic.txt
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1853 ;; http://www.iana.org/domain-names.htm
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1854 ;; http://www.iana.org/cctld/cctld-whois.htm
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
1855 ;; Latest change: 2007/11/15
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1856
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1857 (defconst mail-extr-all-top-level-domains
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1858 (let ((ob (make-vector 739 0)))
41300
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1859 (mapc
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1860 (lambda (x)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1861 (put (intern (downcase (car x)) ob)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1862 'domain-name
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1863 (if (nth 2 x)
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1864 (format (nth 2 x) (nth 1 x))
5f6710a130ca Use backquote/dolist/mapc/when. Docstring fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41159
diff changeset
1865 (nth 1 x))))
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1866 '(
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1867 ;; ISO 3166 codes:
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
1868 ("ac" "Ascension Island")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1869 ("ad" "Andorra")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1870 ("ae" "United Arab Emirates")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1871 ("af" "Afghanistan")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1872 ("ag" "Antigua and Barbuda")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1873 ("ai" "Anguilla")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1874 ("al" "Albania")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1875 ("am" "Armenia")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1876 ("an" "Netherlands Antilles")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1877 ("ao" "Angola")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1878 ("aq" "Antarctica") ; continent
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1879 ("ar" "Argentina" "Argentine Republic")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1880 ("as" "American Samoa")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1881 ("at" "Austria" "The Republic of %s")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1882 ("au" "Australia")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1883 ("aw" "Aruba")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
1884 ("ax" "Aland Islands")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1885 ("az" "Azerbaijan")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1886 ("ba" "Bosnia-Herzegovina")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1887 ("bb" "Barbados")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1888 ("bd" "Bangladesh")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1889 ("be" "Belgium" "The Kingdom of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1890 ("bf" "Burkina Faso")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1891 ("bg" "Bulgaria")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1892 ("bh" "Bahrain")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1893 ("bi" "Burundi")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1894 ("bj" "Benin")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
1895 ("bl" "Saint Barthelemy")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1896 ("bm" "Bermuda")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1897 ("bn" "Brunei Darussalam")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1898 ("bo" "Bolivia" "Republic of %s")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1899 ("br" "Brazil" "The Federative Republic of %s")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1900 ("bs" "Bahamas")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1901 ("bt" "Bhutan")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1902 ("bv" "Bouvet Island")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1903 ("bw" "Botswana")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1904 ("by" "Belarus")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1905 ("bz" "Belize")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1906 ("ca" "Canada")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1907 ("cc" "Cocos (Keeling) Islands")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1908 ("cd" "Congo" "The Democratic Republic of the %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1909 ("cf" "Central African Republic")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1910 ("cg" "Congo")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1911 ("ch" "Switzerland" "The Swiss Confederation")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1912 ("ci" "Ivory Coast") ; Cote D'ivoire
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1913 ("ck" "Cook Islands")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1914 ("cl" "Chile" "The Republic of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1915 ("cm" "Cameroon") ; In .fr domain
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1916 ("cn" "China" "The People's Republic of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1917 ("co" "Colombia")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1918 ("cr" "Costa Rica" "The Republic of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1919 ("cu" "Cuba")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1920 ("cv" "Cape Verde")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1921 ("cx" "Christmas Island")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1922 ("cy" "Cyprus")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1923 ("cz" "Czech Republic")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1924 ("de" "Germany")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1925 ("dj" "Djibouti")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1926 ("dk" "Denmark")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1927 ("dm" "Dominica")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1928 ("do" "Dominican Republic" "The %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1929 ("dz" "Algeria")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1930 ("ec" "Ecuador" "The Republic of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1931 ("ee" "Estonia")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1932 ("eg" "Egypt" "The Arab Republic of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1933 ("eh" "Western Sahara")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1934 ("er" "Eritrea")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1935 ("es" "Spain" "The Kingdom of %s")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1936 ("et" "Ethiopia")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
1937 ("eu" "European Union")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1938 ("fi" "Finland" "The Republic of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1939 ("fj" "Fiji")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1940 ("fk" "Falkland Islands (Malvinas)")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1941 ("fm" "Micronesia" "Federated States of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1942 ("fo" "Faroe Islands")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1943 ("fr" "France")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1944 ("ga" "Gabon")
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1945 ("gb" "United Kingdom")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1946 ("gd" "Grenada")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1947 ("ge" "Georgia")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1948 ("gf" "French Guiana")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
1949 ("gg" "Guernsey")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1950 ("gh" "Ghana")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1951 ("gi" "Gibraltar")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1952 ("gl" "Greenland")
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1953 ("gm" "Gambia")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1954 ("gn" "Guinea")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1955 ("gp" "Guadeloupe (Fr.)")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1956 ("gq" "Equatorial Guinea")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1957 ("gr" "Greece" "The Hellenic Republic (%s)")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1958 ("gs" "South Georgia and The South Sandwich Islands")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1959 ("gt" "Guatemala")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1960 ("gu" "Guam (U.S.)")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1961 ("gw" "Guinea-Bissau")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1962 ("gy" "Guyana")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1963 ("hk" "Hong Kong")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1964 ("hm" "Heard Island and Mcdonald Islands")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1965 ("hn" "Honduras")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1966 ("hr" "Croatia" "Croatia (Hrvatska)")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1967 ("ht" "Haiti")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1968 ("hu" "Hungary" "The Hungarian Republic")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1969 ("id" "Indonesia")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1970 ("ie" "Ireland")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1971 ("il" "Israel" "The State of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1972 ("im" "Isle of Man" "The %s") ; NOT in ISO 3166-1 of 2001-02-26
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1973 ("in" "India" "The Republic of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1974 ("io" "British Indian Ocean Territory")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1975 ("iq" "Iraq")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1976 ("ir" "Iran" "Islamic Republic of %s")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1977 ("is" "Iceland" "The Republic of %s")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1978 ("it" "Italy" "The Italian Republic")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
1979 ("je" "Jersey")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1980 ("jm" "Jamaica")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
1981 ("jo" "Jordan")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1982 ("jp" "Japan")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1983 ("ke" "Kenya")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1984 ("kg" "Kyrgyzstan")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1985 ("kh" "Cambodia")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1986 ("ki" "Kiribati")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1987 ("km" "Comoros")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1988 ("kn" "Saint Kitts and Nevis")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1989 ("kp" "Korea (North)" "Democratic People's Republic of Korea")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1990 ("kr" "Korea (South)" "Republic of Korea")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1991 ("kw" "Kuwait")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1992 ("ky" "Cayman Islands")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
1993 ("kz" "Kazakhstan")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1994 ("la" "Lao People's Democratic Republic")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1995 ("lb" "Lebanon")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1996 ("lc" "Saint Lucia")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
1997 ("li" "Liechtenstein")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
1998 ("lk" "Sri Lanka" "The Democratic Socialist Republic of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
1999 ("lr" "Liberia")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2000 ("ls" "Lesotho")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2001 ("lt" "Lithuania")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2002 ("lu" "Luxembourg")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2003 ("lv" "Latvia")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2004 ("ly" "Libyan Arab Jamahiriya")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2005 ("ma" "Morocco")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2006 ("mc" "Monaco")
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2007 ("md" "Moldova" "The Republic of %s")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2008 ("me" "Montenegro")
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2009 ("mf" "Saint Martin (French part)")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2010 ("mg" "Madagascar")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2011 ("mh" "Marshall Islands")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2012 ("mk" "Macedonia" "The Former Yugoslav Republic of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2013 ("ml" "Mali")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2014 ("mm" "Myanmar")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2015 ("mn" "Mongolia")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2016 ("mo" "Macao")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2017 ("mp" "Northern Mariana Islands")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2018 ("mq" "Martinique")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2019 ("mr" "Mauritania")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2020 ("ms" "Montserrat")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2021 ("mt" "Malta")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2022 ("mu" "Mauritius")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2023 ("mv" "Maldives")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2024 ("mw" "Malawi")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2025 ("mx" "Mexico" "The United Mexican States")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2026 ("my" "Malaysia")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2027 ("mz" "Mozambique")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2028 ("na" "Namibia")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2029 ("nc" "New Caledonia (Fr.)")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2030 ("ne" "Niger") ; In .fr domain
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2031 ("nf" "Norfolk Island")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2032 ("ng" "Nigeria")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2033 ("ni" "Nicaragua" "The Republic of %s")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2034 ("nl" "Netherlands" "The Kingdom of the %s")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2035 ("no" "Norway" "The Kingdom of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2036 ("np" "Nepal") ; Via .in domain
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2037 ("nr" "Nauru")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2038 ("nu" "Niue")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2039 ("nz" "New Zealand")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2040 ("om" "Oman")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2041 ("pa" "Panama")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2042 ("pe" "Peru")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2043 ("pf" "French Polynesia")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2044 ("pg" "Papua New Guinea")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2045 ("ph" "Philippines" "The Republic of the %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2046 ("pk" "Pakistan")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2047 ("pl" "Poland")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2048 ("pm" "Saint Pierre and Miquelon")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2049 ("pn" "Pitcairn")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2050 ("pr" "Puerto Rico (U.S.)")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2051 ("ps" "Palestinian Territory, Occupied")
13959
b07ed8bef291 (mail-extr-nuke-outside-range,
Karl Heuer <kwzh@gnu.org>
parents: 11985
diff changeset
2052 ("pt" "Portugal" "The Portuguese Republic")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2053 ("pw" "Palau")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2054 ("py" "Paraguay")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2055 ("qa" "Qatar")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2056 ("re" "Reunion (Fr.)") ; In .fr domain
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2057 ("ro" "Romania")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2058 ("rs" "Serbia")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2059 ("ru" "Russia" "Russian Federation")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2060 ("rw" "Rwanda")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2061 ("sa" "Saudi Arabia")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2062 ("sb" "Solomon Islands")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2063 ("sc" "Seychelles")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2064 ("sd" "Sudan")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2065 ("se" "Sweden" "The Kingdom of %s")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2066 ("sg" "Singapore" "The Republic of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2067 ("sh" "Saint Helena")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2068 ("si" "Slovenia")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2069 ("sj" "Svalbard and Jan Mayen") ; In .no domain
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2070 ("sk" "Slovakia" "The Slovak Republic")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2071 ("sl" "Sierra Leone")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2072 ("sm" "San Marino")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2073 ("sn" "Senegal")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2074 ("so" "Somalia")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2075 ("sr" "Suriname")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2076 ("st" "Sao Tome and Principe")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2077 ("su" "U.S.S.R." "The Union of Soviet Socialist Republics")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2078 ("sv" "El Salvador")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2079 ("sy" "Syrian Arab Republic")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2080 ("sz" "Swaziland")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2081 ("tc" "Turks and Caicos Islands")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2082 ("td" "Chad")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2083 ("tf" "French Southern Territories")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2084 ("tg" "Togo")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2085 ("th" "Thailand" "The Kingdom of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2086 ("tj" "Tajikistan")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2087 ("tk" "Tokelau")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2088 ("tl" "East Timor")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2089 ("tm" "Turkmenistan")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2090 ("tn" "Tunisia")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2091 ("to" "Tonga")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2092 ("tp" "East Timor")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2093 ("tr" "Turkey" "The Republic of %s")
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2094 ("tt" "Trinidad and Tobago")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2095 ("tv" "Tuvalu")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2096 ("tw" "Taiwan" "%s, Province of China")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2097 ("tz" "Tanzania" "United Republic of %s")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2098 ("ua" "Ukraine")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2099 ("ug" "Uganda")
8318
3fc49ff2ea03 (mail-extr-all-top-level-domains): Update a few long names.
Richard M. Stallman <rms@gnu.org>
parents: 7133
diff changeset
2100 ("uk" "United Kingdom" "The %s of Great Britain and Northern Ireland")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2101 ("um" "United States Minor Outlying Islands")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2102 ("us" "United States" "The %s of America")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2103 ("uy" "Uruguay" "The Eastern Republic of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2104 ("uz" "Uzbekistan")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2105 ("va" "Holy See (Vatican City State)")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2106 ("vc" "Saint Vincent and the Grenadines")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2107 ("ve" "Venezuela" "The Republic of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2108 ("vg" "Virgin Islands, British")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2109 ("vi" "Virgin Islands, U.S.")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2110 ("vn" "Vietnam")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2111 ("vu" "Vanuatu")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2112 ("wf" "Wallis and Futuna")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2113 ("ws" "Samoa")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2114 ("ye" "Yemen")
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2115 ("yt" "Mayotte")
20427
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2116 ("yu" "Yugoslavia" "Yugoslavia, AKA Serbia-Montenegro")
1b4f02e638b8 (mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents: 20400
diff changeset
2117 ("za" "South Africa" "The Republic of %s")
38363
413a99578997 (mail-extr-all-top-level-domains): Increase
Gerd Moellmann <gerd@gnu.org>
parents: 37148
diff changeset
2118 ("zm" "Zambia")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2119 ("zw" "Zimbabwe" "Republic of %s")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2120 ;; Generic Domains:
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2121 ("aero" t "Air Transport Industry")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2122 ("asia" t "Pan-Asia and Asia Pacific community")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2123 ("biz" t "Businesses")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2124 ("cat" t "Catalan language and culture")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2125 ("com" t "Commercial")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2126 ("coop" t "Cooperative Associations")
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2127 ("info" t "Info")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2128 ("jobs" t "Employment")
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2129 ("mobi" t "Mobile products")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2130 ("museum" t "Museums")
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2131 ("name" t "Individuals")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2132 ("net" t "Network")
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2133 ("org" t "Non-profit Organization")
79435
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2134 ("pro" t "Credentialed professionals")
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2135 ("tel" t "Contact data")
31904ab276cd (mail-extr-all-top-level-domains): Update domains.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
2136 ("travel" t "Travel industry")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2137 ;;("bitnet" t "Because It's Time NET")
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2138 ("gov" t "United States Government")
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2139 ("edu" t "Educational")
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2140 ("mil" t "United States Military")
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2141 ("int" t "International Treaties")
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2142 ;;("nato" t "North Atlantic Treaty Organization")
8983
522fbe95e651 (mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents: 8356
diff changeset
2143 ("uucp" t "Unix to Unix CoPy")
46273
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2144 ;; Infrastructure Domains:
9854e85b69c8 (mail-extr-all-top-level-domains): Update names.
Simon Josefsson <jas@extundo.com>
parents: 46255
diff changeset
2145 ("arpa" t "Advanced Research Projects Agency (U.S. DoD)")
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2146 ))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2147 ob))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2148
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2149 ;;;###autoload
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2150 (defun what-domain (domain)
8356
bdf40e36b6a9 (what-domain): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8318
diff changeset
2151 "Convert mail domain DOMAIN to the country it corresponds to."
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2152 (interactive
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2153 (let ((completion-ignore-case t))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2154 (list (completing-read "Domain: "
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2155 mail-extr-all-top-level-domains nil t))))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2156 (or (setq domain (intern-soft (downcase domain)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2157 mail-extr-all-top-level-domains))
14029
8812f5ef65db (mail-extr-nuke-outside-range): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents: 13959
diff changeset
2158 (error "No such domain"))
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2159 (message "%s: %s" (upcase (symbol-name domain)) (get domain 'domain-name)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2160
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2161
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2162 ;(let ((all nil))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2163 ; (mapatoms #'(lambda (x)
47939
5f47d61ffbdc Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47615
diff changeset
2164 ; (if (and (boundp x)
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2165 ; (string-match "^mail-extr-" (symbol-name x)))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2166 ; (setq all (cons x all)))))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2167 ; (setq all (sort all #'string-lessp))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2168 ; (cons 'setq
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2169 ; (apply 'nconc (mapcar #'(lambda (x)
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2170 ; (list x (symbol-value x)))
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2171 ; all))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2172
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2173
7060
58d613f69b39 (mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents: 1186
diff changeset
2174 (provide 'mail-extr)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2175
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92148
diff changeset
2176 ;; arch-tag: 7785fade-1073-4ed6-b4f6-28db34a7982d
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2177 ;;; mail-extr.el ends here