summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-03-09 08:48:56 +0000
committerRichard M. Stallman <rms@gnu.org>1996-03-09 08:48:56 +0000
commit57987b4374f9fc370a6b4e282ef76b252b0922cd (patch)
tree1c02c598b4ab3b4cc4db68a0e2d863094227db55
parent725c07f82864d0ecf5352f518cd6b5dfde90abb2 (diff)
downloademacs-57987b4374f9fc370a6b4e282ef76b252b0922cd.tar.gz
(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 @@
;;; mailabbrev.el --- abbrev-expansion of mail aliases.
-;; Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 87, 92, 93, 1996 Free Software Foundation, Inc.
;; Author: Jamie Zawinski <jwz@lucid.com>
;; Maintainer: Jamie Zawinski <jwz@lucid.com>
@@ -136,12 +136,27 @@ If this is nil, it means the aliases have not yet been initialized and
should be read from the .mailrc file. (This is distinct from there being
no aliases, which is represented by this being a table with no entries.)")
+(defvar mail-abbrev-modtime nil
+ "The modification time of your mail alias file when it was last examined.")
+
+(defun mail-abbrevs-sync-aliases ()
+ (if (file-exists-p mail-personal-alias-file)
+ (let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))
+ (if (not (equal mail-abbrev-modtime modtime))
+ (progn
+ (setq mail-abbrev-modtime modtime)
+ (build-mail-abbrevs))))))
+
;;;###autoload
(defun mail-abbrevs-setup ()
"Initialize use of the `mailabbrev' package."
(if (and (not (vectorp mail-abbrevs))
(file-exists-p mail-personal-alias-file))
- (build-mail-abbrevs))
+ (progn
+ (setq mail-abbrev-modtime
+ (nth 5 (file-attributes mail-personal-alias-file)))
+ (build-mail-abbrevs)))
+ (mail-abbrevs-sync-aliases)
(make-local-hook 'pre-abbrev-expand-hook)
(add-hook 'pre-abbrev-expand-hook 'sendmail-pre-abbrev-expand-hook
nil t)