This is my first submission using patcher; I hope I didn't botch
anything.
Also, Lisp is not my primary programming language. Feedback is always
welcome.
mike
ChangeLog addition:
2006-08-22 Mike Kupfer <mike.kupfer(a)xemacs.org>
* patcher.el (patcher-mail-mh, patcher-send-mh): New functions to
support sending mail using MH-E.
* patcher.el (patcher-default-mail-method,
patcher-project-options-custom-type): add 'mh mail type.
* Makefile (REQUIRES): add mh-e
xemacs-devel source patch:
Diff command: cvs -q diff -uN
Files affected: patcher.el Makefile
Index: Makefile
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xemacs-devel/Makefile,v
retrieving revision 1.87
diff -u -r1.87 Makefile
--- Makefile 2006/08/14 08:32:40 1.87
+++ Makefile 2006/10/18 03:52:01
@@ -24,7 +24,7 @@
MAINTAINER = XEmacs Development Team <xemacs-beta(a)xemacs.org>
PACKAGE = xemacs-devel
PKG_TYPE = single-file
-REQUIRES = xemacs-base ispell mail-lib gnus rmail tm apel sh-script \
+REQUIRES = xemacs-base ispell mail-lib mh-e gnus rmail tm apel sh-script \
net-utils eterm ecrypto
CATEGORY = standard
Index: patcher.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xemacs-devel/patcher.el,v
retrieving revision 1.23
diff -u -r1.23 patcher.el
--- patcher.el 2005/07/26 14:20:07 1.23
+++ patcher.el 2006/10/18 03:52:04
@@ -343,8 +343,8 @@
(defcustom patcher-default-mail-method 'compose-mail
"*Default method used by Patcher to prepare a mail.
-Currently, there are four built-in methods: 'compose-mail \(the default),
-'sendmail, 'message, 'gnus and 'fake. Please refer to the corresponding
+Currently, there are five built-in methods: 'compose-mail \(the default),
+'sendmail, 'message, 'gnus, 'mh and 'fake. Please refer to the
corresponding
`patcher-mail-*' function for a description of each method.
You can also define your own method, say `foo'. In that case, you *must*
@@ -357,6 +357,7 @@
(const sendmail)
(const message)
(const gnus)
+ (const mh)
(const fake)
(symbol :tag "other")))
@@ -742,6 +743,7 @@
(const sendmail)
(const message)
(const gnus)
+ (const mh)
(const fake)
(symbol :tag "other")))
(list :inline t :tag "User name"
@@ -2973,6 +2975,41 @@
;; `message-exit-actions' is probably more appropriate than
;; `message-send-actions' to perform the cleanup.
(push '(patcher-after-send) message-exit-actions))
+
+(defun patcher-mail-mh (project subject)
+ "Prepare a patch-related mail using MH-E.
+This function uses the `:to-address' project option to determine the email
+address for sending the message. Otherwise, the address is prompted
+for."
+ (require 'mh-e)
+ ;; We can't guarantee that there is an MH-E folder buffer
+ ;; available. So use mh-smail to create the message, then fill it
+ ;; in.
+ (patcher-with-mail-parameters project
+ (let ((to (or (patcher-project-option project :to-address)
+ (read-string "To address: "))))
+ (mh-smail)
+ (goto-char (point-min))
+ (re-search-forward "^To:")
+ (kill-entire-line)
+ (insert "To: " to "\n")
+ (goto-char (point-min))
+ (re-search-forward "^Subject:")
+ (kill-entire-line)
+ (insert "Subject: " subject "\n")))
+ (goto-char (point-max))
+ (add-local-hook 'mh-before-send-letter-hook 'patcher-before-send)
+ ;; MH-E doesn't have a hook for after the message has been sent. So
+ ;; bind the send key sequence to a custom function that includes the
+ ;; patcher post-send cleanup function.
+ (local-set-key "\C-c\C-c" 'patcher-send-mh))
+
+(defun patcher-send-mh ()
+ "Helper function for patcher-mail-mh. Sends the composed mail and
+ then invokes the patcher post-send cleanup function."
+ (interactive)
+ (mh-send-letter)
+ (patcher-after-send))
(defun patcher-mail-fake (project subject)
"Prepare a patch-related fake mail.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches