# HG changeset patch # User Alex Schroeder # Date 1138035168 0 # Node ID 0be17d16f2ef914e7387d8f21475626096345046 # Parent ae06377861e063a38673022a8a74710fd3fbfd32 (rmail-user-mail-address-regexp): Compute a default value instead of assuming nil. Doc. (rmail-summary-get-sender): Compare with rmail-user-mail-address-regexp instead of computing the default value. diff -r ae06377861e0 -r 0be17d16f2ef lisp/mail/rmailsum.el --- a/lisp/mail/rmailsum.el Mon Jan 23 10:52:46 2006 +0000 +++ b/lisp/mail/rmailsum.el Mon Jan 23 16:52:48 2006 +0000 @@ -299,17 +299,26 @@ :group 'rmail-summary) ;;;###autoload -(defcustom rmail-user-mail-address-regexp nil +(defcustom rmail-user-mail-address-regexp +(concat "^\\(" + (regexp-quote (user-login-name)) + "\\($\\|@\\)\\|" + (regexp-quote + (or user-mail-address + (concat (user-login-name) "@" + (or mail-host-address + (system-name))))) + "\\>\\)") "*Regexp matching user mail addresses. If non-nil, this variable is used to identify the correspondent -when receiving new mail. If it matches the address of the sender, -the recipient is taken as correspondent of a mail. -If nil \(default value\), your `user-login-name' and `user-mail-address' -are used to exclude yourself as correspondent. +when receiving new mail. If it matches the address of the +sender, the recipient is taken as correspondent of a mail. It is +initialized based on your `user-login-name' and +`user-mail-address'. -Usually you don't have to set this variable, except if you collect mails -sent by you under different user names. -Then it should be a regexp matching your mail addresses. +Usually you don't have to set this variable, except if you +collect mails sent by you under different user names. Then it +should be a regexp matching your mail addresses. Setting this variable has an effect only before reading a mail." :type '(choice (const :tag "None" nil) regexp) @@ -1480,20 +1489,7 @@ `user-mail-address', return the to-address instead." (let ((sender (rmail-desc-get-sender n))) (if (or (null sender) - (string-match - (or rmail-user-mail-address-regexp - (concat "^\\(" - (regexp-quote (user-login-name)) - "\\($\\|@\\)\\|" - (regexp-quote - ;; Don't lose if run from init file where - ;; user-mail-address is not set yet. - (or user-mail-address - (concat (user-login-name) "@" - (or mail-host-address - (system-name))))) - "\\>\\)")) - sender)) + (string-match rmail-user-mail-address-regexp sender)) ;; Either no sender known, or it's this user. (save-restriction (narrow-to-region (rmail-desc-get-start n)