sheffler@maxwell.CS.CMU.EDU (Thomas Sheffler) (08/31/89)
I save posts in Rmail files in ~/News and got tired of having to invoke rmail-input by typing M-x rmail-input /usr/sheffler/News/comp.sys.amiga or whatever. SO, I wrote these two little functions. My bindings are to key "i" in GROUP and SUBJECT mode. The "i" is like rmail, which uses "i" for rmail-input. Pressing the "i" key causes rmail to start up on a file in your ~/News/ directory -- the default being the current group of your *Newsgroups* or *Subject* buffer. Default behaviour is to bounce you right back to the GROUP or SUBJECT buffer you were in after reading your rmail file. ================================================================ (setq gnus-Subject-mode-hook '(lambda () (define-key gnus-Subject-mode-map "i" (function gnus-Subject-rmail-input)) )) (setq gnus-Group-mode-hook '(lambda () (define-key gnus-Group-mode-map "i" (function gnus-Group-rmail-input)) )) (defun gnus-Group-rmail-input (&optional filename) "Input the rmail file for articles saved in this newsgroup." (interactive) (save-excursion (save-restriction (let* ((overlay-arrow-position nil) (default-name (funcall gnus-rmail-save-name (gnus-Group-group-name) "" gnus-newsgroup-last-rmail ))) (or filename (setq filename (read-file-name (concat "Input Rmail from file: (default " (file-name-nondirectory default-name) ") ") (file-name-directory default-name) default-name))) (rmail-input filename) ))) ;;; Then switch to that buffer (switch-to-buffer (file-name-nondirectory filename)) (rmail-summary) ) (defun gnus-Subject-rmail-input (&optional filename) "Read the rmail file for articles saved in this newsgroup." (interactive) (save-excursion (save-restriction (let* ((overlay-arrow-position nil) (default-name (funcall gnus-rmail-save-name gnus-newsgroup-name gnus-current-headers gnus-newsgroup-last-rmail ))) (or filename (setq filename (read-file-name (concat "Input Rmail from file: (default " (file-name-nondirectory default-name) ") ") (file-name-directory default-name) default-name))) (rmail-input filename) ))) ;;; Then switch to that buffer (switch-to-buffer (file-name-nondirectory filename)) (rmail-summary) )
lbn@mcs.auc.dk ( Lars Bo Nielsen ) (09/01/89)
In article <SHEFFLER.89Aug31093229@maxwell.CS.CMU.EDU> sheffler@maxwell.CS.CMU.EDU (Thomas Sheffler) writes:
I save posts in Rmail files in ~/News and got tired of having to
invoke rmail-input by typing
M-x rmail-input /usr/sheffler/News/comp.sys.amiga
or whatever.
I also got tired of having to invoke rmail when I visited files
written by gnus in rmail format, so I put the following in my .emacs.
Now every time an rmail-file is found, rmail automaticly starts up.
(setq find-file-hooks (cons 'my-rmail-find-file find-file-hooks))
(defun my-rmail-find-file ()
(and (looking-at "BABYL OPTIONS")
(progn
(if (featurep 'rmail)
()
(message "Hmm... Looks like an rmail file. Loading rmail...")
(require 'rmail))
(rmail-mode)
(rmail-last-message) ; Dummy to get rmail-mode to behave
(message "You are in rmail-mode..."))))