[comp.emacs] Rmail question and mods

john@wpi.wpi.edu (John F Stoffel) (08/30/90)

Hello net,
	I have a question for all you rmail wizards out there.  I want
to modify my rmail so that whenever I type 'o' to save a message, it
will not ask me if I wish to create it if it doesn't exist.  I've
narrowed down the function I need to modify,
rmail-output-to-rmail-file.  This function description is as follows:

rmail-output-to-rmail-file:
Append the current message to an Rmail file named FILE-NAME.
If the file does not exist, ask if it should be created.
If file is being visited, the message is appended to the Emacs
buffer visiting that file.

So what I want to do is remove the asking part about it's creation.  I
really don't know much lisp, but I'm willing to work on it.  Thanks
again for any and all help!

----------------------------------------------------------------------------
When you know who you are, you know what to do.
			-Pen, sibling of the shroud
John Stoffel | john@wpi.wpi.edu | 508-792-5050 

-- 
----------------------------------------------------------------------------
When you know who you are, you know what to do.
			-Pen, sibling of the shroud
John Stoffel | john%wpi.wpi.edu@cunyvm.bitnet | john@wpi.wpi.edu | 508-792-5050 

rock@rancho.uucp (Rock Kent) (09/02/90)

John> 	I have a question for all you rmail wizards out there.  I want
John> to modify my rmail so that whenever I type 'o' to save a message, it
John> will not ask me if I wish to create it if it doesn't exist.  I've
John> narrowed down the function I need to modify,
John> rmail-output-to-rmail-file.

You can do what you want if you modify rmail-output-to-rmail-file
(rmailout.el) as follows:

  (setq rmail-last-rmail-file file-name)
  (rmail-maybe-set-message-counters)
  (or (get-file-buffer file-name)
**Delete     |     (file-exists-p file-name)
**Change from|     (if (yes-or-no-p
**         to|     (if (file-exists-p file-name)
**Delete     |         (concat "\"" file-name "\" does not exist, create it? "))
	  (let ((file-buffer (create-file-buffer file-name)))
	    (save-excursion
	      (set-buffer file-buffer)
	      (rmail-insert-rmail-file-header)
	      (let ((require-final-newline nil))
		(write-region (point-min) (point-max) file-name t 1)))
**Change from|	    (kill-buffer file-buffer))
**         to|	    (kill-buffer file-buffer))))
**Delete     |	(error "Output file does not exist")))
  (save-restriction
    (widen)

I'm really gonna have to learn context diffs some day :-).

You should really wrap up your revised rmail-output-to-rmail-file into
your .emacs so that you don't have to remember that you changed the
source.  You can do something like:

(setq rmail-mode-hook '(lambda ()
  (defun rmail-output-to-rmail-file
         . . . your new revised function definition . . . )
	))

Good luck.

***************************************************************************
*Rock Kent    rock@rancho.uucp        POB 8964, Rancho Sante Fe, CA. 92067*
***************************************************************************