[comp.emacs] Re-binding Control Keys

mejicovs@eniac.seas.upenn.edu (03/13/91)

I would like to rebind C-c C-c in RMAIL to a set of commands (kind of like
a Unix script).  Unfortunately I have absolutely no idea how to do this.
What I want it to do is to automatically save a copy of mail that I send
out - and then send it for me.

Preferrably, it would save it as an original file each time - but if that's
too difficult then it's not completely necesary (I thought about imbedding
the date or time in the filename - but I don't know how to do that either).

Thanks for the help - and I'm sorry if this is just *too* easy for all y'all.

James
mejicovs@eniac.seas.upenn.edu

squash@math.ufl.edu (Jonathan King) (03/14/91)

  In article <39062@netnews.upenn.edu> mejicovs@eniac.seas.upenn.edu writes:

   I would like to rebind C-c C-c in RMAIL to a set of commands (kind of like
   a Unix script).  Unfortunately I have absolutely no idea how to do this.
   What I want it to do is to automatically save a copy of mail that I send
   out - and then send it for me.

   Preferrably, it would save it as an original file each time - but if that's
   too difficult then it's not completely necesary (I thought about imbedding
   the date or time in the filename - but I don't know how to do that either)...

James, you refer to RMAIL.  However, "sending" mail is done by
mail mode, not by RMAIL mode.  So it is perhaps C-c C-c in mail mode
that you wish to define.
  However: It may be that what you want can be obtained by putting

(setq  mail-archive-file-name	"~/outgoing.mail")

into your .emacs file.  This will cause the header

FCC: ~/outgoing.mail

to appear in your mail buffer whenever you send mail.  (FCC
stands for "file carbon copy").  If you don't delete this line before
sending the mail, a copy will be appended (in RMAIL format if you
want) to the file outgoing.mail (or whatever file name you set
mail-archive-file-name to).

This has an advantage over CC: <myself>
 --people who (R)eply to your mail
messages won't send you two copies, which they would if they forgot to
delete the CC: header.

Jonathan


PS.  If this won't do what you want, then do

(define-key mail-mode-map "^C^C" 'James-custom-mail-send-and-exit)
(defun James-custom-mail-send-and-exit ()
  (interactive)
  <etc>
  )

If you do not know how to write "defun"s, you'll need to consult the
Elisp manual.