entered into RCS
[bpt/emacs.git] / lisp / mail / mailabbrev.el
index 6b8bfef..e5efae3 100644 (file)
@@ -1,16 +1,17 @@
-;;; ??? We must get papers for this or delete it.
 ;;; mailabbrev.el --- abbrev-expansion of mail aliases.
 
-;;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
-;;; Created: 19 oct 90, Jamie Zawinski <jwz@lucid.com>
-;;; Modified: 5 apr 92, Roland McGrath <roland@gnu.ai.mit.edu>
-;;; Last change 22-apr-92. jwz
+;;; Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc.
+
+;; Author: Jamie Zawinski <jwz@lucid.com>
+;; Maintainer: Jamie Zawinski <jwz@lucid.com>
+;; Created: 19 Oct 90
+;; Keywords: mail
 
 ;;; This file is part of GNU Emacs.
 
 ;;; GNU Emacs is free software; you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 1, or (at your option)
+;;; the Free Software Foundation; either version 2, or (at your option)
 ;;; any later version.
 
 ;;; GNU Emacs is distributed in the hope that it will be useful,
@@ -22,6 +23,8 @@
 ;;; along with GNU Emacs; see the file COPYING.  If not, write to
 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
+;;; Commentary:
+
 ;;; This file ensures that, when the point is in a To:, CC:, BCC:, or From: 
 ;;; field, word-abbrevs are defined for each of your mail aliases.  These
 ;;; aliases will be defined from your .mailrc file (or the file specified by
@@ -68,7 +71,7 @@
 ;;; but that's what the file format is, so we have to live with it.)
 ;;;
 ;;; If you like, you can call the function define-mail-alias to define your
-;;; mail-aliases instead of using a .mailrc file.  When you call it in this
+;;; mail aliases instead of using a .mailrc file.  When you call it in this
 ;;; way, addresses are separated by commas.
 ;;;
 ;;; CAVEAT: This works on most Sun systems; I have been told that some versions
 ;;; specific case of mail-alias word-abbrevs.
 ;;;
 ;;; To read in the contents of another .mailrc-type file from emacs, use the
-;;; command Meta-X merge-mail-aliases.  The rebuild-mail-aliases command is
+;;; command Meta-X merge-mail-abbrevs.  The rebuild-mail-abbrevs command is
 ;;; similar, but will delete existing aliases first.
 ;;;
 ;;; If you would like your aliases to be expanded when you type M-> or ^N to
 ;;; move out of the mail-header into the message body (instead of having to
 ;;; type SPC at the end of the abbrev before moving away) then you can do
 ;;;
-;;;    (define-key mail-mode-map "\C-n" 'abbrev-hacking-next-line)
-;;;    (define-key mail-mode-map "\M->" 'abbrev-hacking-end-of-buffer)
+;;;    (define-key mail-mode-map "\C-n" 'mail-abbrev-next-line)
+;;;    (define-key mail-mode-map "\M->" 'mail-abbrev-end-of-buffer)
 ;;;
 ;;; If you want multiple addresses separated by a string other than ", " then
 ;;; you can set the variable mail-alias-separator-string to it.  This has to
 ;;;
 ;;; Thanks to Harald Hanche-Olsen, Michael Ernst, David Loeffler, and
 ;;; Noah Friedman for suggestions and bug reports.
-;;;
-;;; INSTALLATION 
-;;;
-;;; If you are using Emacs 18, you shouldn't have to do anything at all to
-;;; install this code other than load this file.  You might want to do this
-;;; to have this code loaded only when needed:
-;;;
-;;;     (setq mail-setup-hook '(lambda () (require 'mail-abbrevs)))
-;;;
-;;; Simply loading this file will redefine and overload the required 
-;;; functions.
-;;;
-;;; If you want to install this code more permanently (instead of loading
-;;; it as a patch) you need to do the following:
-;;;
-;;;    -  Remove the entire file mailalias.el;
-;;;    -  Remove the definition of mail-aliases from sendmail.el;
-;;;    -  Add a call to mail-aliases-setup to the front of the function
-;;;       mail-setup in the file sendmail.el;
-;;;    -  Remove the call to expand-mail-aliases from the function
-;;;       sendmail-send-it in the file sendmail.el;
-;;;    -  Remove the autoload of expand-mail-aliases from the file sendmail.el;
-;;;    -  Remove the autoload of build-mail-aliases from the file sendmail.el;
-;;;    -  Add an autoload of define-mail-alias to loaddefs.el.
+
+;;; To use this file, add mail-abbrevs-setup as a hook 
+;;; to the hook list `mail-setup-hook'.
+
+;;; Code:
 
 (require 'sendmail)
 
             (or (getenv "MAILRC") "~/.mailrc"))))
 
 ;; originally defined in sendmail.el - used to be an alist, now is a table.
-(defvar mail-aliases nil
+(defvar mail-abbrevs nil
   "Word-abbrev table of mail address aliases.
 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.)")
 
 ;;;###autoload
-(defun mail-aliases-setup ()
-  (if (and (not (vectorp mail-aliases))
+(defun mail-abbrevs-setup ()
+  (if (and (not (vectorp mail-abbrevs))
           (file-exists-p (mail-abbrev-mailrc-file)))
-      (build-mail-aliases))
+      (build-mail-abbrevs))
   (make-local-variable 'pre-abbrev-expand-hook)
   (setq pre-abbrev-expand-hook
     (cond ((and (listp pre-abbrev-expand-hook)
@@ -172,16 +156,14 @@ no aliases, which is represented by this being a table with no entries.)")
           (list 'sendmail-pre-abbrev-expand-hook pre-abbrev-expand-hook))))
   (abbrev-mode 1))
 
-;;; Originally defined in mailalias.el.  Changed to call define-mail-alias
-;;; with an additional argument.
 ;;;###autoload
-(defun build-mail-aliases (&optional file recursivep)
-  "Read mail aliases from .mailrc and set mail-aliases."
+(defun build-mail-abbrevs (&optional file recursivep)
+  "Read mail aliases from `~/.mailrc' file and set `mail-abbrevs'."
   (setq file (expand-file-name (or file (mail-abbrev-mailrc-file))))
-  (if (vectorp mail-aliases)
+  (if (vectorp mail-abbrevs)
       nil
-    (setq mail-aliases nil)
-    (define-abbrev-table 'mail-aliases '()))
+    (setq mail-abbrevs nil)
+    (define-abbrev-table 'mail-abbrevs '()))
   (message "Parsing %s..." file)
   (let ((buffer nil)
        (obuf (current-buffer)))
@@ -214,12 +196,12 @@ no aliases, which is represented by this being a table with no entries.)")
                (forward-char 1)))
          (goto-char (point-min))
          (while (re-search-forward
-                 "^\\(a\\(lias\\|\\)\\|g\\(roup\\)\\|source\\)[ \t]+" nil t)
+                 "^\\(a\\(lias\\)?\\|g\\(roup\\)?\\|source\\)[ \t]+" nil t)
            (beginning-of-line)
            (if (looking-at "source[ \t]+\\([^ \t\n]+\\)")
                (progn
                  (end-of-line)
-                 (build-mail-aliases
+                 (build-mail-abbrevs
                   (buffer-substring (match-beginning 1) (match-end 1)) t))
              (re-search-forward "[ \t]+\\([^ \t\n]+\\)")
              (let* ((name (buffer-substring
@@ -235,7 +217,7 @@ no aliases, which is represented by this being a table with no entries.)")
          ;; This would happen automatically before the first abbrev was
          ;; expanded, but why not do it now.
          (or recursivep (mail-resolve-all-aliases))
-         mail-aliases)
+         mail-abbrevs)
       (if buffer (kill-buffer buffer))
       (set-buffer obuf)))
     (message "Parsing %s... done" file))
@@ -249,23 +231,23 @@ also want something like \",\\n    \" to get each address on its own line.")
 ;; to be called before expanding abbrevs if it's necessary.
 (defvar mail-abbrev-aliases-need-to-be-resolved t)
 
-;; originally defined in mailalias.el ; build-mail-aliases calls this with
+;; originally defined in mailalias.el ; build-mail-abbrevs calls this with
 ;; stuff parsed from the .mailrc file.
 ;;
 ;;;###autoload
 (defun define-mail-alias (name definition &optional from-mailrc-file)
   "Define NAME as a mail-alias that translates to DEFINITION.
 If DEFINITION contains multiple addresses, separate them with commas."
-  ;; When this is called from build-mail-aliases, the third argument is
+  ;; When this is called from build-mail-abbrevs, the third argument is
   ;; true, and we do some evil space->comma hacking like /bin/mail does.
   (interactive "sDefine mail alias: \nsDefine %s as mail alias for: ")
   ;; Read the defaults first, if we have not done so.
-  (if (vectorp mail-aliases)
+  (if (vectorp mail-abbrevs)
       nil
-    (setq mail-aliases nil)
-    (define-abbrev-table 'mail-aliases '())
+    (setq mail-abbrevs nil)
+    (define-abbrev-table 'mail-abbrevs '())
     (if (file-exists-p (mail-abbrev-mailrc-file))
-       (build-mail-aliases)))
+       (build-mail-abbrevs)))
   ;; strip garbage from front and end
   (if (string-match "\\`[ \t\n,]+" definition)
       (setq definition (substring definition (match-end 0))))
@@ -294,9 +276,9 @@ If DEFINITION contains multiple addresses, separate them with commas."
                                mail-alias-separator-string)))
   (setq mail-abbrev-aliases-need-to-be-resolved t)
   (setq name (downcase name))
-  ;; use an abbrev table instead of an alist for mail-aliases.
+  ;; use an abbrev table instead of an alist for mail-abbrevs.
   (let ((abbrevs-changed abbrevs-changed))  ; protect this from being changed.
-    (define-abbrev mail-aliases name definition 'mail-abbrev-expand-hook)))
+    (define-abbrev mail-abbrevs name definition 'mail-abbrev-expand-hook)))
 
 
 (defun mail-resolve-all-aliases ()
@@ -304,13 +286,16 @@ If DEFINITION contains multiple addresses, separate them with commas."
   (if mail-abbrev-aliases-need-to-be-resolved
       (progn
 ;;     (message "Resolving mail aliases...")
-       (if (vectorp mail-aliases)
-           (mapatoms (function mail-resolve-all-aliases-1) mail-aliases))
+       (if (vectorp mail-abbrevs)
+           (mapatoms (function mail-resolve-all-aliases-1) mail-abbrevs))
        (setq mail-abbrev-aliases-need-to-be-resolved nil)
 ;;     (message "Resolving mail aliases... done.")
        )))
 
-(defun mail-resolve-all-aliases-1 (sym)
+(defun mail-resolve-all-aliases-1 (sym &optional so-far)
+  (if (memq sym so-far)
+      (error "mail alias loop detected: %s"
+            (mapconcat 'symbol-name (cons sym so-far) " <- ")))
   (let ((definition (and (boundp sym) (symbol-value sym))))
     (if definition
        (let ((result '())
@@ -322,7 +307,8 @@ If DEFINITION contains multiple addresses, separate them with commas."
          (setq definition
                (mapconcat (function (lambda (x)
                             (or (mail-resolve-all-aliases-1
-                                  (intern-soft x mail-aliases))
+                                  (intern-soft x mail-abbrevs)
+                                  (cons sym so-far))
                                 x)))
                           (nreverse result)
                           mail-alias-separator-string))
@@ -364,7 +350,7 @@ line."
 ;;; Syntax tables and abbrev-expansion
 
 (defvar mail-abbrev-mode-regexp "^\\(Resent-\\)?\\(To\\|From\\|CC\\|BCC\\):"
-  "*Regexp to select mail-headers in which mail-aliases should be expanded.
+  "*Regexp to select mail-headers in which mail-abbrevs should be expanded.
 This string it will be handed to `looking-at' with the point at the beginning
 of the current line; if it matches, abbrev mode will be turned on, otherwise
 it will be turned off.  (You don't need to worry about continuation lines.)
@@ -432,53 +418,70 @@ characters which may be a part of the name of a mail-alias.")
 (defvar mail-mode-abbrev-table) ; quiet the compiler
 
 (defun sendmail-pre-abbrev-expand-hook ()
-  (if mail-abbrev-aliases-need-to-be-resolved
-      (mail-resolve-all-aliases))
-  (if (and mail-aliases (not (eq mail-aliases t)))
-      (if (not (mail-abbrev-in-expansion-header-p))
-         ;;
-         ;; If we're not in a mail header in which mail aliases should
-         ;; be expanded, then use the normal mail-mode abbrev table (if any)
-         ;; and the normal mail-mode syntax table.
-         ;;
-         (progn
-           (setq local-abbrev-table (and (boundp 'mail-mode-abbrev-table)
-                                         mail-mode-abbrev-table))
-           (set-syntax-table mail-mode-syntax-table))
-       ;;
-       ;; Otherwise, we are in a To: (or CC:, or whatever) header, and
-       ;; should use word-abbrevs to expand mail aliases.
-       ;;   -  First, install the mail-aliases as the word-abbrev table.
-       ;;   -  Then install the mail-abbrev-syntax-table, which temporarily
-       ;;      marks all of the non-alphanumeric-atom-characters (the "_"
-       ;;      syntax ones) as being normal word-syntax.  We do this because
-       ;;      the C code for expand-abbrev only works on words, and we want
-       ;;      these characters to be considered words for the purpose of
-       ;;      abbrev expansion.
-       ;;   -  Then we call expand-abbrev again, recursively, to do the abbrev
-       ;;      expansion with the above syntax table.
-       ;;   -  Then we do a trick which tells the expand-abbrev frame which
-       ;;      invoked us to not continue (and thus not expand twice.)
-       ;;   -  Then we set the syntax table to mail-mode-header-syntax-table,
-       ;;      which doesn't have anything to do with abbrev expansion, but
-       ;;      is just for the user's convenience (see its doc string.)
-       ;;
-       (setq local-abbrev-table mail-aliases)
-       ;; If the character just typed was non-alpha-symbol-syntax, then don't
-       ;; expand the abbrev now (that is, don't expand when the user types -.)
-       (or (= (char-syntax last-command-char) ?_)
-           (let ((pre-abbrev-expand-hook nil)) ; that's us; don't loop
-             (set-syntax-table mail-abbrev-syntax-table)
-             (expand-abbrev)))
-       (setq abbrev-start-location (point)  ; this is the trick
-             abbrev-start-location-buffer (current-buffer))
-       ;; and do this just because.
-       (set-syntax-table mail-mode-header-syntax-table)
-       )))
+  (and (and mail-abbrevs (not (eq mail-abbrevs t)))
+       (if (mail-abbrev-in-expansion-header-p)
+          (progn
+            ;;
+            ;; We are in a To: (or CC:, or whatever) header, and
+            ;; should use word-abbrevs to expand mail aliases.
+
+            ;; Before anything else, resolve aliases if they need it.
+            (and mail-abbrev-aliases-need-to-be-resolved
+                 (mail-resolve-all-aliases))
+
+            ;; Now proceed with the abbrev section.
+            ;;   -  First, install the mail-abbrevs as the word-abbrev table.
+            ;;   -  Then install the mail-abbrev-syntax-table, which
+            ;;      temporarily marks all of the
+            ;;      non-alphanumeric-atom-characters (the "_"
+            ;;      syntax ones) as being normal word-syntax.  We do this
+            ;;      because the C code for expand-abbrev only works on words,
+            ;;      and we want these characters to be considered words for
+            ;;      the purpose of abbrev expansion.
+            ;;   -  Then we call expand-abbrev again, recursively, to do
+            ;;      the abbrev expansion with the above syntax table.
+            ;;   -  Then we do a trick which tells the expand-abbrev frame
+            ;;      which invoked us to not continue (and thus not
+            ;;      expand twice.) This means that any abbrev expansion
+            ;;      will happen as a result of this function's call to
+            ;;      expand-abbrev, and not as a result of the call to
+            ;;      expand-abbrev which invoked *us*.
+            ;;   -  Then we set the syntax table to
+            ;;      mail-mode-header-syntax-table, which doesn't have
+            ;;      anything to do with abbrev expansion, but
+            ;;      is just for the user's convenience (see its doc string.)
+            ;;
+
+            (setq local-abbrev-table mail-abbrevs)
+
+            ;; If the character just typed was non-alpha-symbol-syntax,
+            ;; then don't expand the abbrev now (that is, don't expand
+            ;; when the user types -.)  Check the character's syntax in
+            ;; the mail-mode-header-syntax-table.
+
+            (set-syntax-table mail-mode-header-syntax-table)
+            (or (eq (char-syntax last-command-char) ?_)
+                (let ((pre-abbrev-expand-hook nil)) ; That's us; don't loop.
+                  ;; Use this table so that abbrevs can have hyphens in them.
+                  (set-syntax-table mail-abbrev-syntax-table)
+                  (expand-abbrev)
+                  ;; Now set it back to what it was before.
+                  (set-syntax-table mail-mode-header-syntax-table)))
+            (setq abbrev-start-location (point) ; This is the trick.
+                  abbrev-start-location-buffer (current-buffer)))
+
+        ;; We're not in a mail header where mail aliases should
+        ;; be expanded, then use the normal mail-mode abbrev table
+        ;; (if any) and the normal mail-mode syntax table.
+
+        (setq local-abbrev-table (and (boundp 'mail-mode-abbrev-table)
+                                      mail-mode-abbrev-table))
+        (set-syntax-table mail-mode-syntax-table))
+       ))
 \f
 ;;; utilities
 
-(defun merge-mail-aliases (file)
+(defun merge-mail-abbrevs (file)
   "Merge mail aliases from the given file with existing ones."
   (interactive (list
                (let ((insert-default-directory t)
@@ -490,9 +493,9 @@ characters which may be a part of the name of a mail-alias.")
                    default-directory
                    (expand-file-name def default-directory)
                    t))))
-  (build-mail-aliases file))
+  (build-mail-abbrevs file))
 
-(defun rebuild-mail-aliases (file)
+(defun rebuild-mail-abbrevs (file)
   "Rebuild all the mail aliases from the given file."
   (interactive (list
                (let ((insert-default-directory t)
@@ -503,117 +506,54 @@ characters which may be a part of the name of a mail-alias.")
                   default-directory
                   (expand-file-name def default-directory)
                   t))))
-  (setq mail-aliases nil)
-  (build-mail-aliases file))
+  (setq mail-abbrevs nil)
+  (build-mail-abbrevs file))
 
 (defun mail-interactive-insert-alias (&optional alias)
   "Prompt for and insert a mail alias."
-  (interactive (list (completing-read "Expand alias: " mail-aliases nil t)))
-  (insert (or (and alias (symbol-value (intern-soft alias mail-aliases))) "")))
-
-(defun abbrev-hacking-next-line (&optional arg)
-  "Just like `next-line' (\\[next-line]) but expands abbrevs when at \
-end of line."
+  (interactive (progn
+               (if (not (vectorp mail-abbrevs)) (mail-abbrevs-setup))
+               (list (completing-read "Expand alias: " mail-abbrevs nil t))))
+  (if (not (vectorp mail-abbrevs)) (mail-abbrevs-setup))
+  (insert (or (and alias (symbol-value (intern-soft alias mail-abbrevs))) "")))
+
+(defun mail-abbrev-next-line (&optional arg)
+  "Expand any mail abbrev, then move cursor vertically down ARG lines.
+If there is no character in the target line exactly under the current column,
+the cursor is positioned after the character in that line which spans this
+column, or at the end of the line if it is not long enough.
+If there is no line in the buffer after this one,
+a newline character is inserted to create a line
+and the cursor moves to that line.
+
+The command \\[set-goal-column] can be used to create
+a semipermanent goal column to which this command always moves.
+Then it does not try to move vertically.  This goal column is stored
+in `goal-column', which is nil when there is none.
+
+If you are thinking of using this in a Lisp program, consider
+using `forward-line' instead.  It is usually easier to use
+and more reliable (no dependence on goal column, etc.)."
   (interactive "p")
-  (if (looking-at "[ \t]*\n") (sendmail-pre-abbrev-expand-hook))
+  (if (looking-at "[ \t]*\n") (expand-abbrev))
+  (setq this-command 'next-line)
   (next-line arg))
 
-(defun abbrev-hacking-end-of-buffer (&optional arg)
-  "Just like `end-of-buffer' (\\[end-of-buffer]) but expands abbrevs when at \
-end of line."
-  (interactive "P")
-  (if (looking-at "[ \t]*\n") (sendmail-pre-abbrev-expand-hook))
+(defun mail-abbrev-end-of-buffer (&optional arg)
+  "Expand any mail abbrev, then move point to end of buffer.
+Leave mark at previous position.
+With arg N, put point N/10 of the way from the true end.
+
+Don't use this command in Lisp programs!
+\(goto-char (point-max)) is faster and avoids clobbering the mark."
+  (interactive "p")
+  (if (looking-at "[ \t]*\n") (expand-abbrev))
+  (setq this-command 'end-of-buffer)
   (end-of-buffer arg))
 
 (define-key mail-mode-map "\C-c\C-a" 'mail-interactive-insert-alias)
 
-;;(define-key mail-mode-map "\C-n" 'abbrev-hacking-next-line)
-;;(define-key mail-mode-map "\M->" 'abbrev-hacking-end-of-buffer)
-
-(provide 'mail-abbrevs)
-
-\f
-;;; V18 compatibility
-;;;
-;;; All of the Emacs18 stuff is isolated down here so that it will be
-;;; easy to delete once v18 finally bites the dust.
-;;;
-;;; These defuns and defvars aren't inside the cond in deference to
-;;; the intense brokenness of the v18 byte-compiler.
-
-(defun sendmail-v18-self-insert-command (arg)
-  "Just like self-insert-command, but runs sendmail-pre-abbrev-expand-hook."
-  (interactive "p")
-  (if (not (= (char-syntax last-command-char) ?w))
-      (progn
-       (sendmail-pre-abbrev-expand-hook)
-        ;; Unhack expand-abbrev, so it will work right next time around.
-       (setq abbrev-start-location nil)))
-  (let ((abbrev-mode nil))
-    (self-insert-command arg)))
-
-(defvar mail-abbrevs-v18-map-munged nil)
-
-(defun mail-abbrevs-v18-munge-map ()
-  ;; For every key that is bound to self-insert-command in global-map,
-  ;; bind that key to sendmail-self-insert-command in mail-mode-map.
-  ;; We used to do this by making the mail-mode-map be a non-sparse map,
-  ;; but that made the esc-map be shared in such a way that making a
-  ;; local meta binding in the mail-mode-map made a *global* binding
-  ;; instead.  Yucko.
-  (let ((global-map (current-global-map))
-       (i 0))
-    (while (< i 128)
-      (if (eq 'self-insert-command (or (cdr (assq i mail-mode-map))
-                                      (aref global-map i)))
-         (define-key mail-mode-map (char-to-string i)
-           'sendmail-v18-self-insert-command))
-      (setq i (1+ i))))
-  (setq mail-abbrevs-v18-map-munged t))
-
-(defun mail-aliases-setup-v18 ()
-  "Put this on `mail-setup-hook' to use mail-abbrevs."
-  (if (and (not (vectorp mail-aliases))
-          (file-exists-p (mail-abbrev-mailrc-file)))
-      (build-mail-aliases))
-  (or mail-abbrevs-v18-map-munged (mail-abbrevs-v18-munge-map))
-  (use-local-map mail-mode-map)
-  (abbrev-mode 1))
-
+;;(define-key mail-mode-map "\C-n" 'mail-abbrev-next-line)
+;;(define-key mail-mode-map "\M->" 'mail-abbrev-end-of-buffer)
 
-(cond ((or (string-match "^18\\." emacs-version)
-          (and (boundp 'epoch::version) epoch::version))
-       ;;
-       ;; v19 (and this code) uses a new name for this function.
-       (or (fboundp 'buffer-disable-undo)
-          (fset 'buffer-disable-undo 'buffer-flush-undo))
-       ;;
-       ;; v19 (and this code) uses a new name for auto-fill-hook (-function).
-       ;; Encapsulate the function that uses it to bind the new name.
-       (or (fboundp 'mail-abbrev-expand-hook-v19)
-          (fset 'mail-abbrev-expand-hook-v19
-                (symbol-function 'mail-abbrev-expand-hook)))
-       (fset 'mail-abbrev-expand-hook
-            (function (lambda ()
-                        (let ((auto-fill-function auto-fill-hook))
-                          (mail-abbrev-expand-hook-v19)))))
-       ;;
-       ;; Turn off the broken v18 code (that is still called from sendmail.el)
-       (fset 'expand-mail-aliases
-            (function (lambda (&rest args)
-                        "Obsoleted by mail-abbrevs.  Does nothing."
-                        nil)))
-       ;;
-       ;; Encapsulate mail-setup to do the necessary buffer initializations.
-       (or (fboundp 'mail-setup-v18)
-          (fset 'mail-setup-v18 (symbol-function 'mail-setup)))
-       (fset 'mail-setup
-            (function (lambda (&rest args)
-                        (mail-aliases-setup-v18)
-                        (apply 'mail-setup-v18 args))))
-       )
-
-      (t ; v19
-       (fmakunbound 'expand-mail-aliases)))
-
-;;; mailabbrev.el ends here
+(provide 'mailabbrev)