]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/mail-extr.el
(makeinfo-compile): Use `compilation-start'. Set `next-error-function'
[gnu-emacs] / lisp / mail / mail-extr.el
index 7f2e6fef6b6e5985830984971f47ac0cf0d039c1..da5ec4bfda123e1ffb0ea44f0784b8eced52d1fa 100644 (file)
@@ -1,7 +1,7 @@
 ;;; mail-extr.el --- extract full name and address from RFC 822 mail header -*- coding: utf-8 -*-
 
-;; Copyright (C) 1991, 1992, 1993, 1994, 1997, 2001
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1992, 1993, 1994, 1997, 2001, 2002, 2003, 2004,
+;;   2005 Free Software Foundation, Inc.
 
 ;; Author: Joe Wells <jbw@cs.bu.edu>
 ;; Maintainer: FSF
@@ -21,8 +21,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -231,7 +231,14 @@ we will assume that \"John Q. Smith\" is the fellow's name."
 If true, then when we see an address like \"Idiot <dumb@stupid.com>\"
 we will act as though we couldn't find a full name in the address."
   :type 'boolean
-  :version "21.4"
+  :version "22.1"
+  :group 'mail-extr)
+
+(defcustom mail-extr-ignore-realname-equals-mailbox-name t
+"*Whether to ignore a name that is equal to the mailbox name.
+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."
+  :type 'boolean
   :group 'mail-extr)
 
 ;; Matches a leading title that is not part of the name (does not
@@ -687,13 +694,14 @@ Unless NO-REPLACE is true, at each of the positions in LIST-SYMBOL
 (defvar disable-initial-guessing-flag) ; dynamic assignment
 (defvar cbeg)                          ; dynamic assignment
 (defvar cend)                          ; dynamic assignment
+(defvar mail-extr-all-top-level-domains) ; Defined below.
 
 ;;;###autoload
 (defun mail-extract-address-components (address &optional all)
   "Given an RFC-822 address ADDRESS, extract full name and canonical address.
 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'.
+`mail-extr-ignore-single-names' and `mail-extr-ignore-realname-equals-mailbox-name'.
 
 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
@@ -1403,8 +1411,9 @@ consing a string.)"
                    (setq names-match-flag nil))
                (setq i (1+ i)))
              (delete-region (+ (point-min) buffer-length) (point-max))
-             (if names-match-flag
-                 (narrow-to-region (point) (point)))))
+             (and names-match-flag
+                          mail-extr-ignore-realname-equals-mailbox-name
+                          (narrow-to-region (point) (point)))))
 
          ;; Nuke name if it's just one word.
          (goto-char (point-min))