[comp.emacs] macro to put the > in front of copied messages

avi@XN.LL.MIT.EDU (Avi Weiss) (01/30/88)

Does anybody have a gnu-emacs macro that will copy a section of a
posting from point to mark, and insert the > (with a space) in front
of each line of the copied message?

    thanks
     avi@xn.ll.mit.edu

weltyc@nysernic (Christopher A. Welty) (01/30/88)

In article <894@xn.LL.MIT.EDU> avi@XN.LL.MIT.EDU (Avi Weiss) writes:
>Does anybody have a gnu-emacs macro that will copy a section of a
>posting from point to mark, and insert the > (with a space) in front
>of each line of the copied message?
>

	I use this quite a lot.  In addition to what you requested it
also does a "fill" on the quoted text.  I've found that inserting a >
at the beginning of some messages causes it to go past the right
margin which annoys me....  If you don't want it to fill, comment out
the line indicated.  I have it bound to ^C^Y in mail-mode-map.

(defun mail-reply-yank (arg)
  "Yank the current msg in the rmail buffer, fill it properly, and insert\n
the standard > before each line.  CW 2/5/86"
  (interactive "P")
  (if mail-reply-buffer
      (let ((start (point)))
	(insert "\n")
        (insert-buffer mail-reply-buffer)
	(mail-yank-clear-headers start (mark))
	(save-excursion
;comment this out if you don't want filled text.
	  (fill-region (dot) (mark)))
	(while (not (eq (dot) (mark)))
	  (let ()
	    (beginning-of-line)
	    (insert "> ")
	    (next-line 1))))))


Christopher Welty  ---  Asst. Director, RPI CS Labs
weltyc@cs.rpi.edu       ...!rutgers!nysernic!weltyc