home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / functions / conv-babl.el < prev    next >
Encoding:
Text File  |  1990-03-21  |  2.2 KB  |  53 lines

  1. ;From dtix!mimsy!haven!purdue!bu-cs!bloom-beacon!athena.mit.edu!jtkohl Tue Jul 18 06:26:21 PDT 1989
  2. ;Article 12 of gnu.emacs.gnus:
  3. ;Path: ark1!dtix!mimsy!haven!purdue!bu-cs!bloom-beacon!athena.mit.edu!jtkohl
  4. ;>From: jtkohl@athena.mit.edu (John T Kohl)
  5. ;Newsgroups: gnu.emacs.gnus
  6. ;Subject: re: how to pretty print out saved messages?
  7. ;Message-ID: <12739@bloom-beacon.MIT.EDU>
  8. ;Date: 17 Jul 89 17:19:33 GMT
  9. ;References: <55098@tut.cis.ohio-state.edu>
  10. ;Sender: daemon@bloom-beacon.MIT.EDU
  11. ;Reply-To: jtkohl@athena.mit.edu (John T Kohl)
  12. ;Organization: Massachusetts Institute of Technology
  13. ;Lines: 35
  14. ;Keywords: Babyl Text convert
  15. ;
  16. ;In article <55098@tut.cis.ohio-state.edu> amra@cis.ohio-state.edu (Nasir K Amra) writes:
  17. ;
  18. ;       Basically, I have a lot of messages saved from various news
  19. ;   groups in babyl format (?) via gnus's "o" command. How can I pretty
  20. ;   print the message files such that for example each message in a file
  21. ;   gets printed on a separate page?
  22. ;
  23. ;Here's some ancient e-lisp code I wrote to do this to RMAIL files (which
  24. ;are Babyl format).  Share and enjoy.
  25. ;
  26. ;To use, do a find-file to get the file in Text (or Fundamental) mode,
  27. ;run the function, then save to some other file and print.
  28. ;
  29. ;---------- cut here -------------
  30. (defun convert-rmail-buffer-to-printable ()
  31.   "Convert an rmail buffer visited in TEXT mode into a file suitable for
  32. printing on a line printer.  Removes headers which have been filtered, and
  33. leaves a formfeed before each message."
  34.   (interactive)
  35.   (message "Converting to printable file...")
  36.   (search-forward "*** EOOH ***\n")
  37.   (delete-region (point-min) (point))
  38.   (let ((mesg-counter 1))
  39.     (while (search-forward "\^_\^L" nil t)
  40.       (if (zerop (% (setq mesg-counter (1+ mesg-counter)) 10))
  41.       (message "Converting to printable file...%d" mesg-counter))
  42.       (delete-region (- (point) 2) (1- (point)))
  43.       (let ((point-save (point)))
  44.     (search-forward "*** EOOH ***\n")
  45.     (delete-region point-save (point))))
  46.     (delete-region (1- (point-max)) (point-max))
  47.     (message "Converting to printable file...done")))
  48. ;John Kohl <jtkohl@ATHENA.MIT.EDU> or <jtkohl@Kolvir.Brookline.MA.US>
  49. ;Digital Equipment Corporation/Project Athena
  50. ;(The above opinions are MINE.  Don't put my words in somebody else's mouth!)
  51.  
  52.  
  53.