aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1997-10-21 02:54:50 +0000
committerKarl Heuer1997-10-21 02:54:50 +0000
commit7d4c958f65501ef358cfd51734913e44c35e421c (patch)
tree1aff12d42efb61fd54ec8d51b7bf0ef5998b62d5
parentf6f4d6902b1673aa6b03314799a40c42767bd7df (diff)
downloademacs-7d4c958f65501ef358cfd51734913e44c35e421c.tar.gz
emacs-7d4c958f65501ef358cfd51734913e44c35e421c.zip
Customize.
(mail-abbrevs-enable, mail-abbrevs-disable): New functions. (mail-abbrevs-mode): New variable enables use of the package. Call mail-abbrevs-enable or mail-abbrevs-disable. (mail-abbrevs-only): New variable. (sendmail-pre-abbrev-expand-hook): Implement mail-abbrevs-only.
-rw-r--r--lisp/mail/mailabbrev.el54
1 files changed, 46 insertions, 8 deletions
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index e69e10cdf5f..261822f8434 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, 87, 92, 93, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 86, 87, 92, 93, 96, 1997 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>
@@ -129,6 +129,26 @@
129 129
130(require 'sendmail) 130(require 'sendmail)
131 131
132(defgroup mail-abbrev nil
133 "Expand mail aliases as abbrevs, in certain mail headers."
134 :group 'abbrev-mode)
135
136(defcustom mail-abbrevs-mode nil
137 "*Non-nil means expand mail aliases as abbrevs, in certain message headers."
138 :type 'boolean
139 :group 'mail-abbrev
140 :require 'mailabbrev
141 :set '(lambda (symbol value)
142 (setq mail-abbrevs-mode value)
143 (if value (mail-abbrevs-enable) (mail-abbrevs-disable)))
144 :initialize 'custom-initialize-default)
145
146(defcustom mail-abbrevs-only nil
147 "*Non-nil means only mail abbrevs should expand automatically.
148Other abbrevs expand only when you explicitly use `expand-abbrev'."
149 :type 'boolean
150 :group 'mail-abbrev)
151
132;; originally defined in sendmail.el - used to be an alist, now is a table. 152;; originally defined in sendmail.el - used to be an alist, now is a table.
133(defvar mail-abbrevs nil 153(defvar mail-abbrevs nil
134 "Word-abbrev table of mail address aliases. 154 "Word-abbrev table of mail address aliases.
@@ -162,6 +182,14 @@ no aliases, which is represented by this being a table with no entries.)")
162 nil t) 182 nil t)
163 (abbrev-mode 1)) 183 (abbrev-mode 1))
164 184
185(defun mail-abbrevs-enable ()
186 (add-hook 'mail-setup-hook 'mail-abbrevs-setup))
187
188(defun mail-abbrevs-disable ()
189 "Turn off use of the `mailabbrev' package."
190 (remove-hook 'mail-setup-hook 'mail-abbrevs-setup)
191 (abbrev-mode (if (default-value 'abbrev-mode) 1 -1)))
192
165;;;###autoload 193;;;###autoload
166(defun build-mail-abbrevs (&optional file recursivep) 194(defun build-mail-abbrevs (&optional file recursivep)
167 "Read mail aliases from personal mail alias file and set `mail-abbrevs'. 195 "Read mail aliases from personal mail alias file and set `mail-abbrevs'.
@@ -482,13 +510,20 @@ of a mail alias.")
482 (setq abbrev-start-location (point-max) ; This is the trick. 510 (setq abbrev-start-location (point-max) ; This is the trick.
483 abbrev-start-location-buffer (current-buffer))) 511 abbrev-start-location-buffer (current-buffer)))
484 512
485 ;; We're not in a mail header where mail aliases should 513 (if (or (not mail-abbrevs-only)
486 ;; be expanded, then use the normal mail-mode abbrev table 514 (eq this-command 'expand-abbrev))
487 ;; (if any) and the normal mail-mode syntax table. 515 (progn
488 516 ;; We're not in a mail header where mail aliases should
489 (setq local-abbrev-table (and (boundp 'mail-mode-abbrev-table) 517 ;; be expanded, then use the normal mail-mode abbrev table
490 mail-mode-abbrev-table)) 518 ;; (if any) and the normal mail-mode syntax table.
491 (set-syntax-table mail-mode-syntax-table)) 519
520 (setq local-abbrev-table (and (boundp 'mail-mode-abbrev-table)
521 mail-mode-abbrev-table))
522 (set-syntax-table mail-mode-syntax-table))
523 ;; This is not a mail abbrev, and we should not expand it.
524 ;; This kludge stops expand-abbrev from doing anything.
525 (setq abbrev-start-location (point-max)
526 abbrev-start-location-buffer (current-buffer))))
492 )) 527 ))
493 528
494;;; utilities 529;;; utilities
@@ -573,4 +608,7 @@ Don't use this command in Lisp programs!
573 608
574(provide 'mailabbrev) 609(provide 'mailabbrev)
575 610
611(if mail-abbrevs-mode
612 (mail-abbrevs-enable))
613
576;;; mailabbrev.el ends here. 614;;; mailabbrev.el ends here.