[comp.emacs] RMAIL-summary

eirik@THEORY.TN.CORNELL.EDU (Eirik Fuller) (01/15/91)

I have a question about RMAIL mode.  I would like an improved
rmail-summary mode.  Speifically, I would like better interaction
between the summary window and the message window.  I want all of the
usual rmail bindings to work in both windows, and I would like the
summary window to get updated by commands in the message window.

At present, I can accomplish this in a clunky way by switching to the
message window, doing my thing, and typing h to update the summary
window.  I would prefer to remain obvlivious to which window is
selected when only those two windows are visible.

The question then, is whether anyone else has already done this.  If
not, I would be happy to do it myself and post the result.

rms@AI.MIT.EDU (Richard Stallman) (01/16/91)

I don't think the existence of VM substitutes for an improved summary
for RMAIL.  If someone writes an improved summary, please send it to me.

ajw@ansa.co.uk (Andrew Watson) (01/17/91)

> At present, I can accomplish this in a clunky way by switching to the
> message window, doing my thing, and typing h to update the summary
> window.  I would prefer to remain obvlivious to which window is
> selected when only those two windows are visible.
> 
> The question then, is whether anyone else has already done this.  If
> not, I would be happy to do it myself and post the result.

I have about 20 lines of lisp that do about half the job (ie: the half
I need and takes no time to hack ...).

I've copied this both to Eirik and to the list. Recently all my mail
to help-gnu-emacs@prep.ai.mit.edu has been bounced with some sort of
authorisation failure. Eirik - if you see this, and it seems useful,
please feel free to re-post to the list if my attempt fails.

Code follows:

----------------------------rmailsum-additions.el----------------------------

;;; Some extra commands for rmail summary mode to make it useful
;;;
;;; AJW 1/9/90

;;; The commands that I want are:
;;;
;;; M-s	Search for string and show message it is found in.
;;; e	Expunge deleted messages. [Done]
;;; g   Move new mail from system spool directory or mbox into this file. [Done]
;;; r	Reply to this message.  Like m but initializes some fields.
;;; f	Forward this message to another user.
;;; o   Output this message to an Rmail file (append it). [Done]

(defun rmail-summary-output-to-rmail-file (file-name)
  (interactive (list (read-file-name
		      (concat "Output message to Rmail file: (default "
			      (file-name-nondirectory rmail-last-rmail-file)
			      ") ")
		      (file-name-directory rmail-last-rmail-file)
		      rmail-last-rmail-file)))
  (rmail-summary-goto-msg)
  (pop-to-buffer rmail-buffer)
  (rmail-output-to-rmail-file file-name)
  (pop-to-buffer rmail-summary-buffer)
  (and rmail-delete-after-output (rmail-summary-delete-forward)))

(defmacro def-rmailsummary-action (name recalculate-flag form)
  (append
   (list 'defun name '()
	 '(interactive)
	 '(pop-to-buffer rmail-buffer)
	 form)
   (if recalculate-flag
       '((rmail-summary)))))

(def-rmailsummary-action rmail-summary-expunge t (rmail-expunge))
(def-rmailsummary-action rmail-summary-get-new-mail t (rmail-get-new-mail))
(def-rmailsummary-action rmail-summary-reply nil (rmail-reply nil))
(def-rmailsummary-action rmail-summary-forward nil (rmail-forward))

------------------------And in the .emacs file ...------------------------
(defun rmailsum-setup ()
  (load "rmailsum-additions")
  (local-set-key "o" 'rmail-summary-output-to-rmail-file)
  (local-set-key "e" 'rmail-summary-expunge)
  (local-set-key "g" 'rmail-summary-get-new-mail)
  (local-set-key "r" 'rmail-summary-reply)
  (local-set-key "f" 'rmail-summary-forward))

(setq rmail-summary-mode-hook 'rmailsum-setup)