summaryrefslogtreecommitdiff
path: root/lisp/abbrev.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-05-26 18:09:45 -0700
committerGlenn Morris <rgm@gnu.org>2014-05-26 18:09:45 -0700
commite38a5ebe6b225ecb31008cafcbd51d85c2305618 (patch)
tree6454216bb8f7e3cd6249d0ea80b3cc6b2741a95d /lisp/abbrev.el
parentcf2f54c4e3d8adb26e3f4b8e9e51364165877444 (diff)
downloademacs-e38a5ebe6b225ecb31008cafcbd51d85c2305618.tar.gz
Doc updates re abbrev-expand-function
* doc/emacs/abbrevs.texi (Expanding Abbrevs): Update re abbrev-expand-function. * doc/lispref/abbrevs.texi (Abbrev Expansion): Update for expand-abbrev changes. * doc/lispref/functions.texi (Advising Functions): Standardize menu case. * lisp/abbrev.el (abbrev-expand-functions, abbrev-expand-function) (expand-abbrev, abbrev--default-expand): Doc fixes.
Diffstat (limited to 'lisp/abbrev.el')
-rw-r--r--lisp/abbrev.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 43b6a5583ee..9e11adadfc0 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -824,23 +824,28 @@ see `define-abbrev' for details."
value))
(defvar abbrev-expand-functions nil
- "Wrapper hook around `expand-abbrev'.")
+ "Wrapper hook around `abbrev--default-expand'.")
(make-obsolete-variable 'abbrev-expand-functions 'abbrev-expand-function "24.4")
(defvar abbrev-expand-function #'abbrev--default-expand
- "Function to perform abbrev expansion.
+ "Function that `expand-abbrev' uses to perform abbrev expansion.
Takes no argument and should return the abbrev symbol if expansion took place.")
(defun expand-abbrev ()
"Expand the abbrev before point, if there is an abbrev there.
Effective when explicitly called even when `abbrev-mode' is nil.
-Returns the abbrev symbol, if expansion took place. (The actual
-return value is that of `abbrev-insert'.)"
+Before doing anything else, runs `pre-abbrev-expand-hook'.
+Calls `abbrev-expand-function' with no argument to do the work,
+and returns whatever it does. (This should be the abbrev symbol
+if expansion occurred, else nil.)"
(interactive)
(run-hooks 'pre-abbrev-expand-hook)
(funcall abbrev-expand-function))
(defun abbrev--default-expand ()
+ "Default function to use for `abbrev-expand-function'.
+This respects the wrapper hook `abbrev-expand-functions'.
+Calls `abbrev-insert' to insert any expansion, and returns what it does."
(with-wrapper-hook abbrev-expand-functions ()
(pcase-let ((`(,sym ,name ,wordstart ,wordend) (abbrev--before-point)))
(when sym