Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think!snorkelwacker!apple!sun-barr!newstop!exodus!urth From: rfm@urth (Rich McAllister) Newsgroups: comp.emacs Subject: Rereading .mailrc (was Re: Auto copy in vm) Summary: Use write-file-hooks to reset mail-aliases to t Message-ID: <165@exodus.Eng.Sun.COM> Date: 11 Apr 90 20:27:22 GMT References: Sender: news@exodus.Eng.Sun.COM Reply-To: rfm@urth (Rich McAllister) Lines: 22 In-reply-to: pierson@encore.com (Dan L. Pierson) In article , 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)