Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!parc.xerox.com!janssen From: janssen@parc.xerox.com (Bill Janssen) Newsgroups: comp.soft-sys.andrew Subject: Re: System wide AMS alias file Message-ID: Date: 9 Feb 90 01:28:40 GMT References: Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 67 For those of us who have users with GNU Emacs "rmail" bound to their brains, here's an elisp function to display an ATK mail message from rmail: ---- Enclosure ---- (defun rmail-show-message-as-andrew-object () "View andrew mail message from RMAIL" (interactive) (if (or (eq window-system 'x) (getenv "DISPLAY")) (let (from to date subject body body-begin msg-end) (save-excursion (save-restriction (setq msg-end (rmail-msgend rmail-current-message)) (widen) (goto-char (rmail-msgbeg rmail-current-message)) (forward-line 1) (narrow-to-region (if (= (following-char) ?0) (progn (search-forward "\n\n" (rmail-msgend rmail-current-message) 'move) (point)) (progn (search-forward "\n*** EOOH ***\n" (rmail-msgend rmail-current-message)) (point))) (rmail-msgend rmail-current-message)) (setq to (mail-fetch-field "to" t)) (setq from (mail-fetch-field "from" t)) (setq date (mail-fetch-field "date" t)) (setq subject (mail-fetch-field "subject" t)) (goto-char (rmail-msgbeg rmail-current-message)) (search-forward "\\begindata" msg-end 'move) (if (= msg-end (point)) (setq header nil) (progn (forward-line 0) (setq begin (point)) (forward-line 2) (setq header (buffer-substring begin (point))))) (if header (setq body-begin (point)) (progn (goto-char (rmail-msgbeg rmail-current-message)) (search-forward "\n\n" (rmail-msgend rmail-current-message) 'move) (setq body-begin (point)) )) (setq body (buffer-substring body-begin msg-end)) ) (let ((buffer (get-buffer-create "*Display Mail As Andrew*"))) (set-buffer buffer) (erase-buffer) (insert-string (or header "\\begindata{text, 1}\n\\textdsversion{12}\n")) (insert-string "\\template{messages}\n") (insert-string (format "\\bold{Date:} %s\n\n" date)) (insert-string (format "\\bold{From:} %s\n\n" from)) (insert-string (format "\\bold{To:} %s\n\n" to)) (insert-string (format "\\bold{Subject:} %s\n\n\n" subject)) (insert-string body) (insert-string "\\enddata{text,1}\n") (write-file "/usr/tmp/mail-message-as-andrew") (setq buffer-file-name nil) (shell-command "ez -d /usr/tmp/mail-message-as-andrew; rm /usr/tmp/mail-message-as-andrew") ))) )) ---- Enclosure ----