rfm@urth (Rich McAllister) (04/12/90)
In article <PIERSON.90Apr11110714@xenna.encore.com>, pierson@encore (Dan L. Pierson) writes: >[sendmail.el] reads my .mailrc just fine. Unfortunately, it only reads it >the first time I send mail; changes won't be noticed in the same Emacs >session. A quick look at the sources reveals that aliases are actually set >up by build-mail-aliases (a non interactive command in mailalias.el) iff >the variable mail-aliases is exactly t. [...] So it looks like the way to >change your aliases while Emacs is running is [to edit .mailrc and then run >build-mail-aliases.] You could package this with [a function to find-file >.mailrc, recursive edit and build-mail-aliases]. What I do is use write-file-hooks to check for writing of .mailrc: (setq write-file-hooks (cons 'alias-check write-file-hooks)) (defun alias-check() "\ Reset mail-aliases to t when ~/.mailrc is written, so that mail-aliases will get updated before next send." (if (equal ".mailrc" (file-name-nondirectory buffer-file-name)) (setq mail-aliases t)) nil) ;must return nil for file to be written Rich McAllister (rfm@sun.com)
montnaro@spyder.crd.ge.com (Skip Montanaro) (04/12/90)
The version of Emacs sendmail we use here recurses on source commands in
your .mailrc file. We have over 1800 local mailnames aliased in a couple
files, so referencing them when first you send mail from Emacs, or even on
the rare occasion when you execute something like
mail -s frobboz foo@bar.oz <some.file
can be a real pain.
My solution was to quit sourcing those large files from .mailrc and build a
Makefile to run nightly to create a quick-to-load piece of ELisp. Mail alias
translation is then taken off-line. I now execute
(load "~/.mail-aliases" t t)
from ~/.emacs.
The GNUmakefile target needed to generate ~/.mail-aliases is:
ARCH := $(strip $(shell arch))
EMACS := /common/$(ARCH)/bin/emacs
ALIASDIR := /common/all/lib
AFILE := /tmp/mail-alias.el
.PRECIOUS : $(HOME)/.mail-aliases
$(HOME)/.mail-aliases : $(HOME)/.mailrc $(ALIASDIR)/unix-aliases \
$(ALIASDIR)/crd-aliases
echo '(message "Building mail aliases... ")' > $(AFILE)
echo '(load "~/emacs/mailalias" nil t)' >> $(AFILE)
echo '$(foreach f,$^,(build-mail-aliases "$f") )' >> $(AFILE)
echo '(set-buffer (find-file-noselect (expand-file-name "~/.mail-aliases")))' >> $(AFILE)
echo "(erase-buffer) (insert \"(setq mail-aliases '\n\")" >> $(AFILE)
echo '(insert (format "%s\n" mail-aliases)) (insert ")\n")' >> $(AFILE)
echo '(save-buffer) (kill-buffer (current-buffer))' >> $(AFILE)
echo '(message "Building mail aliases... Done")' >> $(AFILE)
$(EMACS) -batch -l $(AFILE)
rm -f $(AFILE)
Executing the above Make actions on my SPARCStation takes about 1 minute.
Loading the ~/.mail-aliases takes about 1 second.
--
Skip (montanaro@crdgw1.ge.com)