]> git.eshelyaron.com Git - emacs.git/commitdiff
* simple.el (compose-mail): Check for incompatibilities and warn.
authorChong Yidong <cyd@stupidchicken.com>
Mon, 7 Dec 2009 16:09:05 +0000 (16:09 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Mon, 7 Dec 2009 16:09:05 +0000 (16:09 +0000)
(compose-mail-user-agent-warnings): New option.

lisp/ChangeLog
lisp/simple.el

index 0d0be747b8774c4af0cd32946e6727ae88ff465b..72be092c851a1ac87c929d134379c032253fa7aa 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-07  Chong Yidong  <cyd@stupidchicken.com>
+
+       * simple.el (compose-mail): Check for incompatibilities and warn.
+       (compose-mail-user-agent-warnings): New option.
+
 2009-12-07  Dan Nicolaescu  <dann@ics.uci.edu>
 
        Support showing a single log entry from vc-annotate.
index d1656b64919fe290219171d1c29e09380361e82f..774b69a484273a9a4858f373674742b8f1db31f3 100644 (file)
@@ -5558,6 +5558,15 @@ See also `read-mail-command' concerning reading mail."
   :version "23.2"                       ; sendmail->message
   :group 'mail)
 
+(defcustom compose-mail-user-agent-warnings t
+  "If non-nil, `compose-mail' warns about changes in `mail-user-agent'.
+If the value of `mail-user-agent' is the default, and the user
+appears to have customizations applying to the old default,
+`compose-mail' issues a warning."
+  :type 'boolean
+  :version "23.2"
+  :group 'mail)
+
 (define-mail-user-agent 'sendmail-user-agent
   'sendmail-user-agent-compose
   'mail-send-and-exit)
@@ -5627,6 +5636,32 @@ SEND-ACTIONS is a list of actions to call when the message is sent.
 Each action has the form (FUNCTION . ARGS)."
   (interactive
    (list nil nil nil current-prefix-arg))
+
+  ;; In Emacs 23.2, the default value of `mail-user-agent' changed
+  ;; from sendmail-user-agent to message-user-agent.  Some users may
+  ;; encounter incompatibilities.  This hack tries to detect problems
+  ;; and warn about them.
+  (and compose-mail-user-agent-warnings
+       (eq mail-user-agent 'message-user-agent)
+       (let (warn-vars)
+        (dolist (var '(mail-mode-hook mail-send-hook mail-setup-hook
+                       mail-yank-hooks mail-archive-file-name
+                       mail-default-reply-to mail-mailing-lists
+                       mail-self-blind mail-setup-with-from))
+          (and (boundp var)
+               (symbol-value var)
+               (push var warn-vars)))
+        (when warn-vars
+          (display-warning 'mail
+                           (format "\
+The default mail mode is now Message mode.
+You have the following Mail mode variable%s customized:
+\n  %s\n\nTo use Mail mode, set `mail-user-agent' to sendmail-user-agent.
+To disable this warning, set `compose-mail-check-user-agent' to nil."
+                                   (if (> (length warn-vars) 1) "s" "")
+                                   (mapconcat 'symbol-name
+                                              warn-vars " "))))))
+
   (let ((function (get mail-user-agent 'composefunc)))
     (funcall function to subject other-headers continue
             switch-function yank-action send-actions)))