Mercurial > emacs
annotate lisp/mail/mail-extr.el @ 37610:44b71631c7a9
*** empty log message ***
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 07 May 2001 17:44:26 +0000 |
parents | aca2b7839d21 |
children | 413a99578997 |
rev | line source |
---|---|
809 | 1 ;;; mail-extr.el --- extract full name and address from RFC 822 mail header. |
2 | |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
809
diff
changeset
|
4 |
809 | 5 ;; Author: Joe Wells <jbw@cs.bu.edu> |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
6 ;; Maintainer: FSF |
809 | 7 ;; Keywords: mail |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
809 | 14 ;; any later version. |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
809 | 25 |
26 ;;; Commentary: | |
27 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
28 ;; 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
|
29 ;; |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
30 ;; mail-extract-address-components: (address &optional all) |
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 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
32 ;; 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
|
33 ;; 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
|
34 ;; If no name can be extracted, FULL-NAME will be nil. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
35 ;; ADDRESS may be a string or a buffer. If it is a buffer, the visible |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
36 ;; (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
|
37 ;; (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
|
38 ;; 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
|
39 ;; 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
|
40 ;; returned. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
41 ;; |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
42 ;; 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
|
43 ;; 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
|
44 ;; the form (FULL-NAME CANONICAL-ADDRESS), one per address. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
45 ;; |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
46 ;; 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
|
47 ;; 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
|
48 ;; |
809 | 49 ;; 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
|
50 ;; |
809 | 51 ;; 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
|
52 ;; any other package we know of. (On the other hand, it will cheerfully |
809 | 53 ;; mangle non-human names/comments.) |
54 ;; 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
|
55 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
56 ;; 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
|
57 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
58 ;; We have an extensive test-case collection of funny addresses if you want to |
809 | 59 ;; 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
|
60 ;; 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
|
61 ;; 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
|
62 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
63 ;; If you find an address that mail-extr fails on, please send it to the |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
64 ;; 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
|
65 ;; not consider it a bug if mail-extr mangles a comment that 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
|
66 ;; correspond to a real human full name, although we would prefer that |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
67 ;; 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
|
68 ;; |
809 | 69 ;; 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
|
70 ;; |
809 | 71 ;; * 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
|
72 ;; |
809 | 73 ;; * knows where full names can be found in an address. |
74 ;; * avoids using empty comments and quoted text. | |
75 ;; * extracts full names from mailbox names. | |
76 ;; * recognizes common formats for comments after a full name. | |
77 ;; * 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
|
78 ;; * 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
|
79 ;; * strips name prefixes like "Prof.", etc. |
809 | 80 ;; * understands what characters can occur in names (not just letters). |
81 ;; * figures out middle initial from mailbox name. | |
82 ;; * removes funny nicknames. | |
83 ;; * keeps suffixes such as Jr., Sr., III, etc. | |
84 ;; * 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
|
85 ;; |
809 | 86 ;; * 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
|
87 ;; |
809 | 88 ;; * parses rfc822 quoted text, comments, and domain literals. |
89 ;; * parses rfc822 multi-line headers. | |
90 ;; * does something reasonable with rfc822 GROUP addresses. | |
91 ;; * handles many rfc822 noncompliant and garbage addresses. | |
92 ;; * canonicalizes addresses (after stripping comments/phrases outside <>). | |
93 ;; * converts ! addresses into .UUCP and %-style addresses. | |
94 ;; * converts rfc822 ROUTE addresses to %-style addresses. | |
95 ;; * truncates %-style addresses at leftmost fully qualified domain name. | |
96 ;; * 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
|
97 ;; |
809 | 98 ;; It does almost no string creation. It primarily uses the built-in |
99 ;; parsing routines with the appropriate syntax tables. This should | |
100 ;; 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
|
101 ;; |
809 | 102 ;; 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
|
103 ;; |
809 | 104 ;; * handle all test cases. (This will take forever.) |
105 ;; * software to pick the correct header to use (eg., "Senders-Name:"). | |
106 ;; * multiple addresses in the "From:" header (almost all of the necessary | |
107 ;; code is there). | |
108 ;; * flag to not treat `,' as an address separator. (This is useful when | |
109 ;; there is a "From:" header but no "Sender:" header, because then there | |
110 ;; is only allowed to be one address.) | |
111 ;; * mailbox name does not necessarily contain full name. | |
112 ;; * fixing capitalization when it's all upper or lowercase. (Hard!) | |
113 ;; * some of the domain literal handling is missing. (But I've never even | |
114 ;; seen one of these in a mail address, so maybe no big deal.) | |
115 ;; * arrange to have syntax tables byte-compiled. | |
116 ;; * speed hacks. | |
117 ;; * delete unused variables. | |
118 ;; * arrange for testing with different relative precedences of ! vs. @ | |
119 ;; and %. | |
120 ;; * insert documentation strings! | |
121 ;; * handle X.400-gatewayed addresses according to RFC 1148. | |
122 | |
123 ;;; Change Log: | |
124 ;; | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
125 ;; 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
|
126 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
127 ;; * 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
|
128 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
129 ;; 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
|
130 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
131 ;; * 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
|
132 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
133 ;; 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
|
134 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
135 ;; * 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
|
136 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
137 ;; 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
|
138 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
139 ;; * 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
|
140 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
141 ;; Tue Mar 23 21:23:18 1993 Joe Wells (jbw at csd.bu.edu) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
142 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
143 ;; * Made mail-full-name-prefixes a user-customizable variable. |
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 passing the address as a buffer as well as as 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
|
145 ;; Allow [ and ] as name characters (Finnish 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
|
146 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
147 ;; Mon Mar 22 21:20:56 1993 Joe Wells (jbw at bigbird.bu.edu) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
148 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
149 ;; * 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
|
150 ;; 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
|
151 ;; 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
|
152 ;; 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
|
153 ;; 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
|
154 ;; Handle more kinds of telephone extension lead-ins. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
155 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
156 ;; Mon Mar 22 20:16:57 1993 Joe Wells (jbw at bigbird.bu.edu) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
157 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
158 ;; * Handle HZ encoding for embedding GB encoded chinese characters. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
159 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
160 ;; Mon Mar 22 00:46:12 1993 Joe Wells (jbw at bigbird.bu.edu) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
161 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
162 ;; * 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
|
163 ;; 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
|
164 ;; 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
|
165 ;; 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
|
166 ;; 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
|
167 ;; 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
|
168 ;; 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
|
169 ;; 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
|
170 ;; certain trailing words are discarded. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
171 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
172 ;; Sun Mar 21 21:41:06 1993 Joe Wells (jbw at bigbird.bu.edu) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
173 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
174 ;; * 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
|
175 ;; 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
|
176 ;; names. Ignore comment field containing mailbox name. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
177 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
178 ;; Sun Mar 21 14:39:38 1993 Joe Wells (jbw at bigbird.bu.edu) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
179 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
180 ;; * 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
|
181 ;; 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
|
182 ;; flag to ignore single-word names. Other changes. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
183 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
184 ;; Mon Feb 1 22:23:31 1993 Joe Wells (jbw at bigbird.bu.edu) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
185 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
186 ;; * 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
|
187 ;; includes the flag mail-extr-guess-middle-initial and the fix for |
7133 | 188 ;; handling multiple addresses correctly. (Whitby just changed |
189 ;; a > to a <.) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
190 ;; |
809 | 191 ;; Mon Apr 6 23:59:09 1992 Joe Wells (jbw at bigbird.bu.edu) |
192 ;; | |
193 ;; * Cleaned up some more. Release version 1.0 to world. | |
194 ;; | |
195 ;; Sun Apr 5 19:39:08 1992 Joe Wells (jbw at bigbird.bu.edu) | |
196 ;; | |
197 ;; * Cleaned up full name extraction extensively. | |
198 ;; | |
199 ;; Sun Feb 2 14:45:24 1992 Joe Wells (jbw at bigbird.bu.edu) | |
200 ;; | |
201 ;; * Total rewrite. Integrated mail-canonicalize-address into | |
202 ;; mail-extract-address-components. Now handles GROUP addresses more | |
203 ;; or less correctly. Better handling of lots of different cases. | |
204 ;; | |
205 ;; Fri Jun 14 19:39:50 1991 | |
206 ;; * Created. | |
207 | |
208 ;;; Code: | |
209 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
210 |
20962 | 211 (defgroup mail-extr nil |
212 "Extract full name and address from RFC 822 mail header." | |
213 :prefix "mail-extr-" | |
214 :group 'mail) | |
215 | |
7060
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 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
218 ;; 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
|
219 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
220 |
20962 | 221 (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
|
222 "*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
|
223 If true, then when we see an address like \"John Smith <jqs@host.com>\" |
20962 | 224 we will assume that \"John Q. Smith\" is the fellow's name." |
225 :type 'boolean | |
226 :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
|
227 |
20962 | 228 (defcustom mail-extr-ignore-single-names 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
|
229 "*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
|
230 If true, then when we see an address like \"Idiot <dumb@stupid.com>\" |
20962 | 231 we will act as though we couldn't find a full name in the address." |
232 :type 'boolean | |
233 :group 'mail-extr) | |
809 | 234 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
235 ;; 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
|
236 ;; contribute to uniquely identifying the person). |
20962 | 237 (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
|
238 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
239 "\\(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
|
240 "*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
|
241 These are stripped from the full name because they do not contribute to |
20962 | 242 uniquely identifying the person." |
243 :type 'regexp | |
244 :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
|
245 |
20962 | 246 (defcustom mail-extr-@-binds-tighter-than-! nil |
247 "*Whether the local mail transport agent looks at ! before @." | |
248 :type 'boolean | |
249 :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
|
250 |
20962 | 251 (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
|
252 "*Whether to throw away information in UUCP addresses |
20962 | 253 by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"." |
254 :type 'boolean | |
255 :group 'mail-extr) | |
809 | 256 |
257 ;;---------------------------------------------------------------------- | |
258 ;; what orderings are meaningful????? | |
259 ;;(defvar mail-operator-precedence-list '(?! ?% ?@)) | |
260 ;; Right operand of a % or a @ must be a domain name, period. No other | |
261 ;; operators allowed. Left operand of a @ is an address relative to that | |
262 ;; site. | |
263 | |
264 ;; Left operand of a ! must be a domain name. Right operand is an | |
265 ;; arbitrary address. | |
266 ;;---------------------------------------------------------------------- | |
267 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
268 |
809 | 269 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
270 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
271 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
272 ;; 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
|
273 ;; |
809 | 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 ;; Codes in |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
276 ;; Names in ISO 8859-1 Name |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
277 ;; ISO 10XXX ISO 8859-2 in |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
278 ;; ISO 6937 ISO 10646 RFC Swedish |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
279 ;; etc. Hex Oct 1345 TeX Split ASCII Description |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
280 ;; --------- ---------- ---- --- ----- ----- ------------------------------- |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
281 ;; %a E4 344 a: \"a ae { latin small a + diaeresis d |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
282 ;; %o F6 366 o: \"o oe | latin small o + diaeresis v |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
283 ;; @a E5 345 aa \oa aa } latin small a + ring above e |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
284 ;; %u FC 374 u: \"u ue ~ latin small u + diaeresis | |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
285 ;; /e E9 351 e' \'e ` latin small e + acute i |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
286 ;; %A C4 304 A: \"A AE [ latin capital a + diaeresis D |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
287 ;; %O D6 326 O: \"O OE \ latin capital o + diaeresis V |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
288 ;; @A C5 305 AA \oA AA ] latin capital a + ring above E |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
289 ;; %U DC 334 U: \"U UE ^ latin capital u + diaeresis \ |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
290 ;; /E C9 311 E' \'E @ latin capital e + acute I |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
291 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
292 ;; NOTE: @a and @A are not in ISO 8859-2 (the codes mentioned above invoke |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
293 ;; /l and /L). Some of this data was retrieved from |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
294 ;; listserv@jhuvm.hcf.jhu.edu. |
809 | 295 |
296 ;; 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
|
297 ;; 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
|
298 ;; 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
|
299 ;; 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
|
300 ;; 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
|
301 (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
|
302 (purecopy "][[:alnum:]{|}'~`")) |
809 | 303 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
304 ;; 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
|
305 ;; 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
|
306 ;; #### 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
|
307 (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
|
308 (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
|
309 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
310 ;; 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
|
311 ;; 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
|
312 (defconst mail-extr-first-letters (purecopy "[:alpha:]")) |
809 | 313 |
314 ;; 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
|
315 ;; 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
|
316 (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
|
317 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
318 (defconst mail-extr-leading-garbage |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
319 (purecopy (format "[^%s]+" 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
|
320 |
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-non-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
|
322 ;; (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
|
323 ;; (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
|
324 ;; (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
|
325 ;; (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
|
326 ;; (purecopy (concat "^" mail-extr-last-letters))) |
809 | 327 |
328 ;; 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
|
329 ;; (defconst mail-extr-bad-initials-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]\\|\\`\\)[%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
|
332 ;; mail-extr-all-letters mail-extr-first-letters mail-extr-all-letters))) |
809 | 333 |
334 ;; Matches periods used instead of spaces. Must not match the period | |
335 ;; 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
|
336 (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
|
337 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
338 (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
|
339 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
|
340 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
|
341 mail-extr-first-letters))) |
809 | 342 |
343 ;; 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
|
344 ;; (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
|
345 ;; (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
346 ;; (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
|
347 ;; mail-extr-all-letters))) |
809 | 348 |
349 ;; 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
|
350 ;; 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
|
351 ;; 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
|
352 ;; *** 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
|
353 ;; *** 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
|
354 (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
|
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 "\\(,? ?\\([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
|
358 mail-extr-all-letters mail-extr-all-letters))) |
809 | 359 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
360 (defconst mail-extr-roman-numeral-pattern (purecopy "V?I+V?\\b")) |
809 | 361 |
362 ;; Matches a trailing uppercase (with other characters possible) acronym. | |
363 ;; 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
|
364 (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
|
365 (purecopy "\\([A-Z]+[-_/]\\|[A-Z][A-Z][A-Z]?\\b\\)")) |
809 | 366 |
367 ;; 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
|
368 ;; #### 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
|
369 ;; (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
|
370 ;; (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
371 ;; (format |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
372 ;; "\\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
|
373 ;; 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
|
374 ;; 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
|
375 ;; mail-extr-last-letters mail-extr-first-letters mail-extr-all-letters))) |
809 | 376 |
377 ;; 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
|
378 ;; #### Match Latin1 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
|
379 ;; #### Match _ before @ 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
|
380 (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
|
381 (purecopy "\\(aka *\\)?[a-zA-Z.]+[!@][a-zA-Z.]")) |
809 | 382 |
383 ;; Matches a variety of trailing comments not including comma-delimited | |
384 ;; 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
|
385 (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
|
386 (purecopy " [-{]\\|--\\|[+@#></\;]")) |
809 | 387 |
388 ;; Matches a name (not an initial). | |
389 ;; This doesn't force a word boundary at the end because sometimes a | |
390 ;; 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
|
391 (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
|
392 (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
|
393 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
|
394 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
|
395 mail-extr-last-letters))) |
809 | 396 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
397 (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
|
398 (purecopy (format "\\b[%s]\\([. ]\\|\\b\\)" mail-extr-first-letters))) |
809 | 399 |
400 ;; 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
|
401 ;; (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
|
402 ;; (purecopy (concat "\\`" mail-extr-name-pattern ","))) |
809 | 403 |
404 ;; 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
|
405 (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
|
406 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
407 "\\(\\([Ee]xt\\|\\|[Tt]ph\\|[Tt]el\\|[Xx]\\).?\\)? *\\+?[0-9][- 0-9]+")) |
809 | 408 |
409 ;; 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
|
410 ;; 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
|
411 ;; <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
|
412 ;; 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
|
413 ;; 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
|
414 ;; 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
|
415 (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
|
416 (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
|
417 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
418 ;; 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
|
419 ;; /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
|
420 ;; /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
|
421 ;; /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
|
422 ;; /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
|
423 ;; /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
|
424 ;; /# == 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
|
425 ;; 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
|
426 ;; anyone putting them with their name in an e-mail address. |
809 | 427 |
428 ;; 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
|
429 (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
|
430 (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
|
431 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
|
432 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
|
433 mail-extr-last-letters))) |
809 | 434 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
435 ;; 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
|
436 ;; (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
|
437 ;; (purecopy (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
|
438 |
809 | 439 ;; 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
|
440 ;; 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
|
441 ;; 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
|
442 ;; 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
|
443 (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
|
444 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
445 (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
|
446 "\\|" 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
|
447 "\\) +\\(" 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
|
448 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
449 (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
|
450 (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
|
451 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
452 (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
|
453 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
454 "[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
|
455 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
456 ;;; 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
|
457 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
458 ;; 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
|
459 ;; 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
|
460 ;; 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
|
461 ;; following special meaning. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
462 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
463 ;; 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
|
464 ;; 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
|
465 ;; 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
|
466 ;; with no output produced. |
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 ;; 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
|
469 ;; 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
|
470 ;; 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
|
471 ;; ($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
|
472 (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
|
473 (purecopy "~{\\([^~].\\|~[^\}]\\)+~}")) |
809 | 474 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
475 ;; 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
|
476 ;; 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
|
477 (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
|
478 (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
|
479 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
480 (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
|
481 (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
|
482 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
483 (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
|
484 ;; 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
|
485 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
486 (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
|
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 (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
|
489 ;; 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
|
490 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
491 (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
|
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 (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
|
494 ;; 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
|
495 ;; 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
|
496 ;; "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
|
497 ;; `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
|
498 ;; 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
|
499 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
500 (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
|
501 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
502 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
503 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
504 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
505 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
506 ;; 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
|
507 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
508 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
509 (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
|
510 (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
|
511 (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
|
512 (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
|
513 (defconst mail-extr-address-text-syntax-table (make-syntax-table)) |
809 | 514 (mapcar |
515 (function | |
516 (lambda (pair) | |
517 (let ((syntax-table (symbol-value (car pair)))) | |
518 (mapcar | |
519 (function | |
520 (lambda (item) | |
521 (if (eq 2 (length item)) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
522 ;; modifying syntax of a single character |
809 | 523 (modify-syntax-entry (car item) (car (cdr item)) 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
|
524 ;; modifying syntax of a range of characters |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
525 (let ((char (nth 0 item)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
526 (bound (nth 1 item)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
527 (syntax (nth 2 item))) |
809 | 528 (while (<= char bound) |
529 (modify-syntax-entry char syntax syntax-table) | |
530 (setq char (1+ char))))))) | |
531 (cdr pair))))) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
532 '((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
|
533 (?\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
|
534 (?\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
|
535 (?! ?~ "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
|
536 (?\177 "w") ;DEL |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
537 (?\200 ?\377 "w") ;high-bit-on characters |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
538 (?\240 " ") ;nobreakspace |
809 | 539 (?\t " ") |
540 (?\r " ") | |
541 (?\n " ") | |
542 (?\( ".") | |
543 (?\) ".") | |
544 (?< ".") | |
545 (?> ".") | |
546 (?@ ".") | |
547 (?, ".") | |
548 (?\; ".") | |
549 (?: ".") | |
550 (?\\ "\\") | |
551 (?\" "\"") | |
552 (?. ".") | |
553 (?\[ ".") | |
554 (?\] ".") | |
555 ;; % and ! aren't RFC822 characters, but it is convenient to pretend | |
556 (?% ".") | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
557 (?! ".") ;; this needs to be word-constituent when not in .UUCP mode |
809 | 558 ) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
559 (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
|
560 (?\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
|
561 (?\040 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
562 (?\240 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
563 (?\t " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
564 (?\r " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
565 (?\n " ") |
809 | 566 (?\( "\(\)") |
567 (?\) "\)\(") | |
568 (?\\ "\\")) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
569 (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
|
570 (?\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
|
571 (?\040 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
572 (?\240 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
573 (?\t " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
574 (?\r " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
575 (?\n " ") |
809 | 576 (?\[ "\(\]") ;?????? |
577 (?\] "\)\[") ;?????? | |
578 (?\\ "\\")) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
579 (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
|
580 (?\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
|
581 (?\040 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
582 (?\240 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
583 (?\t " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
584 (?\r " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
585 (?\n " ") |
809 | 586 (?\( "\(\)") |
587 (?\) "\)\(") | |
588 (?\[ "\(\]") | |
589 (?\] "\)\[") | |
590 (?\{ "\(\}") | |
591 (?\} "\)\{") | |
592 (?\\ "\\") | |
593 (?\" "\"") | |
594 ;; (?\' "\)\`") | |
595 ;; (?\` "\(\'") | |
596 ) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
597 (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
|
598 (?\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
|
599 (?\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
|
600 (?\040 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
601 (?\t " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
602 (?\r " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
603 (?\n " ") |
809 | 604 (?A ?Z "w") |
605 (?a ?z "w") | |
606 (?- "w") | |
607 (?\} "w") | |
608 (?\{ "w") | |
609 (?| "w") | |
610 (?\' "w") | |
611 (?~ "w") | |
612 (?0 ?9 "w")) | |
613 )) | |
614 | |
615 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
616 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
617 ;; |
809 | 618 ;; 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
|
619 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
620 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
621 (defsubst mail-extr-delete-char (n) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
622 ;; in v19, delete-char is compiled as a function call, but delete-region |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
623 ;; is byte-coded, so it's much much faster. |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
624 (delete-region (point) (+ (point) n))) |
809 | 625 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
626 (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
|
627 ;; v19 fn skip-syntax-forward is more tasteful, but not byte-coded. |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
628 (skip-chars-forward " \t\n\r\240")) |
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 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
630 (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
|
631 ;; v19 fn skip-syntax-backward is more tasteful, but not byte-coded. |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
632 (skip-chars-backward " \t\n\r\240")) |
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 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
634 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
635 (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
|
636 (save-excursion |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
637 (save-restriction |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
638 (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
|
639 (goto-char (point-min)) |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
640 ;; undo \ quoting |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
641 (while (search-forward "\\" nil t) |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
642 (mail-extr-delete-char -1) |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
643 (or (eobp) |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
644 (forward-char 1)))))) |
809 | 645 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
646 (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
|
647 (save-excursion |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
648 (goto-char pos) |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
649 (mail-extr-delete-char 1) |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
650 (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
|
651 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
652 (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
|
653 'edebug-form-spec '(symbolp &optional form form atom)) |
809 | 654 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
655 (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
|
656 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
|
657 &optional no-replace) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
658 ;; LIST-SYMBOL names a variable holding a list of buffer positions |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
659 ;; BEG-SYMBOL and END-SYMBOL name variables delimiting a range |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
660 ;; Each element of LIST-SYMBOL which lies outside of the range is |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
661 ;; deleted from the list. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
662 ;; Unless NO-REPLACE is true, at each of the positions in 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
|
663 ;; which lie outside of the range, one character at that position is |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
664 ;; replaced with a SPC. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
665 (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
|
666 (error "no-replace must be t or nil, evaluable at macroexpand-time")) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
667 (` (let ((temp (, 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
|
668 ch) |
809 | 669 (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
|
670 (setq ch (car temp)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
671 (cond ((or (> ch (, 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
|
672 (< ch (, beg-symbol))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
673 (,@ (if no-replace |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
674 nil |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
675 (` ((mail-extr-nuke-char-at ch))))) |
809 | 676 (setcar temp nil))) |
677 (setq temp (cdr temp))) | |
678 (setq (, list-symbol) (delq nil (, list-symbol)))))) | |
679 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
680 (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
|
681 ;; 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
|
682 ;; 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
|
683 (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
|
684 (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
|
685 (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
|
686 temp) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
687 marker)) |
809 | 688 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
689 (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
|
690 ;; 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
|
691 (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
|
692 pos |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
693 (copy-marker pos))) |
809 | 694 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
695 (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
|
696 ;; 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
|
697 (condition-case error |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
698 (progn |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
699 (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
|
700 t) |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
701 (error |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
702 ;; #### 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
|
703 (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
|
704 nil |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
705 (while t |
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
706 (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
|
707 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
708 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
709 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
710 ;; 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
|
711 ;; |
809 | 712 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
713 (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
|
714 (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
|
715 (defvar cend) ; dynamic assignment |
809 | 716 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
717 ;;;###autoload |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
718 (defun mail-extract-address-components (address &optional all) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
719 "Given an RFC-822 address ADDRESS, extract full name and canonical 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
|
720 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
|
721 If no name can be extracted, FULL-NAME will be nil. |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
722 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
723 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
|
724 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
|
725 the form ((FULL-NAME CANONICAL-ADDRESS) ...) with one element for |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
726 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
|
727 one recipients, all but the first is ignored. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
728 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
729 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
|
730 (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
|
731 (This feature exists so that the clever caller might be able to avoid |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
732 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
|
733 (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
|
734 (extraction-buffer (get-buffer-create " *extract address components*")) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
735 value-list) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
736 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
737 (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
|
738 (fundamental-mode) |
923 | 739 (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
|
740 (set-syntax-table mail-extr-address-syntax-table) |
809 | 741 (widen) |
742 (erase-buffer) | |
743 (setq case-fold-search nil) | |
744 | |
745 ;; Insert extra space at beginning to allow later replacement with < | |
746 ;; 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
|
747 (insert ?\ ) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
748 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
749 ;; 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
|
750 (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
|
751 (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
|
752 ((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
|
753 (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
|
754 (t |
14029
8812f5ef65db
(mail-extr-nuke-outside-range): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
13959
diff
changeset
|
755 (error "Invalid address: %s" address))) |
16727
45d9891b03b2
(mail-extract-address-components): Clear text props
Richard M. Stallman <rms@gnu.org>
parents:
16699
diff
changeset
|
756 |
45d9891b03b2
(mail-extract-address-components): Clear text props
Richard M. Stallman <rms@gnu.org>
parents:
16699
diff
changeset
|
757 (set-text-properties (point-min) (point-max) nil) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
758 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
759 (with-current-buffer (get-buffer-create canonicalization-buffer) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
760 (fundamental-mode) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
761 (buffer-disable-undo canonicalization-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
762 (setq case-fold-search nil)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
763 |
809 | 764 |
765 ;; Unfold multiple lines. | |
766 (goto-char (point-min)) | |
767 (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t) | |
768 (replace-match "\\1 " t)) | |
769 | |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
770 ;; 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
|
771 (while (and (or all (null value-list)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
772 (progn (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
773 (skip-chars-forward " \t") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
774 (not (eobp)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
775 (let (char |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
776 end-of-address |
21477
a61dfbd23534
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20962
diff
changeset
|
777 <-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
|
778 group-:-pos group-\;-pos route-addr-:-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
779 record-pos-symbol |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
780 first-real-pos last-real-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
781 phrase-beg phrase-end |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
782 cbeg cend ; dynamically set from -voodoo |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
783 quote-beg quote-end |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
784 atom-beg atom-end |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
785 mbox-beg mbox-end |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
786 \.-ends-name |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
787 temp |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
788 ;; name-suffix |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
789 fi mi li ; first, middle, last initial |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
790 saved-%-pos saved-!-pos saved-@-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
791 domain-pos \.-pos insert-point |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
792 ;; mailbox-name-processed-flag |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
793 disable-initial-guessing-flag) ; dynamically set from -voodoo |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
794 |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
795 (set-syntax-table mail-extr-address-syntax-table) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
796 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
797 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
798 ;; Insert extra space at beginning to allow later replacement with < |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
799 ;; without having to move markers. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
800 (or (eq (following-char) ?\ ) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
801 (insert ?\ )) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
802 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
803 ;; First pass grabs useful information about address. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
804 (while (progn |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
805 (mail-extr-skip-whitespace-forward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
806 (not (eobp))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
807 (setq char (char-after (point))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
808 (or first-real-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
809 (if (not (eq char ?\()) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
810 (setq first-real-pos (point)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
811 (cond |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
812 ;; comment |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
813 ((eq char ?\() |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
814 (set-syntax-table mail-extr-address-comment-syntax-table) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
815 ;; only record the first non-empty comment's position |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
816 (if (and (not cbeg) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
817 (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
818 (forward-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
819 (mail-extr-skip-whitespace-forward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
820 (not (eq ?\) (char-after (point)))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
821 (setq cbeg (point))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
822 ;; TODO: don't record if unbalanced |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
823 (or (mail-extr-safe-move-sexp 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
824 (forward-char 1)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
825 (set-syntax-table mail-extr-address-syntax-table) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
826 (if (and cbeg |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
827 (not cend)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
828 (setq cend (point)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
829 ;; quoted text |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
830 ((eq char ?\") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
831 ;; only record the first non-empty quote's position |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
832 (if (and (not quote-beg) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
833 (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
834 (forward-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
835 (mail-extr-skip-whitespace-forward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
836 (not (eq ?\" (char-after (point)))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
837 (setq quote-beg (point))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
838 ;; TODO: don't record if unbalanced |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
839 (or (mail-extr-safe-move-sexp 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
840 (forward-char 1)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
841 (if (and quote-beg |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
842 (not quote-end)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
843 (setq quote-end (point)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
844 ;; domain literals |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
845 ((eq char ?\[) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
846 (set-syntax-table mail-extr-address-domain-literal-syntax-table) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
847 (or (mail-extr-safe-move-sexp 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
848 (forward-char 1)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
849 (set-syntax-table mail-extr-address-syntax-table)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
850 ;; commas delimit addresses when outside < > pairs. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
851 ((and (eq char ?,) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
852 (or (and (null <-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
853 ;; Handle ROUTE-ADDR address that is missing its <. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
854 (not (eq ?@ (char-after (1+ (point)))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
855 (and >-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
856 ;; handle weird munged addresses |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
857 ;; BUG FIX: This test was reversed. Thanks to the |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
858 ;; brilliant Rod Whitby <rwhitby@research.canon.oz.au> |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
859 ;; for discovering this! |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
860 (< (car (last <-pos)) (car >-pos))))) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
861 ;; The argument contains more than one address. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
862 ;; 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
|
863 (setq end-of-address (copy-marker (1+ (point)) t)) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
864 (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
|
865 (delete-char 1) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
866 (setq char ?\() ; HAVE I NO SHAME?? |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
867 ) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
868 ;; record the position of various interesting chars, determine |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
869 ;; legality later. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
870 ((setq record-pos-symbol |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
871 (cdr (assq char |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
872 '((?< . <-pos) (?> . >-pos) (?@ . @-pos) |
21477
a61dfbd23534
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20962
diff
changeset
|
873 (?: . colon-pos) (?, . comma-pos) (?! . !-pos) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
874 (?% . %-pos) (?\; . \;-pos))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
875 (set record-pos-symbol |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
876 (cons (point) (symbol-value record-pos-symbol))) |
809 | 877 (forward-char 1)) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
878 ((eq char ?.) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
879 (forward-char 1)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
880 ((memq char '( |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
881 ;; comment terminator illegal |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
882 ?\) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
883 ;; domain literal terminator illegal |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
884 ?\] |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
885 ;; \ allowed only within quoted strings, |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
886 ;; domain literals, and comments |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
887 ?\\ |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
888 )) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
889 (mail-extr-nuke-char-at (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
890 (forward-char 1)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
891 (t |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
892 (forward-word 1))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
893 (or (eq char ?\() |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
894 ;; 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
|
895 (and (eq char ?,) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
896 (eobp)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
897 (setq last-real-pos (point)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
898 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
899 ;; 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
|
900 (while (cdr <-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
901 (mail-extr-nuke-char-at (car <-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
902 (setq <-pos (cdr <-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
903 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
904 ;; 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
|
905 (while (cdr >-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
906 (mail-extr-nuke-char-at (nth 1 >-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
907 (setcdr >-pos (nthcdr 2 >-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
908 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
909 ;; 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
|
910 ;; 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
|
911 ;; This commonly happens on the UUCP "From " line. Ugh. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
912 (cond ((and (> (length @-pos) 1) |
21477
a61dfbd23534
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20962
diff
changeset
|
913 (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
|
914 (not \;-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
915 (not <-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
916 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
917 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
918 (setq <-pos (list (point))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
919 (insert ?<))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
920 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
921 ;; If < but no >, insert > in rightmost possible position |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
922 (cond ((and <-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
923 (null >-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
924 (goto-char (point-max)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
925 (setq >-pos (list (point))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
926 (insert ?>))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
927 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
928 ;; If > but no <, replace > with space. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
929 (cond ((and >-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
930 (null <-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
931 (mail-extr-nuke-char-at (car >-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
932 (setq >-pos nil))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
933 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
934 ;; Turn >-pos and <-pos into non-lists |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
935 (setq >-pos (car >-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
936 <-pos (car <-pos)) |
809 | 937 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
938 ;; Trim other punctuation lists of items outside < > pair to handle |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
939 ;; stupid MTAs. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
940 (cond (<-pos ; don't need to check >-pos also |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
941 ;; handle bozo software that violates RFC 822 by sticking |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
942 ;; punctuation marks outside of a < > pair |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
943 (mail-extr-nuke-outside-range @-pos <-pos >-pos t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
944 ;; RFC 822 says nothing about these two outside < >, but |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
945 ;; remove those positions from the lists to make things |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
946 ;; easier. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
947 (mail-extr-nuke-outside-range !-pos <-pos >-pos t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
948 (mail-extr-nuke-outside-range %-pos <-pos >-pos t))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
949 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
950 ;; Check for : that indicates GROUP list and for : part of |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
951 ;; ROUTE-ADDR spec. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
952 ;; 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
|
953 (while colon-pos |
a61dfbd23534
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20962
diff
changeset
|
954 (setq temp (car colon-pos) |
a61dfbd23534
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20962
diff
changeset
|
955 colon-pos (cdr colon-pos)) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
956 (cond ((and <-pos >-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 (< temp >-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
959 (if (or route-addr-:-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
960 (< (length @-pos) 2) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
961 (> temp (car @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
962 (< temp (nth 1 @-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
963 (mail-extr-nuke-char-at temp) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
964 (setq route-addr-:-pos temp))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
965 ((or (not <-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
966 (and <-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 (setq group-:-pos temp)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
969 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
970 ;; 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
|
971 ;; of a GROUP starting :. Also, there may only be one ;. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
972 (while \;-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
973 (setq temp (car \;-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
974 \;-pos (cdr \;-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
975 (cond ((and <-pos >-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
976 (> temp <-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
977 (< temp >-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
978 (mail-extr-nuke-char-at temp)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
979 ((and (or (not group-:-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
980 (> temp group-:-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
981 (not group-\;-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
982 (setq group-\;-pos temp)))) |
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 ;; Nuke unmatched GROUP syntax characters. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
985 (cond ((and group-:-pos (not group-\;-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
986 ;; *** Do I really need to erase it? |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
987 (mail-extr-nuke-char-at group-:-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
988 (setq group-:-pos nil))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
989 (cond ((and group-\;-pos (not group-:-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
990 ;; *** Do I really need to erase it? |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
991 (mail-extr-nuke-char-at group-\;-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
992 (setq group-\;-pos nil))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
993 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
994 ;; Handle junk like ";@host.company.dom" that sendmail adds. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
995 ;; **** should I remember comment positions? |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
996 (cond |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
997 (group-\;-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
998 ;; this is fine for now |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
999 (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
|
1000 (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
|
1001 (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
|
1002 (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
|
1003 (and last-real-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1004 (> last-real-pos (1+ group-\;-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1005 (setq last-real-pos (1+ group-\;-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1006 ;; *** This may be wrong: |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1007 (and cend |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1008 (> cend group-\;-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1009 (setq cend nil |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1010 cbeg nil)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1011 (and quote-end |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1012 (> quote-end group-\;-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1013 (setq quote-end nil |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1014 quote-beg nil)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1015 ;; This was both wrong and unnecessary: |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1016 ;;(narrow-to-region (point-min) group-\;-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1017 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1018 ;; *** The entire handling of GROUP addresses seems rather lame. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1019 ;; *** It deserves a complete rethink, except that these addresses |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1020 ;; *** are hardly ever seen. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1021 )) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1022 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1023 ;; 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
|
1024 ;; others. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1025 ;; Hell, go ahead an nuke all of the commas. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1026 ;; **** This will cause problems when we start handling commas in |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1027 ;; the PHRASE part .... no it won't ... yes it will ... ????? |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1028 (mail-extr-nuke-outside-range comma-pos 1 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1029 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1030 ;; 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
|
1031 ;; 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
|
1032 ;; handled above. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1033 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1034 ;; Locate PHRASE part of ROUTE-ADDR. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1035 (cond (<-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1036 (goto-char <-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1037 (mail-extr-skip-whitespace-backward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1038 (setq phrase-end (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1039 (goto-char (or ;;group-:-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1040 (point-min))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1041 (mail-extr-skip-whitespace-forward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1042 (if (< (point) phrase-end) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1043 (setq phrase-beg (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1044 (setq phrase-end nil)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1045 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1046 ;; handle ROUTE-ADDRS with real ROUTEs. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1047 ;; 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
|
1048 ;; any % or ! must be semantically meaningless. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1049 ;; TODO: do this processing into canonicalization buffer |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1050 (cond (route-addr-:-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1051 (setq !-pos nil |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1052 %-pos nil |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1053 >-pos (copy-marker >-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1054 route-addr-:-pos (copy-marker route-addr-:-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1055 (goto-char >-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1056 (insert-before-markers ?X) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1057 (goto-char (car @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1058 (while (setq @-pos (cdr @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1059 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1060 (setq %-pos (cons (point-marker) %-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1061 (insert "%") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1062 (goto-char (1- >-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1063 (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1064 (insert-buffer-substring extraction-buffer |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1065 (car @-pos) route-addr-:-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1066 (delete-region (car @-pos) route-addr-:-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1067 (or (cdr @-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1068 (setq saved-@-pos (list (point))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1069 (setq @-pos saved-@-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1070 (goto-char >-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1071 (mail-extr-delete-char -1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1072 (mail-extr-nuke-char-at route-addr-:-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1073 (mail-extr-demarkerize route-addr-:-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1074 (setq route-addr-:-pos nil |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1075 >-pos (mail-extr-demarkerize >-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1076 %-pos (mapcar 'mail-extr-demarkerize %-pos)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1077 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1078 ;; de-listify @-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1079 (setq @-pos (car @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1080 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1081 ;; TODO: remove comments in the middle of an address |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1082 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1083 (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1084 (set-buffer canonicalization-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1085 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1086 (widen) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1087 (erase-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1088 (insert-buffer-substring extraction-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1089 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1090 (if <-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1091 (narrow-to-region (progn |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1092 (goto-char (1+ <-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1093 (mail-extr-skip-whitespace-forward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1094 (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1095 >-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1096 (if (and first-real-pos last-real-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1097 (narrow-to-region first-real-pos last-real-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1098 ;; ****** Oh no! What if the address is completely empty! |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1099 ;; *** Is this correct? |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1100 (narrow-to-region (point-max) (point-max)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1101 )) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1102 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1103 (and @-pos %-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1104 (mail-extr-nuke-outside-range %-pos (point-min) @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1105 (and %-pos !-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1106 (mail-extr-nuke-outside-range !-pos (point-min) (car %-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1107 (and @-pos !-pos (not %-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1108 (mail-extr-nuke-outside-range !-pos (point-min) @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1109 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1110 ;; Error condition:?? (and %-pos (not @-pos)) |
809 | 1111 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1112 ;; WARNING: THIS CODE IS DUPLICATED BELOW. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1113 (cond ((and %-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1114 (not @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1115 (goto-char (car %-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1116 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1117 (setq @-pos (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1118 (insert "@") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1119 (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
|
1120 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1121 (if mail-extr-mangle-uucp |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1122 (cond (!-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1123 ;; **** I don't understand this save-restriction and the |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1124 ;; narrow-to-region inside it. Why did I do that? |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1125 (save-restriction |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1126 (cond ((and @-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1127 mail-extr-@-binds-tighter-than-!) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1128 (goto-char @-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1129 (setq %-pos (cons (point) %-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1130 @-pos nil) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1131 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1132 (insert "%") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1133 (setq insert-point (point-max))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1134 (mail-extr-@-binds-tighter-than-! |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1135 (setq insert-point (point-max))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1136 (%-pos |
37148
aca2b7839d21
(mail-extr-delete-char, mail-extr-safe-move-sexp)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25439
diff
changeset
|
1137 (setq insert-point (car (last %-pos)) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1138 saved-%-pos (mapcar 'mail-extr-markerize %-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1139 %-pos nil |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1140 @-pos (mail-extr-markerize @-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1141 (@-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1142 (setq insert-point @-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1143 (setq @-pos (mail-extr-markerize @-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1144 (t |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1145 (setq insert-point (point-max)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1146 (narrow-to-region (point-min) insert-point) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1147 (setq saved-!-pos (car !-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1148 (while !-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1149 (goto-char (point-max)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1150 (cond ((and (not @-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1151 (not (cdr !-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1152 (setq @-pos (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1153 (insert-before-markers "@ ")) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1154 (t |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1155 (setq %-pos (cons (point) %-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1156 (insert-before-markers "% "))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1157 (backward-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1158 (insert-buffer-substring |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1159 (current-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1160 (if (nth 1 !-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1161 (1+ (nth 1 !-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1162 (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1163 (car !-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1164 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1165 (or (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1166 (mail-extr-safe-move-sexp -1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1167 (mail-extr-skip-whitespace-backward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1168 (eq ?. (preceding-char))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1169 (insert-before-markers |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1170 (if (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1171 (mail-extr-skip-whitespace-backward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1172 (eq ?. (preceding-char))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1173 "" |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1174 ".") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1175 "uucp")) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1176 (setq !-pos (cdr !-pos)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1177 (and saved-%-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1178 (setq %-pos (append (mapcar 'mail-extr-demarkerize |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1179 saved-%-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1180 %-pos))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1181 (setq @-pos (mail-extr-demarkerize @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1182 (narrow-to-region (1+ saved-!-pos) (point-max))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1183 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1184 ;; WARNING: THIS CODE IS DUPLICATED ABOVE. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1185 (cond ((and %-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1186 (not @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1187 (goto-char (car %-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1188 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1189 (setq @-pos (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1190 (insert "@") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1191 (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
|
1192 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1193 (setq %-pos (nreverse %-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1194 (cond (%-pos ; implies @-pos valid |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1195 (setq temp %-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1196 (catch 'truncated |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1197 (while temp |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1198 (goto-char (or (nth 1 temp) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1199 @-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1200 (mail-extr-skip-whitespace-backward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1201 (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1202 (mail-extr-safe-move-sexp -1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1203 (setq domain-pos (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1204 (mail-extr-skip-whitespace-backward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1205 (setq \.-pos (eq ?. (preceding-char)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1206 (cond ((and \.-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1207 ;; #### string consing |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1208 (let ((s (intern-soft |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1209 (buffer-substring domain-pos (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1210 mail-extr-all-top-level-domains))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1211 (and s (get s 'domain-name)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1212 (narrow-to-region (point-min) (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1213 (goto-char (car temp)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1214 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1215 (setq @-pos (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1216 (setcdr temp nil) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1217 (setq %-pos (delq @-pos %-pos)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1218 (insert "@") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1219 (throw 'truncated t))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1220 (setq temp (cdr temp)))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1221 (setq mbox-beg (point-min) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1222 mbox-end (if %-pos (car %-pos) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1223 (or @-pos |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1224 (point-max))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1225 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1226 ;; Done canonicalizing address. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1227 ;; We are now back in extraction-buffer. |
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 ;; 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
|
1230 (cond ( |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1231 ;; Example: "First M. Last" <fml@foo.bar.dom> |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1232 (and phrase-beg |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1233 (eq quote-beg phrase-beg) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1234 (<= quote-end phrase-end)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1235 (narrow-to-region (1+ quote-beg) (1- quote-end)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1236 (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
|
1237 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1238 ;; Example: First Last <fml@foo.bar.dom> |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1239 (phrase-beg |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1240 (narrow-to-region phrase-beg phrase-end)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1241 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1242 ;; Example: fml@foo.bar.dom (First M. Last) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1243 (cbeg |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1244 (narrow-to-region (1+ cbeg) (1- cend)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1245 (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
|
1246 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1247 ;; Deal with spacing problems |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1248 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1249 ;;; (cond ((not (search-forward " " nil t)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1250 ;;; (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1251 ;;; (cond ((search-forward "_" nil t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1252 ;;; ;; Handle the *idiotic* use of underlines as spaces. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1253 ;;; ;; Example: fml@foo.bar.dom (First_M._Last) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1254 ;;; (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1255 ;;; (while (search-forward "_" nil t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1256 ;;; (replace-match " " t))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1257 ;;; ((search-forward "." nil t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1258 ;;; ;; Fix . used as space |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1259 ;;; ;; Example: danj1@cb.att.com (daniel.jacobson) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1260 ;;; (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1261 ;;; (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
|
1262 ;;; (replace-match "\\1 \\2" t)))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1263 ) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1264 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1265 ;; 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
|
1266 ;; of the address. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1267 ;; Example: First_M_Last@foo.bar.dom |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1268 (t |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1269 ;; *** Work in canon buffer instead? No, can't. Hmm. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1270 (goto-char (point-max)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1271 (narrow-to-region (point) (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1272 (insert-buffer-substring canonicalization-buffer |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1273 mbox-beg mbox-end) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1274 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1275 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1276 ;; Example: First_Last.XXX@foo.bar.dom |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1277 (setq \.-ends-name (re-search-forward "[_0-9]" nil t)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1278 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1279 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1280 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1281 (if (not mail-extr-mangle-uucp) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1282 (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
|
1283 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1284 (while (progn |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1285 (mail-extr-skip-whitespace-forward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1286 (not (eobp))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1287 (setq char (char-after (point))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1288 (cond |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1289 ((eq char ?\") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1290 (setq quote-beg (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1291 (or (mail-extr-safe-move-sexp 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1292 ;; TODO: handle this error condition!!!!! |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1293 (forward-char 1)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1294 ;; take into account deletions |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1295 (setq quote-end (- (point) 2)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1296 (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1297 (backward-char 1) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1298 (mail-extr-delete-char 1) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1299 (goto-char quote-beg) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1300 (or (eobp) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1301 (mail-extr-delete-char 1))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1302 (mail-extr-undo-backslash-quoting quote-beg quote-end) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1303 (or (eq ?\ (char-after (point))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1304 (insert " ")) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1305 ;; (setq mailbox-name-processed-flag t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1306 (setq \.-ends-name t)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1307 ((eq char ?.) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1308 (if (memq (char-after (1+ (point))) '(?_ ?=)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1309 (progn |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1310 (forward-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1311 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1312 (insert ?\ )) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1313 (if \.-ends-name |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1314 (narrow-to-region (point-min) (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1315 (mail-extr-delete-char 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1316 (insert " "))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1317 ;; (setq mailbox-name-processed-flag t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1318 ) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1319 ((memq (char-syntax 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
|
1320 (mail-extr-delete-char 1) |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1321 (insert " ") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1322 ;; (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
|
1323 ) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1324 (t |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1325 (setq atom-beg (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1326 (forward-word 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1327 (setq atom-end (point)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1328 (goto-char atom-beg) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1329 (save-restriction |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1330 (narrow-to-region atom-beg atom-end) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1331 (cond |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1332 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1333 ;; Handle X.400 addresses encoded in RFC-822. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1334 ;; *** Shit! This has to handle the case where it is |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1335 ;; *** embedded in a quote too! |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1336 ;; *** Shit! The input is being broken up into atoms |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1337 ;; *** by periods! |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1338 ((looking-at mail-extr-x400-encoded-address-pattern) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1339 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1340 ;; Copy the contents of the individual fields that |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1341 ;; might hold name data to the beginning. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1342 (mapcar |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1343 (function |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1344 (lambda (field-pattern) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1345 (cond |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1346 ((save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1347 (re-search-forward field-pattern nil t)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1348 (insert-buffer-substring (current-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1349 (match-beginning 1) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1350 (match-end 1)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1351 (insert " "))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1352 (list mail-extr-x400-encoded-address-given-name-pattern |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1353 mail-extr-x400-encoded-address-surname-pattern |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1354 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
|
1355 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1356 ;; Discard the rest, since it contains stuff like |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1357 ;; routing information, not part of a name. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1358 (mail-extr-skip-whitespace-backward) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1359 (delete-region (point) (point-max)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1360 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1361 ;; Handle periods used for spacing. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1362 (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
|
1363 (replace-match "\\1 \\2" t)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1364 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1365 ;; (setq mailbox-name-processed-flag t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1366 ) |
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 ;; Handle normal addresses. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1369 (t |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1370 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1371 ;; Handle _ and = used for spacing. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1372 (while (re-search-forward "\\([^_=]+\\)[_=]" nil t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1373 (replace-match "\\1 " t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1374 ;; (setq mailbox-name-processed-flag t) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1375 ) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1376 (goto-char (point-max)))))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1377 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1378 ;; undo the dirty deed |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1379 (if (not mail-extr-mangle-uucp) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1380 (modify-syntax-entry ?! "." (syntax-table))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1381 ;; |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1382 ;; 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
|
1383 ;; 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
|
1384 ;; name. "foo@bar" --> (nil "foo@bar"), not ("foo" "foo@bar") |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1385 ;; (if (not mailbox-name-processed-flag) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1386 ;; (delete-region (point-min) (point-max))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1387 )) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1388 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1389 (set-syntax-table mail-extr-address-text-syntax-table) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1390 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1391 (mail-extr-voodoo mbox-beg mbox-end canonicalization-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1392 (goto-char (point-min)) |
809 | 1393 |
20285
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1394 ;; 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
|
1395 ;; the middle initial is the second letter in the userid. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1396 ;; Initial code by Jamie Zawinski <jwz@lucid.com> |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1397 ;; *** Make it work when there's a suffix as well. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1398 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1399 (cond ((and mail-extr-guess-middle-initial |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1400 (not disable-initial-guessing-flag) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1401 (eq 3 (- mbox-end mbox-beg)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1402 (progn |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1403 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1404 (looking-at mail-extr-two-name-pattern))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1405 (setq fi (char-after (match-beginning 0)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1406 li (char-after (match-beginning 3))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1407 (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1408 (set-buffer canonicalization-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1409 ;; char-equal is ignoring case here, so no need to upcase |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1410 ;; or downcase. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1411 (let ((case-fold-search t)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1412 (and (char-equal fi (char-after mbox-beg)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1413 (char-equal li (char-after (1- mbox-end))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1414 (setq mi (char-after (1+ mbox-beg)))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1415 (cond ((and mi |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1416 ;; TODO: use better table than syntax table |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1417 (eq ?w (char-syntax mi))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1418 (goto-char (match-beginning 3)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1419 (insert (upcase mi) ". "))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1420 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1421 ;; Nuke name if it is the same as mailbox name. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1422 (let ((buffer-length (- (point-max) (point-min))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1423 (i 0) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1424 (names-match-flag t)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1425 (cond ((and (> buffer-length 0) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1426 (eq buffer-length (- mbox-end mbox-beg))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1427 (goto-char (point-max)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1428 (insert-buffer-substring canonicalization-buffer |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1429 mbox-beg mbox-end) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1430 (while (and names-match-flag |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1431 (< i buffer-length)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1432 (or (eq (downcase (char-after (+ i (point-min)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1433 (downcase |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1434 (char-after (+ i buffer-length (point-min))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1435 (setq names-match-flag nil)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1436 (setq i (1+ i))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1437 (delete-region (+ (point-min) buffer-length) (point-max)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1438 (if names-match-flag |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1439 (narrow-to-region (point) (point)))))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1440 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1441 ;; Nuke name if it's just one word. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1442 (goto-char (point-min)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1443 (and mail-extr-ignore-single-names |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1444 (not (re-search-forward "[- ]" nil t)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1445 (narrow-to-region (point) (point))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1446 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1447 ;; Record the result |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1448 (setq value-list |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1449 (cons (list (if (not (= (point-min) (point-max))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1450 (buffer-string)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1451 (save-excursion |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1452 (set-buffer canonicalization-buffer) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1453 (if (not (= (point-min) (point-max))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1454 (buffer-string)))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1455 value-list)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1456 |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1457 ;; Unless one address is all we wanted, |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1458 ;; delete this one from extraction-buffer |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1459 ;; and get ready to extract the next address. |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1460 (when all |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1461 (if end-of-address |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1462 (narrow-to-region 1 end-of-address) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1463 (widen)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1464 (delete-region (point-min) (point-max)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1465 (widen)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1466 ))) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1467 (if all (nreverse value-list) (car value-list)) |
3b0ad3d46bde
(mail-extract-address-components):
Karl Heuer <kwzh@gnu.org>
parents:
20242
diff
changeset
|
1468 )) |
809 | 1469 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1470 (defun mail-extr-voodoo (mbox-beg mbox-end canonicalization-buffer) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1471 (let ((word-count 0) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1472 (case-fold-search nil) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1473 mixed-case-flag lower-case-flag ;;upper-case-flag |
809 | 1474 suffix-flag last-name-comma-flag |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1475 ;;cbeg cend |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1476 initial |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1477 begin-again-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1478 drop-this-word-if-trailing-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1479 drop-last-word-if-trailing-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1480 word-found-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1481 this-word-beg last-word-beg |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1482 name-beg name-end |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1483 name-done-flag |
809 | 1484 ) |
1485 (save-excursion | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1486 (set-syntax-table mail-extr-address-text-syntax-table) |
18816
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1487 |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1488 ;; Get rid of comments. |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1489 (goto-char (point-min)) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1490 (while (not (eobp)) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1491 ;; Initialize for this iteration of the loop. |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1492 (skip-chars-forward "^({[\"'`") |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1493 (let ((cbeg (point))) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1494 (set-syntax-table mail-extr-address-text-comment-syntax-table) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1495 (cond ((memq (following-char) '(?\' ?\`)) |
19006
8a0265f609ff
(mail-extr-voodoo): Handle unmatched quotes in the comment-deletion loop.
Richard M. Stallman <rms@gnu.org>
parents:
18816
diff
changeset
|
1496 (search-forward "'" nil 'move |
18816
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1497 (if (eq ?\' (following-char)) 2 1))) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1498 (t |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1499 (or (mail-extr-safe-move-sexp 1) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1500 (goto-char (point-max))))) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1501 (set-syntax-table mail-extr-address-text-syntax-table) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1502 (when (eq (char-after cbeg) ?\() |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1503 ;; Delete the comment itself. |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1504 (delete-region cbeg (point)) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1505 ;; Canonicalize whitespace where the comment was. |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1506 (skip-chars-backward " \t") |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1507 (if (looking-at "\\([ \t]+$\\|[ \t]+,\\)") |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1508 (replace-match "") |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1509 (setq cbeg (point)) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1510 (skip-chars-forward " \t") |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1511 (if (bobp) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1512 (delete-region (point) cbeg) |
92913b38a478
(mail-extr-voodoo): Get rid of comments at an early stage.
Richard M. Stallman <rms@gnu.org>
parents:
16727
diff
changeset
|
1513 (just-one-space)))))) |
809 | 1514 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1515 ;; This was moved above. |
809 | 1516 ;; Fix . used as 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
|
1517 ;; But it belongs here because it occurs not only as |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1518 ;; rypens@reks.uia.ac.be (Piet.Rypens) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1519 ;; but also as |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1520 ;; "Piet.Rypens" <rypens@reks.uia.ac.be> |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1521 ;;(goto-char (point-min)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1522 ;;(while (re-search-forward mail-extr-bad-dot-pattern 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
|
1523 ;; (replace-match "\\1 \\2" t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1524 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1525 (cond ((not (search-forward " " 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
|
1526 (goto-char (point-min)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1527 (cond ((search-forward "_" 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
|
1528 ;; Handle the *idiotic* use of underlines as spaces. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1529 ;; Example: fml@foo.bar.dom (First_M._Last) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1530 (goto-char (point-min)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1531 (while (search-forward "_" 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
|
1532 (replace-match " " t))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1533 ((search-forward "." 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
|
1534 ;; Fix . used as space |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1535 ;; Example: danj1@cb.att.com (daniel.jacobson) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1536 (goto-char (point-min)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1537 (while (re-search-forward mail-extr-bad-dot-pattern 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
|
1538 (replace-match "\\1 \\2" t)))))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1539 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1540 ;; Loop over the words (and other junk) in the name. |
809 | 1541 (goto-char (point-min)) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1542 (while (not name-done-flag) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1543 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1544 (cond (word-found-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1545 ;; Last time through this loop we skipped over a word. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1546 (setq last-word-beg this-word-beg) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1547 (setq drop-last-word-if-trailing-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1548 drop-this-word-if-trailing-flag) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1549 (setq word-found-flag nil))) |
809 | 1550 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1551 (cond (begin-again-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1552 ;; Last time through the loop we found something that |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1553 ;; indicates we should pretend we are beginning again from |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1554 ;; the start. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1555 (setq word-count 0) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1556 (setq last-word-beg nil) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1557 (setq drop-last-word-if-trailing-flag nil) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1558 (setq mixed-case-flag nil) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1559 (setq lower-case-flag nil) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1560 ;; (setq upper-case-flag nil) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1561 (setq begin-again-flag nil) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1562 )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1563 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1564 ;; Initialize for this iteration of the loop. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1565 (mail-extr-skip-whitespace-forward) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1566 (if (eq word-count 0) (narrow-to-region (point) (point-max))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1567 (setq this-word-beg (point)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1568 (setq drop-this-word-if-trailing-flag nil) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1569 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1570 ;; Decide what to do based on what we are looking at. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1571 (cond |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1572 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1573 ;; Delete title |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1574 ((and (eq word-count 0) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1575 (looking-at mail-extr-full-name-prefixes)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1576 (goto-char (match-end 0)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1577 (narrow-to-region (point) (point-max))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1578 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1579 ;; Stop after name suffix |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1580 ((and (>= word-count 2) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1581 (looking-at 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
|
1582 (mail-extr-skip-whitespace-backward) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1583 (setq suffix-flag (point)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1584 (if (eq ?, (following-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1585 (forward-char 1) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1586 (insert ?,)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1587 ;; Enforce at least one space after comma |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1588 (or (eq ?\ (following-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1589 (insert ?\ )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1590 (mail-extr-skip-whitespace-forward) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1591 (cond ((memq (following-char) '(?j ?J ?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
|
1592 (capitalize-word 1) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1593 (if (eq (following-char) ?.) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1594 (forward-char 1) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1595 (insert ?.))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1596 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1597 (upcase-word 1))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1598 (setq word-found-flag t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1599 (setq name-done-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1600 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1601 ;; Handle SCA names |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1602 ((looking-at "MKA \\(.+\\)") ; "Mundanely Known As" |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1603 (goto-char (match-beginning 1)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1604 (narrow-to-region (point) (point-max)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1605 (setq begin-again-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1606 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1607 ;; Check for initial last name followed by comma |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1608 ((and (eq ?, (following-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1609 (eq word-count 1)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1610 (forward-char 1) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1611 (setq last-name-comma-flag t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1612 (or (eq ?\ (following-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1613 (insert ?\ ))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1614 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1615 ;; Stop before trailing comma-separated comment |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1616 ;; THIS CASE MUST BE AFTER THE PRECEDING CASES. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1617 ;; *** This case is redundant??? |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1618 ;;((eq ?, (following-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1619 ;; (setq name-done-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1620 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1621 ;; Delete parenthesized/quoted comment/nickname |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1622 ((memq (following-char) '(?\( ?\{ ?\[ ?\" ?\' ?\`)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1623 (setq cbeg (point)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1624 (set-syntax-table 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
|
1625 (cond ((memq (following-char) '(?\' ?\`)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1626 (or (search-forward "'" 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
|
1627 (if (eq ?\' (following-char)) 2 1)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1628 (mail-extr-delete-char 1))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1629 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1630 (or (mail-extr-safe-move-sexp 1) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1631 (goto-char (point-max))))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1632 (set-syntax-table 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
|
1633 (setq cend (point)) |
809 | 1634 (cond |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1635 ;; Handle case of entire name being quoted |
809 | 1636 ((and (eq word-count 0) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1637 (looking-at " *\\'") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1638 (>= (- cend cbeg) 2)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1639 (narrow-to-region (1+ cbeg) (1- cend)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1640 (goto-char (point-min))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1641 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1642 ;; Handle case of quoted initial |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1643 (if (and (or (= 3 (- cend cbeg)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1644 (and (= 4 (- cend cbeg)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1645 (eq ?. (char-after (+ 2 cbeg))))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1646 (not (looking-at " *\\'"))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1647 (setq initial (char-after (1+ cbeg))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1648 (setq initial nil)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1649 (delete-region cbeg cend) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1650 (if initial |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1651 (insert initial ". "))))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1652 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1653 ;; Handle *Stupid* VMS date stamps |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1654 ((looking-at 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
|
1655 (replace-match "" t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1656 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1657 ;; Handle Chinese characters. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1658 ((looking-at 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
|
1659 (goto-char (match-end 0)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1660 (setq word-found-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1661 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1662 ;; Skip initial garbage characters. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1663 ;; THIS CASE MUST BE AFTER THE PRECEDING CASES. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1664 ((and (eq word-count 0) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1665 (looking-at mail-extr-leading-garbage)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1666 (goto-char (match-end 0)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1667 ;; *** Skip backward over these??? |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1668 ;; (skip-chars-backward "& \"") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1669 (narrow-to-region (point) (point-max))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1670 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1671 ;; Various stopping points |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1672 ((or |
809 | 1673 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1674 ;; Stop before ALL CAPS acronyms, if preceded by mixed-case |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1675 ;; words. Example: XT-DEM. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1676 (and (>= word-count 2) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1677 mixed-case-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1678 (looking-at 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
|
1679 (not (looking-at mail-extr-roman-numeral-pattern))) |
809 | 1680 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1681 ;; Stop before trailing alternative address |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1682 (looking-at 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
|
1683 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1684 ;; Stop before trailing comment not introduced by comma |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1685 ;; THIS CASE MUST BE AFTER AN EARLIER CASE. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1686 (looking-at mail-extr-trailing-comment-start-pattern) |
809 | 1687 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1688 ;; Stop before telephone numbers |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1689 (looking-at 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
|
1690 (setq name-done-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1691 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1692 ;; Delete ham radio call signs |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1693 ((looking-at 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
|
1694 (delete-region (match-beginning 0) (match-end 0))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1695 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1696 ;; Fixup initials |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1697 ((looking-at 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
|
1698 (or (eq (following-char) (upcase (following-char))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1699 (setq lower-case-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1700 (forward-char 1) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1701 (if (eq ?. (following-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1702 (forward-char 1) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1703 (insert ?.)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1704 (or (eq ?\ (following-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1705 (insert ?\ )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1706 (setq word-found-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1707 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1708 ;; Handle BITNET LISTSERV list names. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1709 ((and (eq word-count 0) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1710 (looking-at 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
|
1711 (narrow-to-region (match-beginning 1) (match-end 1)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1712 (setq word-found-flag t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1713 (setq name-done-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1714 |
20400
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1715 ;; Handle & substitution, when & is last and is not first. |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1716 ((and (> word-count 0) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1717 (eq ?\ (preceding-char)) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1718 (eq (following-char) ?&) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1719 (eq (1+ (point)) (point-max))) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1720 (mail-extr-delete-char 1) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1721 (capitalize-region |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1722 (point) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1723 (progn |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1724 (insert-buffer-substring canonicalization-buffer |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1725 mbox-beg mbox-end) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1726 (point))) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1727 (setq disable-initial-guessing-flag t) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1728 (setq word-found-flag t)) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1729 |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1730 ;; Handle & between names, as in "Bob & Susie". |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1731 ((and (> word-count 0) (eq (following-char) ?\&)) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1732 (setq name-beg (point)) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1733 (setq name-end (1+ name-beg)) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1734 (setq word-found-flag t) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1735 (goto-char name-end)) |
fd74979309d3
(mail-extr-voodoo): Allow & between names.
Richard M. Stallman <rms@gnu.org>
parents:
20285
diff
changeset
|
1736 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1737 ;; Regular name words |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1738 ((looking-at 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
|
1739 (setq name-beg (point)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1740 (setq name-end (match-end 0)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1741 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1742 ;; Certain words will be dropped if they are at the end. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1743 (and (>= word-count 2) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1744 (not lower-case-flag) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1745 (or |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1746 ;; A trailing 4-or-more letter lowercase words preceded by |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1747 ;; mixed case or uppercase words will be dropped. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1748 (looking-at "[a-z][a-z][a-z][a-z]+[ \t]*\\'") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1749 ;; Drop a trailing word which is terminated with a period. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1750 (eq ?. (char-after (1- name-end)))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1751 (setq drop-this-word-if-trailing-flag t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1752 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1753 ;; Set the flags that indicate whether we have seen a lowercase |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1754 ;; word, a mixed case word, and an uppercase word. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1755 (if (re-search-forward "[a-z]" name-end t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1756 (if (progn |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1757 (goto-char name-beg) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1758 (re-search-forward "[A-Z]" name-end t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1759 (setq mixed-case-flag t) |
809 | 1760 (setq lower-case-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
|
1761 ;; (setq upper-case-flag t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1762 ) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1763 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1764 (goto-char name-end) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1765 (setq word-found-flag t)) |
809 | 1766 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1767 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1768 (setq name-done-flag t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1769 )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1770 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1771 ;; Count any word that we skipped over. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1772 (if word-found-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1773 (setq word-count (1+ word-count)))) |
809 | 1774 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1775 ;; If the last thing in the name is 2 or more periods, or one or more |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1776 ;; other sentence terminators (but not a single period) then keep them |
13959 | 1777 ;; and the preceding word. This is for the benefit of whole sentences |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1778 ;; in the name field: it's better behavior than dropping the last word |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1779 ;; of the sentence... |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1780 (if (and (not suffix-flag) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1781 (looking-at "\\(\\.+\\|[?!;:.][?!;:.]+\\|[?!;:][?!;:.]*\\)\\'")) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1782 (goto-char (setq suffix-flag (point-max)))) |
809 | 1783 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1784 ;; Drop everything after point and certain trailing words. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1785 (narrow-to-region (point-min) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1786 (or (and drop-last-word-if-trailing-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1787 last-word-beg) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1788 (point))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1789 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1790 ;; Xerox's mailers SUCK!!!!!! |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1791 ;; We simply refuse to believe that any last name is PARC or ADOC. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1792 ;; If it looks like that is the last name, that there is no meaningful |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1793 ;; here at all. Actually I guess it would be best to map patterns |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1794 ;; like foo.hoser@xerox.com into foo@hoser.xerox.com, but I don't |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1795 ;; actually know that that is what's going on. |
809 | 1796 (cond ((not suffix-flag) |
1797 (goto-char (point-min)) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1798 (let ((case-fold-search t)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1799 (if (looking-at "[-A-Za-z_]+[. ]\\(PARC\\|ADOC\\)\\'") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1800 (erase-buffer))))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1801 |
809 | 1802 ;; If last name first put it at end (but before suffix) |
1803 (cond (last-name-comma-flag | |
1804 (goto-char (point-min)) | |
1805 (search-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
|
1806 (setq name-end (1- (point))) |
809 | 1807 (goto-char (or suffix-flag (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
|
1808 (or (eq ?\ (preceding-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1809 (insert ?\ )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1810 (insert-buffer-substring (current-buffer) (point-min) name-end) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1811 (goto-char name-end) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1812 (skip-chars-forward "\t ,") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1813 (narrow-to-region (point) (point-max)))) |
809 | 1814 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1815 ;; Delete leading and trailing junk characters. |
13959 | 1816 ;; *** This is probably completely unneeded now. |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1817 ;;(goto-char (point-max)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1818 ;;(skip-chars-backward 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
|
1819 ;;(if (eq ?. (following-char)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1820 ;; (forward-char 1)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1821 ;;(narrow-to-region (point) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1822 ;; (progn |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1823 ;; (goto-char (point-min)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1824 ;; (skip-chars-forward 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
|
1825 ;; (point))) |
809 | 1826 |
1827 ;; Compress whitespace | |
1828 (goto-char (point-min)) | |
1829 (while (re-search-forward "[ \t\n]+" nil 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
|
1830 (replace-match (if (eobp) "" " ") t)) |
809 | 1831 ))) |
1832 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1833 |
809 | 1834 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1835 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1836 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1837 ;; 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
|
1838 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1839 ;; This is used during address canonicalization; be careful of format changes. |
809 | 1840 ;; Keep in mind that the country abbreviations follow ISO-3166. There is |
1841 ;; a U.S. FIPS that specifies a different set of two-letter country | |
1842 ;; abbreviations. | |
1843 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1844 (defconst mail-extr-all-top-level-domains |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1845 (let ((ob (make-vector 509 0))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1846 (mapcar |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1847 (function |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1848 (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
|
1849 (put (intern (downcase (car x)) ob) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1850 'domain-name |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1851 (if (nth 2 x) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1852 (format (nth 2 x) (nth 1 x)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1853 (nth 1 x))))) |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1854 '( |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1855 ;; ISO 3166 codes: |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1856 ("ad" "Andorra") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1857 ("ae" "United Arab Emirates") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1858 ("ag" "Antigua and Barbuda") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1859 ("al" "Albania") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1860 ("am" "Armenia") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1861 ("ao" "Angola") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1862 ("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
|
1863 ("ar" "Argentina" "Argentine Republic") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1864 ("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
|
1865 ("au" "Australia") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1866 ("az" "Azerbaijan") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1867 ("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
|
1868 ("bb" "Barbados") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1869 ("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
|
1870 ("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
|
1871 ("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
|
1872 ("bg" "Bulgaria") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1873 ("bh" "Bahrain") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1874 ("bm" "Bermuda") |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1875 ("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
|
1876 ("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
|
1877 ("bs" "Bahamas") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1878 ("bw" "Botswana") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1879 ("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
|
1880 ("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
|
1881 ("ca" "Canada") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1882 ("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
|
1883 ("ch" "Switzerland" "The Swiss Confederation") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1884 ("ci" "Ivory Coast") |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1885 ("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
|
1886 ("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
|
1887 ("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
|
1888 ("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
|
1889 ("cr" "Costa Rica" "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
|
1890 ("cs" "Czechoslovakia") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1891 ("cu" "Cuba") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1892 ("cy" "Cyprus") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1893 ("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
|
1894 ("de" "Germany") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1895 ("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
|
1896 ("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
|
1897 ("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
|
1898 ("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
|
1899 ("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
|
1900 ("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
|
1901 ("eg" "Egypt" "The Arab Republic of %s") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1902 ("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
|
1903 ("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
|
1904 ("et" "Ethiopia") |
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 ("fi" "Finland" "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
|
1906 ("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
|
1907 ("fr" "France") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1908 ("ga" "Gabon") |
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1909 ("gb" "United Kingdom") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1910 ("gd" "Grenada") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1911 ("ge" "Georgia") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1912 ("gf" "Guyana (Fr.)") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1913 ("gj" "Fiji") |
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1914 ("gl" "Greenland") |
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1915 ("gm" "Gambia") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1916 ("gp" "Guadeloupe (Fr.)") |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1917 ("gr" "Greece" "The Hellenic Republic (%s)") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1918 ("gt" "Guatemala") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1919 ("gu" "Guam (U.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
|
1920 ("hk" "Hong Kong") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1921 ("hn" "Honduras") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1922 ("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
|
1923 ("ht" "Haiti") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1924 ("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
|
1925 ("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
|
1926 ("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
|
1927 ("il" "Israel" "The State of %s") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1928 ("im" "Isle of Man" "The %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
|
1929 ("in" "India" "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
|
1930 ("ir" "Iran") |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1931 ("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
|
1932 ("it" "Italy" "The Italian Republic") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1933 ("jm" "Jamaica") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1934 ("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
|
1935 ("jp" "Japan") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1936 ("ke" "Kenya") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1937 ("kn" "St. Kitts, Nevis, and Anguilla") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1938 ("kp" "Korea (North)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1939 ("kr" "Korea (South)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1940 ("kw" "Kuwait") |
13959 | 1941 ("kz" "Kazakhstan") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1942 ("lb" "Lebanon") |
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 ("lc" "St. Lucia") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1944 ("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
|
1945 ("lk" "Sri Lanka" "The Democratic Socialist Republic of %s") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1946 ("ls" "Lesotho") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1947 ("lt" "Lithuania") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1948 ("lu" "Luxembourg") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1949 ("lv" "Latvia") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1950 ("ma" "Morocco") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1951 ("mc" "Monaco") |
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1952 ("md" "Moldova" "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
|
1953 ("mg" "Madagascar") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1954 ("mk" "Macedonia") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1955 ("ml" "Mali") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1956 ("mo" "Macau") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1957 ("mt" "Malta") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1958 ("mu" "Mauritius") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1959 ("mv" "Maldives") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1960 ("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
|
1961 ("mx" "Mexico" "The United Mexican States") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1962 ("my" "Malaysia" "%s (changed to Myanmar?)") ;??? |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1963 ("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
|
1964 ("na" "Namibia") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1965 ("nc" "New Caledonia (Fr.)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1966 ("ne" "Niger") ; 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
|
1967 ("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
|
1968 ("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
|
1969 ("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
|
1970 ("np" "Nepal") ; Via .in domain |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1971 ("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
|
1972 ("nz" "New Zealand") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1973 ("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
|
1974 ("pe" "Peru") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1975 ("pf" "Polynesia (Fr.)") |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1976 ("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
|
1977 ("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
|
1978 ("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
|
1979 ("pl" "Poland") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1980 ("pr" "Puerto Rico (U.S.)") |
13959 | 1981 ("pt" "Portugal" "The Portuguese 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
|
1982 ("py" "Paraguay") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1983 ("qa" "Qatar") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1984 ("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
|
1985 ("ro" "Romania") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1986 ("ru" "Russian Federation") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1987 ("sa" "Saudi Arabia") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1988 ("sc" "Seychelles") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1989 ("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
|
1990 ("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
|
1991 ("sg" "Singapore" "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
|
1992 ("si" "Slovenia") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1993 ("sj" "Svalbard and Jan Mayen Is.") ; In .no domain |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1994 ("sk" "Slovakia" "The Slovak Republic") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1995 ("sm" "San Marino") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1996 ("sn" "Senegal") |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1997 ("sr" "Suriname") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
1998 ("su" "U.S.S.R." "The Union of Soviet Socialist Republics") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
1999 ("sz" "Swaziland") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2000 ("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
|
2001 ("th" "Thailand" "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
|
2002 ("tm" "Turkmenistan") ; In .su 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
|
2003 ("tn" "Tunisia") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
2004 ("to" "Tonga") |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2005 ("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
|
2006 ("tt" "Trinidad and Tobago") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2007 ("tw" "Taiwan") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2008 ("ua" "Ukraine") |
8318
3fc49ff2ea03
(mail-extr-all-top-level-domains): Update a few long names.
Richard M. Stallman <rms@gnu.org>
parents:
7133
diff
changeset
|
2009 ("uk" "United Kingdom" "The %s of Great Britain and Northern Ireland") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2010 ("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
|
2011 ("uy" "Uruguay" "The Eastern 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
|
2012 ("vc" "St. Vincent and the Grenadines") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2013 ("ve" "Venezuela" "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
|
2014 ("vi" "Virgin Islands (U.S.)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2015 ("vn" "Vietnam") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2016 ("vu" "Vanuatu") |
20427
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
2017 ("yu" "Yugoslavia" "Yugoslavia, AKA Serbia-Montenegro") |
1b4f02e638b8
(mail-extr-all-top-level-domains): More domains.
Karl Heuer <kwzh@gnu.org>
parents:
20400
diff
changeset
|
2018 ("za" "South Africa" "The 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
|
2019 ("zw" "Zimbabwe" "Republic of %s") |
8983
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2020 ;; Special top-level domains: |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2021 ("arpa" t "Advanced Research Projects Agency (U.S. DoD)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2022 ("bitnet" t "Because It's Time NET") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2023 ("com" t "Commercial") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2024 ("edu" t "Educational") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2025 ("gov" t "Government (U.S.)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2026 ("int" t "International (NATO)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2027 ("mil" t "Military (U.S.)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2028 ("nato" t "North Atlantic Treaty Organization") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2029 ("net" t "Network") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2030 ("org" t "Non-profit Organization") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2031 ;;("unter-dom" t "? (Ger.)") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2032 ("uucp" t "Unix to Unix CoPy") |
522fbe95e651
(mail-extr-all-top-level-domains): Update domain list.
Richard M. Stallman <rms@gnu.org>
parents:
8356
diff
changeset
|
2033 ;;("fipnet" 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
|
2034 )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2035 ob)) |
809 | 2036 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2037 ;;;###autoload |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2038 (defun what-domain (domain) |
8356 | 2039 "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
|
2040 (interactive |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2041 (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
|
2042 (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
|
2043 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
|
2044 (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
|
2045 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
|
2046 (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
|
2047 (message "%s: %s" (upcase (symbol-name domain)) (get domain 'domain-name))) |
809 | 2048 |
2049 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2050 ;(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
|
2051 ; (mapatoms #'(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
|
2052 ; (if (and (boundp x) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2053 ; (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
|
2054 ; (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
|
2055 ; (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
|
2056 ; (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
|
2057 ; (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
|
2058 ; (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
|
2059 ; all)))) |
809 | 2060 |
2061 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
2062 (provide 'mail-extr) |
809 | 2063 |
2064 ;;; mail-extr.el ends here |