Function: mail-abbrev-expand-wrapper
mail-abbrev-expand-wrapper is a byte-compiled function defined in
mailabbrev.el.gz.
Signature
(mail-abbrev-expand-wrapper EXPAND)
Source Code
;; Defined in /usr/src/emacs/lisp/mail/mailabbrev.el.gz
(defun mail-abbrev-expand-wrapper (expand)
(if (and mail-abbrevs (not (eq mail-abbrevs t)))
(if (or (mail-abbrev-in-expansion-header-p)
;; Necessary for `message-read-from-minibuffer' to work.
(window-minibuffer-p))
;; We are in a To: (or Cc:, or whatever) header or a minibuffer,
;; and should use word-abbrevs to expand mail aliases.
(let ((local-abbrev-table mail-abbrevs))
;; 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.
;; - We already installed mail-abbrevs as the 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 the expand function, to do
;; the abbrev expansion with the above syntax table.
(mail-abbrev-make-syntax-table)
;; 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 usual syntax table.
(or (and (integerp last-command-event)
;; Some commands such as M-> may want to expand first.
(equal this-command 'self-insert-command)
(or (eq (char-syntax last-command-event) ?_)
;; Don't expand on @.
(memq last-command-event '(?@ ?. ?% ?! ?_ ?-))))
;; Use this table so that abbrevs can have hyphens in them.
(with-syntax-table mail-abbrev-syntax-table
(funcall expand))))
(if (or (not mail-abbrevs-only)
(eq this-command 'expand-abbrev))
;; 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.
(funcall expand)
;; This is not a mail abbrev, and we should not expand it.
;; Don't expand anything.
nil))
;; No mail-abbrevs at all, do the normal thing.
(funcall expand)))