home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / emacs / gnus / 1503 < prev    next >
Encoding:
Text File  |  1993-01-24  |  2.9 KB  |  78 lines

  1. Path: sparky!uunet!stanford.edu!agate!spool.mu.edu!hri.com!noc.near.net!news.centerline.com!franl
  2. From: franl@centerline.com (Fran Litterio)
  3. Newsgroups: gnu.emacs.gnus
  4. Subject: Re: Getting ">" when following up
  5. Message-ID: <FRANL.93Jan24151434@draco.centerline.com>
  6. Date: 24 Jan 93 20:14:34 GMT
  7. References: <Y-PISAN.93Jan24132529@SPD-13.ils.nwu.edu>
  8. Distribution: gnu
  9. Organization: CenterLine Software R&D
  10. Lines: 64
  11. NNTP-Posting-Host: 140.239.3.116
  12. In-reply-to: y-pisan@nwu.edu's message of 24 Jan 93 19:25:29 GMT
  13.  
  14. y-pisan@nwu.edu (Yusuf Pisan) writes:
  15.  
  16. > When I use gnus-Subejct-mail-reply-with-original the original article
  17. > gets indented without any characters being added to the beginning of
  18. > the line. I would like ">" to be added to the original message to
  19. > distinguish it from my reply. 
  20.  
  21. This elisp should do the trick.  It includes two functions that may
  22. have general use elsewhere: my-shorten-reference-lines and
  23. my-indent-region-with-string.  If you don't want your replies and
  24. followups to have shortened references, remove the calls to
  25. my-shorten-reference-lines.
  26.  
  27. (setq gnus-Subject-mode-hook 'my-gnus-Subject-mode-hook)
  28.  
  29. (defun my-gnus-Subject-mode-hook ()
  30.   "Adjust gnus-Subject-mode keybindings to my liking."
  31.   (define-key gnus-Subject-mode-map "f" 'my-gnus-Subject-post-reply-with-original)
  32.   (define-key gnus-Subject-mode-map "r" 'my-gnus-Subject-mail-reply-with-original))
  33.  
  34. (defun my-gnus-Subject-mail-reply-with-original ()
  35.   "Send mail to news articles author with article included."
  36.   (interactive)
  37.   (gnus-Subject-mail-reply nil)
  38.   (mail-yank-original 0)
  39.   (my-shorten-reference-lines)
  40.   (my-indent-region-with-string "> ")
  41.   (goto-char (point-min))
  42.   (forward-line 5))
  43.  
  44. (defun my-gnus-Subject-post-reply-with-original ()
  45.   "Post news followup with original article included."
  46.   (interactive)
  47.   (gnus-Subject-post-reply nil)
  48.   (news-reply-yank-original 0)
  49.   (my-shorten-reference-lines)
  50.   (my-indent-region-with-string "> "))
  51.  
  52. (defun my-shorten-reference-lines ()
  53.   "Reduce the horizontal space occupied by article references within the region."
  54.   (interactive)
  55.   (save-excursion
  56.     (goto-char (point-min))
  57.     (replace-regexp "In article <[^>]*> " "" nil)))
  58.  
  59. (defun my-indent-region-with-string (indent-string)
  60.   "Prefixs every line in the region with a user-supplied string."
  61.   (interactive "*sIndent region with string: ")
  62.   (if (equal indent-string "")
  63.       (setq indent-string "> "))
  64.   (save-excursion
  65.     (let ((reglines    (count-lines (region-beginning) (region-end)))
  66.       (line        1))
  67.       (goto-char (region-beginning))
  68.       (while (<= line reglines)
  69.     (beginning-of-line)
  70.     (insert indent-string)
  71.     (setq line (+ line 1))
  72.     (forward-line 1)))))
  73. --
  74. franl@centerline.com         "So what we've decided to do is set you up in
  75. uunet!centerline!franl        Cicely, situated in an area that we Alaskans
  76. 617-498-3255 (USA)            refer to as The Alaskan Riviera."
  77. PGP 2.0 public key available.
  78.