2021-03-11 14:32:42 -05:00
|
|
|
|
;;; mail-extr.el --- extract full name and address from email header -*- lexical-binding: t; -*-
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2025-01-01 07:39:17 +00:00
|
|
|
|
;; Copyright (C) 1991-2025 Free Software Foundation, Inc.
|
1992-07-22 04:22:42 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Author: Joe Wells <jbw@cs.bu.edu>
|
2019-05-25 13:43:06 -07:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Keywords: mail
|
2010-08-29 12:17:13 -04:00
|
|
|
|
;; Package: mail-utils
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; The entry point of this code is
|
|
|
|
|
;;
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; mail-extract-address-components: (address &optional all)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
;; Given an RFC-822-or-later ADDRESS, extract name and address.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).
|
|
|
|
|
;; If no name can be extracted, FULL-NAME will be nil.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;; ADDRESS may be a string or a buffer. If it is a buffer, the visible
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; (narrowed) portion of the buffer will be interpreted as the address.
|
|
|
|
|
;; (This feature exists so that the clever caller might be able to avoid
|
|
|
|
|
;; consing a string.)
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
;; If ADDRESS contains more than one RFC-822-or-later address, only
|
|
|
|
|
;; the first is returned.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; If ALL is non-nil, that means return info about all the addresses
|
|
|
|
|
;; that are found in ADDRESS. The value is a list of elements of
|
|
|
|
|
;; the form (FULL-NAME CANONICAL-ADDRESS), one per address.
|
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; This code is more correct (and more heuristic) parser than the code in
|
|
|
|
|
;; rfc822.el. And despite its size, it's fairly fast.
|
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; There are two main benefits:
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; 1. Higher probability of getting the correct full name for a human than
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; any other package we know of. (On the other hand, it will cheerfully
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; mangle non-human names/comments.)
|
|
|
|
|
;; 2. Address part is put in a canonical form.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
|
|
|
|
;; The interface is not yet carved in stone; please give us suggestions.
|
|
|
|
|
;;
|
|
|
|
|
;; We have an extensive test-case collection of funny addresses if you want to
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; work with the code. Developing this code requires frequent testing to
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; make sure you're not breaking functionality. The test cases aren't included
|
|
|
|
|
;; because they are over 100K.
|
|
|
|
|
;;
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;; If you find an address that mail-extr fails on, please send it to the
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; maintainer along with what you think the correct results should be. We do
|
|
|
|
|
;; not consider it a bug if mail-extr mangles a comment that does not
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;; correspond to a real human full name, although we would prefer that
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; mail-extr would return the comment as-is.
|
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Features:
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * Full name handling:
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * knows where full names can be found in an address.
|
|
|
|
|
;; * avoids using empty comments and quoted text.
|
|
|
|
|
;; * extracts full names from mailbox names.
|
|
|
|
|
;; * recognizes common formats for comments after a full name.
|
|
|
|
|
;; * puts a period and a space after each initial.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; * understands & referring to the mailbox name, capitalized.
|
|
|
|
|
;; * strips name prefixes like "Prof.", etc.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * understands what characters can occur in names (not just letters).
|
|
|
|
|
;; * figures out middle initial from mailbox name.
|
|
|
|
|
;; * removes funny nicknames.
|
|
|
|
|
;; * keeps suffixes such as Jr., Sr., III, etc.
|
|
|
|
|
;; * reorders "Last, First" type names.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * Address handling:
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * parses rfc822 quoted text, comments, and domain literals.
|
|
|
|
|
;; * parses rfc822 multi-line headers.
|
|
|
|
|
;; * does something reasonable with rfc822 GROUP addresses.
|
|
|
|
|
;; * handles many rfc822 noncompliant and garbage addresses.
|
|
|
|
|
;; * canonicalizes addresses (after stripping comments/phrases outside <>).
|
|
|
|
|
;; * converts ! addresses into .UUCP and %-style addresses.
|
|
|
|
|
;; * converts rfc822 ROUTE addresses to %-style addresses.
|
|
|
|
|
;; * truncates %-style addresses at leftmost fully qualified domain name.
|
|
|
|
|
;; * handles local relative precedence of ! vs. % and @ (untested).
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; It does almost no string creation. It primarily uses the built-in
|
|
|
|
|
;; parsing routines with the appropriate syntax tables. This should
|
|
|
|
|
;; result in greater speed.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; TODO:
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * handle all test cases. (This will take forever.)
|
|
|
|
|
;; * software to pick the correct header to use (eg., "Senders-Name:").
|
|
|
|
|
;; * multiple addresses in the "From:" header (almost all of the necessary
|
|
|
|
|
;; code is there).
|
|
|
|
|
;; * flag to not treat `,' as an address separator. (This is useful when
|
|
|
|
|
;; there is a "From:" header but no "Sender:" header, because then there
|
|
|
|
|
;; is only allowed to be one address.)
|
|
|
|
|
;; * mailbox name does not necessarily contain full name.
|
|
|
|
|
;; * fixing capitalization when it's all upper or lowercase. (Hard!)
|
|
|
|
|
;; * some of the domain literal handling is missing. (But I've never even
|
|
|
|
|
;; seen one of these in a mail address, so maybe no big deal.)
|
|
|
|
|
;; * arrange to have syntax tables byte-compiled.
|
|
|
|
|
;; * speed hacks.
|
|
|
|
|
;; * delete unused variables.
|
|
|
|
|
;; * arrange for testing with different relative precedences of ! vs. @
|
|
|
|
|
;; and %.
|
|
|
|
|
;; * insert documentation strings!
|
|
|
|
|
;; * handle X.400-gatewayed addresses according to RFC 1148.
|
|
|
|
|
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;; Change Log:
|
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Thu Feb 17 17:57:33 1994 Jamie Zawinski (jwz@lucid.com)
|
|
|
|
|
;;
|
|
|
|
|
;; * merged with jbw's latest version
|
|
|
|
|
;;
|
|
|
|
|
;; Wed Feb 9 21:56:27 1994 Jamie Zawinski (jwz@lucid.com)
|
|
|
|
|
;;
|
|
|
|
|
;; * high-bit chars in comments weren't treated as word syntax
|
|
|
|
|
;;
|
|
|
|
|
;; Sat Feb 5 03:13:40 1994 Jamie Zawinski (jwz@lucid.com)
|
|
|
|
|
;;
|
|
|
|
|
;; * call replace-match with fixed-case arg
|
|
|
|
|
;;
|
|
|
|
|
;; Thu Dec 16 21:56:45 1993 Jamie Zawinski (jwz@lucid.com)
|
|
|
|
|
;;
|
|
|
|
|
;; * some more cleanup, doc, added provide
|
|
|
|
|
;;
|
|
|
|
|
;; Tue Mar 23 21:23:18 1993 Joe Wells (jbw at csd.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; * Made mail-full-name-prefixes a user-customizable variable.
|
2002-07-08 11:42:57 +00:00
|
|
|
|
;; Allow passing the address as a buffer as well as a string.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Allow [ and ] as name characters (Finnish character set).
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Mon Mar 22 21:20:56 1993 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; * Handle "null" addresses. Handle = used for spacing in mailbox
|
|
|
|
|
;; name. Fix bug in handling of ROUTE-ADDR-type addresses that are
|
|
|
|
|
;; missing their brackets. Handle uppercase "JR". Extract full
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
;; names from X.400 addresses encoded in RFC-822-or-later. Fix bug in
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; handling of multiple addresses where first has trailing comment.
|
|
|
|
|
;; Handle more kinds of telephone extension lead-ins.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Mon Mar 22 20:16:57 1993 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; * Handle HZ encoding for embedding GB encoded chinese characters.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Mon Mar 22 00:46:12 1993 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; * Fixed too broad matching of ham radio call signs. Fixed bug in
|
|
|
|
|
;; handling an unmatched ' in a name string. Enhanced recognition
|
|
|
|
|
;; of when . in the mailbox name terminates the name portion.
|
|
|
|
|
;; Narrowed conversion of . to space to only the necessary
|
|
|
|
|
;; situation. Deal with VMS's stupid date stamps. Handle a unique
|
|
|
|
|
;; way of introducing an alternate address. Fixed spacing bug I
|
|
|
|
|
;; introduced in switching last name order. Fixed bug in handling
|
|
|
|
|
;; address with ! and % but no @. Narrowed the cases in which
|
|
|
|
|
;; certain trailing words are discarded.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Sun Mar 21 21:41:06 1993 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; * Fixed bugs in handling GROUP addresses. Certain words in the
|
|
|
|
|
;; middle of a name no longer terminate it. Handle LISTSERV list
|
|
|
|
|
;; names. Ignore comment field containing mailbox name.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Sun Mar 21 14:39:38 1993 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; * Moved variant-method code back into main function. Handle
|
|
|
|
|
;; underscores as spaces in comments. Handle leading nickname. Add
|
|
|
|
|
;; flag to ignore single-word names. Other changes.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Mon Feb 1 22:23:31 1993 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; * Added in changes by Rod Whitby and Jamie Zawinski. This
|
|
|
|
|
;; includes the flag mail-extr-guess-middle-initial and the fix for
|
1994-04-27 08:39:01 +00:00
|
|
|
|
;; handling multiple addresses correctly. (Whitby just changed
|
|
|
|
|
;; a > to a <.)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Mon Apr 6 23:59:09 1992 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * Cleaned up some more. Release version 1.0 to world.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Sun Apr 5 19:39:08 1992 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * Cleaned up full name extraction extensively.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Sun Feb 2 14:45:24 1992 Joe Wells (jbw at bigbird.bu.edu)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; * Total rewrite. Integrated mail-canonicalize-address into
|
|
|
|
|
;; mail-extract-address-components. Now handles GROUP addresses more
|
|
|
|
|
;; or less correctly. Better handling of lots of different cases.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Fri Jun 14 19:39:50 1991
|
|
|
|
|
;; * Created.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
|
1998-02-22 22:01:28 +00:00
|
|
|
|
(defgroup mail-extr nil
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
"Extract full name and address from RFC 822 (or later) mail header."
|
1998-02-22 22:01:28 +00:00
|
|
|
|
:prefix "mail-extr-"
|
|
|
|
|
:group 'mail)
|
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
|
|
|
|
;; User configuration variable definitions.
|
|
|
|
|
;;
|
|
|
|
|
|
1998-02-22 22:01:28 +00:00
|
|
|
|
(defcustom mail-extr-guess-middle-initial nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Whether to try to guess middle initial from mail address.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
If true, then when we see an address like \"John Smith <jqs@host.com>\"
|
1998-02-22 22:01:28 +00:00
|
|
|
|
we will assume that \"John Q. Smith\" is the fellow's name."
|
2021-03-11 14:32:42 -05:00
|
|
|
|
:type 'boolean)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
2002-09-25 20:21:28 +00:00
|
|
|
|
(defcustom mail-extr-ignore-single-names nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Whether to ignore a name that is just a single word.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
If true, then when we see an address like \"Idiot <dumb@stupid.com>\"
|
1998-02-22 22:01:28 +00:00
|
|
|
|
we will act as though we couldn't find a full name in the address."
|
|
|
|
|
:type 'boolean
|
2021-03-11 14:32:42 -05:00
|
|
|
|
:version "22.1")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
2004-10-08 17:53:18 +00:00
|
|
|
|
(defcustom mail-extr-ignore-realname-equals-mailbox-name t
|
Remove obsolete leading * from defcustom, defface doc strings.
* lisp/cedet/ede/linux.el, lisp/cedet/ede/project-am.el:
* lisp/cedet/ede/simple.el, lisp/cedet/semantic/bovine/c.el:
* lisp/cedet/semantic/complete.el, lisp/cedet/semantic/db.el:
* lisp/cedet/semantic/decorate/include.el:
* lisp/cedet/semantic/decorate/mode.el, lisp/cedet/semantic/format.el:
* lisp/cedet/semantic/ia.el, lisp/cedet/semantic/idle.el:
* lisp/cedet/semantic/imenu.el, lisp/cedet/semantic/lex-spp.el:
* lisp/cedet/semantic/mru-bookmark.el, lisp/cedet/semantic/sb.el:
* lisp/cedet/srecode/fields.el, lisp/ecomplete.el:
* lisp/gnus/gnus-agent.el, lisp/gnus/gnus-art.el:
* lisp/gnus/gnus-async.el, lisp/gnus/gnus-cache.el:
* lisp/gnus/gnus-cite.el, lisp/gnus/gnus-delay.el:
* lisp/gnus/gnus-diary.el, lisp/gnus/gnus-dup.el:
* lisp/gnus/gnus-fun.el, lisp/gnus/gnus-group.el:
* lisp/gnus/gnus-kill.el, lisp/gnus/gnus-msg.el:
* lisp/gnus/gnus-picon.el, lisp/gnus/gnus-salt.el:
* lisp/gnus/gnus-score.el, lisp/gnus/gnus-start.el:
* lisp/gnus/gnus-sum.el, lisp/gnus/gnus-topic.el:
* lisp/gnus/gnus-util.el, lisp/gnus/gnus-uu.el, lisp/gnus/gnus-win.el:
* lisp/gnus/gnus.el, lisp/gnus/mail-source.el, lisp/gnus/message.el:
* lisp/gnus/mm-url.el, lisp/gnus/mm-uu.el, lisp/gnus/mml.el:
* lisp/gnus/nndiary.el, lisp/gnus/nnir.el, lisp/gnus/nnmail.el:
* lisp/gnus/smiley.el, lisp/gnus/smime.el, lisp/mail/mail-extr.el:
* lisp/mh-e/mh-e.el, lisp/net/mailcap.el, lisp/net/pop3.el:
* lisp/net/starttls.el, lisp/progmodes/cc-vars.el:
* lisp/progmodes/cperl-mode.el, test/manual/cedet/tests/test.el:
Remove obsolete leading * from defcustom, defface doc strings.
2016-06-09 20:13:12 -04:00
|
|
|
|
"Whether to ignore a name that is equal to the mailbox name.
|
2004-10-08 17:53:18 +00:00
|
|
|
|
If true, then when the address is like \"Single <single@address.com>\"
|
|
|
|
|
we will act as though we couldn't find a full name in the address."
|
2021-03-11 14:32:42 -05:00
|
|
|
|
:type 'boolean)
|
2004-10-08 17:53:18 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Matches a leading title that is not part of the name (does not
|
|
|
|
|
;; contribute to uniquely identifying the person).
|
1998-02-22 22:01:28 +00:00
|
|
|
|
(defcustom mail-extr-full-name-prefixes
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"\\(Prof\\|D[Rr]\\|Mrs?\\|Rev\\|Rabbi\\|SysOp\\|LCDR\\)\\.?[ \t\n]"
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Matches prefixes to the full name that identify a person's position.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
These are stripped from the full name because they do not contribute to
|
1998-02-22 22:01:28 +00:00
|
|
|
|
uniquely identifying the person."
|
2021-03-11 14:32:42 -05:00
|
|
|
|
:type 'regexp)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
1998-02-22 22:01:28 +00:00
|
|
|
|
(defcustom mail-extr-@-binds-tighter-than-! nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Whether the local mail transport agent looks at ! before @."
|
2021-03-11 14:32:42 -05:00
|
|
|
|
:type 'boolean)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
1998-02-22 22:01:28 +00:00
|
|
|
|
(defcustom mail-extr-mangle-uucp nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Whether to throw away information in UUCP addresses
|
1998-02-22 22:01:28 +00:00
|
|
|
|
by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"."
|
2021-03-11 14:32:42 -05:00
|
|
|
|
:type 'boolean)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;;----------------------------------------------------------------------
|
|
|
|
|
;; what orderings are meaningful?????
|
|
|
|
|
;;(defvar mail-operator-precedence-list '(?! ?% ?@))
|
|
|
|
|
;; Right operand of a % or a @ must be a domain name, period. No other
|
|
|
|
|
;; operators allowed. Left operand of a @ is an address relative to that
|
|
|
|
|
;; site.
|
|
|
|
|
|
|
|
|
|
;; Left operand of a ! must be a domain name. Right operand is an
|
|
|
|
|
;; arbitrary address.
|
|
|
|
|
;;----------------------------------------------------------------------
|
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
|
|
|
|
;; Constant definitions.
|
|
|
|
|
;;
|
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Any character that can occur in a name, not counting characters that
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; separate parts of a multipart name (hyphen and period).
|
|
|
|
|
;; Yes, there are weird people with digits in their names.
|
|
|
|
|
;; You will also notice the consideration for the
|
|
|
|
|
;; Swedish/Finnish/Norwegian character set.
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(defconst mail-extr-all-letters-but-separators "][[:alnum:]{|}'~`")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
;; Any character that can occur in a name in an RFC 822 (or later)
|
|
|
|
|
;; address including the separator (hyphen and possibly period) for
|
|
|
|
|
;; multipart names.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; #### should . be in here?
|
|
|
|
|
(defconst mail-extr-all-letters
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(concat mail-extr-all-letters-but-separators "-"))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
;; Any character that can start a name.
|
|
|
|
|
;; Keep this set as minimal as possible.
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(defconst mail-extr-first-letters "[:alpha:]")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Any character that can end a name.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Keep this set as minimal as possible.
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(defconst mail-extr-last-letters "[:alpha:]`'.")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2001-11-16 19:57:07 +00:00
|
|
|
|
(defconst mail-extr-leading-garbage "\\W+")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; (defconst mail-extr-non-begin-name-chars
|
2022-07-10 18:57:19 +02:00
|
|
|
|
;; (concat "^" mail-extr-first-letters))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; (defconst mail-extr-non-end-name-chars
|
2022-07-10 18:57:19 +02:00
|
|
|
|
;; (concat "^" mail-extr-last-letters))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches periods used instead of spaces. Must not match the period
|
|
|
|
|
;; following an initial.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-bad-dot-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(format "\\([%s][%s]\\)\\.+\\([%s]\\)"
|
|
|
|
|
mail-extr-all-letters
|
|
|
|
|
mail-extr-last-letters
|
|
|
|
|
mail-extr-first-letters))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches an embedded or leading nickname that should be removed.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; (defconst mail-extr-nickname-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
;; (format "\\([ .]\\|\\`\\)[\"'`[(]\\([ .%s]+\\)[]\"')] "
|
|
|
|
|
;; mail-extr-all-letters))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches the occurrence of a generational name suffix, and the last
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; character of the preceding name. This is important because we want to
|
|
|
|
|
;; keep such suffixes: they help to uniquely identify the person.
|
|
|
|
|
;; *** Perhaps this should be a user-customizable variable. However, the
|
|
|
|
|
;; *** regular expression is fairly tricky to alter, so maybe not.
|
|
|
|
|
(defconst mail-extr-full-name-suffix-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(format
|
|
|
|
|
"\\(,? ?\\([JjSs][Rr]\\.?\\|V?I+V?\\)\\)\\([^%s]\\([^%s]\\|\\'\\)\\|\\'\\)"
|
|
|
|
|
mail-extr-all-letters mail-extr-all-letters))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(defconst mail-extr-roman-numeral-pattern "V?I+V?\\b")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches a trailing uppercase (with other characters possible) acronym.
|
|
|
|
|
;; Must not match a trailing uppercase last name or trailing initial
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-weird-acronym-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"\\([A-Z]+[-_/]\\|[A-Z][A-Z][A-Z]?\\b\\)")
|
2002-10-18 08:52:37 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Matches a mixed-case or lowercase name (not an initial).
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; #### Match Latin1 lower case letters here too?
|
|
|
|
|
;; (defconst mail-extr-mixed-case-name-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
;; (format
|
|
|
|
|
;; "\\b\\([a-z][%s]*[%s]\\|[%s][%s]*[a-z][%s]*[%s]\\|[%s][%s]*[a-z]\\)"
|
|
|
|
|
;; mail-extr-all-letters mail-extr-last-letters
|
|
|
|
|
;; mail-extr-first-letters mail-extr-all-letters mail-extr-all-letters
|
|
|
|
|
;; mail-extr-last-letters mail-extr-first-letters mail-extr-all-letters))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches a trailing alternative address.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; #### Match Latin1 letters here too?
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;; #### Match _ before @ here too?
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-alternative-address-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"\\(aka *\\)?[a-zA-Z.]+[!@][a-zA-Z.]")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches a variety of trailing comments not including comma-delimited
|
|
|
|
|
;; comments.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-trailing-comment-start-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
" [-{]\\|--\\|[+@#></;]")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches a name (not an initial).
|
|
|
|
|
;; This doesn't force a word boundary at the end because sometimes a
|
|
|
|
|
;; comment is separated by a `-' with no preceding space.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-name-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(format "\\b[%s][%s]*[%s]"
|
|
|
|
|
mail-extr-first-letters
|
|
|
|
|
mail-extr-all-letters
|
|
|
|
|
mail-extr-last-letters))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-initial-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(format "\\b[%s]\\([. ]\\|\\b\\)" mail-extr-first-letters))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches a single name before a comma.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; (defconst mail-extr-last-name-first-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
;; (concat "\\`" mail-extr-name-pattern ","))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches telephone extensions.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-telephone-extension-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"\\(\\([Ee]xt\\|[Tt]ph\\|[Tt]el\\|[Xx]\\)\\.?\\)? *\\+?[0-9][- 0-9]+")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches ham radio call signs.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Help from: Mat Maessen N2NJZ <maessm@rpi.edu>, Mark Feit
|
|
|
|
|
;; <mark@era.com>, Michael Covington <mcovingt@ai.uga.edu>.
|
2012-01-10 22:53:12 -08:00
|
|
|
|
;; Examples: DX504 DX515 K5MRU K8DHK KA9WGN KD3FU KD6EUI KD6HBW
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; KE9TV KF0NV N1API N3FU N3GZE N3IGS N4KCC N7IKQ N9HHU W4YHF W6ANK WA2SUH
|
|
|
|
|
;; WB7VZI N2NJZ NR3G KJ4KK AB4UM AL7NI KH6OH WN3KBT N4TMI W1A N0NZO
|
|
|
|
|
(defconst mail-extr-ham-call-sign-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"\\b\\(DX[0-9]+\\|[AKNW][A-Z]?[0-9][A-Z][A-Z]?[A-Z]?\\)")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
;; Possible trailing suffixes: "\\(/\\(KT\\|A[AEG]\\|[R0-9]\\)\\)?"
|
|
|
|
|
;; /KT == Temporary Technician (has CSC but not "real" license)
|
|
|
|
|
;; /AA == Temporary Advanced
|
|
|
|
|
;; /AE == Temporary Extra
|
|
|
|
|
;; /AG == Temporary General
|
|
|
|
|
;; /R == repeater
|
|
|
|
|
;; /# == stations operating out of home district
|
|
|
|
|
;; I don't include these in the regexp above because I can't imagine
|
|
|
|
|
;; anyone putting them with their name in an e-mail address.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;; Matches normal single-part name
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-normal-name-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(format "\\b[%s][%s]+[%s]"
|
|
|
|
|
mail-extr-first-letters
|
|
|
|
|
mail-extr-all-letters-but-separators
|
|
|
|
|
mail-extr-last-letters))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
;; Matches a single word name.
|
|
|
|
|
;; (defconst mail-extr-one-name-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
;; (concat "\\`" mail-extr-normal-name-pattern "\\'"))
|
2002-10-18 08:52:37 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Matches normal two names with missing middle initial
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; The first name is not allowed to have a hyphen because this can cause
|
|
|
|
|
;; false matches where the "middle initial" is actually the first letter
|
|
|
|
|
;; of the second part of the first name.
|
|
|
|
|
(defconst mail-extr-two-name-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(concat "\\`\\(" mail-extr-normal-name-pattern
|
|
|
|
|
"\\|" mail-extr-initial-pattern
|
|
|
|
|
"\\) +\\(" mail-extr-name-pattern "\\)\\(,\\|\\'\\)"))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
(defconst mail-extr-listserv-list-name-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"Multiple recipients of list \\([-A-Z]+\\)")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
(defconst mail-extr-stupid-vms-date-stamp-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"[0-9][0-9]-[JFMASOND][aepuco][nbrylgptvc]-[0-9][0-9][0-9][0-9] [0-9]+ *")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
;;; HZ -- GB (PRC Chinese character encoding) in ASCII embedding protocol
|
|
|
|
|
;;
|
|
|
|
|
;; In ASCII mode, a byte is interpreted as an ASCII character, unless a '~' is
|
|
|
|
|
;; encountered. The character '~' is an escape character. By convention, it
|
|
|
|
|
;; must be immediately followed ONLY by '~', '{' or '\n' (<LF>), with the
|
|
|
|
|
;; following special meaning.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; o The escape sequence '~~' is interpreted as a '~'.
|
|
|
|
|
;; o The escape-to-GB sequence '~{' switches the mode from ASCII to GB.
|
|
|
|
|
;; o The escape sequence '~\n' is a line-continuation marker to be consumed
|
|
|
|
|
;; with no output produced.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;;
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; In GB mode, characters are interpreted two bytes at a time as (pure) GB
|
|
|
|
|
;; codes until the escape-from-GB code '~}' is read. This code switches the
|
|
|
|
|
;; mode from GB back to ASCII. (Note that the escape-from-GB code '~}'
|
|
|
|
|
;; ($7E7D) is outside the defined GB range.)
|
|
|
|
|
(defconst mail-extr-hz-embedded-gb-encoded-chinese-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"~{\\([^~].\\|~[^}]\\)+~}")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
;; The leading optional lowercase letters are for a bastardized version of
|
|
|
|
|
;; the encoding, as is the optional nature of the final slash.
|
|
|
|
|
(defconst mail-extr-x400-encoded-address-pattern
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"[a-z]?[a-z]?\\(/[A-Za-z]+\\(\\.[A-Za-z]+\\)?=[^/]+\\)+/?\\'")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
(defconst mail-extr-x400-encoded-address-field-pattern-format
|
2022-07-10 18:57:19 +02:00
|
|
|
|
"/%s=\\([^/]+\\)\\(/\\|\\'\\)")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
(defconst mail-extr-x400-encoded-address-surname-pattern
|
|
|
|
|
;; S stands for Surname (family name).
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(format mail-extr-x400-encoded-address-field-pattern-format "[Ss]"))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
(defconst mail-extr-x400-encoded-address-given-name-pattern
|
|
|
|
|
;; G stands for Given name.
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(format mail-extr-x400-encoded-address-field-pattern-format "[Gg]"))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
(defconst mail-extr-x400-encoded-address-full-name-pattern
|
|
|
|
|
;; PN stands for Personal Name. When used it represents the combination
|
|
|
|
|
;; of the G and S fields.
|
|
|
|
|
;; "The one system I used having this field asked it with the prompt
|
|
|
|
|
;; `Personal Name'. But they mapped it into G and S on outgoing real
|
|
|
|
|
;; X.400 addresses. As they mapped G and S into PN on incoming..."
|
2022-07-10 18:57:19 +02:00
|
|
|
|
(format mail-extr-x400-encoded-address-field-pattern-format "[Pp][Nn]"))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
|
|
|
|
;; Syntax tables used for quick parsing.
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
(defconst mail-extr-address-syntax-table (make-syntax-table))
|
|
|
|
|
(defconst mail-extr-address-comment-syntax-table (make-syntax-table))
|
|
|
|
|
(defconst mail-extr-address-domain-literal-syntax-table (make-syntax-table))
|
|
|
|
|
(defconst mail-extr-address-text-comment-syntax-table (make-syntax-table))
|
|
|
|
|
(defconst mail-extr-address-text-syntax-table (make-syntax-table))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(mapc
|
|
|
|
|
(lambda (pair)
|
|
|
|
|
(let ((syntax-table (symbol-value (car pair))))
|
|
|
|
|
(dolist (item (cdr pair))
|
|
|
|
|
(if (eq 2 (length item))
|
|
|
|
|
;; modifying syntax of a single character
|
|
|
|
|
(modify-syntax-entry (car item) (car (cdr item)) syntax-table)
|
|
|
|
|
;; modifying syntax of a range of characters
|
|
|
|
|
(let ((char (nth 0 item))
|
|
|
|
|
(bound (nth 1 item))
|
|
|
|
|
(syntax (nth 2 item)))
|
|
|
|
|
(while (<= char bound)
|
|
|
|
|
(modify-syntax-entry char syntax syntax-table)
|
|
|
|
|
(setq char (1+ char))))))))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
'((mail-extr-address-syntax-table
|
|
|
|
|
(?\000 ?\037 "w") ;control characters
|
|
|
|
|
(?\040 " ") ;SPC
|
|
|
|
|
(?! ?~ "w") ;printable characters
|
|
|
|
|
(?\177 "w") ;DEL
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(?\t " ")
|
|
|
|
|
(?\r " ")
|
|
|
|
|
(?\n " ")
|
|
|
|
|
(?\( ".")
|
|
|
|
|
(?\) ".")
|
|
|
|
|
(?< ".")
|
|
|
|
|
(?> ".")
|
|
|
|
|
(?@ ".")
|
|
|
|
|
(?, ".")
|
|
|
|
|
(?\; ".")
|
|
|
|
|
(?: ".")
|
|
|
|
|
(?\\ "\\")
|
|
|
|
|
(?\" "\"")
|
|
|
|
|
(?. ".")
|
|
|
|
|
(?\[ ".")
|
|
|
|
|
(?\] ".")
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
;; % and ! aren't RFC 822 (or later) characters,
|
|
|
|
|
;; but it is convenient to pretend.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(?% ".")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(?! ".") ;; this needs to be word-constituent when not in .UUCP mode
|
1992-07-17 06:48:03 +00:00
|
|
|
|
)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(mail-extr-address-comment-syntax-table
|
|
|
|
|
(?\000 ?\377 "w")
|
|
|
|
|
(?\040 " ")
|
|
|
|
|
(?\240 " ")
|
|
|
|
|
(?\t " ")
|
|
|
|
|
(?\r " ")
|
|
|
|
|
(?\n " ")
|
2015-09-17 16:08:20 -07:00
|
|
|
|
(?\( "()")
|
|
|
|
|
(?\) ")(")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(?\\ "\\"))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(mail-extr-address-domain-literal-syntax-table
|
|
|
|
|
(?\000 ?\377 "w")
|
|
|
|
|
(?\040 " ")
|
|
|
|
|
(?\240 " ")
|
|
|
|
|
(?\t " ")
|
|
|
|
|
(?\r " ")
|
|
|
|
|
(?\n " ")
|
2015-09-17 16:08:20 -07:00
|
|
|
|
(?\[ "(]") ;??????
|
|
|
|
|
(?\] ")[") ;??????
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(?\\ "\\"))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(mail-extr-address-text-comment-syntax-table
|
|
|
|
|
(?\000 ?\377 "w")
|
|
|
|
|
(?\040 " ")
|
|
|
|
|
(?\240 " ")
|
|
|
|
|
(?\t " ")
|
|
|
|
|
(?\r " ")
|
|
|
|
|
(?\n " ")
|
2015-09-17 16:08:20 -07:00
|
|
|
|
(?\( "()")
|
|
|
|
|
(?\) ")(")
|
|
|
|
|
(?\[ "(]")
|
|
|
|
|
(?\] ")[")
|
|
|
|
|
(?\{ "(}")
|
|
|
|
|
(?\} "){")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(?\\ "\\")
|
|
|
|
|
(?\" "\"")
|
2015-09-17 16:08:20 -07:00
|
|
|
|
;; (?\' ")`")
|
|
|
|
|
;; (?\` "('")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(mail-extr-address-text-syntax-table
|
|
|
|
|
(?\000 ?\177 ".")
|
|
|
|
|
(?\200 ?\377 "w")
|
|
|
|
|
(?\040 " ")
|
|
|
|
|
(?\t " ")
|
|
|
|
|
(?\r " ")
|
|
|
|
|
(?\n " ")
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(?A ?Z "w")
|
|
|
|
|
(?a ?z "w")
|
|
|
|
|
(?- "w")
|
|
|
|
|
(?\} "w")
|
|
|
|
|
(?\{ "w")
|
|
|
|
|
(?| "w")
|
|
|
|
|
(?\' "w")
|
|
|
|
|
(?~ "w")
|
|
|
|
|
(?0 ?9 "w"))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Utility functions and macros.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
|
|
|
|
|
2003-10-23 11:42:11 +00:00
|
|
|
|
;; Fixme: There are Latin-1 nbsp below. If such characters should be
|
|
|
|
|
;; included, this is the wrong thing to do -- it should use syntax (or
|
|
|
|
|
;; regexp char classes).
|
|
|
|
|
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(defsubst mail-extr-skip-whitespace-forward ()
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; v19 fn skip-syntax-forward is more tasteful, but not byte-coded.
|
2003-05-18 21:27:41 +00:00
|
|
|
|
(skip-chars-forward " \t\n\r "))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(defsubst mail-extr-skip-whitespace-backward ()
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; v19 fn skip-syntax-backward is more tasteful, but not byte-coded.
|
2003-05-18 21:27:41 +00:00
|
|
|
|
(skip-chars-backward " \t\n\r "))
|
2001-04-02 22:49:38 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(defsubst mail-extr-undo-backslash-quoting (beg end)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region beg end)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
;; undo \ quoting
|
|
|
|
|
(while (search-forward "\\" nil t)
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(delete-char -1)
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(or (eobp)
|
|
|
|
|
(forward-char 1))))))
|
|
|
|
|
|
|
|
|
|
(defsubst mail-extr-nuke-char-at (pos)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char pos)
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(delete-char 1)
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(insert ?\ )))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
|
|
|
|
(put 'mail-extr-nuke-outside-range
|
|
|
|
|
'edebug-form-spec '(symbolp &optional form form atom))
|
|
|
|
|
|
|
|
|
|
(defmacro mail-extr-nuke-outside-range (list-symbol
|
|
|
|
|
beg-symbol end-symbol
|
|
|
|
|
&optional no-replace)
|
2001-11-19 23:16:21 +00:00
|
|
|
|
"Delete all elements outside BEG..END in LIST.
|
|
|
|
|
LIST-SYMBOL names a variable holding a list of buffer positions
|
|
|
|
|
BEG-SYMBOL and END-SYMBOL name variables delimiting a range
|
|
|
|
|
Each element of LIST-SYMBOL which lies outside of the range is
|
|
|
|
|
deleted from the list.
|
|
|
|
|
Unless NO-REPLACE is true, at each of the positions in LIST-SYMBOL
|
|
|
|
|
which lie outside of the range, one character at that position is
|
|
|
|
|
replaced with a SPC."
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(or (memq no-replace '(t nil))
|
2024-07-08 14:24:33 +02:00
|
|
|
|
(error "`no-replace' must be t or nil, evaluable at macroexpand-time"))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
`(let ((temp ,list-symbol)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
ch)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(while temp
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(setq ch (car temp))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when (or (> ch ,end-symbol)
|
|
|
|
|
(< ch ,beg-symbol))
|
|
|
|
|
,@(if no-replace
|
|
|
|
|
nil
|
2018-11-05 01:22:15 +01:00
|
|
|
|
'((mail-extr-nuke-char-at ch)))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(setcar temp nil))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(setq temp (cdr temp)))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(setq ,list-symbol (delq nil ,list-symbol))))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defun mail-extr-demarkerize (marker)
|
|
|
|
|
;; if arg is a marker, destroys the marker, then returns the old value.
|
|
|
|
|
;; otherwise returns the arg.
|
|
|
|
|
(if (markerp marker)
|
|
|
|
|
(let ((temp (marker-position marker)))
|
|
|
|
|
(set-marker marker nil)
|
|
|
|
|
temp)
|
|
|
|
|
marker))
|
|
|
|
|
|
|
|
|
|
(defun mail-extr-markerize (pos)
|
|
|
|
|
;; coerces pos to a marker if non-nil.
|
|
|
|
|
(if (or (markerp pos) (null pos))
|
|
|
|
|
pos
|
|
|
|
|
(copy-marker pos)))
|
|
|
|
|
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(defsubst mail-extr-safe-move-sexp (arg)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;; Safely skip over one balanced sexp, if there is one. Return t if success.
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(condition-case error
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (or (scan-sexps (point) arg) (point)))
|
|
|
|
|
t)
|
|
|
|
|
(error
|
|
|
|
|
;; #### kludge kludge kludge kludge kludge kludge kludge !!!
|
|
|
|
|
(if (string-equal (nth 1 error) "Unbalanced parentheses")
|
|
|
|
|
nil
|
|
|
|
|
(while t
|
|
|
|
|
(signal (car error) (cdr error)))))))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; The main function to grind addresses
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
(defvar disable-initial-guessing-flag) ; dynamic assignment
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(defvar mailextr-cbeg) ; dynamic assignment
|
|
|
|
|
(defvar mailextr-cend) ; dynamic assignment
|
2004-08-22 17:09:58 +00:00
|
|
|
|
(defvar mail-extr-all-top-level-domains) ; Defined below.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;;###autoload
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(defun mail-extract-address-components (address &optional all)
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
"Extract full name and canonical address from ADDRESS.
|
|
|
|
|
ADDRESS should be in RFC 822 (or later) format.
|
2005-12-09 16:44:18 +00:00
|
|
|
|
Returns a list of the form (FULL-NAME CANONICAL-ADDRESS). If no
|
|
|
|
|
name can be extracted, FULL-NAME will be nil. Also see
|
|
|
|
|
`mail-extr-ignore-single-names' and
|
|
|
|
|
`mail-extr-ignore-realname-equals-mailbox-name'.
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
If the optional argument ALL is non-nil, then ADDRESS can contain zero
|
|
|
|
|
or more recipients, separated by commas, and we return a list of
|
|
|
|
|
the form ((FULL-NAME CANONICAL-ADDRESS) ...) with one element for
|
|
|
|
|
each recipient. If ALL is nil, then if ADDRESS contains more than
|
|
|
|
|
one recipients, all but the first is ignored.
|
|
|
|
|
|
2001-04-02 22:49:38 +00:00
|
|
|
|
ADDRESS may be a string or a buffer. If it is a buffer, the visible
|
2002-09-25 20:21:28 +00:00
|
|
|
|
\(narrowed) portion of the buffer will be interpreted as the address.
|
|
|
|
|
\(This feature exists so that the clever caller might be able to avoid
|
2018-04-15 19:45:05 +02:00
|
|
|
|
consing a string.)
|
|
|
|
|
|
|
|
|
|
This function is primarily meant for when you're displaying the
|
|
|
|
|
result to the user: Many prettifications are applied to the
|
|
|
|
|
result returned. If you want to decode an address for further
|
|
|
|
|
non-display use, you should probably use
|
2021-08-14 15:20:59 +02:00
|
|
|
|
`mail-header-parse-address' instead. Also see
|
|
|
|
|
`mail-header-parse-address-lax' for a function that's less strict
|
|
|
|
|
than `mail-header-parse-address', but does less post-processing
|
|
|
|
|
to the results."
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(let ((canonicalization-buffer (get-buffer-create " *canonical address*"))
|
|
|
|
|
(extraction-buffer (get-buffer-create " *extract address components*"))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
value-list)
|
|
|
|
|
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create extraction-buffer)
|
1992-08-04 04:15:43 +00:00
|
|
|
|
(buffer-disable-undo extraction-buffer)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(set-syntax-table mail-extr-address-syntax-table)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(widen)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(setq case-fold-search nil)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Insert extra space at beginning to allow later replacement with <
|
|
|
|
|
;; without having to move markers.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(insert ?\ )
|
|
|
|
|
|
|
|
|
|
;; Insert the address itself.
|
|
|
|
|
(cond ((stringp address)
|
|
|
|
|
(insert address))
|
|
|
|
|
((bufferp address)
|
|
|
|
|
(insert-buffer-substring address))
|
|
|
|
|
(t
|
1996-01-05 07:14:40 +00:00
|
|
|
|
(error "Invalid address: %s" address)))
|
1996-12-19 02:48:49 +00:00
|
|
|
|
|
|
|
|
|
(set-text-properties (point-min) (point-max) nil)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create canonicalization-buffer)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(buffer-disable-undo canonicalization-buffer)
|
|
|
|
|
(setq case-fold-search nil))
|
|
|
|
|
|
2002-10-18 08:52:37 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Unfold multiple lines.
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t)
|
|
|
|
|
(replace-match "\\1 " t))
|
2002-10-18 08:52:37 +00:00
|
|
|
|
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; Loop over addresses until we have as many as we want.
|
|
|
|
|
(while (and (or all (null value-list))
|
|
|
|
|
(progn (goto-char (point-min))
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(not (eobp))))
|
|
|
|
|
(let (char
|
|
|
|
|
end-of-address
|
1998-04-12 06:43:56 +00:00
|
|
|
|
<-pos >-pos @-pos colon-pos comma-pos !-pos %-pos \;-pos
|
1997-11-20 21:45:59 +00:00
|
|
|
|
group-:-pos group-\;-pos route-addr-:-pos
|
|
|
|
|
first-real-pos last-real-pos
|
|
|
|
|
phrase-beg phrase-end
|
2010-11-06 12:28:44 -07:00
|
|
|
|
;; Dynamically set in mail-extr-voodoo.
|
|
|
|
|
mailextr-cbeg mailextr-cend
|
1997-11-20 21:45:59 +00:00
|
|
|
|
quote-beg quote-end
|
|
|
|
|
atom-beg atom-end
|
|
|
|
|
mbox-beg mbox-end
|
|
|
|
|
\.-ends-name
|
|
|
|
|
temp
|
|
|
|
|
;; name-suffix
|
|
|
|
|
fi mi li ; first, middle, last initial
|
|
|
|
|
saved-%-pos saved-!-pos saved-@-pos
|
|
|
|
|
domain-pos \.-pos insert-point
|
|
|
|
|
;; mailbox-name-processed-flag
|
|
|
|
|
disable-initial-guessing-flag) ; dynamically set from -voodoo
|
|
|
|
|
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(set-syntax-table mail-extr-address-syntax-table)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
|
|
|
|
|
;; Insert extra space at beginning to allow later replacement with <
|
|
|
|
|
;; without having to move markers.
|
|
|
|
|
(or (eq (following-char) ?\ )
|
|
|
|
|
(insert ?\ ))
|
|
|
|
|
|
|
|
|
|
;; First pass grabs useful information about address.
|
|
|
|
|
(while (progn
|
|
|
|
|
(mail-extr-skip-whitespace-forward)
|
|
|
|
|
(not (eobp)))
|
|
|
|
|
(setq char (char-after (point)))
|
|
|
|
|
(or first-real-pos
|
|
|
|
|
(if (not (eq char ?\())
|
|
|
|
|
(setq first-real-pos (point))))
|
|
|
|
|
(cond
|
|
|
|
|
;; comment
|
|
|
|
|
((eq char ?\()
|
|
|
|
|
(set-syntax-table mail-extr-address-comment-syntax-table)
|
|
|
|
|
;; only record the first non-empty comment's position
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(if (and (not mailextr-cbeg)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(mail-extr-skip-whitespace-forward)
|
|
|
|
|
(not (eq ?\) (char-after (point))))))
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(setq mailextr-cbeg (point)))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; TODO: don't record if unbalanced
|
|
|
|
|
(or (mail-extr-safe-move-sexp 1)
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
(set-syntax-table mail-extr-address-syntax-table)
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(if (and mailextr-cbeg
|
|
|
|
|
(not mailextr-cend))
|
|
|
|
|
(setq mailextr-cend (point))))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; quoted text
|
|
|
|
|
((eq char ?\")
|
|
|
|
|
;; only record the first non-empty quote's position
|
|
|
|
|
(if (and (not quote-beg)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(mail-extr-skip-whitespace-forward)
|
|
|
|
|
(not (eq ?\" (char-after (point))))))
|
|
|
|
|
(setq quote-beg (point)))
|
|
|
|
|
;; TODO: don't record if unbalanced
|
|
|
|
|
(or (mail-extr-safe-move-sexp 1)
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
(if (and quote-beg
|
|
|
|
|
(not quote-end))
|
|
|
|
|
(setq quote-end (point))))
|
|
|
|
|
;; domain literals
|
|
|
|
|
((eq char ?\[)
|
|
|
|
|
(set-syntax-table mail-extr-address-domain-literal-syntax-table)
|
|
|
|
|
(or (mail-extr-safe-move-sexp 1)
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
(set-syntax-table mail-extr-address-syntax-table))
|
|
|
|
|
;; commas delimit addresses when outside < > pairs.
|
|
|
|
|
((and (eq char ?,)
|
|
|
|
|
(or (and (null <-pos)
|
|
|
|
|
;; Handle ROUTE-ADDR address that is missing its <.
|
|
|
|
|
(not (eq ?@ (char-after (1+ (point))))))
|
|
|
|
|
(and >-pos
|
|
|
|
|
;; handle weird munged addresses
|
|
|
|
|
;; BUG FIX: This test was reversed. Thanks to the
|
|
|
|
|
;; brilliant Rod Whitby <rwhitby@research.canon.oz.au>
|
|
|
|
|
;; for discovering this!
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(< (car (last <-pos)) (car >-pos)))))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; The argument contains more than one address.
|
|
|
|
|
;; Temporarily hide everything after this one.
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(setq end-of-address (copy-marker (1+ (point)) t))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(narrow-to-region (point-min) (1+ (point)))
|
2001-04-02 22:49:38 +00:00
|
|
|
|
(delete-char 1)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(setq char ?\() ; HAVE I NO SHAME??
|
|
|
|
|
)
|
|
|
|
|
;; record the position of various interesting chars, determine
|
2008-02-05 13:00:43 +00:00
|
|
|
|
;; validity later.
|
2021-03-11 14:32:42 -05:00
|
|
|
|
((memq char '(?< ?> ?@ ?: ?, ?! ?% ?\;))
|
|
|
|
|
(push (point) (pcase-exhaustive char
|
|
|
|
|
(?< <-pos)
|
|
|
|
|
(?> >-pos)
|
|
|
|
|
(?@ @-pos)
|
|
|
|
|
(?: colon-pos)
|
|
|
|
|
(?, comma-pos)
|
|
|
|
|
(?! !-pos)
|
|
|
|
|
(?% %-pos)
|
|
|
|
|
(?\; \;-pos)))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(forward-char 1))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
((eq char ?.)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(forward-char 1))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
((memq char '(
|
2008-02-05 13:00:43 +00:00
|
|
|
|
;; comment terminator invalid
|
1997-11-20 21:45:59 +00:00
|
|
|
|
?\)
|
2008-02-05 13:00:43 +00:00
|
|
|
|
;; domain literal terminator invalid
|
1997-11-20 21:45:59 +00:00
|
|
|
|
?\]
|
|
|
|
|
;; \ allowed only within quoted strings,
|
|
|
|
|
;; domain literals, and comments
|
|
|
|
|
?\\
|
|
|
|
|
))
|
|
|
|
|
(mail-extr-nuke-char-at (point))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(forward-char 1))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(t
|
2007-05-22 02:13:27 +00:00
|
|
|
|
;; Do `(forward-word 1)', recognizing non-ASCII characters
|
|
|
|
|
;; except Latin-1 nbsp as words.
|
|
|
|
|
(while (progn
|
|
|
|
|
(skip-chars-forward "^\000-\177 ")
|
|
|
|
|
(and (not (eobp))
|
|
|
|
|
(eq ?w (char-syntax (char-after)))
|
|
|
|
|
(progn
|
Fix problems caused by new implementation of sub-word mode
* lisp/subr.el (forward-word-strictly, backward-word-strictly):
New functions.
(word-move-empty-char-table): New variable.
* etc/NEWS: Mention 'forward-word-strictly' and
'backward-word-strictly'.
* doc/lispref/positions.texi (Word Motion): Document
'find-word-boundary-function-table', 'forward-word-strictly', and
'backward-word-strictly'. (Bug#22560)
* src/syntax.c (syms_of_syntax)
<find-word-boundary-function-table>: Doc fix.
* lisp/wdired.el (wdired-xcase-word):
* lisp/textmodes/texnfo-upd.el (texinfo-copy-node-name)
(texinfo-copy-section-title, texinfo-start-menu-description)
(texinfo-copy-menu-title, texinfo-specific-section-type)
(texinfo-insert-node-lines, texinfo-copy-next-section-title):
* lisp/textmodes/texinfo.el (texinfo-clone-environment)
(texinfo-insert-@end):
* lisp/textmodes/texinfmt.el (texinfo-format-scan)
(texinfo-anchor, texinfo-multitable-widths)
(texinfo-multitable-item):
* lisp/textmodes/tex-mode.el (latex-env-before-change):
* lisp/textmodes/flyspell.el (texinfo-mode-flyspell-verify):
* lisp/skeleton.el (skeleton-insert):
* lisp/simple.el (count-words):
* lisp/progmodes/vhdl-mode.el (vhdl-beginning-of-libunit)
(vhdl-beginning-of-defun, vhdl-beginning-of-statement-1)
(vhdl-update-sensitivity-list, vhdl-template-block)
(vhdl-template-break, vhdl-template-case, vhdl-template-default)
(vhdl-template-default-indent, vhdl-template-for-loop)
(vhdl-template-if-then-use, vhdl-template-bare-loop)
(vhdl-template-nature, vhdl-template-procedural)
(vhdl-template-process, vhdl-template-selected-signal-asst)
(vhdl-template-type, vhdl-template-variable)
(vhdl-template-while-loop, vhdl-beginning-of-block)
(vhdl-hooked-abbrev, vhdl-port-copy, vhdl-hs-forward-sexp-func):
* lisp/progmodes/verilog-mode.el (verilog-backward-sexp)
(verilog-forward-sexp, verilog-beg-of-statement)
(verilog-set-auto-endcomments, verilog-backward-token)
(verilog-do-indent):
* lisp/progmodes/vera-mode.el (vera-guess-basic-syntax)
(vera-indent-block-closing):
* lisp/progmodes/simula.el (simula-context)
(simula-backward-up-level, simula-forward-down-level)
(simula-previous-statement, simula-next-statement)
(simula-skip-comment-backward, simula-calculate-indent)
(simula-find-if, simula-electric-keyword):
* lisp/progmodes/sh-script.el (sh-smie--rc-newline-semi-p):
* lisp/progmodes/ruby-mode.el (ruby-smie--redundant-do-p)
(ruby-smie--forward-token, ruby-smie--backward-token)
(ruby-singleton-class-p, ruby-calculate-indent)
(ruby-forward-sexp, ruby-backward-sexp):
* lisp/progmodes/ps-mode.el (ps-run-goto-error):
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function)
(perl-syntax-propertize-special-constructs)
(perl-backward-to-start-of-continued-exp):
* lisp/progmodes/pascal.el (pascal-indent-declaration):
* lisp/progmodes/octave.el (octave-function-file-p):
* lisp/progmodes/mantemp.el (mantemp-insert-cxx-syntax):
* lisp/progmodes/js.el (js--forward-function-decl):
* lisp/progmodes/idlwave.el (idlwave-show-begin-check)
(idlwave-beginning-of-block, idlwave-end-of-block)
(idlwave-block-jump-out, idlwave-determine-class):
* lisp/progmodes/icon.el (icon-is-continuation-line)
(icon-backward-to-start-of-continued-exp, end-of-icon-defun):
* lisp/progmodes/hideif.el (hide-ifdef-define):
* lisp/progmodes/f90.el (f90-change-keywords):
* lisp/progmodes/cperl-mode.el (cperl-electric-pod)
(cperl-linefeed, cperl-electric-terminator)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-invert-if-unless):
* lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur):
* lisp/progmodes/cc-align.el (c-lineup-java-inher):
* lisp/progmodes/ada-mode.el (ada-compile-goto-error)
(ada-adjust-case-skeleton, ada-create-case-exception)
(ada-create-case-exception-substring)
(ada-case-read-exceptions-from-file, ada-after-keyword-p)
(ada-scan-paramlist, ada-get-current-indent, ada-get-indent-end)
(ada-get-indent-if, ada-get-indent-block-start)
(ada-get-indent-loop, ada-get-indent-type)
(ada-search-prev-end-stmt, ada-check-defun-name)
(ada-goto-decl-start, ada-goto-matching-start)
(ada-goto-matching-end, ada-looking-at-semi-or)
(ada-looking-at-semi-private, ada-in-paramlist-p)
(ada-search-ignore-complex-boolean, ada-move-to-start)
(ada-move-to-end, ada-which-function, ada-gen-treat-proc):
* lisp/net/quickurl.el (quickurl-grab-url):
* lisp/mail/sendmail.el (mail-do-fcc):
* lisp/mail/rmail.el (rmail-resend):
* lisp/mail/mailabbrev.el (mail-abbrev-complete-alias):
* lisp/mail/mail-extr.el (mail-extract-address-components):
* lisp/json.el (json-read-keyword):
* lisp/files.el (insert-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/completion.el (symbol-under-point, symbol-before-point)
(symbol-before-point-for-complete, next-cdabbrev)
(add-completions-from-c-buffer):
* lisp/cedet/semantic/texi.el (semantic-up-context)
(semantic-beginning-of-context):
* lisp/cedet/semantic/bovine/el.el (semantic-get-local-variables):
use 'forward-word-strictly' and 'backward-word-strictly' instead
of 'forward-word' and 'backward-word'.
[This reapplies commit c1d32a65372c72d7de4808d620eefd3214a8e92a,
which was inadvertently lost by merge commit
c71e7cc113ed0d5f01aaa2e441a3e3c9fbeb9fa5.]
2016-03-21 17:42:35 -07:00
|
|
|
|
(forward-word-strictly 1)
|
2007-05-22 02:13:27 +00:00
|
|
|
|
(and (not (eobp))
|
|
|
|
|
(> (char-after) ?\177)
|
|
|
|
|
(not (eq (char-after) ? )))))))))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(or (eq char ?\()
|
|
|
|
|
;; At the end of first address of a multiple address header.
|
|
|
|
|
(and (eq char ?,)
|
|
|
|
|
(eobp))
|
|
|
|
|
(setq last-real-pos (point))))
|
|
|
|
|
|
|
|
|
|
;; Use only the leftmost <, if any. Replace all others with spaces.
|
|
|
|
|
(while (cdr <-pos)
|
|
|
|
|
(mail-extr-nuke-char-at (car <-pos))
|
|
|
|
|
(setq <-pos (cdr <-pos)))
|
|
|
|
|
|
|
|
|
|
;; Use only the rightmost >, if any. Replace all others with spaces.
|
|
|
|
|
(while (cdr >-pos)
|
|
|
|
|
(mail-extr-nuke-char-at (nth 1 >-pos))
|
|
|
|
|
(setcdr >-pos (nthcdr 2 >-pos)))
|
|
|
|
|
|
|
|
|
|
;; If multiple @s and a :, but no < and >, insert around buffer.
|
|
|
|
|
;; Example: @foo.bar.dom,@xxx.yyy.zzz:mailbox@aaa.bbb.ccc
|
|
|
|
|
;; This commonly happens on the UUCP "From " line. Ugh.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when (and (> (length @-pos) 1)
|
1998-04-12 06:43:56 +00:00
|
|
|
|
(eq 1 (length colon-pos)) ;TODO: check if between last two @s
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(not \;-pos)
|
|
|
|
|
(not <-pos))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(delete-char 1)
|
|
|
|
|
(setq <-pos (list (point)))
|
|
|
|
|
(insert ?<))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; If < but no >, insert > in rightmost possible position
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when (and <-pos (null >-pos))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(setq >-pos (list (point)))
|
|
|
|
|
(insert ?>))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; If > but no <, replace > with space.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when (and >-pos (null <-pos))
|
|
|
|
|
(mail-extr-nuke-char-at (car >-pos))
|
|
|
|
|
(setq >-pos nil))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; Turn >-pos and <-pos into non-lists
|
|
|
|
|
(setq >-pos (car >-pos)
|
|
|
|
|
<-pos (car <-pos))
|
|
|
|
|
|
|
|
|
|
;; Trim other punctuation lists of items outside < > pair to handle
|
|
|
|
|
;; stupid MTAs.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when <-pos ; don't need to check >-pos also
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
;; Handle bozo software that violates RFC 822 (or later)
|
|
|
|
|
;; by sticking punctuation marks outside of a < > pair.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(mail-extr-nuke-outside-range @-pos <-pos >-pos t)
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
;; RFC 822 (or later) says nothing about these two outside < >, but
|
2001-11-19 23:16:21 +00:00
|
|
|
|
;; remove those positions from the lists to make things
|
|
|
|
|
;; easier.
|
|
|
|
|
(mail-extr-nuke-outside-range !-pos <-pos >-pos t)
|
|
|
|
|
(mail-extr-nuke-outside-range %-pos <-pos >-pos t))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; Check for : that indicates GROUP list and for : part of
|
|
|
|
|
;; ROUTE-ADDR spec.
|
|
|
|
|
;; Can't possibly be more than two :. Nuke any extra.
|
1998-04-12 06:43:56 +00:00
|
|
|
|
(while colon-pos
|
|
|
|
|
(setq temp (car colon-pos)
|
|
|
|
|
colon-pos (cdr colon-pos))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(cond ((and <-pos >-pos
|
|
|
|
|
(> temp <-pos)
|
|
|
|
|
(< temp >-pos))
|
|
|
|
|
(if (or route-addr-:-pos
|
|
|
|
|
(< (length @-pos) 2)
|
|
|
|
|
(> temp (car @-pos))
|
|
|
|
|
(< temp (nth 1 @-pos)))
|
|
|
|
|
(mail-extr-nuke-char-at temp)
|
|
|
|
|
(setq route-addr-:-pos temp)))
|
|
|
|
|
((or (not <-pos)
|
|
|
|
|
(and <-pos
|
|
|
|
|
(< temp <-pos)))
|
|
|
|
|
(setq group-:-pos temp))))
|
|
|
|
|
|
|
|
|
|
;; Nuke any ; that is in or to the left of a < > pair or to the left
|
|
|
|
|
;; of a GROUP starting :. Also, there may only be one ;.
|
|
|
|
|
(while \;-pos
|
|
|
|
|
(setq temp (car \;-pos)
|
|
|
|
|
\;-pos (cdr \;-pos))
|
|
|
|
|
(cond ((and <-pos >-pos
|
|
|
|
|
(> temp <-pos)
|
|
|
|
|
(< temp >-pos))
|
|
|
|
|
(mail-extr-nuke-char-at temp))
|
|
|
|
|
((and (or (not group-:-pos)
|
|
|
|
|
(> temp group-:-pos))
|
|
|
|
|
(not group-\;-pos))
|
|
|
|
|
(setq group-\;-pos temp))))
|
|
|
|
|
|
|
|
|
|
;; Nuke unmatched GROUP syntax characters.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when (and group-:-pos (not group-\;-pos))
|
|
|
|
|
;; *** Do I really need to erase it?
|
|
|
|
|
(mail-extr-nuke-char-at group-:-pos)
|
|
|
|
|
(setq group-:-pos nil))
|
|
|
|
|
(when (and group-\;-pos (not group-:-pos))
|
|
|
|
|
;; *** Do I really need to erase it?
|
|
|
|
|
(mail-extr-nuke-char-at group-\;-pos)
|
|
|
|
|
(setq group-\;-pos nil))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; Handle junk like ";@host.company.dom" that sendmail adds.
|
|
|
|
|
;; **** should I remember comment positions?
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when group-\;-pos
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; this is fine for now
|
|
|
|
|
(mail-extr-nuke-outside-range !-pos group-:-pos group-\;-pos t)
|
|
|
|
|
(mail-extr-nuke-outside-range @-pos group-:-pos group-\;-pos t)
|
|
|
|
|
(mail-extr-nuke-outside-range %-pos group-:-pos group-\;-pos t)
|
|
|
|
|
(mail-extr-nuke-outside-range comma-pos group-:-pos group-\;-pos t)
|
|
|
|
|
(and last-real-pos
|
|
|
|
|
(> last-real-pos (1+ group-\;-pos))
|
|
|
|
|
(setq last-real-pos (1+ group-\;-pos)))
|
|
|
|
|
;; *** This may be wrong:
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(and mailextr-cend
|
|
|
|
|
(> mailextr-cend group-\;-pos)
|
|
|
|
|
(setq mailextr-cend nil
|
|
|
|
|
mailextr-cbeg nil))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(and quote-end
|
|
|
|
|
(> quote-end group-\;-pos)
|
|
|
|
|
(setq quote-end nil
|
|
|
|
|
quote-beg nil))
|
|
|
|
|
;; This was both wrong and unnecessary:
|
|
|
|
|
;;(narrow-to-region (point-min) group-\;-pos)
|
|
|
|
|
|
|
|
|
|
;; *** The entire handling of GROUP addresses seems rather lame.
|
|
|
|
|
;; *** It deserves a complete rethink, except that these addresses
|
|
|
|
|
;; *** are hardly ever seen.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; Any commas must be between < and : of ROUTE-ADDR. Nuke any
|
|
|
|
|
;; others.
|
2002-10-18 08:52:37 +00:00
|
|
|
|
;; Hell, go ahead and nuke all of the commas.
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; **** This will cause problems when we start handling commas in
|
|
|
|
|
;; the PHRASE part .... no it won't ... yes it will ... ?????
|
|
|
|
|
(mail-extr-nuke-outside-range comma-pos 1 1)
|
|
|
|
|
|
|
|
|
|
;; can only have multiple @s inside < >. The fact that some MTAs
|
|
|
|
|
;; put de-bracketed ROUTE-ADDRs in the UUCP-style "From " line is
|
|
|
|
|
;; handled above.
|
|
|
|
|
|
|
|
|
|
;; Locate PHRASE part of ROUTE-ADDR.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when <-pos
|
|
|
|
|
(goto-char <-pos)
|
|
|
|
|
(mail-extr-skip-whitespace-backward)
|
|
|
|
|
(setq phrase-end (point))
|
|
|
|
|
(goto-char (or ;;group-:-pos
|
|
|
|
|
(point-min)))
|
|
|
|
|
(mail-extr-skip-whitespace-forward)
|
|
|
|
|
(if (< (point) phrase-end)
|
|
|
|
|
(setq phrase-beg (point))
|
|
|
|
|
(setq phrase-end nil)))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; handle ROUTE-ADDRS with real ROUTEs.
|
|
|
|
|
;; If there are multiple @s, then we assume ROUTE-ADDR syntax, and
|
|
|
|
|
;; any % or ! must be semantically meaningless.
|
|
|
|
|
;; TODO: do this processing into canonicalization buffer
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when route-addr-:-pos
|
|
|
|
|
(setq !-pos nil
|
|
|
|
|
%-pos nil
|
|
|
|
|
>-pos (copy-marker >-pos)
|
|
|
|
|
route-addr-:-pos (copy-marker route-addr-:-pos))
|
|
|
|
|
(goto-char >-pos)
|
|
|
|
|
(insert-before-markers ?X)
|
|
|
|
|
(goto-char (car @-pos))
|
|
|
|
|
(while (setq @-pos (cdr @-pos))
|
|
|
|
|
(delete-char 1)
|
|
|
|
|
(setq %-pos (cons (point-marker) %-pos))
|
|
|
|
|
(insert "%")
|
|
|
|
|
(goto-char (1- >-pos))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(insert-buffer-substring extraction-buffer
|
|
|
|
|
(car @-pos) route-addr-:-pos)
|
|
|
|
|
(delete-region (car @-pos) route-addr-:-pos))
|
|
|
|
|
(or (cdr @-pos)
|
|
|
|
|
(setq saved-@-pos (list (point)))))
|
|
|
|
|
(setq @-pos saved-@-pos)
|
|
|
|
|
(goto-char >-pos)
|
|
|
|
|
(delete-char -1)
|
|
|
|
|
(mail-extr-nuke-char-at route-addr-:-pos)
|
|
|
|
|
(mail-extr-demarkerize route-addr-:-pos)
|
|
|
|
|
(setq route-addr-:-pos nil
|
|
|
|
|
>-pos (mail-extr-demarkerize >-pos)
|
2021-03-11 14:32:42 -05:00
|
|
|
|
%-pos (mapcar #'mail-extr-demarkerize %-pos)))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; de-listify @-pos
|
|
|
|
|
(setq @-pos (car @-pos))
|
|
|
|
|
|
|
|
|
|
;; TODO: remove comments in the middle of an address
|
|
|
|
|
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(with-current-buffer canonicalization-buffer
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(widen)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert-buffer-substring extraction-buffer)
|
|
|
|
|
|
|
|
|
|
(if <-pos
|
|
|
|
|
(narrow-to-region (progn
|
|
|
|
|
(goto-char (1+ <-pos))
|
|
|
|
|
(mail-extr-skip-whitespace-forward)
|
|
|
|
|
(point))
|
|
|
|
|
>-pos)
|
|
|
|
|
(if (and first-real-pos last-real-pos)
|
|
|
|
|
(narrow-to-region first-real-pos last-real-pos)
|
|
|
|
|
;; ****** Oh no! What if the address is completely empty!
|
|
|
|
|
;; *** Is this correct?
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(narrow-to-region (point-max) (point-max))))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
(and @-pos %-pos
|
|
|
|
|
(mail-extr-nuke-outside-range %-pos (point-min) @-pos))
|
|
|
|
|
(and %-pos !-pos
|
|
|
|
|
(mail-extr-nuke-outside-range !-pos (point-min) (car %-pos)))
|
|
|
|
|
(and @-pos !-pos (not %-pos)
|
|
|
|
|
(mail-extr-nuke-outside-range !-pos (point-min) @-pos))
|
|
|
|
|
|
|
|
|
|
;; Error condition:?? (and %-pos (not @-pos))
|
|
|
|
|
|
|
|
|
|
;; WARNING: THIS CODE IS DUPLICATED BELOW.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when (and %-pos (not @-pos))
|
|
|
|
|
(goto-char (car %-pos))
|
|
|
|
|
(delete-char 1)
|
|
|
|
|
(setq @-pos (point))
|
|
|
|
|
(insert "@")
|
|
|
|
|
(setq %-pos (cdr %-pos)))
|
|
|
|
|
|
|
|
|
|
(when (and mail-extr-mangle-uucp !-pos)
|
|
|
|
|
;; **** I don't understand this save-restriction and the
|
|
|
|
|
;; narrow-to-region inside it. Why did I do that?
|
|
|
|
|
(save-restriction
|
|
|
|
|
(cond ((and @-pos
|
|
|
|
|
mail-extr-@-binds-tighter-than-!)
|
|
|
|
|
(goto-char @-pos)
|
|
|
|
|
(setq %-pos (cons (point) %-pos)
|
|
|
|
|
@-pos nil)
|
|
|
|
|
(delete-char 1)
|
|
|
|
|
(insert "%")
|
|
|
|
|
(setq insert-point (point-max)))
|
|
|
|
|
(mail-extr-@-binds-tighter-than-!
|
|
|
|
|
(setq insert-point (point-max)))
|
|
|
|
|
(%-pos
|
|
|
|
|
(setq insert-point (car (last %-pos))
|
2021-03-11 14:32:42 -05:00
|
|
|
|
saved-%-pos (mapcar #'mail-extr-markerize %-pos)
|
2001-11-19 23:16:21 +00:00
|
|
|
|
%-pos nil
|
|
|
|
|
@-pos (mail-extr-markerize @-pos)))
|
|
|
|
|
(@-pos
|
|
|
|
|
(setq insert-point @-pos)
|
|
|
|
|
(setq @-pos (mail-extr-markerize @-pos)))
|
|
|
|
|
(t
|
|
|
|
|
(setq insert-point (point-max))))
|
|
|
|
|
(narrow-to-region (point-min) insert-point)
|
|
|
|
|
(setq saved-!-pos (car !-pos))
|
|
|
|
|
(while !-pos
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(cond ((and (not @-pos)
|
|
|
|
|
(not (cdr !-pos)))
|
|
|
|
|
(setq @-pos (point))
|
|
|
|
|
(insert-before-markers "@ "))
|
|
|
|
|
(t
|
|
|
|
|
(setq %-pos (cons (point) %-pos))
|
|
|
|
|
(insert-before-markers "% ")))
|
|
|
|
|
(backward-char 1)
|
|
|
|
|
(insert-buffer-substring
|
|
|
|
|
(current-buffer)
|
|
|
|
|
(if (nth 1 !-pos)
|
|
|
|
|
(1+ (nth 1 !-pos))
|
|
|
|
|
(point-min))
|
|
|
|
|
(car !-pos))
|
|
|
|
|
(delete-char 1)
|
|
|
|
|
(or (save-excursion
|
|
|
|
|
(mail-extr-safe-move-sexp -1)
|
|
|
|
|
(mail-extr-skip-whitespace-backward)
|
|
|
|
|
(eq ?. (preceding-char)))
|
|
|
|
|
(insert-before-markers
|
|
|
|
|
(if (save-excursion
|
|
|
|
|
(mail-extr-skip-whitespace-backward)
|
|
|
|
|
(eq ?. (preceding-char)))
|
|
|
|
|
""
|
|
|
|
|
".")
|
|
|
|
|
"uucp"))
|
|
|
|
|
(setq !-pos (cdr !-pos))))
|
|
|
|
|
(and saved-%-pos
|
2021-03-11 14:32:42 -05:00
|
|
|
|
(setq %-pos (append (mapcar #'mail-extr-demarkerize
|
2001-11-19 23:16:21 +00:00
|
|
|
|
saved-%-pos)
|
|
|
|
|
%-pos)))
|
|
|
|
|
(setq @-pos (mail-extr-demarkerize @-pos))
|
|
|
|
|
(narrow-to-region (1+ saved-!-pos) (point-max)))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; WARNING: THIS CODE IS DUPLICATED ABOVE.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when (and %-pos (not @-pos))
|
|
|
|
|
(goto-char (car %-pos))
|
|
|
|
|
(delete-char 1)
|
|
|
|
|
(setq @-pos (point))
|
|
|
|
|
(insert "@")
|
|
|
|
|
(setq %-pos (cdr %-pos)))
|
|
|
|
|
|
|
|
|
|
(when (setq %-pos (nreverse %-pos)) ; implies @-pos valid
|
|
|
|
|
(setq temp %-pos)
|
|
|
|
|
(catch 'truncated
|
|
|
|
|
(while temp
|
|
|
|
|
(goto-char (or (nth 1 temp)
|
|
|
|
|
@-pos))
|
|
|
|
|
(mail-extr-skip-whitespace-backward)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(mail-extr-safe-move-sexp -1)
|
|
|
|
|
(setq domain-pos (point))
|
|
|
|
|
(mail-extr-skip-whitespace-backward)
|
|
|
|
|
(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))))
|
|
|
|
|
(narrow-to-region (point-min) (point))
|
|
|
|
|
(goto-char (car temp))
|
|
|
|
|
(delete-char 1)
|
|
|
|
|
(setq @-pos (point))
|
|
|
|
|
(setcdr temp nil)
|
|
|
|
|
(setq %-pos (delq @-pos %-pos))
|
|
|
|
|
(insert "@")
|
|
|
|
|
(throw 'truncated t))
|
|
|
|
|
(setq temp (cdr temp)))))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(setq mbox-beg (point-min)
|
|
|
|
|
mbox-end (if %-pos (car %-pos)
|
|
|
|
|
(or @-pos
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(point-max))))
|
|
|
|
|
|
|
|
|
|
(when @-pos
|
|
|
|
|
;; Make the domain-name part lowercase since it's case
|
|
|
|
|
;; insensitive anyway.
|
|
|
|
|
(downcase-region (1+ @-pos) (point-max))))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; Done canonicalizing address.
|
|
|
|
|
;; We are now back in extraction-buffer.
|
|
|
|
|
|
|
|
|
|
;; Decide what part of the address to search to find the full name.
|
|
|
|
|
(cond (
|
|
|
|
|
;; Example: "First M. Last" <fml@foo.bar.dom>
|
|
|
|
|
(and phrase-beg
|
|
|
|
|
(eq quote-beg phrase-beg)
|
|
|
|
|
(<= quote-end phrase-end))
|
|
|
|
|
(narrow-to-region (1+ quote-beg) (1- quote-end))
|
|
|
|
|
(mail-extr-undo-backslash-quoting (point-min) (point-max)))
|
|
|
|
|
|
|
|
|
|
;; Example: First Last <fml@foo.bar.dom>
|
|
|
|
|
(phrase-beg
|
|
|
|
|
(narrow-to-region phrase-beg phrase-end))
|
|
|
|
|
|
|
|
|
|
;; Example: fml@foo.bar.dom (First M. Last)
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(mailextr-cbeg
|
|
|
|
|
(narrow-to-region (1+ mailextr-cbeg) (1- mailextr-cend))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(mail-extr-undo-backslash-quoting (point-min) (point-max))
|
|
|
|
|
|
|
|
|
|
;; Deal with spacing problems
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
;;; (cond ((not (search-forward " " nil t))
|
|
|
|
|
;;; (goto-char (point-min))
|
|
|
|
|
;;; (cond ((search-forward "_" nil t)
|
|
|
|
|
;;; ;; Handle the *idiotic* use of underlines as spaces.
|
|
|
|
|
;;; ;; Example: fml@foo.bar.dom (First_M._Last)
|
|
|
|
|
;;; (goto-char (point-min))
|
|
|
|
|
;;; (while (search-forward "_" nil t)
|
|
|
|
|
;;; (replace-match " " t)))
|
|
|
|
|
;;; ((search-forward "." nil t)
|
|
|
|
|
;;; ;; Fix . used as space
|
|
|
|
|
;;; ;; Example: danj1@cb.att.com (daniel.jacobson)
|
|
|
|
|
;;; (goto-char (point-min))
|
|
|
|
|
;;; (while (re-search-forward mail-extr-bad-dot-pattern nil t)
|
|
|
|
|
;;; (replace-match "\\1 \\2" t))))))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; Otherwise we try to get the name from the mailbox portion
|
|
|
|
|
;; of the address.
|
|
|
|
|
;; Example: First_M_Last@foo.bar.dom
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(t
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; *** Work in canon buffer instead? No, can't. Hmm.
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(narrow-to-region (point) (point))
|
|
|
|
|
(insert-buffer-substring canonicalization-buffer
|
|
|
|
|
mbox-beg mbox-end)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
|
|
|
|
|
;; Example: First_Last.XXX@foo.bar.dom
|
|
|
|
|
(setq \.-ends-name (re-search-forward "[_0-9]" nil t))
|
|
|
|
|
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
|
|
|
|
|
(if (not mail-extr-mangle-uucp)
|
|
|
|
|
(modify-syntax-entry ?! "w" (syntax-table)))
|
|
|
|
|
|
|
|
|
|
(while (progn
|
|
|
|
|
(mail-extr-skip-whitespace-forward)
|
|
|
|
|
(not (eobp)))
|
|
|
|
|
(setq char (char-after (point)))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(cond
|
1997-11-20 21:45:59 +00:00
|
|
|
|
((eq char ?\")
|
|
|
|
|
(setq quote-beg (point))
|
|
|
|
|
(or (mail-extr-safe-move-sexp 1)
|
|
|
|
|
;; TODO: handle this error condition!!!!!
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
;; take into account deletions
|
|
|
|
|
(setq quote-end (- (point) 2))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(backward-char 1)
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(delete-char 1)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(goto-char quote-beg)
|
|
|
|
|
(or (eobp)
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(delete-char 1)))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(mail-extr-undo-backslash-quoting quote-beg quote-end)
|
|
|
|
|
(or (eq ?\ (char-after (point)))
|
|
|
|
|
(insert " "))
|
|
|
|
|
;; (setq mailbox-name-processed-flag t)
|
|
|
|
|
(setq \.-ends-name t))
|
|
|
|
|
((eq char ?.)
|
|
|
|
|
(if (memq (char-after (1+ (point))) '(?_ ?=))
|
|
|
|
|
(progn
|
|
|
|
|
(forward-char 1)
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(delete-char 1)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(insert ?\ ))
|
|
|
|
|
(if \.-ends-name
|
|
|
|
|
(narrow-to-region (point-min) (point))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(delete-char 1)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(insert " ")))
|
|
|
|
|
;; (setq mailbox-name-processed-flag t)
|
|
|
|
|
)
|
|
|
|
|
((memq (char-syntax char) '(?. ?\\))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(delete-char 1)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(insert " ")
|
|
|
|
|
;; (setq mailbox-name-processed-flag t)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
)
|
|
|
|
|
(t
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(setq atom-beg (point))
|
Fix problems caused by new implementation of sub-word mode
* lisp/subr.el (forward-word-strictly, backward-word-strictly):
New functions.
(word-move-empty-char-table): New variable.
* etc/NEWS: Mention 'forward-word-strictly' and
'backward-word-strictly'.
* doc/lispref/positions.texi (Word Motion): Document
'find-word-boundary-function-table', 'forward-word-strictly', and
'backward-word-strictly'. (Bug#22560)
* src/syntax.c (syms_of_syntax)
<find-word-boundary-function-table>: Doc fix.
* lisp/wdired.el (wdired-xcase-word):
* lisp/textmodes/texnfo-upd.el (texinfo-copy-node-name)
(texinfo-copy-section-title, texinfo-start-menu-description)
(texinfo-copy-menu-title, texinfo-specific-section-type)
(texinfo-insert-node-lines, texinfo-copy-next-section-title):
* lisp/textmodes/texinfo.el (texinfo-clone-environment)
(texinfo-insert-@end):
* lisp/textmodes/texinfmt.el (texinfo-format-scan)
(texinfo-anchor, texinfo-multitable-widths)
(texinfo-multitable-item):
* lisp/textmodes/tex-mode.el (latex-env-before-change):
* lisp/textmodes/flyspell.el (texinfo-mode-flyspell-verify):
* lisp/skeleton.el (skeleton-insert):
* lisp/simple.el (count-words):
* lisp/progmodes/vhdl-mode.el (vhdl-beginning-of-libunit)
(vhdl-beginning-of-defun, vhdl-beginning-of-statement-1)
(vhdl-update-sensitivity-list, vhdl-template-block)
(vhdl-template-break, vhdl-template-case, vhdl-template-default)
(vhdl-template-default-indent, vhdl-template-for-loop)
(vhdl-template-if-then-use, vhdl-template-bare-loop)
(vhdl-template-nature, vhdl-template-procedural)
(vhdl-template-process, vhdl-template-selected-signal-asst)
(vhdl-template-type, vhdl-template-variable)
(vhdl-template-while-loop, vhdl-beginning-of-block)
(vhdl-hooked-abbrev, vhdl-port-copy, vhdl-hs-forward-sexp-func):
* lisp/progmodes/verilog-mode.el (verilog-backward-sexp)
(verilog-forward-sexp, verilog-beg-of-statement)
(verilog-set-auto-endcomments, verilog-backward-token)
(verilog-do-indent):
* lisp/progmodes/vera-mode.el (vera-guess-basic-syntax)
(vera-indent-block-closing):
* lisp/progmodes/simula.el (simula-context)
(simula-backward-up-level, simula-forward-down-level)
(simula-previous-statement, simula-next-statement)
(simula-skip-comment-backward, simula-calculate-indent)
(simula-find-if, simula-electric-keyword):
* lisp/progmodes/sh-script.el (sh-smie--rc-newline-semi-p):
* lisp/progmodes/ruby-mode.el (ruby-smie--redundant-do-p)
(ruby-smie--forward-token, ruby-smie--backward-token)
(ruby-singleton-class-p, ruby-calculate-indent)
(ruby-forward-sexp, ruby-backward-sexp):
* lisp/progmodes/ps-mode.el (ps-run-goto-error):
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function)
(perl-syntax-propertize-special-constructs)
(perl-backward-to-start-of-continued-exp):
* lisp/progmodes/pascal.el (pascal-indent-declaration):
* lisp/progmodes/octave.el (octave-function-file-p):
* lisp/progmodes/mantemp.el (mantemp-insert-cxx-syntax):
* lisp/progmodes/js.el (js--forward-function-decl):
* lisp/progmodes/idlwave.el (idlwave-show-begin-check)
(idlwave-beginning-of-block, idlwave-end-of-block)
(idlwave-block-jump-out, idlwave-determine-class):
* lisp/progmodes/icon.el (icon-is-continuation-line)
(icon-backward-to-start-of-continued-exp, end-of-icon-defun):
* lisp/progmodes/hideif.el (hide-ifdef-define):
* lisp/progmodes/f90.el (f90-change-keywords):
* lisp/progmodes/cperl-mode.el (cperl-electric-pod)
(cperl-linefeed, cperl-electric-terminator)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-invert-if-unless):
* lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur):
* lisp/progmodes/cc-align.el (c-lineup-java-inher):
* lisp/progmodes/ada-mode.el (ada-compile-goto-error)
(ada-adjust-case-skeleton, ada-create-case-exception)
(ada-create-case-exception-substring)
(ada-case-read-exceptions-from-file, ada-after-keyword-p)
(ada-scan-paramlist, ada-get-current-indent, ada-get-indent-end)
(ada-get-indent-if, ada-get-indent-block-start)
(ada-get-indent-loop, ada-get-indent-type)
(ada-search-prev-end-stmt, ada-check-defun-name)
(ada-goto-decl-start, ada-goto-matching-start)
(ada-goto-matching-end, ada-looking-at-semi-or)
(ada-looking-at-semi-private, ada-in-paramlist-p)
(ada-search-ignore-complex-boolean, ada-move-to-start)
(ada-move-to-end, ada-which-function, ada-gen-treat-proc):
* lisp/net/quickurl.el (quickurl-grab-url):
* lisp/mail/sendmail.el (mail-do-fcc):
* lisp/mail/rmail.el (rmail-resend):
* lisp/mail/mailabbrev.el (mail-abbrev-complete-alias):
* lisp/mail/mail-extr.el (mail-extract-address-components):
* lisp/json.el (json-read-keyword):
* lisp/files.el (insert-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/completion.el (symbol-under-point, symbol-before-point)
(symbol-before-point-for-complete, next-cdabbrev)
(add-completions-from-c-buffer):
* lisp/cedet/semantic/texi.el (semantic-up-context)
(semantic-beginning-of-context):
* lisp/cedet/semantic/bovine/el.el (semantic-get-local-variables):
use 'forward-word-strictly' and 'backward-word-strictly' instead
of 'forward-word' and 'backward-word'.
[This reapplies commit c1d32a65372c72d7de4808d620eefd3214a8e92a,
which was inadvertently lost by merge commit
c71e7cc113ed0d5f01aaa2e441a3e3c9fbeb9fa5.]
2016-03-21 17:42:35 -07:00
|
|
|
|
(forward-word-strictly 1)
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(setq atom-end (point))
|
|
|
|
|
(goto-char atom-beg)
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region atom-beg atom-end)
|
|
|
|
|
(cond
|
|
|
|
|
|
Update citations of Internet RFCs
For example, RFC 822 has been obsoleted by RFC 2822, which in
turn has been obsoleted by RFC 5322.
* doc/emacs/ack.texi, doc/lispref/os.texi:
* doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
* doc/misc/gnus.texi, doc/misc/sc.texi:
* lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
* lisp/gnus/gnus-util.el, lisp/gnus/message.el:
* lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
* lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
* lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
* lisp/mail/mailclient.el, lisp/mail/mailheader.el:
* lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
* lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
* lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
* lisp/mh-e/mh-utils.el, lisp/net/imap.el:
* lisp/net/newst-backend.el, lisp/org/org-id.el:
* lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
Update RFC citations.
2019-02-16 11:20:09 -08:00
|
|
|
|
;; Handle X.400 addresses encoded in RFC 822 or later.
|
1997-11-20 21:45:59 +00:00
|
|
|
|
;; *** Shit! This has to handle the case where it is
|
|
|
|
|
;; *** embedded in a quote too!
|
|
|
|
|
;; *** Shit! The input is being broken up into atoms
|
|
|
|
|
;; *** by periods!
|
|
|
|
|
((looking-at mail-extr-x400-encoded-address-pattern)
|
|
|
|
|
|
|
|
|
|
;; Copy the contents of the individual fields that
|
|
|
|
|
;; might hold name data to the beginning.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(mapc
|
|
|
|
|
(lambda (field-pattern)
|
|
|
|
|
(when
|
|
|
|
|
(save-excursion
|
|
|
|
|
(re-search-forward field-pattern nil t))
|
|
|
|
|
(insert-buffer-substring (current-buffer)
|
|
|
|
|
(match-beginning 1)
|
|
|
|
|
(match-end 1))
|
|
|
|
|
(insert " ")))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(list mail-extr-x400-encoded-address-given-name-pattern
|
|
|
|
|
mail-extr-x400-encoded-address-surname-pattern
|
|
|
|
|
mail-extr-x400-encoded-address-full-name-pattern))
|
|
|
|
|
|
|
|
|
|
;; Discard the rest, since it contains stuff like
|
|
|
|
|
;; routing information, not part of a name.
|
|
|
|
|
(mail-extr-skip-whitespace-backward)
|
|
|
|
|
(delete-region (point) (point-max))
|
|
|
|
|
|
|
|
|
|
;; Handle periods used for spacing.
|
|
|
|
|
(while (re-search-forward mail-extr-bad-dot-pattern nil t)
|
|
|
|
|
(replace-match "\\1 \\2" t))
|
|
|
|
|
|
|
|
|
|
;; (setq mailbox-name-processed-flag t)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Handle normal addresses.
|
|
|
|
|
(t
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
;; Handle _ and = used for spacing.
|
|
|
|
|
(while (re-search-forward "\\([^_=]+\\)[_=]" nil t)
|
|
|
|
|
(replace-match "\\1 " t)
|
|
|
|
|
;; (setq mailbox-name-processed-flag t)
|
|
|
|
|
)
|
|
|
|
|
(goto-char (point-max))))))))
|
|
|
|
|
|
|
|
|
|
;; undo the dirty deed
|
|
|
|
|
(if (not mail-extr-mangle-uucp)
|
|
|
|
|
(modify-syntax-entry ?! "." (syntax-table)))
|
|
|
|
|
;;
|
|
|
|
|
;; If we derived the name from the mailbox part of the address,
|
|
|
|
|
;; and we only got one word out of it, don't treat that as a
|
|
|
|
|
;; name. "foo@bar" --> (nil "foo@bar"), not ("foo" "foo@bar")
|
|
|
|
|
;; (if (not mailbox-name-processed-flag)
|
|
|
|
|
;; (delete-region (point-min) (point-max)))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(set-syntax-table mail-extr-address-text-syntax-table)
|
|
|
|
|
|
|
|
|
|
(mail-extr-voodoo mbox-beg mbox-end canonicalization-buffer)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
|
|
|
|
|
;; If name is "First Last" and userid is "F?L", then assume
|
|
|
|
|
;; the middle initial is the second letter in the userid.
|
|
|
|
|
;; Initial code by Jamie Zawinski <jwz@lucid.com>
|
|
|
|
|
;; *** Make it work when there's a suffix as well.
|
|
|
|
|
(goto-char (point-min))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(when (and mail-extr-guess-middle-initial
|
|
|
|
|
(not disable-initial-guessing-flag)
|
|
|
|
|
(eq 3 (- mbox-end mbox-beg))
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(looking-at mail-extr-two-name-pattern)))
|
|
|
|
|
(setq fi (char-after (match-beginning 0))
|
|
|
|
|
li (char-after (match-beginning 3)))
|
|
|
|
|
(with-current-buffer canonicalization-buffer
|
|
|
|
|
;; char-equal is ignoring case here, so no need to upcase
|
|
|
|
|
;; or downcase.
|
|
|
|
|
(let ((case-fold-search t))
|
|
|
|
|
(and (char-equal fi (char-after mbox-beg))
|
|
|
|
|
(char-equal li (char-after (1- mbox-end)))
|
|
|
|
|
(setq mi (char-after (1+ mbox-beg))))))
|
|
|
|
|
(when (and mi
|
|
|
|
|
;; TODO: use better table than syntax table
|
|
|
|
|
(eq ?w (char-syntax mi)))
|
|
|
|
|
(goto-char (match-beginning 3))
|
|
|
|
|
(insert (upcase mi) ". ")))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; Nuke name if it is the same as mailbox name.
|
2018-04-15 19:28:04 +02:00
|
|
|
|
(let ((buffer-length (- (point-max) (point-min)))
|
|
|
|
|
(i 0)
|
|
|
|
|
(names-match-flag t))
|
|
|
|
|
(when (and (> buffer-length 0)
|
|
|
|
|
(eq buffer-length (- mbox-end mbox-beg)))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(insert-buffer-substring canonicalization-buffer
|
|
|
|
|
mbox-beg mbox-end)
|
|
|
|
|
(while (and names-match-flag
|
|
|
|
|
(< i buffer-length))
|
|
|
|
|
(or (eq (downcase (char-after (+ i (point-min))))
|
|
|
|
|
(downcase
|
|
|
|
|
(char-after (+ i buffer-length (point-min)))))
|
|
|
|
|
(setq names-match-flag nil))
|
|
|
|
|
(setq i (1+ i)))
|
|
|
|
|
(delete-region (+ (point-min) buffer-length) (point-max))
|
|
|
|
|
(and names-match-flag
|
|
|
|
|
mail-extr-ignore-realname-equals-mailbox-name
|
|
|
|
|
(narrow-to-region (point) (point)))))
|
1997-11-20 21:45:59 +00:00
|
|
|
|
|
|
|
|
|
;; Nuke name if it's just one word.
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(and mail-extr-ignore-single-names
|
|
|
|
|
(not (re-search-forward "[- ]" nil t))
|
|
|
|
|
(narrow-to-region (point) (point)))
|
|
|
|
|
|
|
|
|
|
;; Record the result
|
|
|
|
|
(setq value-list
|
|
|
|
|
(cons (list (if (not (= (point-min) (point-max)))
|
|
|
|
|
(buffer-string))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(with-current-buffer canonicalization-buffer
|
1997-11-20 21:45:59 +00:00
|
|
|
|
(if (not (= (point-min) (point-max)))
|
|
|
|
|
(buffer-string))))
|
|
|
|
|
value-list))
|
|
|
|
|
|
|
|
|
|
;; Unless one address is all we wanted,
|
|
|
|
|
;; delete this one from extraction-buffer
|
|
|
|
|
;; and get ready to extract the next address.
|
|
|
|
|
(when all
|
|
|
|
|
(if end-of-address
|
|
|
|
|
(narrow-to-region 1 end-of-address)
|
|
|
|
|
(widen))
|
|
|
|
|
(delete-region (point-min) (point-max))
|
|
|
|
|
(widen))
|
|
|
|
|
)))
|
|
|
|
|
(if all (nreverse value-list) (car value-list))
|
|
|
|
|
))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(defcustom mail-extr-disable-voodoo "\\cj"
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"If it is a regexp, names matching it will never be modified.
|
2004-08-05 00:15:15 +00:00
|
|
|
|
If it is neither nil nor a string, modifying of names will never take
|
|
|
|
|
place. It affects how `mail-extract-address-components' works."
|
|
|
|
|
:type '(choice (regexp :size 0)
|
|
|
|
|
(const :tag "Always enabled" nil)
|
2021-03-11 14:32:42 -05:00
|
|
|
|
(const :tag "Always disabled" t)))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defun mail-extr-voodoo (mbox-beg mbox-end canonicalization-buffer)
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(unless (and mail-extr-disable-voodoo
|
|
|
|
|
(or (not (stringp mail-extr-disable-voodoo))
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(re-search-forward mail-extr-disable-voodoo nil t))))
|
|
|
|
|
(let ((word-count 0)
|
|
|
|
|
(case-fold-search nil)
|
|
|
|
|
mixed-case-flag lower-case-flag ;;upper-case-flag
|
|
|
|
|
suffix-flag last-name-comma-flag
|
|
|
|
|
initial
|
|
|
|
|
begin-again-flag
|
|
|
|
|
drop-this-word-if-trailing-flag
|
|
|
|
|
drop-last-word-if-trailing-flag
|
|
|
|
|
word-found-flag
|
|
|
|
|
this-word-beg last-word-beg
|
|
|
|
|
name-beg name-end
|
|
|
|
|
name-done-flag
|
|
|
|
|
)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(set-syntax-table mail-extr-address-text-syntax-table)
|
|
|
|
|
|
|
|
|
|
;; Get rid of comments.
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(goto-char (point-min))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(while (not (eobp))
|
|
|
|
|
;; Initialize for this iteration of the loop.
|
|
|
|
|
(skip-chars-forward "^({[\"'`")
|
|
|
|
|
(let ((cbeg (point)))
|
|
|
|
|
(set-syntax-table mail-extr-address-text-comment-syntax-table)
|
|
|
|
|
(if (memq (following-char) '(?\' ?\`))
|
|
|
|
|
(search-forward "'" nil 'move
|
|
|
|
|
(if (eq ?\' (following-char)) 2 1))
|
|
|
|
|
(or (mail-extr-safe-move-sexp 1)
|
|
|
|
|
(goto-char (point-max))))
|
|
|
|
|
(set-syntax-table mail-extr-address-text-syntax-table)
|
|
|
|
|
(when (eq (char-after cbeg) ?\()
|
|
|
|
|
;; Delete the comment itself.
|
|
|
|
|
(delete-region cbeg (point))
|
|
|
|
|
;; Canonicalize whitespace where the comment was.
|
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
|
(if (looking-at "\\([ \t]+$\\|[ \t]+,\\)")
|
|
|
|
|
(replace-match "")
|
|
|
|
|
(setq cbeg (point))
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(if (bobp)
|
|
|
|
|
(delete-region (point) cbeg)
|
|
|
|
|
(just-one-space))))))
|
|
|
|
|
|
|
|
|
|
;; This was moved above.
|
|
|
|
|
;; Fix . used as space
|
|
|
|
|
;; But it belongs here because it occurs not only as
|
|
|
|
|
;; rypens@reks.uia.ac.be (Piet.Rypens)
|
|
|
|
|
;; but also as
|
|
|
|
|
;; "Piet.Rypens" <rypens@reks.uia.ac.be>
|
|
|
|
|
;;(goto-char (point-min))
|
|
|
|
|
;;(while (re-search-forward mail-extr-bad-dot-pattern nil t)
|
|
|
|
|
;; (replace-match "\\1 \\2" t))
|
|
|
|
|
|
|
|
|
|
(unless (search-forward " " nil t)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(cond ((search-forward "_" nil t)
|
|
|
|
|
;; Handle the *idiotic* use of underlines as spaces.
|
|
|
|
|
;; Example: fml@foo.bar.dom (First_M._Last)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (search-forward "_" nil t)
|
|
|
|
|
(replace-match " " t)))
|
|
|
|
|
((search-forward "." nil t)
|
|
|
|
|
;; Fix . used as space
|
|
|
|
|
;; Example: danj1@cb.att.com (daniel.jacobson)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (re-search-forward mail-extr-bad-dot-pattern nil t)
|
|
|
|
|
(replace-match "\\1 \\2" t)))))
|
2002-10-18 08:52:37 +00:00
|
|
|
|
|
2004-08-05 00:15:15 +00:00
|
|
|
|
;; Loop over the words (and other junk) in the name.
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not name-done-flag)
|
|
|
|
|
|
|
|
|
|
(when word-found-flag
|
|
|
|
|
;; Last time through this loop we skipped over a word.
|
|
|
|
|
(setq last-word-beg this-word-beg)
|
|
|
|
|
(setq drop-last-word-if-trailing-flag
|
|
|
|
|
drop-this-word-if-trailing-flag)
|
|
|
|
|
(setq word-found-flag nil))
|
|
|
|
|
|
|
|
|
|
(when begin-again-flag
|
|
|
|
|
;; Last time through the loop we found something that
|
|
|
|
|
;; indicates we should pretend we are beginning again from
|
|
|
|
|
;; the start.
|
|
|
|
|
(setq word-count 0)
|
|
|
|
|
(setq last-word-beg nil)
|
|
|
|
|
(setq drop-last-word-if-trailing-flag nil)
|
|
|
|
|
(setq mixed-case-flag nil)
|
|
|
|
|
(setq lower-case-flag nil)
|
|
|
|
|
;; (setq upper-case-flag nil)
|
|
|
|
|
(setq begin-again-flag nil))
|
|
|
|
|
|
|
|
|
|
;; Initialize for this iteration of the loop.
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(mail-extr-skip-whitespace-forward)
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(if (eq word-count 0) (narrow-to-region (point) (point-max)))
|
|
|
|
|
(setq this-word-beg (point))
|
|
|
|
|
(setq drop-this-word-if-trailing-flag nil)
|
|
|
|
|
|
|
|
|
|
;; Decide what to do based on what we are looking at.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(cond
|
2004-08-05 00:15:15 +00:00
|
|
|
|
|
|
|
|
|
;; Delete title
|
1992-07-17 06:48:03 +00:00
|
|
|
|
((and (eq word-count 0)
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(looking-at mail-extr-full-name-prefixes))
|
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
|
(narrow-to-region (point) (point-max)))
|
2002-10-18 08:52:37 +00:00
|
|
|
|
|
2004-08-05 00:15:15 +00:00
|
|
|
|
;; Stop after name suffix
|
|
|
|
|
((and (>= word-count 2)
|
|
|
|
|
(looking-at mail-extr-full-name-suffix-pattern))
|
|
|
|
|
(mail-extr-skip-whitespace-backward)
|
|
|
|
|
(setq suffix-flag (point))
|
|
|
|
|
(if (eq ?, (following-char))
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(insert ?,))
|
|
|
|
|
;; Enforce at least one space after comma
|
|
|
|
|
(or (eq ?\ (following-char))
|
|
|
|
|
(insert ?\ ))
|
|
|
|
|
(mail-extr-skip-whitespace-forward)
|
|
|
|
|
(cond ((memq (following-char) '(?j ?J ?s ?S))
|
|
|
|
|
(capitalize-word 1)
|
|
|
|
|
(if (eq (following-char) ?.)
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(insert ?.)))
|
|
|
|
|
(t
|
|
|
|
|
(upcase-word 1)))
|
|
|
|
|
(setq word-found-flag t)
|
|
|
|
|
(setq name-done-flag t))
|
|
|
|
|
|
|
|
|
|
;; Handle SCA names
|
|
|
|
|
((looking-at "MKA \\(.+\\)") ; "Mundanely Known As"
|
|
|
|
|
(goto-char (match-beginning 1))
|
|
|
|
|
(narrow-to-region (point) (point-max))
|
|
|
|
|
(setq begin-again-flag t))
|
|
|
|
|
|
|
|
|
|
;; Check for initial last name followed by comma
|
|
|
|
|
((and (eq ?, (following-char))
|
|
|
|
|
(eq word-count 1))
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(setq last-name-comma-flag t)
|
|
|
|
|
(or (eq ?\ (following-char))
|
|
|
|
|
(insert ?\ )))
|
|
|
|
|
|
|
|
|
|
;; Stop before trailing comma-separated comment
|
|
|
|
|
;; THIS CASE MUST BE AFTER THE PRECEDING CASES.
|
|
|
|
|
;; *** This case is redundant???
|
|
|
|
|
;;((eq ?, (following-char))
|
|
|
|
|
;; (setq name-done-flag t))
|
|
|
|
|
|
|
|
|
|
;; Delete parenthesized/quoted comment/nickname
|
|
|
|
|
((memq (following-char) '(?\( ?\{ ?\[ ?\" ?\' ?\`))
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(setq mailextr-cbeg (point))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(set-syntax-table mail-extr-address-text-comment-syntax-table)
|
|
|
|
|
(cond ((memq (following-char) '(?\' ?\`))
|
|
|
|
|
(or (search-forward "'" nil t
|
|
|
|
|
(if (eq ?\' (following-char)) 2 1))
|
|
|
|
|
(delete-char 1)))
|
|
|
|
|
(t
|
|
|
|
|
(or (mail-extr-safe-move-sexp 1)
|
|
|
|
|
(goto-char (point-max)))))
|
|
|
|
|
(set-syntax-table mail-extr-address-text-syntax-table)
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(setq mailextr-cend (point))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(cond
|
|
|
|
|
;; Handle case of entire name being quoted
|
|
|
|
|
((and (eq word-count 0)
|
|
|
|
|
(looking-at " *\\'")
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(>= (- mailextr-cend mailextr-cbeg) 2))
|
|
|
|
|
(narrow-to-region (1+ mailextr-cbeg) (1- mailextr-cend))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(goto-char (point-min)))
|
|
|
|
|
(t
|
|
|
|
|
;; Handle case of quoted initial
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(if (and (or (= 3 (- mailextr-cend mailextr-cbeg))
|
|
|
|
|
(and (= 4 (- mailextr-cend mailextr-cbeg))
|
|
|
|
|
(eq ?. (char-after (+ 2 mailextr-cbeg)))))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(not (looking-at " *\\'")))
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(setq initial (char-after (1+ mailextr-cbeg)))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(setq initial nil))
|
2010-11-06 12:28:44 -07:00
|
|
|
|
(delete-region mailextr-cbeg mailextr-cend)
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(if initial
|
|
|
|
|
(insert initial ". ")))))
|
|
|
|
|
|
|
|
|
|
;; Handle *Stupid* VMS date stamps
|
|
|
|
|
((looking-at mail-extr-stupid-vms-date-stamp-pattern)
|
|
|
|
|
(replace-match "" t))
|
|
|
|
|
|
|
|
|
|
;; Handle Chinese characters.
|
|
|
|
|
((looking-at mail-extr-hz-embedded-gb-encoded-chinese-pattern)
|
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
|
(setq word-found-flag t))
|
|
|
|
|
|
|
|
|
|
;; Skip initial garbage characters.
|
|
|
|
|
;; THIS CASE MUST BE AFTER THE PRECEDING CASES.
|
|
|
|
|
((and (eq word-count 0)
|
|
|
|
|
(looking-at mail-extr-leading-garbage))
|
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
|
;; *** Skip backward over these???
|
|
|
|
|
;; (skip-chars-backward "& \"")
|
|
|
|
|
(narrow-to-region (point) (point-max)))
|
|
|
|
|
|
|
|
|
|
;; Various stopping points
|
|
|
|
|
((or
|
|
|
|
|
|
|
|
|
|
;; Stop before ALL CAPS acronyms, if preceded by mixed-case
|
|
|
|
|
;; words. Example: XT-DEM.
|
|
|
|
|
(and (>= word-count 2)
|
|
|
|
|
mixed-case-flag
|
|
|
|
|
(looking-at mail-extr-weird-acronym-pattern)
|
|
|
|
|
(not (looking-at mail-extr-roman-numeral-pattern)))
|
|
|
|
|
|
|
|
|
|
;; Stop before trailing alternative address
|
|
|
|
|
(looking-at mail-extr-alternative-address-pattern)
|
|
|
|
|
|
|
|
|
|
;; Stop before trailing comment not introduced by comma
|
|
|
|
|
;; THIS CASE MUST BE AFTER AN EARLIER CASE.
|
|
|
|
|
(looking-at mail-extr-trailing-comment-start-pattern)
|
|
|
|
|
|
|
|
|
|
;; Stop before telephone numbers
|
|
|
|
|
(and (>= word-count 1)
|
|
|
|
|
(looking-at mail-extr-telephone-extension-pattern)))
|
|
|
|
|
(setq name-done-flag t))
|
|
|
|
|
|
|
|
|
|
;; Delete ham radio call signs
|
|
|
|
|
((looking-at mail-extr-ham-call-sign-pattern)
|
|
|
|
|
(delete-region (match-beginning 0) (match-end 0)))
|
|
|
|
|
|
|
|
|
|
;; Fixup initials
|
|
|
|
|
((looking-at mail-extr-initial-pattern)
|
|
|
|
|
(or (eq (following-char) (upcase (following-char)))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
(setq lower-case-flag t))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(forward-char 1)
|
|
|
|
|
(if (eq ?. (following-char))
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(insert ?.))
|
|
|
|
|
(or (eq ?\ (following-char))
|
|
|
|
|
(insert ?\ ))
|
|
|
|
|
(setq word-found-flag t))
|
|
|
|
|
|
|
|
|
|
;; Handle BITNET LISTSERV list names.
|
|
|
|
|
((and (eq word-count 0)
|
|
|
|
|
(looking-at mail-extr-listserv-list-name-pattern))
|
|
|
|
|
(narrow-to-region (match-beginning 1) (match-end 1))
|
|
|
|
|
(setq word-found-flag t)
|
|
|
|
|
(setq name-done-flag t))
|
|
|
|
|
|
|
|
|
|
;; Handle & substitution, when & is last and is not first.
|
|
|
|
|
((and (> word-count 0)
|
|
|
|
|
(eq ?\ (preceding-char))
|
|
|
|
|
(eq (following-char) ?&)
|
|
|
|
|
(eq (1+ (point)) (point-max)))
|
|
|
|
|
(delete-char 1)
|
|
|
|
|
(capitalize-region
|
|
|
|
|
(point)
|
|
|
|
|
(progn
|
|
|
|
|
(insert-buffer-substring canonicalization-buffer
|
|
|
|
|
mbox-beg mbox-end)
|
|
|
|
|
(point)))
|
|
|
|
|
(setq disable-initial-guessing-flag t)
|
|
|
|
|
(setq word-found-flag t))
|
|
|
|
|
|
|
|
|
|
;; Handle & between names, as in "Bob & Susie".
|
|
|
|
|
((and (> word-count 0) (eq (following-char) ?\&))
|
|
|
|
|
(setq name-beg (point))
|
|
|
|
|
(setq name-end (1+ name-beg))
|
|
|
|
|
(setq word-found-flag t)
|
|
|
|
|
(goto-char name-end))
|
|
|
|
|
|
|
|
|
|
;; Regular name words
|
|
|
|
|
((looking-at mail-extr-name-pattern)
|
|
|
|
|
(setq name-beg (point))
|
|
|
|
|
(setq name-end (match-end 0))
|
|
|
|
|
|
|
|
|
|
;; Certain words will be dropped if they are at the end.
|
|
|
|
|
(and (>= word-count 2)
|
|
|
|
|
(not lower-case-flag)
|
|
|
|
|
(or
|
|
|
|
|
;; Trailing 4-or-more letter lowercase words preceded by
|
|
|
|
|
;; mixed case or uppercase words will be dropped.
|
|
|
|
|
(looking-at "[[:lower:]]\\{4,\\}[ \t]*\\'")
|
|
|
|
|
;; Drop a trailing word which is terminated with a period.
|
|
|
|
|
(eq ?. (char-after (1- name-end))))
|
|
|
|
|
(setq drop-this-word-if-trailing-flag t))
|
|
|
|
|
|
|
|
|
|
;; Set the flags that indicate whether we have seen a lowercase
|
|
|
|
|
;; word, a mixed case word, and an uppercase word.
|
|
|
|
|
(if (re-search-forward "[[:lower:]]" name-end t)
|
|
|
|
|
(if (progn
|
|
|
|
|
(goto-char name-beg)
|
|
|
|
|
(re-search-forward "[[:upper:]]" name-end t))
|
|
|
|
|
(setq mixed-case-flag t)
|
|
|
|
|
(setq lower-case-flag t))
|
|
|
|
|
;; (setq upper-case-flag t)
|
|
|
|
|
)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(goto-char name-end)
|
|
|
|
|
(setq word-found-flag t))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2004-08-05 00:15:15 +00:00
|
|
|
|
;; Allow a number as a word, if it doesn't mean anything else.
|
|
|
|
|
((looking-at "[0-9]+\\>")
|
|
|
|
|
(setq name-beg (point))
|
|
|
|
|
(setq name-end (match-end 0))
|
|
|
|
|
(goto-char name-end)
|
|
|
|
|
(setq word-found-flag t))
|
|
|
|
|
|
|
|
|
|
(t
|
|
|
|
|
(setq name-done-flag t)
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
;; Count any word that we skipped over.
|
|
|
|
|
(if word-found-flag
|
|
|
|
|
(setq word-count (1+ word-count))))
|
|
|
|
|
|
|
|
|
|
;; If the last thing in the name is 2 or more periods, or one or more
|
|
|
|
|
;; other sentence terminators (but not a single period) then keep them
|
|
|
|
|
;; and the preceding word. This is for the benefit of whole sentences
|
|
|
|
|
;; in the name field: it's better behavior than dropping the last word
|
|
|
|
|
;; of the sentence...
|
|
|
|
|
(if (and (not suffix-flag)
|
|
|
|
|
(looking-at "\\(\\.+\\|[?!;:.][?!;:.]+\\|[?!;:][?!;:.]*\\)\\'"))
|
|
|
|
|
(goto-char (setq suffix-flag (point-max))))
|
|
|
|
|
|
|
|
|
|
;; Drop everything after point and certain trailing words.
|
|
|
|
|
(narrow-to-region (point-min)
|
|
|
|
|
(or (and drop-last-word-if-trailing-flag
|
|
|
|
|
last-word-beg)
|
|
|
|
|
(point)))
|
|
|
|
|
|
|
|
|
|
;; Xerox's mailers SUCK!!!!!!
|
|
|
|
|
;; We simply refuse to believe that any last name is PARC or ADOC.
|
|
|
|
|
;; If it looks like that is the last name, that there is no meaningful
|
|
|
|
|
;; here at all. Actually I guess it would be best to map patterns
|
|
|
|
|
;; like foo.hoser@xerox.com into foo@hoser.xerox.com, but I don't
|
|
|
|
|
;; actually know that that is what's going on.
|
|
|
|
|
(unless suffix-flag
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(let ((case-fold-search t))
|
|
|
|
|
(if (looking-at "[-A-Za-z_]+[. ]\\(PARC\\|ADOC\\)\\'")
|
|
|
|
|
(erase-buffer))))
|
|
|
|
|
|
|
|
|
|
;; If last name first put it at end (but before suffix)
|
|
|
|
|
(when last-name-comma-flag
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(search-forward ",")
|
|
|
|
|
(setq name-end (1- (point)))
|
|
|
|
|
(goto-char (or suffix-flag (point-max)))
|
|
|
|
|
(or (eq ?\ (preceding-char))
|
|
|
|
|
(insert ?\ ))
|
|
|
|
|
(insert-buffer-substring (current-buffer) (point-min) name-end)
|
2001-11-16 19:57:07 +00:00
|
|
|
|
(goto-char name-end)
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(skip-chars-forward "\t ,")
|
|
|
|
|
(narrow-to-region (point) (point-max)))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
2004-08-05 00:15:15 +00:00
|
|
|
|
;; Delete leading and trailing junk characters.
|
|
|
|
|
;; *** This is probably completely unneeded now.
|
|
|
|
|
;;(goto-char (point-max))
|
|
|
|
|
;;(skip-chars-backward mail-extr-non-end-name-chars)
|
|
|
|
|
;;(if (eq ?. (following-char))
|
|
|
|
|
;; (forward-char 1))
|
|
|
|
|
;;(narrow-to-region (point)
|
|
|
|
|
;; (progn
|
|
|
|
|
;; (goto-char (point-min))
|
|
|
|
|
;; (skip-chars-forward mail-extr-non-begin-name-chars)
|
|
|
|
|
;; (point)))
|
|
|
|
|
|
|
|
|
|
;; Compress whitespace
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(goto-char (point-min))
|
2004-08-05 00:15:15 +00:00
|
|
|
|
(while (re-search-forward "[ \t\n]+" nil t)
|
|
|
|
|
(replace-match (if (eobp) "" " ") t))
|
|
|
|
|
))))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
|
|
|
|
;; Table of top-level domain names.
|
|
|
|
|
;;
|
|
|
|
|
;; This is used during address canonicalization; be careful of format changes.
|
1992-07-17 06:48:03 +00:00
|
|
|
|
;; Keep in mind that the country abbreviations follow ISO-3166. There is
|
|
|
|
|
;; a U.S. FIPS that specifies a different set of two-letter country
|
|
|
|
|
;; abbreviations.
|
2002-07-09 10:06:17 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Updated by the RIPE Network Coordination Centre.
|
|
|
|
|
;;
|
|
|
|
|
;; Source: ISO 3166 Maintenance Agency
|
2020-10-24 20:22:33 +02:00
|
|
|
|
;; https://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1-semic.txt
|
2020-10-01 15:24:21 +02:00
|
|
|
|
;; https://www.iana.org/domain-names.htm
|
|
|
|
|
;; https://www.iana.org/cctld/cctld-whois.htm
|
2007-11-16 07:55:42 +00:00
|
|
|
|
;; Latest change: 2007/11/15
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
2020-10-21 14:49:04 +02:00
|
|
|
|
;; FIXME: There are over 1500 top level domains, the vast majority of
|
|
|
|
|
;; which are not in the below list. Should they be?
|
|
|
|
|
;; https://data.iana.org/TLD/tlds-alpha-by-domain.txt
|
|
|
|
|
;; https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
|
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(defconst mail-extr-all-top-level-domains
|
2024-02-08 18:23:00 +01:00
|
|
|
|
(let ((ob (obarray-make 739)))
|
2001-11-19 23:16:21 +00:00
|
|
|
|
(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))))
|
1994-09-22 03:34:43 +00:00
|
|
|
|
'(
|
|
|
|
|
;; ISO 3166 codes:
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("ac" "Ascension Island")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("ad" "Andorra")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ae" "United Arab Emirates")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("af" "Afghanistan")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ag" "Antigua and Barbuda")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("ai" "Anguilla")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("al" "Albania")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("am" "Armenia")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("an" "Netherlands Antilles")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ao" "Angola")
|
|
|
|
|
("aq" "Antarctica") ; continent
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("ar" "Argentina" "Argentine Republic")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("as" "American Samoa")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("at" "Austria" "The Republic of %s")
|
|
|
|
|
("au" "Australia")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("aw" "Aruba")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("ax" "Aland Islands")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("az" "Azerbaijan")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("ba" "Bosnia-Herzegovina")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("bb" "Barbados")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("bd" "Bangladesh")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("be" "Belgium" "The Kingdom of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("bf" "Burkina Faso")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("bg" "Bulgaria")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("bh" "Bahrain")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("bi" "Burundi")
|
|
|
|
|
("bj" "Benin")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("bl" "Saint Barthelemy")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("bm" "Bermuda")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("bn" "Brunei Darussalam")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("bo" "Bolivia" "Republic of %s")
|
|
|
|
|
("br" "Brazil" "The Federative Republic of %s")
|
|
|
|
|
("bs" "Bahamas")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("bt" "Bhutan")
|
|
|
|
|
("bv" "Bouvet Island")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("bw" "Botswana")
|
|
|
|
|
("by" "Belarus")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("bz" "Belize")
|
|
|
|
|
("ca" "Canada")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("cc" "Cocos (Keeling) Islands")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("cd" "Congo" "The Democratic Republic of the %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("cf" "Central African Republic")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("cg" "Congo")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("ch" "Switzerland" "The Swiss Confederation")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("ci" "Ivory Coast") ; Cote D'ivoire
|
|
|
|
|
("ck" "Cook Islands")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("cl" "Chile" "The Republic of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("cm" "Cameroon") ; In .fr domain
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("cn" "China" "The People's Republic of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("co" "Colombia")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("cr" "Costa Rica" "The Republic of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("cu" "Cuba")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("cv" "Cape Verde")
|
|
|
|
|
("cx" "Christmas Island")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("cy" "Cyprus")
|
|
|
|
|
("cz" "Czech Republic")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("de" "Germany")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("dj" "Djibouti")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("dk" "Denmark")
|
|
|
|
|
("dm" "Dominica")
|
|
|
|
|
("do" "Dominican Republic" "The %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("dz" "Algeria")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("ec" "Ecuador" "The Republic of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ee" "Estonia")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("eg" "Egypt" "The Arab Republic of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("eh" "Western Sahara")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("er" "Eritrea")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("es" "Spain" "The Kingdom of %s")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("et" "Ethiopia")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("eu" "European Union")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("fi" "Finland" "The Republic of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("fj" "Fiji")
|
|
|
|
|
("fk" "Falkland Islands (Malvinas)")
|
|
|
|
|
("fm" "Micronesia" "Federated States of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("fo" "Faroe Islands")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("fr" "France")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("ga" "Gabon")
|
|
|
|
|
("gb" "United Kingdom")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("gd" "Grenada")
|
|
|
|
|
("ge" "Georgia")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("gf" "French Guiana")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("gg" "Guernsey")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("gh" "Ghana")
|
|
|
|
|
("gi" "Gibraltar")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("gl" "Greenland")
|
|
|
|
|
("gm" "Gambia")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("gn" "Guinea")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("gp" "Guadeloupe (Fr.)")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("gq" "Equatorial Guinea")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("gr" "Greece" "The Hellenic Republic (%s)")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("gs" "South Georgia and The South Sandwich Islands")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("gt" "Guatemala")
|
|
|
|
|
("gu" "Guam (U.S.)")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("gw" "Guinea-Bissau")
|
|
|
|
|
("gy" "Guyana")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("hk" "Hong Kong")
|
2011-11-13 22:27:12 -08:00
|
|
|
|
("hm" "Heard Island and McDonald Islands")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("hn" "Honduras")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("hr" "Croatia" "Croatia (Hrvatska)")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ht" "Haiti")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("hu" "Hungary" "The Hungarian Republic")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("id" "Indonesia")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("ie" "Ireland")
|
|
|
|
|
("il" "Israel" "The State of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("im" "Isle of Man" "The %s") ; NOT in ISO 3166-1 of 2001-02-26
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("in" "India" "The Republic of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("io" "British Indian Ocean Territory")
|
|
|
|
|
("iq" "Iraq")
|
|
|
|
|
("ir" "Iran" "Islamic Republic of %s")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("is" "Iceland" "The Republic of %s")
|
|
|
|
|
("it" "Italy" "The Italian Republic")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("je" "Jersey")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("jm" "Jamaica")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("jo" "Jordan")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("jp" "Japan")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ke" "Kenya")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("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")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("kw" "Kuwait")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("ky" "Cayman Islands")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("kz" "Kazakhstan")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("la" "Lao People's Democratic Republic")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("lb" "Lebanon")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("lc" "Saint Lucia")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("li" "Liechtenstein")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("lk" "Sri Lanka" "The Democratic Socialist Republic of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("lr" "Liberia")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ls" "Lesotho")
|
|
|
|
|
("lt" "Lithuania")
|
|
|
|
|
("lu" "Luxembourg")
|
|
|
|
|
("lv" "Latvia")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("ly" "Libyan Arab Jamahiriya")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ma" "Morocco")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("mc" "Monaco")
|
|
|
|
|
("md" "Moldova" "The Republic of %s")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("me" "Montenegro")
|
|
|
|
|
("mf" "Saint Martin (French part)")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("mg" "Madagascar")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("mh" "Marshall Islands")
|
|
|
|
|
("mk" "Macedonia" "The Former Yugoslav Republic of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ml" "Mali")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("mm" "Myanmar")
|
|
|
|
|
("mn" "Mongolia")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("mo" "Macao")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("mp" "Northern Mariana Islands")
|
|
|
|
|
("mq" "Martinique")
|
|
|
|
|
("mr" "Mauritania")
|
|
|
|
|
("ms" "Montserrat")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("mt" "Malta")
|
|
|
|
|
("mu" "Mauritius")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("mv" "Maldives")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("mw" "Malawi")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("mx" "Mexico" "The United Mexican States")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("my" "Malaysia")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("mz" "Mozambique")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("na" "Namibia")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("nc" "New Caledonia (Fr.)")
|
|
|
|
|
("ne" "Niger") ; In .fr domain
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("nf" "Norfolk Island")
|
|
|
|
|
("ng" "Nigeria")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("ni" "Nicaragua" "The Republic of %s")
|
|
|
|
|
("nl" "Netherlands" "The Kingdom of the %s")
|
|
|
|
|
("no" "Norway" "The Kingdom of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("np" "Nepal") ; Via .in domain
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("nr" "Nauru")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("nu" "Niue")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("nz" "New Zealand")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("om" "Oman")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("pa" "Panama")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("pe" "Peru")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("pf" "French Polynesia")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("pg" "Papua New Guinea")
|
|
|
|
|
("ph" "Philippines" "The Republic of the %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("pk" "Pakistan")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("pl" "Poland")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("pm" "Saint Pierre and Miquelon")
|
|
|
|
|
("pn" "Pitcairn")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("pr" "Puerto Rico (U.S.)")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("ps" "Palestinian Territory, Occupied")
|
1996-01-04 23:19:43 +00:00
|
|
|
|
("pt" "Portugal" "The Portuguese Republic")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("pw" "Palau")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("py" "Paraguay")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("qa" "Qatar")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("re" "Reunion (Fr.)") ; In .fr domain
|
|
|
|
|
("ro" "Romania")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("rs" "Serbia")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("ru" "Russia" "Russian Federation")
|
|
|
|
|
("rw" "Rwanda")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("sa" "Saudi Arabia")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("sb" "Solomon Islands")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("sc" "Seychelles")
|
|
|
|
|
("sd" "Sudan")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("se" "Sweden" "The Kingdom of %s")
|
|
|
|
|
("sg" "Singapore" "The Republic of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("sh" "Saint Helena")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("si" "Slovenia")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("sj" "Svalbard and Jan Mayen") ; In .no domain
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("sk" "Slovakia" "The Slovak Republic")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("sl" "Sierra Leone")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("sm" "San Marino")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("sn" "Senegal")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("so" "Somalia")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("sr" "Suriname")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("st" "Sao Tome and Principe")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("su" "U.S.S.R." "The Union of Soviet Socialist Republics")
|
|
|
|
|
("sv" "El Salvador")
|
|
|
|
|
("sy" "Syrian Arab Republic")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("sz" "Swaziland")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("tc" "Turks and Caicos Islands")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("td" "Chad")
|
|
|
|
|
("tf" "French Southern Territories")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("tg" "Togo")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("th" "Thailand" "The Kingdom of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("tj" "Tajikistan")
|
|
|
|
|
("tk" "Tokelau")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("tl" "East Timor")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("tm" "Turkmenistan")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("tn" "Tunisia")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("to" "Tonga")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("tp" "East Timor")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("tr" "Turkey" "The Republic of %s")
|
|
|
|
|
("tt" "Trinidad and Tobago")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("tv" "Tuvalu")
|
|
|
|
|
("tw" "Taiwan" "%s, Province of China")
|
|
|
|
|
("tz" "Tanzania" "United Republic of %s")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("ua" "Ukraine")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("ug" "Uganda")
|
1994-07-24 06:14:32 +00:00
|
|
|
|
("uk" "United Kingdom" "The %s of Great Britain and Northern Ireland")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("um" "United States Minor Outlying Islands")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("us" "United States" "The %s of America")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("uy" "Uruguay" "The Eastern Republic of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("uz" "Uzbekistan")
|
|
|
|
|
("va" "Holy See (Vatican City State)")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("vc" "Saint Vincent and the Grenadines")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("ve" "Venezuela" "The Republic of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("vg" "Virgin Islands, British")
|
|
|
|
|
("vi" "Virgin Islands, U.S.")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("vn" "Vietnam")
|
|
|
|
|
("vu" "Vanuatu")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("wf" "Wallis and Futuna")
|
|
|
|
|
("ws" "Samoa")
|
|
|
|
|
("ye" "Yemen")
|
|
|
|
|
("yt" "Mayotte")
|
1997-12-07 22:15:02 +00:00
|
|
|
|
("yu" "Yugoslavia" "Yugoslavia, AKA Serbia-Montenegro")
|
|
|
|
|
("za" "South Africa" "The Republic of %s")
|
2001-07-11 11:17:44 +00:00
|
|
|
|
("zm" "Zambia")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
("zw" "Zimbabwe" "Republic of %s")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
;; Generic Domains:
|
|
|
|
|
("aero" t "Air Transport Industry")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("asia" t "Pan-Asia and Asia Pacific community")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("biz" t "Businesses")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("cat" t "Catalan language and culture")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("com" t "Commercial")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("coop" t "Cooperative Associations")
|
|
|
|
|
("info" t "Info")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("jobs" t "Employment")
|
|
|
|
|
("mobi" t "Mobile products")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
("museum" t "Museums")
|
|
|
|
|
("name" t "Individuals")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("net" t "Network")
|
|
|
|
|
("org" t "Non-profit Organization")
|
2007-11-16 07:55:42 +00:00
|
|
|
|
("pro" t "Credentialed professionals")
|
|
|
|
|
("tel" t "Contact data")
|
|
|
|
|
("travel" t "Travel industry")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
;;("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")
|
1994-09-22 03:34:43 +00:00
|
|
|
|
("uucp" t "Unix to Unix CoPy")
|
2002-07-09 10:06:17 +00:00
|
|
|
|
;; Infrastructure Domains:
|
|
|
|
|
("arpa" t "Advanced Research Projects Agency (U.S. DoD)")
|
2020-10-21 14:49:04 +02:00
|
|
|
|
;; Geographic Domains:
|
|
|
|
|
("abudhabi" "Abu Dhabi")
|
|
|
|
|
("africa" "Africa")
|
|
|
|
|
("alsace" "Alsace, France")
|
|
|
|
|
("amsterdam" "Amsterdam, The Netherlands")
|
|
|
|
|
("arab" "League of Arab States")
|
|
|
|
|
("asia" "Asia-Pacific region")
|
|
|
|
|
("bar" "Bar, Montenegro")
|
|
|
|
|
("barcelona" "Barcelona, Spain")
|
|
|
|
|
("bayern" "Bavaria, Germany")
|
|
|
|
|
("bcn" "Barcelona, Spain")
|
|
|
|
|
("berlin" "Berlin, Germany")
|
|
|
|
|
("boston" "Boston, Massachusetts")
|
|
|
|
|
("brussels" "Brussels, Belgium")
|
|
|
|
|
("budapest" "Budapest, Hungary")
|
|
|
|
|
("bzh" "Brittany, France")
|
|
|
|
|
("capetown" "Cape Town, South Africa")
|
|
|
|
|
("cat" "Catalonia, Spain")
|
|
|
|
|
("cologne" "Cologne, Germany")
|
|
|
|
|
("corsica" "Corsica, France")
|
|
|
|
|
("cymru" "Wales, United Kingdom")
|
|
|
|
|
("doha" "Doha")
|
|
|
|
|
("dubai" "Dubai")
|
|
|
|
|
("durban" "Durban, South Africa")
|
|
|
|
|
("eus" "Basque, Spain and France")
|
|
|
|
|
("frl" "Friesland, Netherlands")
|
|
|
|
|
("gal" "Galicia, Spain")
|
|
|
|
|
("gent" "Ghent, Belgium")
|
|
|
|
|
("hamburg" "Hamburg, Germany")
|
|
|
|
|
("helsinki" "Helsinki, Finland")
|
|
|
|
|
("irish" "Ireland")
|
|
|
|
|
("ist" "İstanbul, Turkey")
|
|
|
|
|
("istanbul" "İstanbul, Turkey")
|
|
|
|
|
("joburg" "Johannesburg, South Africa")
|
|
|
|
|
("kiwi" "New Zealanders")
|
|
|
|
|
("koeln" "Cologne, Germany")
|
|
|
|
|
("krd" "Kurdistan")
|
|
|
|
|
("kyoto" "Kyoto, Japan")
|
|
|
|
|
("lat" "Latin America")
|
|
|
|
|
("london" "London, United Kingdom")
|
|
|
|
|
("madrid" "Madrid, Spain")
|
|
|
|
|
("melbourne" "Melbourne, Australia")
|
|
|
|
|
("miami" "Miami, Florida")
|
|
|
|
|
("nagoya" "Nagoya, Japan")
|
|
|
|
|
("nrw" "North Rhine-Westphalia, Germany")
|
|
|
|
|
("nyc" "New York City, New York")
|
|
|
|
|
("okinawa" "Okinawa, Japan")
|
|
|
|
|
("osaka" "Osaka, Japan")
|
|
|
|
|
("paris" "Paris, France")
|
|
|
|
|
("quebec" "Québec, Canada")
|
|
|
|
|
("rio" "Rio de Janeiro, Brazil")
|
|
|
|
|
("ruhr" "Ruhr, Germany")
|
|
|
|
|
("ryukyu" "Ryukyu Islands, Japan")
|
|
|
|
|
("saarland" "Saarland, Germany")
|
|
|
|
|
("scot" "Scotland, United Kingdom")
|
|
|
|
|
("stockholm" "Stockholm, Sweden")
|
|
|
|
|
("swiss" "Switzerland")
|
|
|
|
|
("sydney" "Sydney, Australia")
|
|
|
|
|
("taipei" "Taipei, Taiwan")
|
|
|
|
|
("tatar" "Tatars")
|
|
|
|
|
("tirol" "Tyrol, Austria")
|
|
|
|
|
("tokyo" "Tokyo, Japan")
|
|
|
|
|
("vegas" "Las Vegas, Nevada")
|
|
|
|
|
("wales" "Wales, United Kingdom")
|
|
|
|
|
("wien" "Vienna, Austria")
|
|
|
|
|
("yokohama" "Yokohama, Japan")
|
|
|
|
|
("zuerich" "Zurich, Switzerland")
|
|
|
|
|
;; Internationalized Geographic Domains:
|
|
|
|
|
("xn--1qqw23a" "Foshan, China")
|
|
|
|
|
("xn--xhq521b" "Guangdong, China")
|
|
|
|
|
("xn--80adxhks" "Moscow, Russia")
|
|
|
|
|
("xn--p1acf" "Russia")
|
|
|
|
|
("xn--mgbca7dzdo" "Abu Dhabi")
|
|
|
|
|
("xn--ngbrx" "Arab")
|
1994-04-24 03:51:13 +00:00
|
|
|
|
))
|
|
|
|
|
ob))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun what-domain (domain)
|
1994-07-27 00:35:18 +00:00
|
|
|
|
"Convert mail domain DOMAIN to the country it corresponds to."
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(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))
|
1996-01-05 07:14:40 +00:00
|
|
|
|
(error "No such domain"))
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(message "%s: %s" (upcase (symbol-name domain)) (get domain 'domain-name)))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
;(let ((all nil))
|
2021-04-01 22:04:21 +02:00
|
|
|
|
; (mapatoms (lambda (x)
|
2002-10-18 08:52:37 +00:00
|
|
|
|
; (if (and (boundp x)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
; (string-match "^mail-extr-" (symbol-name x)))
|
|
|
|
|
; (setq all (cons x all)))))
|
|
|
|
|
; (setq all (sort all #'string-lessp))
|
|
|
|
|
; (cons 'setq
|
2021-04-01 22:04:21 +02:00
|
|
|
|
; (apply 'nconc (mapcar (lambda (x)
|
1994-04-24 03:51:13 +00:00
|
|
|
|
; (list x (symbol-value x)))
|
|
|
|
|
; all))))
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
|
1994-04-24 03:51:13 +00:00
|
|
|
|
(provide 'mail-extr)
|
1992-07-17 06:48:03 +00:00
|
|
|
|
|
|
|
|
|
;;; mail-extr.el ends here
|