diff options
author | Glenn Morris <rgm@gnu.org> | 2017-02-17 19:06:15 -0500 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2017-02-17 19:06:15 -0500 |
commit | 8675f9c8b8a002530d0c4e0263bb3d4cf3a649fa (patch) | |
tree | 458537063b7b9974209a0fbedcba2799247f2153 /lisp/startup.el | |
parent | f3eaab0a3749822592ddf36e591dcafd31451177 (diff) | |
download | emacs-8675f9c8b8a002530d0c4e0263bb3d4cf3a649fa.tar.gz |
Ensure that user-mail-address always has a value
* lisp/startup.el (user-mail-address): Initialize in the normal way.
(command-line): Reset user-mail-address if needed using
standard custom machinery.
* lisp/mail/feedmail.el (feedmail-fiddle-from):
* lisp/mail/rmail.el (rmail-unknown-mail-followup-to):
* lisp/mail/rmailsum.el (rmail-header-summary):
Simplify now that user-mail-address is always set.
; * doc/lispref/os.texi (System Environment): Remove fixme comment.
Diffstat (limited to 'lisp/startup.el')
-rw-r--r-- | lisp/startup.el | 35 |
1 files changed, 19 insertions, 16 deletions
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'." :type '(choice (const nil) string) :group 'mail) -(defcustom user-mail-address (if command-line-processed - (or (getenv "EMAIL") - (concat (user-login-name) "@" - (or mail-host-address - (system-name)))) - ;; Empty string means "not set yet". - "") - "Full mailing address of this user. -This is initialized with environment variable `EMAIL' or, as a -fallback, using `mail-host-address'. This is done after your -init file is read, in case it sets `mail-host-address'." +(defcustom user-mail-address + (or (getenv "EMAIL") + (concat (user-login-name) "@" (or mail-host-address (system-name)))) + "The email address of the current user. +This defaults to either: the value of EMAIL environment variable; or +user@host, using `user-login-name' and `mail-host-address' (or `system-name')." + :initialize 'custom-initialize-delay + :set-after '(mail-host-address) :type 'string :group 'mail) @@ -1296,11 +1293,17 @@ the `--debug-init' option to view a complete error backtrace." (set-language-environment current-language-environment))) ;; Do this here in case the init file sets mail-host-address. - (if (equal user-mail-address "") - (setq user-mail-address (or (getenv "EMAIL") - (concat (user-login-name) "@" - (or mail-host-address - (system-name)))))) + (and mail-host-address + ;; Check that user-mail-address has not been set by hand. + ;; Yes, this is ugly, but slightly less so than leaving + ;; user-mail-address uninitialized during init file processing. + ;; Perhaps we should make :set-after do something like this? + ;; Ie, extend it to also mean (re)initialize-after. + (equal user-mail-address + (let (mail-host-address) + (ignore-errors + (eval (car (get 'user-mail-address 'standard-value)))))) + (custom-reevaluate-setting 'user-mail-address)) ;; If parameter have been changed in the init file which influence ;; face realization, clear the face cache so that new faces will |