home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / emacs / 3605 < prev    next >
Encoding:
Text File  |  1992-11-23  |  2.8 KB  |  73 lines

  1. Newsgroups: comp.emacs
  2. Path: sparky!uunet!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!Germany.EU.net!ira.uka.de!slsvaat!josef!kanze
  3. From: kanze@us-es.sel.de (James Kanze)
  4. Subject: Re: Emacs & mail
  5. In-Reply-To: campo@sunthpi3.difi.unipi.it's message of Mon, 23 Nov 1992 19:38:09 GMT
  6. Message-ID: <KANZE.92Nov23162812@slsvhat.us-es.sel.de>
  7. Sender: news@us-es.sel.de
  8. Organization: SEL
  9. References: <1992Nov20.164126.17154@lynx.dac.northeastern.edu>
  10.     <OSHINS.92Nov21132152@wolf.cs.washington.edu>
  11.     <CAMPO.92Nov23143809@sunthpi3.difi.unipi.it>
  12. Date: 23 Nov 92 16:28:11
  13. Lines: 58
  14.  
  15. In article <CAMPO.92Nov23143809@sunthpi3.difi.unipi.it>
  16. campo@sunthpi3.difi.unipi.it (Massimo Campostrini) writes:
  17.  
  18. |>    Is there any way to use emacs to reply to e-mail and include the previous
  19. |>    message?  Want i really want is emacs to insert some type of marker, such
  20. |>    as the `>` before every line of the previous message.  I know that elm 
  21. |>    does this but i don't have access to it anymore.
  22.  
  23. |>   If you reply to a message using Emacs, you can include the original
  24. |> message by typing C-c C-y, which is bound to mail-yank-original.  This
  25. |> puts four spaces in front of every line instead of a '>'.  But you can
  26. |> get rid of this by using C-u C-c C-y.
  27. |>   If anyone knows of a way to change this to a '>' I would be
  28. |> interested.
  29.  
  30. I picked this up off the net a while back, and it seems to work pretty
  31. good for me.  I didn't note who posted it, so I can't give credit.
  32.  
  33. Regrettably, I'm not proficient enough in elisp to modify it.  I'd
  34. like it to also reformat paragraphs (the equivalent of M-q) before
  35. inserting the |>.
  36. --
  37. James Kanze            GABI Software, Sarl.
  38. email: kanze@us-es.sel.de    8 rue du Faisan
  39.                 67000 Strasbourg
  40.                 France
  41. --------------cut here---------------
  42.  
  43. ;;      The following hook is used so that mail yank indentation will
  44. ;;      use the conventional "|> " string, instead of just indenting.
  45. ;; -------------------------------------------------------------------------- 
  46. (setq mail-setup-hook
  47.       (setq news-reply-mode-hook 
  48.         '(lambda ()
  49.            (defvar mail-yank-indent-string "|> ")
  50.            
  51.            (defun mail-yank-original (arg)
  52.          (interactive "P")
  53.          (if mail-reply-buffer
  54.              (let ((start (point)))
  55.                (delete-windows-on mail-reply-buffer)
  56.                (insert-buffer mail-reply-buffer)
  57.                (mail-yank-clear-headers start (mark))
  58.                (mail-yank-indent start)
  59.                (exchange-point-and-mark)
  60.                (if (not (eolp)) (insert ?\n)))))
  61.            
  62.            (defun mail-yank-indent (start)
  63.          (save-excursion
  64.            (goto-char start)
  65.            (while (re-search-forward "^" (point-max) t)
  66.              (replace-match mail-yank-indent-string)) 
  67.            (goto-char start)
  68.            (while (re-search-forward 
  69.                (concat "^" mail-yank-indent-string "[ \t]*$") 
  70.                (point-max) t)
  71.              (replace-match "")))) )))
  72.  
  73.