aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/os.texi2
-rw-r--r--lisp/mail/feedmail.el19
-rw-r--r--lisp/mail/rmail.el7
-rw-r--r--lisp/mail/rmailsum.el10
-rw-r--r--lisp/startup.el35
5 files changed, 27 insertions, 46 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index c0a9c81fda2..9b6752c5e1a 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -941,8 +941,6 @@ If this variable is non-@code{nil}, it is used instead of
941@code{system-name} for purposes of generating email addresses. For 941@code{system-name} for purposes of generating email addresses. For
942example, it is used when constructing the default value of 942example, it is used when constructing the default value of
943@code{user-mail-address}. @xref{User Identification}. 943@code{user-mail-address}. @xref{User Identification}.
944@c FIXME sounds like should probably give this a :set-after and some
945@c custom-initialize-delay voodoo.
946@end defopt 944@end defopt
947 945
948@deffn Command getenv var &optional frame 946@deffn Command getenv var &optional frame
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index 53791565bb1..e0bd4590b13 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -2759,24 +2759,17 @@ return that value."
2759 (cond 2759 (cond
2760 ;; nil means do nothing 2760 ;; nil means do nothing
2761 ((eq nil feedmail-from-line) nil) 2761 ((eq nil feedmail-from-line) nil)
2762 ;; t is the same a using the default computation, so compute it and recurse 2762 ;; t is the same as using the default computation, so compute it and recurse
2763 ;; user-full-name suggested by kpc@ptolemy.arc.nasa.gov (=Kimball Collins) 2763 ;; user-full-name suggested by kpc@ptolemy.arc.nasa.gov (=Kimball Collins)
2764 ;; improvement using user-mail-address suggested by 2764 ;; improvement using user-mail-address suggested by
2765 ;; gray@austin.apc.slb.com (Douglas Gray Stephens) 2765 ;; gray@austin.apc.slb.com (Douglas Gray Stephens)
2766 ;; improvement using mail-host-address suggested by "Jason Eisner" <jason@cs.jhu.edu>
2767 ;; ((this situation really is hopeless, though)
2768 ((eq t feedmail-from-line) 2766 ((eq t feedmail-from-line)
2769 (let ((feedmail-from-line 2767 (let ((feedmail-from-line
2770 (let ((at-stuff 2768 (cond
2771 (if (> (length user-mail-address) 0) 2769 ((eq mail-from-style nil) user-mail-address)
2772 user-mail-address 2770 ((eq mail-from-style 'parens) (concat user-mail-address " (" (user-full-name) ")"))
2773 (concat (user-login-name) "@" 2771 ((eq mail-from-style 'angles) (concat "\"" (user-full-name) "\" <" user-mail-address ">"))
2774 (or mail-host-address (system-name)))))) 2772 )))
2775 (cond
2776 ((eq mail-from-style nil) at-stuff)
2777 ((eq mail-from-style 'parens) (concat at-stuff " (" (user-full-name) ")"))
2778 ((eq mail-from-style 'angles) (concat "\"" (user-full-name) "\" <" at-stuff ">"))
2779 ))))
2780 (feedmail-fiddle-from))) 2773 (feedmail-fiddle-from)))
2781 2774
2782 ;; if it's a string, simply make a fiddle-plex out of it and recurse 2775 ;; if it's a string, simply make a fiddle-plex out of it and recurse
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 695638fa062..4b72b3562d1 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -2665,12 +2665,7 @@ Ask the user whether to add that list name to `mail-mailing-lists'."
2665 (concat "^\\(" 2665 (concat "^\\("
2666 (regexp-quote (user-login-name)) 2666 (regexp-quote (user-login-name))
2667 "\\($\\|@\\)\\|" 2667 "\\($\\|@\\)\\|"
2668 (regexp-quote 2668 (regexp-quote user-mail-address)
2669 (if (> (length user-mail-address) 0)
2670 user-mail-address
2671 (concat (user-login-name) "@"
2672 (or mail-host-address
2673 (system-name)))))
2674 "\\>\\)")) 2669 "\\>\\)"))
2675 addr)) 2670 addr))
2676 (y-or-n-p 2671 (y-or-n-p
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 729538173a0..37ac46c6af6 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -753,15 +753,7 @@ the message being processed."
753 (concat "^\\(" 753 (concat "^\\("
754 (regexp-quote (user-login-name)) 754 (regexp-quote (user-login-name))
755 "\\($\\|@\\)\\|" 755 "\\($\\|@\\)\\|"
756 (regexp-quote 756 (regexp-quote user-mail-address)
757 ;; Don't lose if run from init file
758 ;; where user-mail-address is not
759 ;; set yet.
760 (if (> (length user-mail-address) 0)
761 user-mail-address
762 (concat (user-login-name) "@"
763 (or mail-host-address
764 (system-name)))))
765 "\\>\\)")) 757 "\\>\\)"))
766 from)) 758 from))
767 ;; No From field, or it's this user. 759 ;; No From field, or it's this user.
diff --git a/lisp/startup.el b/lisp/startup.el
index 4272708ce9a..2d48bd5df15 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -381,17 +381,14 @@ If this is nil, Emacs uses `system-name'."
381 :type '(choice (const nil) string) 381 :type '(choice (const nil) string)
382 :group 'mail) 382 :group 'mail)
383 383
384(defcustom user-mail-address (if command-line-processed 384(defcustom user-mail-address
385 (or (getenv "EMAIL") 385 (or (getenv "EMAIL")
386 (concat (user-login-name) "@" 386 (concat (user-login-name) "@" (or mail-host-address (system-name))))
387 (or mail-host-address 387 "The email address of the current user.
388 (system-name)))) 388This defaults to either: the value of EMAIL environment variable; or
389 ;; Empty string means "not set yet". 389user@host, using `user-login-name' and `mail-host-address' (or `system-name')."
390 "") 390 :initialize 'custom-initialize-delay
391 "Full mailing address of this user. 391 :set-after '(mail-host-address)
392This is initialized with environment variable `EMAIL' or, as a
393fallback, using `mail-host-address'. This is done after your
394init file is read, in case it sets `mail-host-address'."
395 :type 'string 392 :type 'string
396 :group 'mail) 393 :group 'mail)
397 394
@@ -1296,11 +1293,17 @@ the `--debug-init' option to view a complete error backtrace."
1296 (set-language-environment current-language-environment))) 1293 (set-language-environment current-language-environment)))
1297 1294
1298 ;; Do this here in case the init file sets mail-host-address. 1295 ;; Do this here in case the init file sets mail-host-address.
1299 (if (equal user-mail-address "") 1296 (and mail-host-address
1300 (setq user-mail-address (or (getenv "EMAIL") 1297 ;; Check that user-mail-address has not been set by hand.
1301 (concat (user-login-name) "@" 1298 ;; Yes, this is ugly, but slightly less so than leaving
1302 (or mail-host-address 1299 ;; user-mail-address uninitialized during init file processing.
1303 (system-name)))))) 1300 ;; Perhaps we should make :set-after do something like this?
1301 ;; Ie, extend it to also mean (re)initialize-after.
1302 (equal user-mail-address
1303 (let (mail-host-address)
1304 (ignore-errors
1305 (eval (car (get 'user-mail-address 'standard-value))))))
1306 (custom-reevaluate-setting 'user-mail-address))
1304 1307
1305 ;; If parameter have been changed in the init file which influence 1308 ;; If parameter have been changed in the init file which influence
1306 ;; face realization, clear the face cache so that new faces will 1309 ;; face realization, clear the face cache so that new faces will