Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!arisia!sgi!silvlis!mdb From: mdb@amadeus.silvlis.com (Mark D. Baushke) Newsgroups: gnu.emacs Subject: Re: emacs RMAIL --> MH(E) ???? Message-ID: Date: 4 Feb 89 08:34:06 GMT References: <6536@polya.Stanford.EDU> Sender: news@silvlis.com Followup-To: gnu.emacs Distribution: gnu Organization: Silvar Lisco, Inc. Menlo Park, CA Lines: 179 In-reply-to: crew@polya.Stanford.EDU's message of 1 Feb 89 03:44:14 GMT > From: crew@polya.Stanford.EDU (Roger Crew) > Newsgroups: comp.mail.mh,gnu.emacs > Followup-To: gnu.emacs > Date: 1 Feb 89 03:44:14 GMT > > Does anyone have anything to convert mail files in > Babyl format of emacs' RMAIL to something usable by mh? > > For that matter, does someone have a description of what Babyl format > is supposed to be. This is something that should be included in the > gnu-emacs documentation but, as far as I can tell, isn't (as of 18.52). The following lisp functions deal with rmail Babyl files as an add-on to the standard rmail.el. I wrote the function rmail-to-mbox-all when I finally switched to MH 6.6 + mh-e.el. M-x rmail-to-mbox-all RET temp-mail RET After you write all of your messages into a file (for example "temp-mail"), use "inc -file temp-mail" to incorporate it into whaterver folder you desire. Enjoy! ------------------------------------------------------------------------------ Mark D. Baushke Internet: mdb%silvlis.com@sun.com Silvar-Lisco, Inc. Nameservers: mdb@silvlis.com 1080 Marsh Road Usenet: {pyramid,sgi,sun}!silvlis!mdb Menlo Park, CA 94025-1053 Telephone: +1 415 853-6411 / +1 415 969-8328 ;;;;;;;;;;;;;;;;;;;;;;;;;;; -*- Mode: Emacs-Lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;; ;; rmail-extras.el --- reduce the size of RMAIL files by removing junk ;; put all messages of an RMAIL file back into a ;; UN*X-style mail file again. ;; Copyright (c) 1988, 1989 by Mark D. Baushke, All Rights Reserved. ;; ;; Author : Mark D. Baushke ;; Created On : Sat Jan 16 00:20:04 1988 ;; Last Modified By: Mark D. Baushke ;; Last Modified On: Sun Aug 28 18:50:37 1988 ;; Update Count : 13 ;; Status : Works for me ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This file may be used as part of GNU Emacs. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY. No author or distributor ;; accepts responsibility to anyone for the consequences of using it ;; or for whether it serves any particular purpose or works at all, ;; unless he says so in writing. Refer to the GNU Emacs General Public ;; License for full details. ;; Everyone is granted permission to copy, modify and redistribute ;; GNU Emacs, but only under the conditions described in the ;; GNU Emacs General Public License. A copy of this license is ;; supposed to have been given to you along with GNU Emacs so you ;; can know your rights and responsibilities. It should be in a ;; file named COPYING. Among other things, the copyright notice ;; and this notice must be preserved on all copies. (require 'rmail) (defconst rmail-deletable-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^received:\\|^from \\|^errors-to:" "\ *Gubbish header fields one may delete with impunity.") (defun rmail-verbose-headers () "Get to the verbose mail header." (if (search-forward "\n\n" nil t) (save-restriction (narrow-to-region (point-min) (point)) (let ((buffer-read-only nil)) (while (let ((case-fold-search t)) (goto-char (point-min)) (re-search-forward rmail-deletable-headers nil t)) (beginning-of-line) (delete-region (point) (progn (re-search-forward "\n[^ \t]") (forward-char -1) (point)))))))) (defun rmail-shrink-header () "Shrink original message header like pruned header." (interactive) (rmail-maybe-set-message-counters) (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max)) (let ((buffer-read-only nil)) (goto-char (point-min)) (forward-line 1) (if (= (following-char) ?1) (progn (delete-char 1) (insert ?0) (forward-line 1) (if (looking-at "Summary-Line:") (forward-line 1)) (insert "*** EOOH ***\n") (forward-char -1) (search-forward "\n*** EOOH ***\n") (forward-line -1) (let ((temp (point))) (and (search-forward "\n\n" nil t) (delete-region temp (point)))) )) (goto-char (point-min)) (search-forward "\n*** EOOH ***\n") (goto-char (point)) (if rmail-deletable-headers (rmail-verbose-headers)) (rmail-reformat-message (point-min) (point-max)))) (defun rmail-compress-all () "Shrink all of the messages." (interactive) (let ((msgnum 1) (origmsg (rmail-what-message))) (while (>= rmail-total-messages msgnum) (message "Compressing messages...%d" msgnum) (rmail-show-message msgnum) (rmail-shrink-header) (setq msgnum (1+ msgnum)) ) (message "Compressing messages...done") (rmail-show-message origmsg))) (defun rmail-delete-n (&optional n) "Delete the next n messages and move to next nondeleted one. Deleted messages stay in the file until the \\[rmail-expunge] command is given." (interactive "p") (while (>= n 1) (message "Deleteing messages...%d" (rmail-what-message)) (rmail-set-attribute "deleted" t) (setq n (1- n)) (rmail-next-message 1) ) (message "Deleteing messages...done")) (defun rmail-undelete-n (&optional n) "unDelete the next n messages and move to last nondeleted one." (interactive "p") (while (>= n 1) (message "Deleteing messages...%d" (rmail-what-message)) (rmail-set-attribute "deleted" nil) (setq n (1- n)) (rmail-next-message 1) ) (message "Deleteing messages...done")) (defun rmail-to-mbox-all (file-name) "Write all messages in Shrink all of the messages." (interactive (list (read-file-name (concat "Output message to Unix mail file" (if rmail-last-file (concat " (default " (file-name-nondirectory rmail-last-file) "): " ) ": ")) (and rmail-last-file (file-name-directory rmail-last-file)) rmail-last-file))) (setq file-name (expand-file-name file-name)) (setq rmail-last-file file-name) (let ((msgnum 1) (origmsg (rmail-what-message))) (while (>= rmail-total-messages msgnum) (message "Writing messages...%d" msgnum) (rmail-show-message msgnum) (rmail-output file-name) (setq msgnum (1+ msgnum)) ) (message "Writing messages...done") (rmail-show-message origmsg))) -- ------------------------------------------------------------------------------ Mark D. Baushke Internet: mdb%silvlis.com@sun.com Silvar-Lisco, Inc. Nameservers: mdb@silvlis.com 1080 Marsh Road Usenet: {pyramid,sgi,sun}!silvlis!mdb Menlo Park, CA 94025-1053 Telephone: +1 415 853-6411 / +1 415 969-8328