andrew@jung.harlqn.uucp (Andrew Watson) (06/02/89)
Being the popular chap that I am (:-), I find that I constantly need to edit my
.mailrc file to add aliases for new mail correspondents. Given that I use GNU
Emacs both to edit the .mailrc and send the mail, I have to remember to tell
the Emacs mailalias mechanism that I've been changing the world under its feet
by (setq mail-aliases t) every time. Eventually I got bored with this, and so
(with some help from John Sturdy) I put together the following few lines of
code to do the job automatically:
Define a couple of functions (in your .emacs, for example):
-------------------------------------------------------------------------
;;; Write hook function to do the job
(defun mailrc-reset ()
(message "Reset aliases variable")
(sit-for 1)
(setq mail-aliases t)
nil) ; this is rather important!
;;; Small function to place the hook
(defun setup-mailrc-hook ()
(make-local-variable 'write-file-hooks) ; make it have a separate value here
(setq write-file-hooks (cons 'mailrc-reset write-file-hooks)))
--------------------------------------------------------------------------
And then add the following lines at the end of the .mailrc to setup the hook
when the file is first visited ...
--------------------------------------------------------------------------
#
# Local Variables:
# eval: (setup-mailrc-hook)
# End:
Regards,
Andrew.
+-----------------------------------------------------------------------------+
| Andrew Watson, andrew@uk.co.harlqn -or- |
| Harlequin Limited, mcvax!ukc!harlqn!andrew |
| Barrington Hall, Barrington, Tel: +44 223 872522 |
| Cambridge CB2 5RG, UK Fax: +44 223 872519 |
+-----------------------------------------------------------------------------+nate@hobbes.intel.com (Nate Hess) (06/08/89)
Andrew provides a way to get new aliases put into the .mailrc to be read
into the current session.
The way I do this is to put the following at the bottom of my .mailrc:
# re-do the aliases by C-x C-e after saving this file.
# Make sure point is at the end of the file when doing the above.
# (build-mail-aliases)
--
"What I like is when you're looking and thinking and looking
and thinking...and suddenly you wake up." - Hobbes
woodstock@hobbes.intel.com ...!{decwrl|hplabs!oliveb}!intelca!mipos3!nate