changeset 106119:471612501920

* mail/sendmail.el (mail-yank-prefix): Change default to "> ". (mail-signature): Change default to t. (mail-from-style): Deprecate `system-default' value. (mail-insert-from-field): For default value of mail-from-style, default to `angles' unless `angles' needs quoting and `parens' does not. (mail-citation-prefix-regexp): Use citation regexp from message-mode.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 19 Nov 2009 16:48:30 +0000
parents 8542a4738a96
children 973f36f0716a
files lisp/ChangeLog lisp/mail/sendmail.el
diffstat 2 files changed, 41 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Nov 19 16:46:50 2009 +0000
+++ b/lisp/ChangeLog	Thu Nov 19 16:48:30 2009 +0000
@@ -1,3 +1,14 @@
+2009-11-19  Chong Yidong  <cyd@stupidchicken.com>
+
+	* mail/sendmail.el (mail-yank-prefix): Change default to "> ".
+	(mail-signature): Change default to t.
+	(mail-from-style): Deprecate `system-default' value.
+	(mail-insert-from-field): For default value of mail-from-style,
+	default to `angles' unless `angles' needs quoting and `parens'
+	does not.
+	(mail-citation-prefix-regexp): Use citation regexp from
+	message-mode.
+
 2009-11-19  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Set
--- a/lisp/mail/sendmail.el	Thu Nov 19 16:46:50 2009 +0000
+++ b/lisp/mail/sendmail.el	Thu Nov 19 16:48:30 2009 +0000
@@ -58,7 +58,7 @@
   :type 'file)
 
 ;;;###autoload
-(defcustom mail-from-style 'angles
+(defcustom mail-from-style 'default
   "Specifies how \"From:\" fields look.
 
 If `nil', they contain just the return address like:
@@ -67,15 +67,14 @@
 	king@grassland.com (Elvis Parsley)
 If `angles', they look like:
 	Elvis Parsley <king@grassland.com>
-If `system-default', allows the mailer to insert its default From field
-derived from the envelope-from address.
 
-In old versions of Emacs, the `system-default' setting also caused
-Emacs to pass the proper email address from `user-mail-address'
-to the mailer to specify the envelope-from address.  But that is now
-controlled by a separate variable, `mail-specify-envelope-from'."
-  :type '(choice (const nil) (const parens) (const angles)
-		 (const system-default))
+Otherwise, most addresses look like `angles', but they look like
+`parens' if `angles' would need quoting and `parens' would not."
+  ;; The value `system-default' is now deprecated.
+  :type '(choice (const :tag "simple" nil)
+		 (const parens)
+		 (const angles)
+		 (const default))
   :version "20.3"
   :group 'sendmail)
 
@@ -241,7 +240,7 @@
   "The modification time of your mail alias file when it was last examined.")
 
 ;;;###autoload
-(defcustom mail-yank-prefix nil
+(defcustom mail-yank-prefix "> "
   "Prefix insert on lines of yanked message being replied to.
 If this is nil, use indentation, as specified by `mail-indentation-spaces'."
   :type '(choice (const nil) string)
@@ -284,7 +283,8 @@
 regardless of what part of it (if any) is included in the cited text.")
 
 ;;;###autoload
-(defcustom mail-citation-prefix-regexp (purecopy "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|[ \t]*")
+(defcustom mail-citation-prefix-regexp
+  (purecopy "\\([ \t]*\\(\\w\\|[_.]\\)+>+\\|[ \t]*[]>|}]\\)+")
   "Regular expression to match a citation prefix plus whitespace.
 It should match whatever sort of citation prefixes you want to handle,
 with whitespace before and after; it should also match just whitespace.
@@ -393,7 +393,7 @@
   nil)
 
 ;;;###autoload
-(defcustom mail-signature nil
+(defcustom mail-signature t
   "Text inserted at end of mail buffer when a message is initialized.
 If t, it means to insert the contents of the file `mail-signature-file'.
 If a string, that string is inserted.
@@ -955,7 +955,21 @@
     (if (string-match "[^\0-\177]" fullname)
 	(setq fullname (rfc2047-encode-string fullname)
 	      quote-fullname t))
-    (cond ((eq mail-from-style 'angles)
+    (cond ((null mail-from-style)
+	   (insert "From: " login "\n"))
+	  ;; This is deprecated.
+	  ((eq mail-from-style 'system-default)
+	   nil)
+	  ((or (eq mail-from-style 'angles)
+	       (and (not (eq mail-from-style 'parens))
+		    ;; Use angles if no quoting is needed, or if
+		    ;; parens would need quoting too.
+		    (or (not (string-match "[^- !#-'*+/-9=?A-Z^-~]" fullname))
+			(let ((tmp (concat fullname nil)))
+			  (while (string-match "([^()]*)" tmp)
+			    (aset tmp (match-beginning 0) ?-)
+			    (aset tmp (1- (match-end 0)) ?-))
+			  (string-match "[\\()]" tmp)))))
 	   (insert "From: " fullname)
 	   (let ((fullname-start (+ (point-min) 6))
 		 (fullname-end (point-marker)))
@@ -974,7 +988,8 @@
 		     (replace-match "\\\\\\&" t))
 		   (insert "\""))))
 	   (insert " <" login ">\n"))
-	  ((eq mail-from-style 'parens)
+	  ;; 'parens or default
+	  (t
 	   (insert "From: " login " (")
 	   (let ((fullname-start (point)))
 	     (if quote-fullname
@@ -997,12 +1012,7 @@
 		       fullname-end 1)
 		 (replace-match "\\1(\\3)" t)
 		 (goto-char fullname-start))))
-	   (insert ")\n"))
-	  ((null mail-from-style)
-	   (insert "From: " login "\n"))
-	  ((eq mail-from-style 'system-default)
-	   nil)
-	  (t (error "Invalid value for `mail-from-style'")))))
+	   (insert ")\n")))))
 
 ;; Normally you will not need to modify these options unless you are
 ;; using some non-genuine substitute for sendmail which does not