[comp.emacs] ?MH Redistribution under GNU Emacs?

swb@batcomputer.tn.cornell.edu (Scott Brim) (08/04/88)

I can't get redistribution (MH "dist", GNUemacs mh-e "r") to work
running MH under GNUemacs.  Messages always come back with "post:
illegal header line -- Resent-To:".  No "Resent-Date" etc. was included
by emacs in the new message.  This is using emacs 18.51 and MH 6.5
under Sun 3.5.  I tried messing with the variable
mh-redist-full-contents but that didn't help.  It could easily be
something in my .emacs or .mh_profile but I don't know what.  Am I
missing something simple?  Anyone else have a similar experience?

						Thanks ... Scott

jr@PIZZA.BBN.COM (John Robinson) (08/04/88)

> I can't get redistribution (MH "dist", GNUemacs mh-e "r") to work
> running MH under GNUemacs.  Messages always come back with "post:
> illegal header line -- Resent-To:".  No "Resent-Date" etc. was included
> by emacs in the new message.  This is using emacs 18.51 and MH 6.5
> under Sun 3.5.  I tried messing with the variable
> mh-redist-full-contents but that didn't help.

The appended replacement for mh-redistribute should fix the problem
(this for mh-redist-full-contents set to nil, which it probably should
be everywhere except at Berkeley).  The bug was the use of
(buffer-file-name) instead of msg-filename as the second argument to
format when mh-redist-full-contents is nil.  I have sent this to Larus
(several times in fact), and this time I think he has it right
finally for the next release.

If this still doesn't help, look through emacs/lisp/mh-e.el for
instructions about building MH - there is an MHE compiler switch that
has to be set for MH's dist and repl to work as mh-e expects them.
The command, e.g., "repl -help" will tell you what MH version and what
switches you are running.

/jr
jr@bbn.com or bbn!jr
------------------------------------------------------------------------
(defun mh-redistribute (to cc msg)
  "Redistribute a letter."
  (interactive (list (read-string "Redist-To: ")
		     (read-string "Redist-Cc: ")
		     (mh-get-msg-num t)))
  (save-window-excursion
    (let ((msg-filename (mh-msg-filename msg))
	  (folder mh-current-folder)
	  (draft (mh-read-draft "redistribution"
				(if mh-redist-full-contents
				    (mh-msg-filename msg)
				    nil)
				nil)))
      (mh-goto-header-end 0)
      (insert "Resent-To: " to "\n")
      (if (not (equal cc "")) (insert "Resent-cc: " cc "\n"))
      (mh-clean-msg-header (point-min)
			   "^Message-Id:\\|^Received:\\|^Return-Path:\\|^Sender:\\|^Date:\\|^From:"
			   nil)
      (save-buffer)
      (message "Redistributing...")
      (if mh-redist-full-contents
	  (call-process "/bin/sh" nil 0 nil "-c"
			(format "mhdist=1 mhaltmsg=%s -push %s"
				(buffer-file-name)
				(mh-expand-file-name "send" mh-progs)
				(buffer-file-name)))
	  (call-process "/bin/sh" nil 0 nil "-c"
			(format "mhdist=1 mhaltmsg=%s mhannotate=1 %s -push %s"
				msg-filename
				(mh-expand-file-name "send" mh-progs)
				(buffer-file-name))))
      (mh-annotate-msg msg folder "R"
		       "-component" "Resent:"
		       "-text" (format "\"%s %s\"" to cc))
      (kill-buffer draft)
      (message "Redistributing...done"))))