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.
This commit is contained in:
parent
f3eaab0a37
commit
8675f9c8b8
5 changed files with 27 additions and 46 deletions
|
@ -941,8 +941,6 @@ If this variable is non-@code{nil}, it is used instead of
|
|||
@code{system-name} for purposes of generating email addresses. For
|
||||
example, it is used when constructing the default value of
|
||||
@code{user-mail-address}. @xref{User Identification}.
|
||||
@c FIXME sounds like should probably give this a :set-after and some
|
||||
@c custom-initialize-delay voodoo.
|
||||
@end defopt
|
||||
|
||||
@deffn Command getenv var &optional frame
|
||||
|
|
|
@ -2759,24 +2759,17 @@ return that value."
|
|||
(cond
|
||||
;; nil means do nothing
|
||||
((eq nil feedmail-from-line) nil)
|
||||
;; t is the same a using the default computation, so compute it and recurse
|
||||
;; t is the same as using the default computation, so compute it and recurse
|
||||
;; user-full-name suggested by kpc@ptolemy.arc.nasa.gov (=Kimball Collins)
|
||||
;; improvement using user-mail-address suggested by
|
||||
;; gray@austin.apc.slb.com (Douglas Gray Stephens)
|
||||
;; improvement using mail-host-address suggested by "Jason Eisner" <jason@cs.jhu.edu>
|
||||
;; ((this situation really is hopeless, though)
|
||||
((eq t feedmail-from-line)
|
||||
(let ((feedmail-from-line
|
||||
(let ((at-stuff
|
||||
(if (> (length user-mail-address) 0)
|
||||
user-mail-address
|
||||
(concat (user-login-name) "@"
|
||||
(or mail-host-address (system-name))))))
|
||||
(cond
|
||||
((eq mail-from-style nil) at-stuff)
|
||||
((eq mail-from-style 'parens) (concat at-stuff " (" (user-full-name) ")"))
|
||||
((eq mail-from-style 'angles) (concat "\"" (user-full-name) "\" <" at-stuff ">"))
|
||||
))))
|
||||
(cond
|
||||
((eq mail-from-style nil) user-mail-address)
|
||||
((eq mail-from-style 'parens) (concat user-mail-address " (" (user-full-name) ")"))
|
||||
((eq mail-from-style 'angles) (concat "\"" (user-full-name) "\" <" user-mail-address ">"))
|
||||
)))
|
||||
(feedmail-fiddle-from)))
|
||||
|
||||
;; if it's a string, simply make a fiddle-plex out of it and recurse
|
||||
|
|
|
@ -2665,12 +2665,7 @@ Ask the user whether to add that list name to `mail-mailing-lists'."
|
|||
(concat "^\\("
|
||||
(regexp-quote (user-login-name))
|
||||
"\\($\\|@\\)\\|"
|
||||
(regexp-quote
|
||||
(if (> (length user-mail-address) 0)
|
||||
user-mail-address
|
||||
(concat (user-login-name) "@"
|
||||
(or mail-host-address
|
||||
(system-name)))))
|
||||
(regexp-quote user-mail-address)
|
||||
"\\>\\)"))
|
||||
addr))
|
||||
(y-or-n-p
|
||||
|
|
|
@ -753,15 +753,7 @@ the message being processed."
|
|||
(concat "^\\("
|
||||
(regexp-quote (user-login-name))
|
||||
"\\($\\|@\\)\\|"
|
||||
(regexp-quote
|
||||
;; Don't lose if run from init file
|
||||
;; where user-mail-address is not
|
||||
;; set yet.
|
||||
(if (> (length user-mail-address) 0)
|
||||
user-mail-address
|
||||
(concat (user-login-name) "@"
|
||||
(or mail-host-address
|
||||
(system-name)))))
|
||||
(regexp-quote user-mail-address)
|
||||
"\\>\\)"))
|
||||
from))
|
||||
;; No From field, or it's this user.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue