[comp.emacs] Changing rmail reply???

epperly@OSNOME.CHE.WISC.EDU (Tom Epperly) (12/12/89)

Please don't flame me for asking a stupid question, but how can I
change rmail to prepend "Re: " to the subject when replying?  I am not
a LISP expert much less GNU Emacs LISP, but it seems that rmail
deliberately removes "Re: " from the subject line.  How do I have it
put one or leave one "Re: " at the beginning?

Thanks in advance,
Tom Epperly
epperly@osnome.che.wisc.edu

jpff@maths.bath.ac.UK (12/12/89)

There was code on the net for this some time ago, but in the upgrade
to 18.55 I lost it.  I would appreciate it being resent.  Also I lost
the code to add BCC to messages, but that was less useful, as it was
often tranmitted so everyone could see it!
==John

rosen@schizo.samsung.com (MFHorn) (12/13/89)

In article <8912121507.AA13978@aeneas.MIT.EDU> jpff@maths.bath.ac.UK writes:
> There was code on the net for this some time ago, but in the upgrade
> to 18.55 I lost it.  I would appreciate it being resent.

This is how I did it..

In emacs/lisp/rmail.el, add the line

(defvar subject-re "Re: " "*String to put in front of subject for replies")

Line 1217 (or so) should look like:

      (mail-strip-quoted-names reply-to)
      subject
      (rmail-make-in-reply-to-field-from date message-id)

[May be a little different, I lost the original.]

Change it to be:

      (mail-strip-quoted-names reply-to)
      (concat subject-re subject)
      (rmail-make-in-reply-to-field-from date message-id)

You can then customize what the subject is prepended with by changing
the variable "subject-re".

> Also I lost
> the code to add BCC to messages, but that was less useful, as it was
> often tranmitted so everyone could see it!

(setq mail-sef-blind t)

--
Andy Rosen                | rosen@samsung.com       | "I got this guitar
Samsung Software America  | rosen@samsung.UUCP      |  and I learned how
One Corporate Drive       | (508) 685-7200          |  to make it talk"
Andover, MA 01810         |                         |    -Thunder Road

hallett@pet16.uucp (Jeff Hallett x5163 ) (12/13/89)

In article <8912112012.AA06265@osnome.che.wisc.edu> epperly@OSNOME.CHE.WISC.EDU (Tom Epperly) writes:
>Please don't flame me for asking a stupid question, but how can I
>change rmail to prepend "Re: " to the subject when replying?  I am not
>a LISP expert much less GNU Emacs LISP, but it seems that rmail
>deliberately removes "Re: " from the subject line.  How do I have it
>put one or leave one "Re: " at the beginning?
>


I modified rmail-reply   and load the  following  file as  part of   my
mail-mode-hook: 

----------------------8<-------------------
(defun rmail-reply (just-sender)
  "Reply to the current message.
Normally include CC: to all other recipients of original message;
prefix argument means ignore them.
While composing the reply, use \\[mail-yank-original] to yank the
original message into it."
  (interactive "P")
  ;;>> this gets set even if we abort. Can't do anything about it, though.
  (rmail-set-attribute "answered" t)
  (rmail-display-labels)
  (let (from reply-to cc subject date to message-id resent-reply-to)
    (save-excursion
      (save-restriction
	(widen)
	(goto-char (rmail-msgbeg rmail-current-message))
	(forward-line 1)
	(if (= (following-char) ?0)
	    (narrow-to-region
	     (progn (forward-line 2)
		    (point))
	     (progn (search-forward "\n\n" (rmail-msgend rmail-current-message)
				    'move)
		    (point)))
	  (narrow-to-region (point)
			    (progn (search-forward "\n*** EOOH ***\n")
				   (beginning-of-line) (point))))
	(setq resent-reply-to (mail-fetch-field "resent-reply-to" t)
	      from (mail-fetch-field "from")
	      reply-to (or resent-reply-to
			   (mail-fetch-field "reply-to" nil t)
			   from)
	      cc (cond (just-sender nil)
		       (resent-reply-to (mail-fetch-field "resent-cc" t))
		       (t (mail-fetch-field "cc" nil t)))
	      subject (or (and resent-reply-to
			       (mail-fetch-field "resent-subject" t))
			  (mail-fetch-field "subject"))
	      date (cond (resent-reply-to
			  (mail-fetch-field "resent-date" t))
			 ((mail-fetch-field "date")))
	      to (cond (resent-reply-to
			(mail-fetch-field "resent-to" t))
		       ((mail-fetch-field "to" nil t))
		       ;((mail-fetch-field "apparently-to")) ack gag barf
		       (t ""))
	      message-id (cond (resent-reply-to
				(mail-fetch-field "resent-message-id" t))
			       ((mail-fetch-field "message-id"))))))
;
;   The change goes here makes Subject == RE: {previous subject}
;
    (setq subject (concat "RE: {" (if subject subject '"No Subject") "}"))
    (mail-other-window nil
      (mail-strip-quoted-names reply-to)
      subject
      (rmail-make-in-reply-to-field from date message-id)
      (if just-sender
	  nil
	(let* ((cc-list (rmail-dont-reply-to
			  (mail-strip-quoted-names
			    (if (null cc) to (concat to ", " cc))))))
	  (if (string= cc-list "") nil cc-list)))
      (current-buffer))))

--------------8<---------------

--
	     Jeffrey A. Hallett, PET Software Engineering
      GE Medical Systems, W641, PO Box 414, Milwaukee, WI  53201
	    (414) 548-5163 : EMAIL -  hallett@gemed.ge.com
		  Est natura hominum novitatis avida