all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: Mail mode and message mode hooks
Date: Sun, 06 Dec 2009 18:52:22 -0500	[thread overview]
Message-ID: <87tyw3fyo9.fsf@stupidchicken.com> (raw)
In-Reply-To: <87ljhfk8bp.fsf@stupidchicken.com> (Chong Yidong's message of "Sun, 06 Dec 2009 18:10:18 -0500")

Chong Yidong <cyd@stupidchicken.com> writes:

> Another idea I had is to change compose-mail to check for hook
> duplication, and pop up a warning window telling the user that the
> default mail-user-agent has changed.

To flesh out this idea a bit more, here is a patch that implements it.
Opinions?

*** emacs/lisp/simple.el.~1.1035.~	2009-12-06 13:48:05.000000000 -0500
--- emacs/lisp/simple.el	2009-12-06 18:48:37.000000000 -0500
***************
*** 5558,5563 ****
--- 5558,5572 ----
    :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,5632 ****
--- 5636,5667 ----
  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-send-hook mail-setup-hook mail-yank-hooks
+ 		        mail-citation-hook mail-mode-hook
+ 			mail-default-reply-to mail-archive-file-name
+ 			mail-self-blind mail-mailing-lists))
+ 	   (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)))




  reply	other threads:[~2009-12-06 23:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01  2:18 Mail mode and message mode hooks Chong Yidong
2009-12-01  3:40 ` Stefan Monnier
2009-12-05  3:37   ` Chong Yidong
2009-12-05  4:55     ` Stefan Monnier
2009-12-05  9:22     ` Eli Zaretskii
2009-12-05 18:34     ` Davis Herring
2009-12-06 23:10       ` Chong Yidong
2009-12-06 23:52         ` Chong Yidong [this message]
2009-12-07  2:16           ` Stefan Monnier
2009-12-01 19:07 ` Chong Yidong
2009-12-01 20:41   ` Davis Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tyw3fyo9.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.