aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-03-09 08:48:56 +0000
committerRichard M. Stallman1996-03-09 08:48:56 +0000
commit00bafa45f92b991d0741c7a74b945ba26a902b22 (patch)
treea17442d4cee2279f2f6c409996abbb99f1ca5640
parent8bc49f8f86f125698f060c24ff697d6a4a350c6c (diff)
downloademacs-00bafa45f92b991d0741c7a74b945ba26a902b22.tar.gz
emacs-00bafa45f92b991d0741c7a74b945ba26a902b22.zip
(mail-abbrev-modtime): New variable.
(mail-abbrevs-sync-alaises): New function. Updates mail-abbrevs if modtime of mail-personal-alias-file is different than mail-abbrev-modtime. (mail-abbrevs-setup): Call mail-abbrevs-sync-aliases.
-rw-r--r--lisp/mail/mailabbrev.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index 4ab61fa8d44..539794ba86f 100644
--- a/lisp/mail/mailabbrev.el
+++ b/lisp/mail/mailabbrev.el
@@ -1,6 +1,6 @@
1;;; mailabbrev.el --- abbrev-expansion of mail aliases. 1;;; mailabbrev.el --- abbrev-expansion of mail aliases.
2 2
3;; Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1986, 87, 92, 93, 1996 Free Software Foundation, Inc.
4 4
5;; Author: Jamie Zawinski <jwz@lucid.com> 5;; Author: Jamie Zawinski <jwz@lucid.com>
6;; Maintainer: Jamie Zawinski <jwz@lucid.com> 6;; Maintainer: Jamie Zawinski <jwz@lucid.com>
@@ -136,12 +136,27 @@ If this is nil, it means the aliases have not yet been initialized and
136should be read from the .mailrc file. (This is distinct from there being 136should be read from the .mailrc file. (This is distinct from there being
137no aliases, which is represented by this being a table with no entries.)") 137no aliases, which is represented by this being a table with no entries.)")
138 138
139(defvar mail-abbrev-modtime nil
140 "The modification time of your mail alias file when it was last examined.")
141
142(defun mail-abbrevs-sync-aliases ()
143 (if (file-exists-p mail-personal-alias-file)
144 (let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))
145 (if (not (equal mail-abbrev-modtime modtime))
146 (progn
147 (setq mail-abbrev-modtime modtime)
148 (build-mail-abbrevs))))))
149
139;;;###autoload 150;;;###autoload
140(defun mail-abbrevs-setup () 151(defun mail-abbrevs-setup ()
141 "Initialize use of the `mailabbrev' package." 152 "Initialize use of the `mailabbrev' package."
142 (if (and (not (vectorp mail-abbrevs)) 153 (if (and (not (vectorp mail-abbrevs))
143 (file-exists-p mail-personal-alias-file)) 154 (file-exists-p mail-personal-alias-file))
144 (build-mail-abbrevs)) 155 (progn
156 (setq mail-abbrev-modtime
157 (nth 5 (file-attributes mail-personal-alias-file)))
158 (build-mail-abbrevs)))
159 (mail-abbrevs-sync-aliases)
145 (make-local-hook 'pre-abbrev-expand-hook) 160 (make-local-hook 'pre-abbrev-expand-hook)
146 (add-hook 'pre-abbrev-expand-hook 'sendmail-pre-abbrev-expand-hook 161 (add-hook 'pre-abbrev-expand-hook 'sendmail-pre-abbrev-expand-hook
147 nil t) 162 nil t)