APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1490219755 0
# Wed Mar 22 21:55:55 2017 +0000
# Node ID d85eeaca795d9c459be7f6b369b8a544a7de56d5
# Parent 7c59d90e8c3957eb3dc3ac85e732c42ac448ed1f
Make `mail-extr-all-top-level-domains' into a hash-table literal, mail-extr.el
ChangeLog addition:
2017-03-22 Aidan Kehoe <kehoea(a)parhasard.net>
* mail-extr.el:
* mail-extr.el (require):
* mail-extr.el (mail-extract-address-components):
* mail-extr.el (mail-extr-all-top-level-domains):
* mail-extr.el (what-domain):
Make `mail-extr-all-top-level-domains' into a hash-table literal
created at macro-expansion time, rather than an obarray created at
load time, for the sake of not calling #'format a bunch of times
at load time, something that recently started complaining about
extra arguments on debug XEmacs builds. This also gives a slight
speedup.
Use the hash table functions in order to do this.
Handle those versions of XEmacs where #'completing-read isn't
compatible with a hash-table COLLECTION within
diff -r 7c59d90e8c39 -r d85eeaca795d ChangeLog
--- a/ChangeLog Wed Mar 22 20:43:34 2017 +0000
+++ b/ChangeLog Wed Mar 22 21:55:55 2017 +0000
@@ -1,3 +1,20 @@
+2017-03-22 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * mail-extr.el:
+ * mail-extr.el (require):
+ * mail-extr.el (mail-extract-address-components):
+ * mail-extr.el (mail-extr-all-top-level-domains):
+ * mail-extr.el (what-domain):
+ Make `mail-extr-all-top-level-domains' into a hash-table literal
+ created at macro-expansion time, rather than an obarray created at
+ load time, for the sake of not calling #'format a bunch of times
+ at load time, something that recently started complaining about
+ extra arguments on debug XEmacs builds. This also gives a slight
+ speedup.
+ Use the hash table functions in order to do this.
+ Handle those versions of XEmacs where #'completing-read isn't
+ compatible with a hash-table COLLECTION within
+
2017-03-22 Aidan Kehoe <kehoea(a)parhasard.net>
* mail-extr.el:
diff -r 7c59d90e8c39 -r d85eeaca795d mail-extr.el
--- a/mail-extr.el Wed Mar 22 20:43:34 2017 +0000
+++ b/mail-extr.el Wed Mar 22 21:55:55 2017 +0000
@@ -212,6 +212,8 @@
(if (featurep 'xemacs) ;; Purespace obsolete in XEmacs.
(define-compiler-macro purecopy (&whole form argument) argument)))
+(eval-when-compile (require 'cl))
+
(defgroup mail-extr nil
"Extract full name and address from RFC 822 mail header."
:prefix "mail-extr-"
@@ -1201,10 +1203,8 @@
(setq \.-pos (eq ?. (preceding-char))))
(when (and \.-pos
;; #### string consing
- (let ((s (intern-soft
- (buffer-substring domain-pos (point))
- mail-extr-all-top-level-domains)))
- (and s (get s 'domain-name))))
+ (gethash (buffer-substring domain-pos (point))
+ mail-extr-all-top-level-domains))
(narrow-to-region (point-min) (point))
(goto-char (car temp))
(delete-char 1)
@@ -1883,308 +1883,315 @@
;; Latest change: 2007/11/15
(defconst mail-extr-all-top-level-domains
- (let ((ob (make-vector 739 0)))
- (mapc
- (lambda (x)
- (put (intern (downcase (car x)) ob)
- 'domain-name
- (if (nth 2 x)
- (format (nth 2 x) (nth 1 x))
- (nth 1 x))))
- '(
- ;; ISO 3166 codes:
- ("ac" "Ascension Island")
- ("ad" "Andorra")
- ("ae" "United Arab Emirates")
- ("af" "Afghanistan")
- ("ag" "Antigua and Barbuda")
- ("ai" "Anguilla")
- ("al" "Albania")
- ("am" "Armenia")
- ("an" "Netherlands Antilles")
- ("ao" "Angola")
- ("aq" "Antarctica") ; continent
- ("ar" "Argentina" "Argentine Republic")
- ("as" "American Samoa")
- ("at" "Austria" "The Republic of %s")
- ("au" "Australia")
- ("aw" "Aruba")
- ("ax" "Aland Islands")
- ("az" "Azerbaijan")
- ("ba" "Bosnia-Herzegovina")
- ("bb" "Barbados")
- ("bd" "Bangladesh")
- ("be" "Belgium" "The Kingdom of %s")
- ("bf" "Burkina Faso")
- ("bg" "Bulgaria")
- ("bh" "Bahrain")
- ("bi" "Burundi")
- ("bj" "Benin")
- ("bl" "Saint Barthelemy")
- ("bm" "Bermuda")
- ("bn" "Brunei Darussalam")
- ("bo" "Bolivia" "Republic of %s")
- ("br" "Brazil" "The Federative Republic of %s")
- ("bs" "Bahamas")
- ("bt" "Bhutan")
- ("bv" "Bouvet Island")
- ("bw" "Botswana")
- ("by" "Belarus")
- ("bz" "Belize")
- ("ca" "Canada")
- ("cc" "Cocos (Keeling) Islands")
- ("cd" "Congo" "The Democratic Republic of the
%s")
- ("cf" "Central African Republic")
- ("cg" "Congo")
- ("ch" "Switzerland" "The Swiss Confederation")
- ("ci" "Ivory Coast") ; Cote D'ivoire
- ("ck" "Cook Islands")
- ("cl" "Chile" "The Republic of %s")
- ("cm" "Cameroon") ; In .fr domain
- ("cn" "China" "The People's Republic of %s")
- ("co" "Colombia")
- ("cr" "Costa Rica" "The Republic of %s")
- ("cu" "Cuba")
- ("cv" "Cape Verde")
- ("cx" "Christmas Island")
- ("cy" "Cyprus")
- ("cz" "Czech Republic")
- ("de" "Germany")
- ("dj" "Djibouti")
- ("dk" "Denmark")
- ("dm" "Dominica")
- ("do" "Dominican Republic" "The %s")
- ("dz" "Algeria")
- ("ec" "Ecuador" "The Republic of %s")
- ("ee" "Estonia")
- ("eg" "Egypt" "The Arab Republic of %s")
- ("eh" "Western Sahara")
- ("er" "Eritrea")
- ("es" "Spain" "The Kingdom of %s")
- ("et" "Ethiopia")
- ("eu" "European Union")
- ("fi" "Finland" "The Republic of %s")
- ("fj" "Fiji")
- ("fk" "Falkland Islands (Malvinas)")
- ("fm" "Micronesia" "Federated States of %s")
- ("fo" "Faroe Islands")
- ("fr" "France")
- ("ga" "Gabon")
- ("gb" "United Kingdom")
- ("gd" "Grenada")
- ("ge" "Georgia")
- ("gf" "French Guiana")
- ("gg" "Guernsey")
- ("gh" "Ghana")
- ("gi" "Gibraltar")
- ("gl" "Greenland")
- ("gm" "Gambia")
- ("gn" "Guinea")
- ("gp" "Guadeloupe (Fr.)")
- ("gq" "Equatorial Guinea")
- ("gr" "Greece" "The Hellenic Republic (%s)")
- ("gs" "South Georgia and The South Sandwich Islands")
- ("gt" "Guatemala")
- ("gu" "Guam (U.S.)")
- ("gw" "Guinea-Bissau")
- ("gy" "Guyana")
- ("hk" "Hong Kong")
- ("hm" "Heard Island and McDonald Islands")
- ("hn" "Honduras")
- ("hr" "Croatia" "Croatia (Hrvatska)")
- ("ht" "Haiti")
- ("hu" "Hungary" "The Hungarian Republic")
- ("id" "Indonesia")
- ("ie" "Ireland")
- ("il" "Israel" "The State of %s")
- ("im" "Isle of Man" "The %s") ; NOT in ISO 3166-1 of
2001-02-26
- ("in" "India" "The Republic of %s")
- ("io" "British Indian Ocean Territory")
- ("iq" "Iraq")
- ("ir" "Iran" "Islamic Republic of %s")
- ("is" "Iceland" "The Republic of %s")
- ("it" "Italy" "The Italian Republic")
- ("je" "Jersey")
- ("jm" "Jamaica")
- ("jo" "Jordan")
- ("jp" "Japan")
- ("ke" "Kenya")
- ("kg" "Kyrgyzstan")
- ("kh" "Cambodia")
- ("ki" "Kiribati")
- ("km" "Comoros")
- ("kn" "Saint Kitts and Nevis")
- ("kp" "Korea (North)" "Democratic People's Republic
of Korea")
- ("kr" "Korea (South)" "Republic of Korea")
- ("kw" "Kuwait")
- ("ky" "Cayman Islands")
- ("kz" "Kazakhstan")
- ("la" "Lao People's Democratic Republic")
- ("lb" "Lebanon")
- ("lc" "Saint Lucia")
- ("li" "Liechtenstein")
- ("lk" "Sri Lanka" "The Democratic Socialist Republic of
%s")
- ("lr" "Liberia")
- ("ls" "Lesotho")
- ("lt" "Lithuania")
- ("lu" "Luxembourg")
- ("lv" "Latvia")
- ("ly" "Libyan Arab Jamahiriya")
- ("ma" "Morocco")
- ("mc" "Monaco")
- ("md" "Moldova" "The Republic of %s")
- ("me" "Montenegro")
- ("mf" "Saint Martin (French part)")
- ("mg" "Madagascar")
- ("mh" "Marshall Islands")
- ("mk" "Macedonia" "The Former Yugoslav Republic of
%s")
- ("ml" "Mali")
- ("mm" "Myanmar")
- ("mn" "Mongolia")
- ("mo" "Macao")
- ("mp" "Northern Mariana Islands")
- ("mq" "Martinique")
- ("mr" "Mauritania")
- ("ms" "Montserrat")
- ("mt" "Malta")
- ("mu" "Mauritius")
- ("mv" "Maldives")
- ("mw" "Malawi")
- ("mx" "Mexico" "The United Mexican States")
- ("my" "Malaysia")
- ("mz" "Mozambique")
- ("na" "Namibia")
- ("nc" "New Caledonia (Fr.)")
- ("ne" "Niger") ; In .fr domain
- ("nf" "Norfolk Island")
- ("ng" "Nigeria")
- ("ni" "Nicaragua" "The Republic of %s")
- ("nl" "Netherlands" "The Kingdom of the %s")
- ("no" "Norway" "The Kingdom of %s")
- ("np" "Nepal") ; Via .in domain
- ("nr" "Nauru")
- ("nu" "Niue")
- ("nz" "New Zealand")
- ("om" "Oman")
- ("pa" "Panama")
- ("pe" "Peru")
- ("pf" "French Polynesia")
- ("pg" "Papua New Guinea")
- ("ph" "Philippines" "The Republic of the %s")
- ("pk" "Pakistan")
- ("pl" "Poland")
- ("pm" "Saint Pierre and Miquelon")
- ("pn" "Pitcairn")
- ("pr" "Puerto Rico (U.S.)")
- ("ps" "Palestinian Territory, Occupied")
- ("pt" "Portugal" "The Portuguese Republic")
- ("pw" "Palau")
- ("py" "Paraguay")
- ("qa" "Qatar")
- ("re" "Reunion (Fr.)") ; In .fr domain
- ("ro" "Romania")
- ("rs" "Serbia")
- ("ru" "Russia" "Russian Federation")
- ("rw" "Rwanda")
- ("sa" "Saudi Arabia")
- ("sb" "Solomon Islands")
- ("sc" "Seychelles")
- ("sd" "Sudan")
- ("se" "Sweden" "The Kingdom of %s")
- ("sg" "Singapore" "The Republic of %s")
- ("sh" "Saint Helena")
- ("si" "Slovenia")
- ("sj" "Svalbard and Jan Mayen") ; In .no domain
- ("sk" "Slovakia" "The Slovak Republic")
- ("sl" "Sierra Leone")
- ("sm" "San Marino")
- ("sn" "Senegal")
- ("so" "Somalia")
- ("sr" "Suriname")
- ("st" "Sao Tome and Principe")
- ("su" "U.S.S.R." "The Union of Soviet Socialist
Republics")
- ("sv" "El Salvador")
- ("sy" "Syrian Arab Republic")
- ("sz" "Swaziland")
- ("tc" "Turks and Caicos Islands")
- ("td" "Chad")
- ("tf" "French Southern Territories")
- ("tg" "Togo")
- ("th" "Thailand" "The Kingdom of %s")
- ("tj" "Tajikistan")
- ("tk" "Tokelau")
- ("tl" "East Timor")
- ("tm" "Turkmenistan")
- ("tn" "Tunisia")
- ("to" "Tonga")
- ("tp" "East Timor")
- ("tr" "Turkey" "The Republic of %s")
- ("tt" "Trinidad and Tobago")
- ("tv" "Tuvalu")
- ("tw" "Taiwan" "%s, Province of China")
- ("tz" "Tanzania" "United Republic of %s")
- ("ua" "Ukraine")
- ("ug" "Uganda")
- ("uk" "United Kingdom" "The %s of Great Britain and
Northern Ireland")
- ("um" "United States Minor Outlying Islands")
- ("us" "United States" "The %s of America")
- ("uy" "Uruguay" "The Eastern Republic of %s")
- ("uz" "Uzbekistan")
- ("va" "Holy See (Vatican City State)")
- ("vc" "Saint Vincent and the Grenadines")
- ("ve" "Venezuela" "The Republic of %s")
- ("vg" "Virgin Islands, British")
- ("vi" "Virgin Islands, U.S.")
- ("vn" "Vietnam")
- ("vu" "Vanuatu")
- ("wf" "Wallis and Futuna")
- ("ws" "Samoa")
- ("ye" "Yemen")
- ("yt" "Mayotte")
- ("yu" "Yugoslavia" "Yugoslavia, AKA
Serbia-Montenegro")
- ("za" "South Africa" "The Republic of %s")
- ("zm" "Zambia")
- ("zw" "Zimbabwe" "Republic of %s")
- ;; Generic Domains:
- ("aero" t "Air Transport Industry")
- ("asia" t "Pan-Asia and Asia Pacific
community")
- ("biz" t "Businesses")
- ("cat" t "Catalan language and culture")
- ("com" t "Commercial")
- ("coop" t "Cooperative Associations")
- ("info" t "Info")
- ("jobs" t "Employment")
- ("mobi" t "Mobile products")
- ("museum" t "Museums")
- ("name" t "Individuals")
- ("net" t "Network")
- ("org" t "Non-profit Organization")
- ("pro" t "Credentialed professionals")
- ("tel" t "Contact data")
- ("travel" t "Travel industry")
- ;;("bitnet" t "Because It's Time NET")
- ("gov" t "United States Government")
- ("edu" t "Educational")
- ("mil" t "United States Military")
- ("int" t "International Treaties")
- ;;("nato" t "North Atlantic Treaty Organization")
- ("uucp" t "Unix to Unix CoPy")
- ;; Infrastructure Domains:
- ("arpa" t "Advanced Research Projects Agency (U.S. DoD)")
- ))
- ob))
-
+ ((macro
+ . (lambda (&rest details)
+ (let ((ob (make-hash-table :test 'equal)))
+ (mapc
+ (lambda (x)
+ (puthash (downcase (car x)) (if (find ?% (nth 2 x))
+ (format (nth 2 x) (nth 1 x))
+ (nth 1 x))
+ ob))
+ details)
+ ob)))
+ ;; ISO 3166 codes:
+ ("ac" "Ascension Island")
+ ("ad" "Andorra")
+ ("ae" "United Arab Emirates")
+ ("af" "Afghanistan")
+ ("ag" "Antigua and Barbuda")
+ ("ai" "Anguilla")
+ ("al" "Albania")
+ ("am" "Armenia")
+ ("an" "Netherlands Antilles")
+ ("ao" "Angola")
+ ("aq" "Antarctica") ; continent
+ ("ar" "Argentina" "Argentine Republic")
+ ("as" "American Samoa")
+ ("at" "Austria" "The Republic of %s")
+ ("au" "Australia")
+ ("aw" "Aruba")
+ ("ax" "Aland Islands")
+ ("az" "Azerbaijan")
+ ("ba" "Bosnia-Herzegovina")
+ ("bb" "Barbados")
+ ("bd" "Bangladesh")
+ ("be" "Belgium" "The Kingdom of %s")
+ ("bf" "Burkina Faso")
+ ("bg" "Bulgaria")
+ ("bh" "Bahrain")
+ ("bi" "Burundi")
+ ("bj" "Benin")
+ ("bl" "Saint Barthelemy")
+ ("bm" "Bermuda")
+ ("bn" "Brunei Darussalam")
+ ("bo" "Bolivia" "Republic of %s")
+ ("br" "Brazil" "The Federative Republic of %s")
+ ("bs" "Bahamas")
+ ("bt" "Bhutan")
+ ("bv" "Bouvet Island")
+ ("bw" "Botswana")
+ ("by" "Belarus")
+ ("bz" "Belize")
+ ("ca" "Canada")
+ ("cc" "Cocos (Keeling) Islands")
+ ("cd" "Congo" "The Democratic Republic of the
%s")
+ ("cf" "Central African Republic")
+ ("cg" "Congo")
+ ("ch" "Switzerland" "The Swiss Confederation")
+ ("ci" "Ivory Coast") ; Cote D'ivoire
+ ("ck" "Cook Islands")
+ ("cl" "Chile" "The Republic of %s")
+ ("cm" "Cameroon") ; In .fr domain
+ ("cn" "China" "The People's Republic of %s")
+ ("co" "Colombia")
+ ("cr" "Costa Rica" "The Republic of %s")
+ ("cu" "Cuba")
+ ("cv" "Cape Verde")
+ ("cx" "Christmas Island")
+ ("cy" "Cyprus")
+ ("cz" "Czech Republic")
+ ("de" "Germany")
+ ("dj" "Djibouti")
+ ("dk" "Denmark")
+ ("dm" "Dominica")
+ ("do" "Dominican Republic" "The %s")
+ ("dz" "Algeria")
+ ("ec" "Ecuador" "The Republic of %s")
+ ("ee" "Estonia")
+ ("eg" "Egypt" "The Arab Republic of %s")
+ ("eh" "Western Sahara")
+ ("er" "Eritrea")
+ ("es" "Spain" "The Kingdom of %s")
+ ("et" "Ethiopia")
+ ("eu" "European Union")
+ ("fi" "Finland" "The Republic of %s")
+ ("fj" "Fiji")
+ ("fk" "Falkland Islands (Malvinas)")
+ ("fm" "Micronesia" "Federated States of %s")
+ ("fo" "Faroe Islands")
+ ("fr" "France")
+ ("ga" "Gabon")
+ ("gb" "United Kingdom")
+ ("gd" "Grenada")
+ ("ge" "Georgia")
+ ("gf" "French Guiana")
+ ("gg" "Guernsey")
+ ("gh" "Ghana")
+ ("gi" "Gibraltar")
+ ("gl" "Greenland")
+ ("gm" "Gambia")
+ ("gn" "Guinea")
+ ("gp" "Guadeloupe (Fr.)")
+ ("gq" "Equatorial Guinea")
+ ("gr" "Greece" "The Hellenic Republic (%s)")
+ ("gs" "South Georgia and The South Sandwich Islands")
+ ("gt" "Guatemala")
+ ("gu" "Guam (U.S.)")
+ ("gw" "Guinea-Bissau")
+ ("gy" "Guyana")
+ ("hk" "Hong Kong")
+ ("hm" "Heard Island and McDonald Islands")
+ ("hn" "Honduras")
+ ("hr" "Croatia" "Croatia (Hrvatska)")
+ ("ht" "Haiti")
+ ("hu" "Hungary" "The Hungarian Republic")
+ ("id" "Indonesia")
+ ("ie" "Ireland")
+ ("il" "Israel" "The State of %s")
+ ("im" "Isle of Man" "The %s") ; NOT in ISO 3166-1 of
2001-02-26
+ ("in" "India" "The Republic of %s")
+ ("io" "British Indian Ocean Territory")
+ ("iq" "Iraq")
+ ("ir" "Iran" "Islamic Republic of %s")
+ ("is" "Iceland" "The Republic of %s")
+ ("it" "Italy" "The Italian Republic")
+ ("je" "Jersey")
+ ("jm" "Jamaica")
+ ("jo" "Jordan")
+ ("jp" "Japan")
+ ("ke" "Kenya")
+ ("kg" "Kyrgyzstan")
+ ("kh" "Cambodia")
+ ("ki" "Kiribati")
+ ("km" "Comoros")
+ ("kn" "Saint Kitts and Nevis")
+ ("kp" "Korea (North)" "Democratic People's Republic of
Korea")
+ ("kr" "Korea (South)" "Republic of Korea")
+ ("kw" "Kuwait")
+ ("ky" "Cayman Islands")
+ ("kz" "Kazakhstan")
+ ("la" "Lao People's Democratic Republic")
+ ("lb" "Lebanon")
+ ("lc" "Saint Lucia")
+ ("li" "Liechtenstein")
+ ("lk" "Sri Lanka" "The Democratic Socialist Republic of
%s")
+ ("lr" "Liberia")
+ ("ls" "Lesotho")
+ ("lt" "Lithuania")
+ ("lu" "Luxembourg")
+ ("lv" "Latvia")
+ ("ly" "Libyan Arab Jamahiriya")
+ ("ma" "Morocco")
+ ("mc" "Monaco")
+ ("md" "Moldova" "The Republic of %s")
+ ("me" "Montenegro")
+ ("mf" "Saint Martin (French part)")
+ ("mg" "Madagascar")
+ ("mh" "Marshall Islands")
+ ("mk" "Macedonia" "The Former Yugoslav Republic of
%s")
+ ("ml" "Mali")
+ ("mm" "Myanmar")
+ ("mn" "Mongolia")
+ ("mo" "Macao")
+ ("mp" "Northern Mariana Islands")
+ ("mq" "Martinique")
+ ("mr" "Mauritania")
+ ("ms" "Montserrat")
+ ("mt" "Malta")
+ ("mu" "Mauritius")
+ ("mv" "Maldives")
+ ("mw" "Malawi")
+ ("mx" "Mexico" "The United Mexican States")
+ ("my" "Malaysia")
+ ("mz" "Mozambique")
+ ("na" "Namibia")
+ ("nc" "New Caledonia (Fr.)")
+ ("ne" "Niger") ; In .fr domain
+ ("nf" "Norfolk Island")
+ ("ng" "Nigeria")
+ ("ni" "Nicaragua" "The Republic of %s")
+ ("nl" "Netherlands" "The Kingdom of the %s")
+ ("no" "Norway" "The Kingdom of %s")
+ ("np" "Nepal") ; Via .in domain
+ ("nr" "Nauru")
+ ("nu" "Niue")
+ ("nz" "New Zealand")
+ ("om" "Oman")
+ ("pa" "Panama")
+ ("pe" "Peru")
+ ("pf" "French Polynesia")
+ ("pg" "Papua New Guinea")
+ ("ph" "Philippines" "The Republic of the %s")
+ ("pk" "Pakistan")
+ ("pl" "Poland")
+ ("pm" "Saint Pierre and Miquelon")
+ ("pn" "Pitcairn")
+ ("pr" "Puerto Rico (U.S.)")
+ ("ps" "Palestinian Territory, Occupied")
+ ("pt" "Portugal" "The Portuguese Republic")
+ ("pw" "Palau")
+ ("py" "Paraguay")
+ ("qa" "Qatar")
+ ("re" "Reunion (Fr.)") ; In .fr domain
+ ("ro" "Romania")
+ ("rs" "Serbia")
+ ("ru" "Russia" "Russian Federation")
+ ("rw" "Rwanda")
+ ("sa" "Saudi Arabia")
+ ("sb" "Solomon Islands")
+ ("sc" "Seychelles")
+ ("sd" "Sudan")
+ ("se" "Sweden" "The Kingdom of %s")
+ ("sg" "Singapore" "The Republic of %s")
+ ("sh" "Saint Helena")
+ ("si" "Slovenia")
+ ("sj" "Svalbard and Jan Mayen") ; In .no domain
+ ("sk" "Slovakia" "The Slovak Republic")
+ ("sl" "Sierra Leone")
+ ("sm" "San Marino")
+ ("sn" "Senegal")
+ ("so" "Somalia")
+ ("sr" "Suriname")
+ ("st" "Sao Tome and Principe")
+ ("su" "U.S.S.R." "The Union of Soviet Socialist
Republics")
+ ("sv" "El Salvador")
+ ("sy" "Syrian Arab Republic")
+ ("sz" "Swaziland")
+ ("tc" "Turks and Caicos Islands")
+ ("td" "Chad")
+ ("tf" "French Southern Territories")
+ ("tg" "Togo")
+ ("th" "Thailand" "The Kingdom of %s")
+ ("tj" "Tajikistan")
+ ("tk" "Tokelau")
+ ("tl" "East Timor")
+ ("tm" "Turkmenistan")
+ ("tn" "Tunisia")
+ ("to" "Tonga")
+ ("tp" "East Timor")
+ ("tr" "Turkey" "The Republic of %s")
+ ("tt" "Trinidad and Tobago")
+ ("tv" "Tuvalu")
+ ("tw" "Taiwan" "%s, Province of China")
+ ("tz" "Tanzania" "United Republic of %s")
+ ("ua" "Ukraine")
+ ("ug" "Uganda")
+ ("uk" "United Kingdom" "The %s of Great Britain and
Northern Ireland")
+ ("um" "United States Minor Outlying Islands")
+ ("us" "United States" "The %s of America")
+ ("uy" "Uruguay" "The Eastern Republic of %s")
+ ("uz" "Uzbekistan")
+ ("va" "Holy See (Vatican City State)")
+ ("vc" "Saint Vincent and the Grenadines")
+ ("ve" "Venezuela" "The Republic of %s")
+ ("vg" "Virgin Islands, British")
+ ("vi" "Virgin Islands, U.S.")
+ ("vn" "Vietnam")
+ ("vu" "Vanuatu")
+ ("wf" "Wallis and Futuna")
+ ("ws" "Samoa")
+ ("ye" "Yemen")
+ ("yt" "Mayotte")
+ ("yu" "Yugoslavia" "Yugoslavia, AKA
Serbia-Montenegro")
+ ("za" "South Africa" "The Republic of %s")
+ ("zm" "Zambia")
+ ("zw" "Zimbabwe" "Republic of %s")
+ ;; Generic Domains:
+ ("aero" "Air Transport Industry")
+ ("asia" "Pan-Asia and Asia Pacific community")
+ ("biz" "Businesses")
+ ("cat" "Catalan language and culture")
+ ("com" "Commercial")
+ ("coop" "Cooperative Associations")
+ ("info" "Info")
+ ("jobs" "Employment")
+ ("mobi" "Mobile products")
+ ("museum" "Museums")
+ ("name" "Individuals")
+ ("net" "Network")
+ ("org" "Non-profit Organization")
+ ("pro" "Credentialed professionals")
+ ("tel" "Contact data")
+ ("travel" "Travel industry")
+ ;;("bitnet" "Because It's Time NET")
+ ("gov" "United States Government")
+ ("edu" "Educational")
+ ("mil" "United States Military")
+ ("int" "International Treaties")
+ ;;("nato" "North Atlantic Treaty Organization")
+ ("uucp" "Unix to Unix CoPy")
+ ;; Infrastructure Domains:
+ ("arpa" "Advanced Research Projects Agency (U.S. DoD)")))
+
;;;###autoload
(defun what-domain (domain)
"Convert mail domain DOMAIN to the country it corresponds to."
(interactive
- (let ((completion-ignore-case t))
- (list (completing-read "Domain: "
- mail-extr-all-top-level-domains nil t))))
- (or (setq domain (intern-soft (downcase domain)
- mail-extr-all-top-level-domains))
- (error "No such domain"))
- (message "%s: %s" (upcase (symbol-name domain)) (get domain
'domain-name)))
+ (let ((completion-ignore-case t)
+ (table (if (fboundp 'exact-minibuffer-completion-p)
+ ;; XEmacs 21.4. Kludge; cons up a table at completion
+ ;; time. This is fine, #'what-domain isn't called
+ ;; interactively that often.
+ (let (alist)
+ (maphash #'(lambda (key value) (push (cons key t) alist))
+ mail-extr-all-top-level-domains)
+ alist)
+ mail-extr-all-top-level-domains)))
+ (list (completing-read "Domain: " table nil t))))
+ (let ((value (gethash (downcase domain) mail-extr-all-top-level-domains)))
+ (or value (error "No such domain"))
+ (message "%s: %s" (upcase domain) value)))
;(let ((all nil))
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)
Show replies by date