$NetBSD: patch-ba,v 1.2 1999/02/25 18:00:29 sommerfe Exp $

--- lisp/mail/mh-comp.el-	Wed Jun 24 05:38:00 1998
+++ lisp/mail/mh-comp.el	Thu Feb 25 12:53:40 1999
@@ -147,6 +147,13 @@
 is searched for first in the user's MH directory, then in the
 system MH lib directory.")
 
+(defvar mh-repl-group-formfile "replgroupcomps"
+  "Name of file to be used as a skeleton for replying to the sender
+and all recipients of a messages.  Only used if mh-nmh-p is non-nil.
+Default is \"replgroupcomps\".  If not an absolute file name, the file
+is searched for first in the user's MH directory, then in the system
+MH lib directory.")
+
 ;;; Hooks:
 
 (defcustom mh-letter-mode-hook nil
@@ -217,7 +224,7 @@
 
 
 ;;;###autoload
-(defun mh-smail-batch (&rest ignored)
+(defun mh-smail-batch (&optional to subject other-headers &rest ignored)
   "Set up a mail composition draft with the MH mail system.
 This function is an entry point to mh-e, the Emacs front end
 to the MH mail system.  This function does not prompt the user
@@ -226,7 +233,7 @@
 Users should use `\\[mh-smail]' to compose mail."
   (mh-find-path)
   (let ((mh-error-if-no-draft t))
-    (mh-send "" "" "")))
+    (mh-send to "" subject)))
 
 
 (defun mh-edit-again (msg)
@@ -407,27 +414,35 @@
   (interactive (list (mh-get-msg-num t) current-prefix-arg))
   (let ((minibuffer-help-form
 	 "from => Sender only\nto => Sender and primary recipients\ncc or all => Sender and all recipients"))
-    (let ((reply-to (or mh-reply-default-reply-to
-			(completing-read "Reply to whom: "
-					 '(("from") ("to") ("cc") ("all"))
-					 nil
-					 t)))
-	  (folder mh-current-folder)
-	  (show-buffer mh-show-buffer)
-	  (config (current-window-configuration)))
+    (let* ((reply-to (or mh-reply-default-reply-to
+			 (completing-read "Reply to whom: "
+					  '(("from") ("to") ("cc") ("all"))
+					  nil
+					  t)))
+	   (folder mh-current-folder)
+	   (show-buffer mh-show-buffer)
+	   (config (current-window-configuration))
+ 	   (group-reply (or (equal reply-to "cc") (equal reply-to "all")))
+	   ;; mh-repl*formfile must be strings, but we're paranoid
+ 	   (form-file (cond ((and mh-nmh-p group-reply
+ 				  (stringp mh-repl-group-formfile))
+ 			     mh-repl-group-formfile)
+ 			    ((stringp mh-repl-formfile) mh-repl-formfile)
+ 			    (t nil))))
       (message "Composing a reply...")
       (mh-exec-cmd "repl" "-build" "-noquery" "-nodraftfolder"
-	     (if (stringp mh-repl-formfile) ;must be string, but we're paranoid
-		 (list "-form" mh-repl-formfile))
-	     mh-current-folder message
-	     (cond ((or (equal reply-to "from") (equal reply-to ""))
-		    '("-nocc" "all"))
-		   ((equal reply-to "to")
-		    '("-cc" "to"))
-		   ((or (equal reply-to "cc") (equal reply-to "all"))
-		    '("-cc" "all" "-nocc" "me")))
-	     (if includep
-		 '("-filter" "mhl.reply")))
+		   (if form-file
+		       (list "-form" form-file))
+		   mh-current-folder message
+		   (cond ((or (equal reply-to "from") (equal reply-to ""))
+			  '("-nocc" "all"))
+			 ((equal reply-to "to")
+			  '("-cc" "to"))
+			 (group-reply (if mh-nmh-p
+					  '("-group" "-nocc" "me")
+					'("-cc" "all" "-nocc" "me"))))
+		   (if includep
+		       '("-filter" "mhl.reply")))
       (let ((draft (mh-read-draft "reply"
 				  (expand-file-name "reply" mh-user-path)
 				  t)))
