;; 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.
(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 ()
(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)
"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