Mercurial > emacs
annotate lisp/mail/mail-extr.el @ 7591:d1a839615554
(bookmark-file): Alternate default on ms-dos.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 20 May 1994 21:22:22 +0000 |
parents | 9367067ee736 |
children | 3fc49ff2ea03 |
rev | line source |
---|---|
809 | 1 ;;; mail-extr.el --- extract full name and address from RFC 822 mail header. |
2 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
3 ;; Copyright (C) 1991, 1992, 1993, 1994 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> |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
6 ;; Maintainer: 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
|
7 ;; Version: 1.8 |
809 | 8 ;; Keywords: mail |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; 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
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
809 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
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 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
30 ;; mail-extract-address-components: (address) |
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 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
42 ;; 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
|
43 ;; 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
|
44 ;; |
809 | 45 ;; 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
|
46 ;; |
809 | 47 ;; 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
|
48 ;; any other package we know of. (On the other hand, it will cheerfully |
809 | 49 ;; mangle non-human names/comments.) |
50 ;; 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
|
51 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
52 ;; 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
|
53 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
54 ;; We have an extensive test-case collection of funny addresses if you want to |
809 | 55 ;; 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
|
56 ;; 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
|
57 ;; 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
|
58 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
59 ;; 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
|
60 ;; 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
|
61 ;; 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
|
62 ;; 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
|
63 ;; 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
|
64 ;; |
809 | 65 ;; 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
|
66 ;; |
809 | 67 ;; * 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
|
68 ;; |
809 | 69 ;; * knows where full names can be found in an address. |
70 ;; * avoids using empty comments and quoted text. | |
71 ;; * extracts full names from mailbox names. | |
72 ;; * recognizes common formats for comments after a full name. | |
73 ;; * 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
|
74 ;; * 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
|
75 ;; * strips name prefixes like "Prof.", etc. |
809 | 76 ;; * understands what characters can occur in names (not just letters). |
77 ;; * figures out middle initial from mailbox name. | |
78 ;; * removes funny nicknames. | |
79 ;; * keeps suffixes such as Jr., Sr., III, etc. | |
80 ;; * 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
|
81 ;; |
809 | 82 ;; * 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
|
83 ;; |
809 | 84 ;; * parses rfc822 quoted text, comments, and domain literals. |
85 ;; * parses rfc822 multi-line headers. | |
86 ;; * does something reasonable with rfc822 GROUP addresses. | |
87 ;; * handles many rfc822 noncompliant and garbage addresses. | |
88 ;; * canonicalizes addresses (after stripping comments/phrases outside <>). | |
89 ;; * converts ! addresses into .UUCP and %-style addresses. | |
90 ;; * converts rfc822 ROUTE addresses to %-style addresses. | |
91 ;; * truncates %-style addresses at leftmost fully qualified domain name. | |
92 ;; * 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
|
93 ;; |
809 | 94 ;; It does almost no string creation. It primarily uses the built-in |
95 ;; parsing routines with the appropriate syntax tables. This should | |
96 ;; 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
|
97 ;; |
809 | 98 ;; 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
|
99 ;; |
809 | 100 ;; * handle all test cases. (This will take forever.) |
101 ;; * software to pick the correct header to use (eg., "Senders-Name:"). | |
102 ;; * multiple addresses in the "From:" header (almost all of the necessary | |
103 ;; code is there). | |
104 ;; * flag to not treat `,' as an address separator. (This is useful when | |
105 ;; there is a "From:" header but no "Sender:" header, because then there | |
106 ;; is only allowed to be one address.) | |
107 ;; * mailbox name does not necessarily contain full name. | |
108 ;; * fixing capitalization when it's all upper or lowercase. (Hard!) | |
109 ;; * some of the domain literal handling is missing. (But I've never even | |
110 ;; seen one of these in a mail address, so maybe no big deal.) | |
111 ;; * arrange to have syntax tables byte-compiled. | |
112 ;; * speed hacks. | |
113 ;; * delete unused variables. | |
114 ;; * arrange for testing with different relative precedences of ! vs. @ | |
115 ;; and %. | |
116 ;; * insert documentation strings! | |
117 ;; * handle X.400-gatewayed addresses according to RFC 1148. | |
118 | |
119 ;;; Change Log: | |
120 ;; | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
121 ;; 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
|
122 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
123 ;; * 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
|
124 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
125 ;; 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
|
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 ;; * 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
|
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 ;; 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
|
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 ;; * 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
|
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 ;; 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
|
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 ;; * 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
|
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 ;; 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
|
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 ;; * 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
|
140 ;; 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
|
141 ;; 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
|
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 ;; 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
|
144 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
145 ;; * 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
|
146 ;; 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
|
147 ;; 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
|
148 ;; 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
|
149 ;; 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
|
150 ;; 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
|
151 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
152 ;; 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
|
153 ;; |
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 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
|
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 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
|
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 ;; * 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
|
159 ;; 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
|
160 ;; 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
|
161 ;; 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
|
162 ;; 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
|
163 ;; 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
|
164 ;; 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
|
165 ;; 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
|
166 ;; 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
|
167 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
168 ;; 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
|
169 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
170 ;; * 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
|
171 ;; 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
|
172 ;; 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
|
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 ;; 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
|
175 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
176 ;; * 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
|
177 ;; 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
|
178 ;; 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
|
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 ;; 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
|
181 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
182 ;; * 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
|
183 ;; includes the flag mail-extr-guess-middle-initial and the fix for |
7133 | 184 ;; handling multiple addresses correctly. (Whitby just changed |
185 ;; 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
|
186 ;; |
809 | 187 ;; Mon Apr 6 23:59:09 1992 Joe Wells (jbw at bigbird.bu.edu) |
188 ;; | |
189 ;; * Cleaned up some more. Release version 1.0 to world. | |
190 ;; | |
191 ;; Sun Apr 5 19:39:08 1992 Joe Wells (jbw at bigbird.bu.edu) | |
192 ;; | |
193 ;; * Cleaned up full name extraction extensively. | |
194 ;; | |
195 ;; Sun Feb 2 14:45:24 1992 Joe Wells (jbw at bigbird.bu.edu) | |
196 ;; | |
197 ;; * Total rewrite. Integrated mail-canonicalize-address into | |
198 ;; mail-extract-address-components. Now handles GROUP addresses more | |
199 ;; or less correctly. Better handling of lots of different cases. | |
200 ;; | |
201 ;; Fri Jun 14 19:39:50 1991 | |
202 ;; * Created. | |
203 | |
204 ;;; Code: | |
205 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
206 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
207 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
208 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
209 ;; 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
|
210 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
211 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
212 (defvar mail-extr-guess-middle-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
|
213 "*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
|
214 If true, then when we see an address like \"John Smith <jqs@host.com>\" |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
215 we will assume that \"John Q. Smith\" is the fellow's name.") |
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 (defvar mail-extr-ignore-single-names t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
218 "*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
|
219 If true, then when we see an address like \"Idiot <dumb@stupid.com>\" |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
220 we will act as though we couldn't find a full name in the address.") |
809 | 221 |
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 ;; 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
|
223 ;; contribute to uniquely identifying 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
|
224 (defvar 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
|
225 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
226 "\\(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
|
227 "*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
|
228 These are stripped from the full name because they do not contribute to |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
229 uniquely identifying 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
|
230 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
231 (defvar mail-extr-@-binds-tighter-than-! nil |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
232 "*Whether the local mail transport agent looks at ! before @.") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
233 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
234 (defvar mail-extr-mangle-uucp nil |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
235 "*Whether to throw away information in UUCP addresses |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
236 by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\".") |
809 | 237 |
238 ;;---------------------------------------------------------------------- | |
239 ;; what orderings are meaningful????? | |
240 ;;(defvar mail-operator-precedence-list '(?! ?% ?@)) | |
241 ;; Right operand of a % or a @ must be a domain name, period. No other | |
242 ;; operators allowed. Left operand of a @ is an address relative to that | |
243 ;; site. | |
244 | |
245 ;; Left operand of a ! must be a domain name. Right operand is an | |
246 ;; arbitrary address. | |
247 ;;---------------------------------------------------------------------- | |
248 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
249 |
809 | 250 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
251 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
252 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
253 ;; 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
|
254 ;; |
809 | 255 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
256 ;; 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
|
257 ;; 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
|
258 ;; 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
|
259 ;; 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
|
260 ;; 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
|
261 ;; --------- ---------- ---- --- ----- ----- ------------------------------- |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
262 ;; %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
|
263 ;; %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
|
264 ;; @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
|
265 ;; %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
|
266 ;; /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
|
267 ;; %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
|
268 ;; %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
|
269 ;; @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
|
270 ;; %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
|
271 ;; /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
|
272 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
273 ;; 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
|
274 ;; /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
|
275 ;; listserv@jhuvm.hcf.jhu.edu. |
809 | 276 |
277 ;; 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
|
278 ;; 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
|
279 ;; 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
|
280 ;; 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
|
281 ;; 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
|
282 ;; #### (go to \376 instead of \377 to work around bug in search.c...) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
283 (defconst 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
|
284 (purecopy "][A-Za-z{|}'~0-9`\200-\376")) |
809 | 285 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
286 ;; 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
|
287 ;; 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
|
288 ;; #### 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
|
289 (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
|
290 (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
|
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 ;; 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
|
293 ;; Keep this set as minimal as possible. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
294 (defconst mail-extr-first-letters (purecopy "A-Za-z")) |
809 | 295 |
296 ;; 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
|
297 ;; Keep this set as minimal as possible. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
298 (defconst mail-extr-last-letters (purecopy "[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
|
299 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
300 (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
|
301 (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
|
302 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
303 ;; (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
|
304 ;; (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
|
305 ;; (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
|
306 ;; (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
|
307 ;; (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
|
308 ;; (purecopy (concat "^" mail-extr-last-letters))) |
809 | 309 |
310 ;; 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
|
311 ;; (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
|
312 ;; (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
313 ;; (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
|
314 ;; mail-extr-all-letters mail-extr-first-letters mail-extr-all-letters))) |
809 | 315 |
316 ;; Matches periods used instead of spaces. Must not match the period | |
317 ;; 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
|
318 (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
|
319 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
320 (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
|
321 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
|
322 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
|
323 mail-extr-first-letters))) |
809 | 324 |
325 ;; 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
|
326 ;; (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
|
327 ;; (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
328 ;; (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
|
329 ;; mail-extr-all-letters))) |
809 | 330 |
331 ;; 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
|
332 ;; 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
|
333 ;; 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
|
334 ;; *** 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
|
335 ;; *** 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
|
336 (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
|
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 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
339 "\\(,? ?\\([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
|
340 mail-extr-all-letters mail-extr-all-letters))) |
809 | 341 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
342 (defconst mail-extr-roman-numeral-pattern (purecopy "V?I+V?\\b")) |
809 | 343 |
344 ;; Matches a trailing uppercase (with other characters possible) acronym. | |
345 ;; 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
|
346 (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
|
347 (purecopy "\\([A-Z]+[-_/]\\|[A-Z][A-Z][A-Z]?\\b\\)")) |
809 | 348 |
349 ;; 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
|
350 ;; #### 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
|
351 ;; (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
|
352 ;; (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
353 ;; (format |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
354 ;; "\\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
|
355 ;; 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
|
356 ;; 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
|
357 ;; mail-extr-last-letters mail-extr-first-letters mail-extr-all-letters))) |
809 | 358 |
359 ;; 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
|
360 ;; #### 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
|
361 ;; #### 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
|
362 (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
|
363 (purecopy "\\(aka *\\)?[a-zA-Z.]+[!@][a-zA-Z.]")) |
809 | 364 |
365 ;; Matches a variety of trailing comments not including comma-delimited | |
366 ;; 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
|
367 (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
|
368 (purecopy " [-{]\\|--\\|[+@#></\;]")) |
809 | 369 |
370 ;; Matches a name (not an initial). | |
371 ;; This doesn't force a word boundary at the end because sometimes a | |
372 ;; 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
|
373 (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
|
374 (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
|
375 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
|
376 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
|
377 mail-extr-last-letters))) |
809 | 378 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
379 (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
|
380 (purecopy (format "\\b[%s]\\([. ]\\|\\b\\)" mail-extr-first-letters))) |
809 | 381 |
382 ;; 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
|
383 ;; (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
|
384 ;; (purecopy (concat "\\`" mail-extr-name-pattern ","))) |
809 | 385 |
386 ;; 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
|
387 (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
|
388 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
389 "\\(\\([Ee]xt\\|\\|[Tt]ph\\|[Tt]el\\|[Xx]\\).?\\)? *\\+?[0-9][- 0-9]+")) |
809 | 390 |
391 ;; 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
|
392 ;; 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
|
393 ;; <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
|
394 ;; 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
|
395 ;; 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
|
396 ;; 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
|
397 (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
|
398 (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
|
399 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
400 ;; 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
|
401 ;; /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
|
402 ;; /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
|
403 ;; /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
|
404 ;; /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
|
405 ;; /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
|
406 ;; /# == 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
|
407 ;; 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
|
408 ;; anyone putting them with their name in an e-mail address. |
809 | 409 |
410 ;; 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
|
411 (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
|
412 (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
|
413 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
|
414 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
|
415 mail-extr-last-letters))) |
809 | 416 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
417 ;; 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
|
418 ;; (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
|
419 ;; (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
|
420 |
809 | 421 ;; 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
|
422 ;; 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
|
423 ;; 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
|
424 ;; 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
|
425 (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
|
426 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
427 (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
|
428 "\\|" 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
|
429 "\\) +\\(" 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
|
430 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
431 (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
|
432 (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
|
433 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
434 (defconst mail-extr-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
|
435 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
436 "[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
|
437 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
438 ;;; 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
|
439 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
440 ;; 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
|
441 ;; 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
|
442 ;; 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
|
443 ;; 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
|
444 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
445 ;; 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
|
446 ;; 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
|
447 ;; 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
|
448 ;; 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
|
449 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
450 ;; 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
|
451 ;; 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
|
452 ;; 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
|
453 ;; ($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
|
454 (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
|
455 (purecopy "~{\\([^~].\\|~[^\}]\\)+~}")) |
809 | 456 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
457 ;; 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
|
458 ;; 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
|
459 (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
|
460 (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
|
461 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
462 (defconst mail-extr-x400-encoded-address-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
|
463 (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
|
464 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
465 (defconst mail-extr-x400-encoded-address-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
|
466 ;; 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
|
467 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
468 (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
|
469 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
470 (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
|
471 ;; 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
|
472 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
473 (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
|
474 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
475 (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
|
476 ;; 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
|
477 ;; 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
|
478 ;; "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
|
479 ;; `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
|
480 ;; 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
|
481 (purecopy |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
482 (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
|
483 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
484 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
485 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
486 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
487 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
488 ;; 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
|
489 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
490 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
491 (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
|
492 (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
|
493 (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
|
494 (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
|
495 (defconst mail-extr-address-text-syntax-table (make-syntax-table)) |
809 | 496 (mapcar |
497 (function | |
498 (lambda (pair) | |
499 (let ((syntax-table (symbol-value (car pair)))) | |
500 (mapcar | |
501 (function | |
502 (lambda (item) | |
503 (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
|
504 ;; modifying syntax of a single character |
809 | 505 (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
|
506 ;; 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
|
507 (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
|
508 (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
|
509 (syntax (nth 2 item))) |
809 | 510 (while (<= char bound) |
511 (modify-syntax-entry char syntax syntax-table) | |
512 (setq char (1+ char))))))) | |
513 (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
|
514 '((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
|
515 (?\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
|
516 (?\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
|
517 (?! ?~ "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
|
518 (?\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
|
519 (?\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
|
520 (?\240 " ") ;nobreakspace |
809 | 521 (?\t " ") |
522 (?\r " ") | |
523 (?\n " ") | |
524 (?\( ".") | |
525 (?\) ".") | |
526 (?< ".") | |
527 (?> ".") | |
528 (?@ ".") | |
529 (?, ".") | |
530 (?\; ".") | |
531 (?: ".") | |
532 (?\\ "\\") | |
533 (?\" "\"") | |
534 (?. ".") | |
535 (?\[ ".") | |
536 (?\] ".") | |
537 ;; % and ! aren't RFC822 characters, but it is convenient to pretend | |
538 (?% ".") | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
539 (?! ".") ;; this needs to be word-constituent when not in .UUCP mode |
809 | 540 ) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
541 (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
|
542 (?\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
|
543 (?\040 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
544 (?\240 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
545 (?\t " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
546 (?\r " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
547 (?\n " ") |
809 | 548 (?\( "\(\)") |
549 (?\) "\)\(") | |
550 (?\\ "\\")) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
551 (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
|
552 (?\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
|
553 (?\040 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
554 (?\240 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
555 (?\t " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
556 (?\r " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
557 (?\n " ") |
809 | 558 (?\[ "\(\]") ;?????? |
559 (?\] "\)\[") ;?????? | |
560 (?\\ "\\")) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
561 (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
|
562 (?\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
|
563 (?\040 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
564 (?\240 " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
565 (?\t " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
566 (?\r " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
567 (?\n " ") |
809 | 568 (?\( "\(\)") |
569 (?\) "\)\(") | |
570 (?\[ "\(\]") | |
571 (?\] "\)\[") | |
572 (?\{ "\(\}") | |
573 (?\} "\)\{") | |
574 (?\\ "\\") | |
575 (?\" "\"") | |
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-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 ?\177 ".") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
581 (?\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
|
582 (?\040 " ") |
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 (?A ?Z "w") |
587 (?a ?z "w") | |
588 (?- "w") | |
589 (?\} "w") | |
590 (?\{ "w") | |
591 (?| "w") | |
592 (?\' "w") | |
593 (?~ "w") | |
594 (?0 ?9 "w")) | |
595 )) | |
596 | |
597 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
598 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
599 ;; |
809 | 600 ;; 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
|
601 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
602 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
603 (defmacro mail-extr-delete-char (n) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
604 ;; 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
|
605 ;; is byte-coded, so it's much much faster. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
606 (list 'delete-region '(point) (list '+ '(point) n))) |
809 | 607 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
608 (defmacro 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
|
609 ;; v19 fn skip-syntax-forward is more tasteful, but not byte-coded. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
610 '(skip-chars-forward " \t\n\r\240")) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
611 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
612 (defmacro 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
|
613 ;; v19 fn skip-syntax-backward is more tasteful, but not byte-coded. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
614 '(skip-chars-backward " \t\n\r\240")) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
615 |
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 (defmacro mail-extr-undo-backslash-quoting (beg end) |
809 | 618 (`(save-excursion |
619 (save-restriction | |
620 (narrow-to-region (, beg) (, end)) | |
621 (goto-char (point-min)) | |
622 ;; undo \ quoting | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
623 (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
|
624 (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
|
625 (or (eobp) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
626 (forward-char 1)) |
809 | 627 ))))) |
628 | |
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 (defmacro mail-extr-nuke-char-at (pos) |
809 | 630 (` (save-excursion |
631 (goto-char (, 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
|
632 (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
|
633 (insert ?\ )))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
634 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
635 (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
|
636 'edebug-form-spec '(symbolp &optional form form atom)) |
809 | 637 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
638 (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
|
639 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
|
640 &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
|
641 ;; 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
|
642 ;; 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
|
643 ;; 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
|
644 ;; 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
|
645 ;; 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
|
646 ;; 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
|
647 ;; 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
|
648 (or (memq no-replace '(t nil)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
649 (error "no-replace must be t or nil, evalable at macroexpand-time.")) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
650 (` (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
|
651 ch) |
809 | 652 (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
|
653 (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
|
654 (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
|
655 (< 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
|
656 (,@ (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
|
657 nil |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
658 (` ((mail-extr-nuke-char-at ch))))) |
809 | 659 (setcar temp nil))) |
660 (setq temp (cdr temp))) | |
661 (setq (, list-symbol) (delq nil (, list-symbol)))))) | |
662 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
663 (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
|
664 ;; 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
|
665 ;; 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
|
666 (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
|
667 (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
|
668 (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
|
669 temp) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
670 marker)) |
809 | 671 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
672 (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
|
673 ;; 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
|
674 (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
|
675 pos |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
676 (copy-marker pos))) |
809 | 677 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
678 (defmacro mail-extr-last (list) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
679 ;; Returns last element of LIST. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
680 ;; Could be a subst. |
809 | 681 (` (let ((list (, list))) |
682 (while (not (null (cdr list))) | |
683 (setq list (cdr list))) | |
684 (car list)))) | |
685 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
686 (defmacro mail-extr-safe-move-sexp (arg) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
687 ;; Safely skip over one balanced sexp, if there is one. Return t if success. |
809 | 688 (` (condition-case error |
689 (progn | |
690 (goto-char (scan-sexps (point) (, arg))) | |
691 t) | |
692 (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
|
693 ;; #### kludge kludge kludge kludge kludge kludge kludge !!! |
809 | 694 (if (string-equal (nth 1 error) "Unbalanced parentheses") |
695 nil | |
696 (while t | |
697 (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
|
698 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
699 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
700 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
701 ;; 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
|
702 ;; |
809 | 703 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
704 (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
|
705 (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
|
706 (defvar cend) ; dynamic assignment |
809 | 707 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
708 ;;;###autoload |
809 | 709 (defun mail-extract-address-components (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
|
710 "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
|
711 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
|
712 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
|
713 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
|
714 (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
|
715 (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
|
716 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
|
717 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
|
718 returned. Some day this function may be extended to extract multiple |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
719 addresses, or perhaps return the position at which parsing stopped." |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
720 (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
|
721 (extraction-buffer (get-buffer-create " *extract address components*")) |
809 | 722 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
|
723 ;; multiple-addresses |
809 | 724 <-pos >-pos @-pos :-pos ,-pos !-pos %-pos \;-pos |
725 group-:-pos group-\;-pos route-addr-:-pos | |
726 record-pos-symbol | |
727 first-real-pos last-real-pos | |
728 phrase-beg phrase-end | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
729 cbeg cend ; dynamically set from -voodoo |
809 | 730 quote-beg quote-end |
731 atom-beg atom-end | |
732 mbox-beg mbox-end | |
733 \.-ends-name | |
734 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
|
735 ;; 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
|
736 fi mi li ; first, middle, last initial |
809 | 737 saved-%-pos saved-!-pos saved-@-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
|
738 domain-pos \.-pos insert-point |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
739 ;; mailbox-name-processed-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
740 disable-initial-guessing-flag ; dynamically set from -voodoo |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
741 ) |
809 | 742 |
743 (save-excursion | |
744 (set-buffer 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
|
745 (fundamental-mode) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
746 (kill-all-local-variables) |
923 | 747 (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
|
748 (set-syntax-table mail-extr-address-syntax-table) |
809 | 749 (widen) |
750 (erase-buffer) | |
751 (setq case-fold-search nil) | |
752 | |
753 ;; Insert extra space at beginning to allow later replacement with < | |
754 ;; 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
|
755 (insert ?\ ) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
756 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
757 ;; 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
|
758 (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
|
759 (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
|
760 ((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
|
761 (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
|
762 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
763 (error "Illegal address: %s" address))) |
809 | 764 |
765 ;; stolen from rfc822.el | |
766 ;; Unfold multiple lines. | |
767 (goto-char (point-min)) | |
768 (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t) | |
769 (replace-match "\\1 " t)) | |
770 | |
771 ;; first pass grabs useful information about address | |
772 (goto-char (point-min)) | |
773 (while (progn | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
774 (mail-extr-skip-whitespace-forward) |
809 | 775 (not (eobp))) |
776 (setq char (char-after (point))) | |
777 (or first-real-pos | |
778 (if (not (eq char ?\()) | |
779 (setq first-real-pos (point)))) | |
780 (cond | |
781 ;; comment | |
782 ((eq 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
|
783 (set-syntax-table mail-extr-address-comment-syntax-table) |
809 | 784 ;; only record the first non-empty comment's position |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
785 (if (and (not cbeg) |
809 | 786 (save-excursion |
787 (forward-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
|
788 (mail-extr-skip-whitespace-forward) |
809 | 789 (not (eq ?\) (char-after (point)))))) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
790 (setq cbeg (point))) |
809 | 791 ;; TODO: don't record if unbalanced |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
792 (or (mail-extr-safe-move-sexp 1) |
809 | 793 (forward-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
|
794 (set-syntax-table 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
|
795 (if (and cbeg |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
796 (not cend)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
797 (setq cend (point)))) |
809 | 798 ;; quoted text |
799 ((eq char ?\") | |
800 ;; only record the first non-empty quote's position | |
801 (if (and (not quote-beg) | |
802 (save-excursion | |
803 (forward-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
|
804 (mail-extr-skip-whitespace-forward) |
809 | 805 (not (eq ?\" (char-after (point)))))) |
806 (setq quote-beg (point))) | |
807 ;; TODO: don't record if unbalanced | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
808 (or (mail-extr-safe-move-sexp 1) |
809 | 809 (forward-char 1)) |
810 (if (and quote-beg | |
811 (not quote-end)) | |
812 (setq quote-end (point)))) | |
813 ;; domain literals | |
814 ((eq 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
|
815 (set-syntax-table 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
|
816 (or (mail-extr-safe-move-sexp 1) |
809 | 817 (forward-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
|
818 (set-syntax-table mail-extr-address-syntax-table)) |
809 | 819 ;; commas delimit addresses when outside < > pairs. |
820 ((and (eq 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
|
821 (or (and (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
|
822 ;; Handle ROUTE-ADDR address that is missing its <. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
823 (not (eq ?@ (char-after (1+ (point)))))) |
809 | 824 (and >-pos |
825 ;; handle weird munged addresses | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
826 ;; BUG FIX: This test was reversed. Thanks 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
|
827 ;; brilliant Rod Whitby <rwhitby@research.canon.oz.au> |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
828 ;; for discovering this! |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
829 (< (mail-extr-last <-pos) (car >-pos))))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
830 ;; It'd be great if some day this worked, but for now, punt. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
831 ;; (setq multiple-addresses t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
832 ;; ;; *** Why do I want this: |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
833 ;; (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
|
834 ;; (narrow-to-region (point-min) (point)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
835 (delete-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
|
836 (setq char ?\() ; HAVE I NO SHAME?? |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
837 ) |
809 | 838 ;; record the position of various interesting chars, determine |
839 ;; legality later. | |
840 ((setq record-pos-symbol | |
841 (cdr (assq char | |
842 '((?< . <-pos) (?> . >-pos) (?@ . @-pos) | |
843 (?: . :-pos) (?, . ,-pos) (?! . !-pos) | |
844 (?% . %-pos) (?\; . \;-pos))))) | |
845 (set record-pos-symbol | |
846 (cons (point) (symbol-value record-pos-symbol))) | |
847 (forward-char 1)) | |
848 ((eq char ?.) | |
849 (forward-char 1)) | |
850 ((memq char '( | |
851 ;; comment terminator illegal | |
852 ?\) | |
853 ;; domain literal terminator illegal | |
854 ?\] | |
855 ;; \ allowed only within quoted strings, | |
856 ;; domain literals, and comments | |
857 ?\\ | |
858 )) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
859 (mail-extr-nuke-char-at (point)) |
809 | 860 (forward-char 1)) |
861 (t | |
862 (forward-word 1))) | |
863 (or (eq 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
|
864 ;; At the end of first address of a multiple address header. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
865 (and (eq char ?,) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
866 (eobp)) |
809 | 867 (setq last-real-pos (point)))) |
868 | |
869 ;; Use only the leftmost <, if any. Replace all others with spaces. | |
870 (while (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
|
871 (mail-extr-nuke-char-at (car <-pos)) |
809 | 872 (setq <-pos (cdr <-pos))) |
873 | |
874 ;; Use only the rightmost >, if any. Replace all others with spaces. | |
875 (while (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
|
876 (mail-extr-nuke-char-at (nth 1 >-pos)) |
809 | 877 (setcdr >-pos (nthcdr 2 >-pos))) |
878 | |
879 ;; If multiple @s and a :, but no < and >, insert around 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
|
880 ;; Example: @foo.bar.dom,@xxx.yyy.zzz:mailbox@aaa.bbb.ccc |
809 | 881 ;; This commonly happens on the UUCP "From " line. Ugh. |
882 (cond ((and (> (length @-pos) 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
|
883 (eq 1 (length :-pos)) ;TODO: check if between last two @s |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
884 (not \;-pos) |
809 | 885 (not <-pos)) |
886 (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
|
887 (mail-extr-delete-char 1) |
809 | 888 (setq <-pos (list (point))) |
889 (insert ?<))) | |
890 | |
891 ;; If < but no >, insert > in rightmost possible position | |
892 (cond ((and <-pos | |
893 (null >-pos)) | |
894 (goto-char (point-max)) | |
895 (setq >-pos (list (point))) | |
896 (insert ?>))) | |
897 | |
898 ;; If > but no <, replace > with space. | |
899 (cond ((and >-pos | |
900 (null <-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
|
901 (mail-extr-nuke-char-at (car >-pos)) |
809 | 902 (setq >-pos nil))) |
903 | |
904 ;; Turn >-pos and <-pos into non-lists | |
905 (setq >-pos (car >-pos) | |
906 <-pos (car <-pos)) | |
907 | |
908 ;; Trim other punctuation lists of items outside < > pair to handle | |
909 ;; stupid MTAs. | |
910 (cond (<-pos ; don't need to check >-pos also | |
911 ;; handle bozo software that violates RFC 822 by sticking | |
912 ;; punctuation marks outside of a < > 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
|
913 (mail-extr-nuke-outside-range @-pos <-pos >-pos t) |
809 | 914 ;; RFC 822 says nothing about these two outside < >, but |
915 ;; remove those positions from the lists to make things | |
916 ;; easier. | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
917 (mail-extr-nuke-outside-range !-pos <-pos >-pos t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
918 (mail-extr-nuke-outside-range %-pos <-pos >-pos t))) |
809 | 919 |
920 ;; Check for : that indicates GROUP list and for : part of | |
921 ;; ROUTE-ADDR spec. | |
922 ;; Can't possibly be more than two :. Nuke any extra. | |
923 (while :-pos | |
924 (setq temp (car :-pos) | |
925 :-pos (cdr :-pos)) | |
926 (cond ((and <-pos >-pos | |
927 (> temp <-pos) | |
928 (< temp >-pos)) | |
929 (if (or route-addr-:-pos | |
930 (< (length @-pos) 2) | |
931 (> temp (car @-pos)) | |
932 (< temp (nth 1 @-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
|
933 (mail-extr-nuke-char-at temp) |
809 | 934 (setq route-addr-:-pos temp))) |
935 ((or (not <-pos) | |
936 (and <-pos | |
937 (< temp <-pos))) | |
938 (setq group-:-pos temp)))) | |
939 | |
940 ;; Nuke any ; that is in or to the left of a < > pair or to the left | |
941 ;; of a GROUP starting :. Also, there may only be one ;. | |
942 (while \;-pos | |
943 (setq temp (car \;-pos) | |
944 \;-pos (cdr \;-pos)) | |
945 (cond ((and <-pos >-pos | |
946 (> temp <-pos) | |
947 (< temp >-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
|
948 (mail-extr-nuke-char-at temp)) |
809 | 949 ((and (or (not group-:-pos) |
950 (> temp group-:-pos)) | |
951 (not group-\;-pos)) | |
952 (setq group-\;-pos temp)))) | |
953 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
954 ;; Nuke unmatched GROUP syntax characters. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
955 (cond ((and group-:-pos (not group-\;-pos)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
956 ;; *** Do I really need to erase it? |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
957 (mail-extr-nuke-char-at group-:-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
958 (setq group-:-pos nil))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
959 (cond ((and group-\;-pos (not group-:-pos)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
960 ;; *** Do I really need to erase it? |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
961 (mail-extr-nuke-char-at group-\;-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
962 (setq group-\;-pos nil))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
963 |
809 | 964 ;; Handle junk like ";@host.company.dom" that sendmail adds. |
965 ;; **** should I remember comment positions? | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
966 (cond |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
967 (group-\;-pos |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
968 ;; this is fine for now |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
969 (mail-extr-nuke-outside-range !-pos group-:-pos group-\;-pos t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
970 (mail-extr-nuke-outside-range @-pos group-:-pos group-\;-pos t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
971 (mail-extr-nuke-outside-range %-pos group-:-pos group-\;-pos t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
972 (mail-extr-nuke-outside-range ,-pos group-:-pos group-\;-pos t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
973 (and last-real-pos |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
974 (> last-real-pos (1+ group-\;-pos)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
975 (setq last-real-pos (1+ group-\;-pos))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
976 ;; *** This may be wrong: |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
977 (and cend |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
978 (> cend group-\;-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
979 (setq cend nil |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
980 cbeg nil)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
981 (and quote-end |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
982 (> quote-end group-\;-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
983 (setq quote-end nil |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
984 quote-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
|
985 ;; This was both wrong and unnecessary: |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
986 ;;(narrow-to-region (point-min) group-\;-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
987 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
988 ;; *** The entire handling of GROUP addresses seems rather lame. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
989 ;; *** It deserves a complete rethink, except that these addresses |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
990 ;; *** are hardly ever seen. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
991 )) |
809 | 992 |
993 ;; Any commas must be between < and : of ROUTE-ADDR. Nuke any | |
994 ;; others. | |
995 ;; Hell, go ahead an nuke all of the commas. | |
996 ;; **** This will cause problems when we start handling commas in | |
997 ;; the PHRASE part .... no it won't ... yes it will ... ????? | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
998 (mail-extr-nuke-outside-range ,-pos 1 1) |
809 | 999 |
1000 ;; can only have multiple @s inside < >. The fact that some MTAs | |
1001 ;; put de-bracketed ROUTE-ADDRs in the UUCP-style "From " line is | |
1002 ;; handled above. | |
1003 | |
1004 ;; Locate PHRASE part of ROUTE-ADDR. | |
1005 (cond (<-pos | |
1006 (goto-char <-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
|
1007 (mail-extr-skip-whitespace-backward) |
809 | 1008 (setq phrase-end (point)) |
1009 (goto-char (or ;;group-:-pos | |
1010 (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
|
1011 (mail-extr-skip-whitespace-forward) |
809 | 1012 (if (< (point) phrase-end) |
1013 (setq phrase-beg (point)) | |
1014 (setq phrase-end nil)))) | |
1015 | |
1016 ;; handle ROUTE-ADDRS with real ROUTEs. | |
1017 ;; If there are multiple @s, then we assume ROUTE-ADDR syntax, and | |
1018 ;; any % or ! must be semantically meaningless. | |
1019 ;; TODO: do this processing into canonicalization buffer | |
1020 (cond (route-addr-:-pos | |
1021 (setq !-pos nil | |
1022 %-pos nil | |
1023 >-pos (copy-marker >-pos) | |
1024 route-addr-:-pos (copy-marker route-addr-:-pos)) | |
1025 (goto-char >-pos) | |
1026 (insert-before-markers ?X) | |
1027 (goto-char (car @-pos)) | |
1028 (while (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
|
1029 (mail-extr-delete-char 1) |
809 | 1030 (setq %-pos (cons (point-marker) %-pos)) |
1031 (insert "%") | |
1032 (goto-char (1- >-pos)) | |
1033 (save-excursion | |
1034 (insert-buffer-substring extraction-buffer | |
1035 (car @-pos) route-addr-:-pos) | |
1036 (delete-region (car @-pos) route-addr-:-pos)) | |
1037 (or (cdr @-pos) | |
1038 (setq saved-@-pos (list (point))))) | |
1039 (setq @-pos saved-@-pos) | |
1040 (goto-char >-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
|
1041 (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
|
1042 (mail-extr-nuke-char-at route-addr-:-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1043 (mail-extr-demarkerize route-addr-:-pos) |
809 | 1044 (setq route-addr-:-pos 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
|
1045 >-pos (mail-extr-demarkerize >-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1046 %-pos (mapcar 'mail-extr-demarkerize %-pos)))) |
809 | 1047 |
1048 ;; de-listify @-pos | |
1049 (setq @-pos (car @-pos)) | |
1050 | |
1051 ;; TODO: remove comments in the middle of an address | |
1052 | |
1053 (set-buffer canonicalization-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
|
1054 (fundamental-mode) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1055 (kill-all-local-variables) |
923 | 1056 (buffer-disable-undo canonicalization-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
|
1057 (set-syntax-table mail-extr-address-syntax-table) |
809 | 1058 (setq case-fold-search nil) |
1059 | |
1060 (widen) | |
1061 (erase-buffer) | |
1062 (insert-buffer-substring extraction-buffer) | |
1063 | |
1064 (if <-pos | |
1065 (narrow-to-region (progn | |
1066 (goto-char (1+ <-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
|
1067 (mail-extr-skip-whitespace-forward) |
809 | 1068 (point)) |
1069 >-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
|
1070 (if (and first-real-pos last-real-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1071 (narrow-to-region first-real-pos last-real-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1072 ;; ****** Oh no! What if the address is completely empty! |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1073 ;; *** Is this correct? |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1074 (narrow-to-region (point-max) (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
|
1075 )) |
809 | 1076 |
1077 (and @-pos %-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
|
1078 (mail-extr-nuke-outside-range %-pos (point-min) @-pos)) |
809 | 1079 (and %-pos !-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
|
1080 (mail-extr-nuke-outside-range !-pos (point-min) (car %-pos))) |
809 | 1081 (and @-pos !-pos (not %-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
|
1082 (mail-extr-nuke-outside-range !-pos (point-min) @-pos)) |
809 | 1083 |
1084 ;; Error condition:?? (and %-pos (not @-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
|
1085 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1086 ;; WARNING: THIS CODE IS DUPLICATED BELOW. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1087 (cond ((and %-pos |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1088 (not @-pos)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1089 (goto-char (car %-pos)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1090 (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
|
1091 (setq @-pos (point)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1092 (insert "@") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1093 (setq %-pos (cdr %-pos)))) |
809 | 1094 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1095 (if mail-extr-mangle-uucp |
809 | 1096 (cond (!-pos |
1097 ;; **** I don't understand this save-restriction and the | |
1098 ;; narrow-to-region inside it. Why did I do that? | |
1099 (save-restriction | |
1100 (cond ((and @-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
|
1101 mail-extr-@-binds-tighter-than-!) |
809 | 1102 (goto-char @-pos) |
1103 (setq %-pos (cons (point) %-pos) | |
1104 @-pos 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
|
1105 (mail-extr-delete-char 1) |
809 | 1106 (insert "%") |
1107 (setq insert-point (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
|
1108 (mail-extr-@-binds-tighter-than-! |
809 | 1109 (setq insert-point (point-max))) |
1110 (%-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
|
1111 (setq insert-point (mail-extr-last %-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1112 saved-%-pos (mapcar 'mail-extr-markerize %-pos) |
809 | 1113 %-pos 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
|
1114 @-pos (mail-extr-markerize @-pos))) |
809 | 1115 (@-pos |
1116 (setq insert-point @-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
|
1117 (setq @-pos (mail-extr-markerize @-pos))) |
809 | 1118 (t |
1119 (setq insert-point (point-max)))) | |
1120 (narrow-to-region (point-min) insert-point) | |
1121 (setq saved-!-pos (car !-pos)) | |
1122 (while !-pos | |
1123 (goto-char (point-max)) | |
1124 (cond ((and (not @-pos) | |
1125 (not (cdr !-pos))) | |
1126 (setq @-pos (point)) | |
1127 (insert-before-markers "@ ")) | |
1128 (t | |
1129 (setq %-pos (cons (point) %-pos)) | |
1130 (insert-before-markers "% "))) | |
1131 (backward-char 1) | |
1132 (insert-buffer-substring | |
1133 (current-buffer) | |
1134 (if (nth 1 !-pos) | |
1135 (1+ (nth 1 !-pos)) | |
1136 (point-min)) | |
1137 (car !-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
|
1138 (mail-extr-delete-char 1) |
809 | 1139 (or (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
|
1140 (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
|
1141 (mail-extr-skip-whitespace-backward) |
809 | 1142 (eq ?. (preceding-char))) |
1143 (insert-before-markers | |
1144 (if (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
|
1145 (mail-extr-skip-whitespace-backward) |
809 | 1146 (eq ?. (preceding-char))) |
1147 "" | |
1148 ".") | |
1149 "uucp")) | |
1150 (setq !-pos (cdr !-pos)))) | |
1151 (and saved-%-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
|
1152 (setq %-pos (append (mapcar 'mail-extr-demarkerize |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1153 saved-%-pos) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1154 %-pos))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1155 (setq @-pos (mail-extr-demarkerize @-pos)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1156 (narrow-to-region (1+ saved-!-pos) (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
|
1157 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1158 ;; WARNING: THIS CODE IS DUPLICATED ABOVE. |
809 | 1159 (cond ((and %-pos |
1160 (not @-pos)) | |
1161 (goto-char (car %-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
|
1162 (mail-extr-delete-char 1) |
809 | 1163 (setq @-pos (point)) |
1164 (insert "@") | |
1165 (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
|
1166 |
809 | 1167 (setq %-pos (nreverse %-pos)) |
1168 ;; RFC 1034 doesn't approve of this, oh well: | |
1169 (downcase-region (or (car %-pos) @-pos (point-max)) (point-max)) | |
1170 (cond (%-pos ; implies @-pos valid | |
1171 (setq temp %-pos) | |
1172 (catch 'truncated | |
1173 (while temp | |
1174 (goto-char (or (nth 1 temp) | |
1175 @-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
|
1176 (mail-extr-skip-whitespace-backward) |
809 | 1177 (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
|
1178 (mail-extr-safe-move-sexp -1) |
809 | 1179 (setq domain-pos (point)) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1180 (mail-extr-skip-whitespace-backward) |
809 | 1181 (setq \.-pos (eq ?. (preceding-char)))) |
1182 (cond ((and \.-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
|
1183 ;; #### string consing |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1184 (let ((s (intern-soft |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1185 (buffer-substring domain-pos (point)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1186 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
|
1187 (and s (get s 'domain-name)))) |
809 | 1188 (narrow-to-region (point-min) (point)) |
1189 (goto-char (car 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
|
1190 (mail-extr-delete-char 1) |
809 | 1191 (setq @-pos (point)) |
1192 (setcdr temp nil) | |
1193 (setq %-pos (delq @-pos %-pos)) | |
1194 (insert "@") | |
1195 (throw 'truncated t))) | |
1196 (setq temp (cdr temp)))))) | |
1197 (setq mbox-beg (point-min) | |
1198 mbox-end (if %-pos (car %-pos) | |
1199 (or @-pos | |
1200 (point-max)))) | |
1201 | |
1202 ;; Done canonicalizing address. | |
1203 | |
1204 (set-buffer extraction-buffer) | |
1205 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1206 ;; Decide what part of the address to search to find the full name. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1207 (cond ( |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1208 ;; Example: "First M. Last" <fml@foo.bar.dom> |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1209 (and phrase-beg |
809 | 1210 (eq quote-beg phrase-beg) |
1211 (<= quote-end phrase-end)) | |
1212 (narrow-to-region (1+ quote-beg) (1- quote-end)) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1213 (mail-extr-undo-backslash-quoting (point-min) (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
|
1214 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1215 ;; Example: First Last <fml@foo.bar.dom> |
809 | 1216 (phrase-beg |
1217 (narrow-to-region phrase-beg phrase-end)) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1218 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1219 ;; 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
|
1220 (cbeg |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1221 (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
|
1222 (mail-extr-undo-backslash-quoting (point-min) (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
|
1223 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1224 ;; Deal with spacing problems |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1225 (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
|
1226 ; (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
|
1227 ; (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
|
1228 ; (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
|
1229 ; ;; 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
|
1230 ; ;; 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
|
1231 ; (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
|
1232 ; (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
|
1233 ; (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
|
1234 ; ((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
|
1235 ; ;; 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
|
1236 ; ;; 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
|
1237 ; (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
|
1238 ; (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
|
1239 ; (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
|
1240 ) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1241 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1242 ;; Otherwise we try to get the name from the mailbox portion |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1243 ;; of 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
|
1244 ;; Example: First_M_Last@foo.bar.dom |
809 | 1245 (t |
1246 ;; *** Work in canon buffer instead? No, can't. Hmm. | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1247 (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
|
1248 (narrow-to-region (point) (point)) |
809 | 1249 (insert-buffer-substring canonicalization-buffer |
1250 mbox-beg mbox-end) | |
1251 (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
|
1252 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1253 ;; Example: First_Last.XXX@foo.bar.dom |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1254 (setq \.-ends-name (re-search-forward "[_0-9]" 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
|
1255 |
809 | 1256 (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
|
1257 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1258 (if (not mail-extr-mangle-uucp) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1259 (modify-syntax-entry ?! "w" (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
|
1260 |
809 | 1261 (while (progn |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1262 (mail-extr-skip-whitespace-forward) |
809 | 1263 (not (eobp))) |
1264 (setq char (char-after (point))) | |
1265 (cond | |
1266 ((eq char ?\") | |
1267 (setq quote-beg (point)) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1268 (or (mail-extr-safe-move-sexp 1) |
809 | 1269 ;; TODO: handle this error condition!!!!! |
1270 (forward-char 1)) | |
1271 ;; take into account deletions | |
1272 (setq quote-end (- (point) 2)) | |
1273 (save-excursion | |
1274 (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
|
1275 (mail-extr-delete-char 1) |
809 | 1276 (goto-char quote-beg) |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1277 (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
|
1278 (mail-extr-undo-backslash-quoting quote-beg quote-end) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1279 (or (eq ?\ (char-after (point))) |
809 | 1280 (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
|
1281 ;; (setq mailbox-name-processed-flag t) |
809 | 1282 (setq \.-ends-name t)) |
1283 ((eq 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
|
1284 (if (memq (char-after (1+ (point))) '(?_ ?=)) |
809 | 1285 (progn |
1286 (forward-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
|
1287 (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
|
1288 (insert ?\ )) |
809 | 1289 (if \.-ends-name |
1290 (narrow-to-region (point-min) (point)) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1291 (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
|
1292 (insert " "))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1293 ;; (setq mailbox-name-processed-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
|
1294 ) |
809 | 1295 ((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
|
1296 (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
|
1297 (insert " ") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1298 ;; (setq mailbox-name-processed-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
|
1299 ) |
809 | 1300 (t |
1301 (setq atom-beg (point)) | |
1302 (forward-word 1) | |
1303 (setq atom-end (point)) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1304 (goto-char atom-beg) |
809 | 1305 (save-restriction |
1306 (narrow-to-region atom-beg atom-end) | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1307 (cond |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1308 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1309 ;; Handle X.400 addresses encoded in RFC-822. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1310 ;; *** Shit! This has to handle the case where it is |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1311 ;; *** embedded in a quote too! |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1312 ;; *** Shit! The input is being broken up into atoms |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1313 ;; *** by periods! |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1314 ((looking-at 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
|
1315 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1316 ;; Copy the contents of the individual fields that |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1317 ;; might hold name data to the beginning. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1318 (mapcar |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1319 (function |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1320 (lambda (field-pattern) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1321 (cond |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1322 ((save-excursion |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1323 (re-search-forward field-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
|
1324 (insert-buffer-substring (current-buffer) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1325 (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
|
1326 (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
|
1327 (insert " "))))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1328 (list 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
|
1329 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
|
1330 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
|
1331 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1332 ;; Discard the rest, since it contains stuff like |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1333 ;; routing information, not part of 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
|
1334 (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
|
1335 (delete-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
|
1336 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1337 ;; Handle periods used for spacing. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1338 (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
|
1339 (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
|
1340 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1341 ;; (setq mailbox-name-processed-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
|
1342 ) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1343 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1344 ;; Handle normal addresses. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1345 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1346 (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
|
1347 ;; Handle _ and = used for spacing. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1348 (while (re-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
|
1349 (replace-match "\\1 " t) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1350 ;; (setq mailbox-name-processed-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
|
1351 ) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1352 (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
|
1353 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1354 ;; undo the dirty deed |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1355 (if (not mail-extr-mangle-uucp) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1356 (modify-syntax-entry ?! "." (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
|
1357 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1358 ;; If we derived the name from the mailbox part of 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
|
1359 ;; and we only got one word out of it, don't treat that 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
|
1360 ;; name. "foo@bar" --> (nil "foo@bar"), not ("foo" "foo@bar") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1361 ;; (if (not mailbox-name-processed-flag) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1362 ;; (delete-region (point-min) (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
|
1363 )) |
809 | 1364 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1365 (set-syntax-table mail-extr-address-text-syntax-table) |
809 | 1366 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1367 (mail-extr-voodoo mbox-beg mbox-end canonicalization-buffer) |
809 | 1368 (goto-char (point-min)) |
1369 | |
1370 ;; If name is "First Last" and userid is "F?L", then assume | |
1371 ;; the middle initial is the second letter in the userid. | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1372 ;; Initial code by 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
|
1373 ;; *** Make it work when there's a suffix as well. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1374 (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
|
1375 (cond ((and mail-extr-guess-middle-initial |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1376 (not disable-initial-guessing-flag) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1377 (eq 3 (- mbox-end mbox-beg)) |
809 | 1378 (progn |
1379 (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
|
1380 (looking-at mail-extr-two-name-pattern))) |
809 | 1381 (setq fi (char-after (match-beginning 0)) |
1382 li (char-after (match-beginning 3))) | |
1383 (save-excursion | |
1384 (set-buffer canonicalization-buffer) | |
1385 ;; char-equal is ignoring case here, so no need to upcase | |
1386 ;; or downcase. | |
1387 (let ((case-fold-search t)) | |
1388 (and (char-equal fi (char-after mbox-beg)) | |
1389 (char-equal li (char-after (1- mbox-end))) | |
1390 (setq mi (char-after (1+ mbox-beg)))))) | |
1391 (cond ((and mi | |
1392 ;; TODO: use better table than syntax table | |
1393 (eq ?w (char-syntax mi))) | |
1394 (goto-char (match-beginning 3)) | |
1395 (insert (upcase mi) ". "))))) | |
1396 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1397 ;; Nuke name if it is the same as 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
|
1398 (let ((buffer-length (- (point-max) (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
|
1399 (i 0) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1400 (names-match-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
|
1401 (cond ((and (> buffer-length 0) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1402 (eq buffer-length (- mbox-end mbox-beg))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1403 (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
|
1404 (insert-buffer-substring 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
|
1405 mbox-beg mbox-end) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1406 (while (and names-match-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1407 (< i buffer-length)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1408 (or (eq (downcase (char-after (+ i (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
|
1409 (downcase |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1410 (char-after (+ i buffer-length (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
|
1411 (setq names-match-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
|
1412 (setq i (1+ i))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1413 (delete-region (+ (point-min) buffer-length) (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
|
1414 (if names-match-flag |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1415 (narrow-to-region (point) (point)))))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1416 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1417 ;; Nuke name if it's just one word. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1418 (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
|
1419 (and mail-extr-ignore-single-names |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1420 (not (re-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
|
1421 (narrow-to-region (point) (point))) |
809 | 1422 |
1423 ;; Result | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1424 (list (if (not (= (point-min) (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
|
1425 (buffer-string)) |
809 | 1426 (progn |
1427 (set-buffer canonicalization-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
|
1428 (if (not (= (point-min) (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
|
1429 (buffer-string)))) |
809 | 1430 ))) |
1431 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1432 (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
|
1433 (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
|
1434 (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
|
1435 mixed-case-flag lower-case-flag ;;upper-case-flag |
809 | 1436 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
|
1437 ;;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
|
1438 initial |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1439 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
|
1440 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
|
1441 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
|
1442 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
|
1443 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
|
1444 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
|
1445 name-done-flag |
809 | 1446 ) |
1447 (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
|
1448 (set-syntax-table mail-extr-address-text-syntax-table) |
809 | 1449 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1450 ;; This was moved above. |
809 | 1451 ;; 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
|
1452 ;; 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
|
1453 ;; 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
|
1454 ;; 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
|
1455 ;; "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
|
1456 ;;(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
|
1457 ;;(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
|
1458 ;; (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
|
1459 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1460 (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
|
1461 (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
|
1462 (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
|
1463 ;; 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
|
1464 ;; 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
|
1465 (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
|
1466 (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
|
1467 (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
|
1468 ((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
|
1469 ;; 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
|
1470 ;; 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
|
1471 (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
|
1472 (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
|
1473 (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
|
1474 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1475 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1476 ;; Loop over the words (and other junk) in the name. |
809 | 1477 (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
|
1478 (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
|
1479 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1480 (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
|
1481 ;; 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
|
1482 (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
|
1483 (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
|
1484 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
|
1485 (setq word-found-flag nil))) |
809 | 1486 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1487 (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
|
1488 ;; 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
|
1489 ;; 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
|
1490 ;; 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
|
1491 (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
|
1492 (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
|
1493 (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
|
1494 (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
|
1495 (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
|
1496 ;; (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
|
1497 (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
|
1498 )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1499 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1500 ;; 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
|
1501 (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
|
1502 (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
|
1503 (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
|
1504 (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
|
1505 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1506 ;; 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
|
1507 (cond |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1508 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1509 ;; 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
|
1510 ((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
|
1511 (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
|
1512 (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
|
1513 (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
|
1514 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1515 ;; 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
|
1516 ((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
|
1517 (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
|
1518 (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
|
1519 (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
|
1520 (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
|
1521 (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
|
1522 (insert ?,)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1523 ;; 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
|
1524 (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
|
1525 (insert ?\ )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1526 (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
|
1527 (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
|
1528 (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
|
1529 (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
|
1530 (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
|
1531 (insert ?.))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1532 (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 (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
|
1534 (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
|
1535 (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
|
1536 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1537 ;; 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
|
1538 ((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
|
1539 (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
|
1540 (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
|
1541 (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
|
1542 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1543 ;; 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
|
1544 ((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
|
1545 (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
|
1546 (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
|
1547 (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
|
1548 (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
|
1549 (insert ?\ ))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1550 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1551 ;; 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
|
1552 ;; 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
|
1553 ;; *** 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
|
1554 ;;((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
|
1555 ;; (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
|
1556 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1557 ;; 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
|
1558 ((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
|
1559 (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
|
1560 (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
|
1561 (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
|
1562 (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
|
1563 (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
|
1564 (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
|
1565 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1566 (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
|
1567 (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
|
1568 (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
|
1569 (setq cend (point)) |
809 | 1570 (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
|
1571 ;; Handle case of entire name being quoted |
809 | 1572 ((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
|
1573 (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
|
1574 (>= (- 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
|
1575 (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
|
1576 (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
|
1577 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1578 ;; 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
|
1579 (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
|
1580 (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
|
1581 (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
|
1582 (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
|
1583 (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
|
1584 (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
|
1585 (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
|
1586 (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
|
1587 (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
|
1588 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1589 ;; Handle & substitution |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1590 ((and (or (bobp) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1591 (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
|
1592 (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
|
1593 (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
|
1594 (capitalize-region |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1595 (point) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1596 (progn |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1597 (insert-buffer-substring 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
|
1598 mbox-beg mbox-end) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1599 (point))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1600 (setq disable-initial-guessing-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
|
1601 (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
|
1602 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1603 ;; 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
|
1604 ((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
|
1605 (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
|
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 ;; 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
|
1608 ((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
|
1609 (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
|
1610 (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
|
1611 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1612 ;; 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
|
1613 ;; 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
|
1614 ((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
|
1615 (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
|
1616 (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
|
1617 ;; *** 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
|
1618 ;; (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
|
1619 (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
|
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 ;; 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
|
1622 ((or |
809 | 1623 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1624 ;; 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
|
1625 ;; 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
|
1626 (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
|
1627 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
|
1628 (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
|
1629 (not (looking-at mail-extr-roman-numeral-pattern))) |
809 | 1630 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1631 ;; 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
|
1632 (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
|
1633 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1634 ;; 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
|
1635 ;; 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
|
1636 (looking-at mail-extr-trailing-comment-start-pattern) |
809 | 1637 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1638 ;; 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
|
1639 (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
|
1640 (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
|
1641 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1642 ;; 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
|
1643 ((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
|
1644 (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
|
1645 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1646 ;; 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
|
1647 ((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
|
1648 (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
|
1649 (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
|
1650 (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
|
1651 (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
|
1652 (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
|
1653 (insert ?.)) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1654 (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
|
1655 (insert ?\ )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1656 (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
|
1657 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1658 ;; 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
|
1659 ((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
|
1660 (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
|
1661 (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
|
1662 (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
|
1663 (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
|
1664 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1665 ;; 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
|
1666 ((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
|
1667 (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
|
1668 (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
|
1669 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1670 ;; 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
|
1671 (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
|
1672 (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
|
1673 (or |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1674 ;; 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
|
1675 ;; 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
|
1676 (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
|
1677 ;; 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
|
1678 (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
|
1679 (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
|
1680 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1681 ;; 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
|
1682 ;; 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
|
1683 (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
|
1684 (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
|
1685 (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
|
1686 (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
|
1687 (setq mixed-case-flag t) |
809 | 1688 (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
|
1689 ;; (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
|
1690 ) |
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 (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
|
1693 (setq word-found-flag t)) |
809 | 1694 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1695 (t |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1696 (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
|
1697 )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1698 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1699 ;; 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
|
1700 (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
|
1701 (setq word-count (1+ word-count)))) |
809 | 1702 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1703 ;; 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
|
1704 ;; other sentence terminators (but not a single period) then keep them |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1705 ;; and the preceeding word. This is for the benefit of whole sentences |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1706 ;; 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
|
1707 ;; 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
|
1708 (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
|
1709 (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
|
1710 (goto-char (setq suffix-flag (point-max)))) |
809 | 1711 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1712 ;; 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
|
1713 (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
|
1714 (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
|
1715 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
|
1716 (point))) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1717 |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1718 ;; 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
|
1719 ;; 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
|
1720 ;; 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
|
1721 ;; 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
|
1722 ;; 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
|
1723 ;; actually know that that is what's going on. |
809 | 1724 (cond ((not suffix-flag) |
1725 (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
|
1726 (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
|
1727 (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
|
1728 (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
|
1729 |
809 | 1730 ;; If last name first put it at end (but before suffix) |
1731 (cond (last-name-comma-flag | |
1732 (goto-char (point-min)) | |
1733 (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
|
1734 (setq name-end (1- (point))) |
809 | 1735 (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
|
1736 (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
|
1737 (insert ?\ )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1738 (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
|
1739 (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
|
1740 (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
|
1741 (narrow-to-region (point) (point-max)))) |
809 | 1742 |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1743 ;; Delete leading and trailing junk characters. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1744 ;; *** This is probably completly unneeded now. |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1745 ;;(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
|
1746 ;;(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
|
1747 ;;(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
|
1748 ;; (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
|
1749 ;;(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
|
1750 ;; (progn |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1751 ;; (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
|
1752 ;; (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
|
1753 ;; (point))) |
809 | 1754 |
1755 ;; Compress whitespace | |
1756 (goto-char (point-min)) | |
1757 (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
|
1758 (replace-match (if (eobp) "" " ") t)) |
809 | 1759 ))) |
1760 | |
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 |
809 | 1762 |
7060
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 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1765 ;; 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
|
1766 ;; |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1767 ;; This is used during address canonicalization; be careful of format changes. |
809 | 1768 ;; Keep in mind that the country abbreviations follow ISO-3166. There is |
1769 ;; a U.S. FIPS that specifies a different set of two-letter country | |
1770 ;; abbreviations. | |
1771 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1772 (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
|
1773 (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
|
1774 (mapcar |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1775 (function |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1776 (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
|
1777 (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
|
1778 '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
|
1779 (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
|
1780 (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
|
1781 (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
|
1782 '(("ag" "Antigua") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1783 ("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
|
1784 ("arpa" t "Advanced Projects Research Agency") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1785 ("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
|
1786 ("au" "Australia") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1787 ("bb" "Barbados") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1788 ("be" "Belgium" "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
|
1789 ("bg" "Bulgaria") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1790 ("bitnet" t "Because It's Time NET") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1791 ("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
|
1792 ("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
|
1793 ("bs" "Bahamas") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1794 ("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
|
1795 ("ca" "Canada") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1796 ("ch" "Switzerland" "The Swiss Confederation") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1797 ("cl" "Chile" "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
|
1798 ("cn" "China" "The People's 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
|
1799 ("co" "Columbia") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1800 ("com" t "Commercial") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1801 ("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
|
1802 ("cs" "Czechoslovakia") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1803 ("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
|
1804 ("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
|
1805 ("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
|
1806 ("do" "Dominican Republic" "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
|
1807 ("ec" "Ecuador" "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
|
1808 ("edu" t "Educational") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1809 ("eg" "Egypt" "The Arab 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
|
1810 ("es" "Spain" "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
|
1811 ("fi" "Finland" "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
|
1812 ("fj" "Fiji") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1813 ("fr" "France") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1814 ("gov" t "Government (U.S.A.)") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1815 ("gr" "Greece" "The Hellenic Republic (%s)") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1816 ("hk" "Hong Kong") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1817 ("hu" "Hungary" "The Hungarian People's Republic") ;??? |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1818 ("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
|
1819 ("il" "Israel" "The State 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
|
1820 ("in" "India" "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
|
1821 ("int" t "(something British, don't know what)") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1822 ("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
|
1823 ("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
|
1824 ("jm" "Jamaica") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1825 ("jp" "Japan") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1826 ("kn" "St. Kitts and Nevis") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1827 ("kr" "South Korea") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1828 ("lc" "St. Lucia") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1829 ("lk" "Sri Lanka" "The Democratic Socialist 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
|
1830 ("mil" t "Military (U.S.A.)") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1831 ("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
|
1832 ("my" "Malaysia" "%s (changed to Myanmar?)") ;??? |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1833 ("na" "Namibia") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1834 ("nato" t "North Atlantic Treaty Organization") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1835 ("net" t "Network") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1836 ("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
|
1837 ("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
|
1838 ("no" "Norway" "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
|
1839 ("nz" "New Zealand") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1840 ("org" t "Organization") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1841 ("pe" "Peru") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1842 ("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
|
1843 ("ph" "Philippines" "The Republic 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
|
1844 ("pl" "Poland") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1845 ("pr" "Puerto Rico") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1846 ("pt" "Portugal" "The Portugese Republic") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1847 ("py" "Paraguay") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1848 ("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
|
1849 ("sg" "Singapore" "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
|
1850 ("sr" "Suriname") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1851 ("su" "Soviet Union") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1852 ("th" "Thailand" "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
|
1853 ("tn" "Tunisia") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1854 ("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
|
1855 ("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
|
1856 ("tw" "Taiwan") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1857 ("uk" "United Kingdom" "The %s of Great Britain") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1858 ("unter-dom" t "(something German)") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1859 ("us" "U.S.A." "The United States of America") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1860 ("uucp" t "Unix to Unix CoPy") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1861 ("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
|
1862 ("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
|
1863 ("ve" "Venezuela" "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
|
1864 ("yu" "Yugoslavia" "The Socialist Federal 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 ;; Also said to be Zambia ... (why not Zaire???) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1866 ("za" "South Africa" "The Republic of %s (or Zambia? Zaire?)") |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1867 ("zw" "Zimbabwe" "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
|
1868 ;; fipnet |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1869 )) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1870 ob)) |
809 | 1871 |
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 ;;;###autoload |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1873 (defun what-domain (domain) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1874 "Convert mail domain to country tit corresponds to." |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1875 (interactive |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1876 (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
|
1877 (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
|
1878 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
|
1879 (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
|
1880 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
|
1881 (error "no such domain")) |
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1882 (message "%s: %s" (upcase (symbol-name domain)) (get domain 'domain-name))) |
809 | 1883 |
1884 | |
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 ;(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
|
1886 ; (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
|
1887 ; (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
|
1888 ; (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
|
1889 ; (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
|
1890 ; (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
|
1891 ; (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
|
1892 ; (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
|
1893 ; (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
|
1894 ; all)))) |
809 | 1895 |
1896 | |
7060
58d613f69b39
(mail-extr-all-top-level-domains): Renamed from all-top-level-domains.
Richard M. Stallman <rms@gnu.org>
parents:
1186
diff
changeset
|
1897 (provide 'mail-extr) |
809 | 1898 |
1899 ;;; mail-extr.el ends here |