home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / misc / cachealias.el < prev    next >
Encoding:
Text File  |  1990-03-21  |  1.9 KB  |  57 lines

  1. ;From: montnaro@sprite.crd.ge.com (Skip Montanaro)
  2. ;Newsgroups: gnu.emacs
  3. ;Subject: Loading up mail-aliases
  4. ;Message-ID: <MONTNARO.89Aug24100552@sprite.crd.ge.com>
  5. ;Date: 24 Aug 89 14:05:52 GMT
  6. ;Reply-To: <montanaro@sprite.crd.ge.com> (Skip Montanaro)
  7. ;Followup-To: gnu.emacs
  8. ;Organization: GE Corporate Research & Development, Schenectady, NY
  9. ;Lines: 46
  10. ;
  11. ;
  12. ;I use a version of mailalias.el that understands the "source" command in
  13. ;~/.mailrc. (It's been posted to various Emacs groups before I believe, and I
  14. ;could have sworn at one point it was in the Emacs distribution, but it isn't
  15. ;at the moment. If you want it, drop me a note.) Unfortunately, we have a
  16. ;couple of huge mail alias files at our site that cause the first call to
  17. ;sendmail to take forever to start (we're talking over 1800 mail aliases that
  18. ;take two-three minutes to parse on a Sun-3/260).
  19. ;
  20. ;What I needed was a way to cache the mail-alises alist, and only update it
  21. ;when the source files changed. I wrote a short Makefile and some ELisp to
  22. ;update a cached mail alias file from cron late at night.
  23. ;
  24. ;
  25. ;The Makefile is:
  26. ;
  27. ;
  28. ;$(HOME)/.mail-aliases : $(HOME)/.mailrc /usr/local/lib/unix-aliases \
  29. ;            /usr/local/lib/crd-aliases
  30. ;    emacs -batch -l cache-mail-aliases.el
  31. ;
  32. ;
  33. ;The file, cache-mail-aliases.el, contains
  34.  
  35.  
  36.     (message "Building mail aliases... ")
  37.     (load "~/emacs/mailalias" nil t)     ; understands "source" command
  38.     (build-mail-aliases "~/.mailrc")
  39.     (set-buffer (find-file-noselect (expand-file-name "~/.mail-aliases")))
  40.     (erase-buffer)
  41.     (insert "(setq mail-aliases '\n")
  42.     (insert (format "%s\n" mail-aliases))
  43.     (insert ")\n")
  44.     (save-buffer)
  45.     (kill-buffer (current-buffer))
  46.     (message "Building mail aliases... Done")
  47.  
  48.  
  49. ;The following additional line in ~/.emacs sets the mail-aliases variable:
  50.  
  51.  
  52. ;    (load "~/.mail-aliases" nil t t)
  53.  
  54.  
  55. ;--
  56. ;Skip Montanaro (montanaro@sprite.crd.ge.com)
  57.