]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/mailabbrev.el
Upgraded to MH-E version 7.1.
[gnu-emacs] / lisp / mail / mailabbrev.el
index ed389526475c03ed742309130959be4e5e1e9304..3412a791f77575cc9ea699c4cc323d3d005e62a3 100644 (file)
@@ -42,7 +42,7 @@
 ;; Your mail alias abbrevs will be in effect only when the point is in an
 ;; appropriate header field.  When in the body of the message, or other
 ;; header fields, the mail aliases will not expand.  Rather, the normal
-;; mode-specific abbrev table (mail-mode-abbrev-table) will be used if
+;; mode-specific abbrev table will be used if
 ;; defined.  So if you use mail-mode specific abbrevs, this code will not
 ;; adversely affect you.  You can control which header fields the abbrevs
 ;; are used in by changing the variable mail-abbrev-mode-regexp.
@@ -408,15 +408,23 @@ of a mail alias.  The value is set up, buffer-local, when first needed.")
 (defun mail-abbrev-make-syntax-table ()
   (make-local-variable 'mail-abbrev-syntax-table)
   (unless mail-abbrev-syntax-table
-    (let ((tab (copy-syntax-table old-syntax-table))
+    (let ((tab (copy-syntax-table (syntax-table)))
          (_ (aref (standard-syntax-table) ?_))
          (w (aref (standard-syntax-table) ?w)))
       (map-char-table
        (function (lambda (key value)
+                  (if (null value)
+                      ;; Fetch the inherited value
+                      (setq value (aref tab key)))
                   (if (equal value _)
                       (set-char-table-range tab key w))))
        tab)
       (modify-syntax-entry ?@ "w" tab)
+      (modify-syntax-entry ?% "w" tab)
+      (modify-syntax-entry ?! "w" tab)
+      (modify-syntax-entry ?. "w" tab)
+      (modify-syntax-entry ?_ "w" tab)
+      (modify-syntax-entry ?- "w" tab)
       (setq mail-abbrev-syntax-table tab))))
 
 (defun mail-abbrev-in-expansion-header-p ()
@@ -438,8 +446,6 @@ of a mail alias.  The value is set up, buffer-local, when first needed.")
            (rfc822-goto-eoh)
            (point)))))))
 
-(defvar mail-mode-abbrev-table) ; quiet the compiler
-
 (defun sendmail-pre-abbrev-expand-hook ()
   (and (and mail-abbrevs (not (eq mail-abbrevs t)))
        (if (mail-abbrev-in-expansion-header-p)
@@ -548,6 +554,7 @@ of a mail alias.  The value is set up, buffer-local, when first needed.")
   "Perform completion on alias preceding point."
   ;; Based on lisp.el:lisp-complete-symbol
   (interactive)
+  (mail-abbrev-make-syntax-table)
   (let* ((end (point))
         (syntax-table (syntax-table))
         (beg (unwind-protect