X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/cf8b484f16197f8f890c75861984e2fc3f214b9f..c3d9274aea16845838647cf2a225e8f60709b3ff:/lisp/mail/mailabbrev.el diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el index ed38952647..3412a791f7 100644 --- a/lisp/mail/mailabbrev.el +++ b/lisp/mail/mailabbrev.el @@ -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