summaryrefslogtreecommitdiff
path: root/lisp/abbrev.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-04-17 20:12:33 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-04-17 20:12:33 -0400
commitd36ed1c8e7a88757890edb629b7da73be05a9ae2 (patch)
tree8c607eda3023a41cd0e5d0529e5b7f71a5d78dda /lisp/abbrev.el
parent04754d3612ea2f09440604c571814e0795511fa3 (diff)
downloademacs-d36ed1c8e7a88757890edb629b7da73be05a9ae2.tar.gz
* lisp/subr.el (with-wrapper-hook): Declare obsolete.
* lisp/simple.el (filter-buffer-substring-function): New hook. (filter-buffer-substring): Use it. (filter-buffer-substring-functions): Mark obsolete. * lisp/minibuffer.el (completion-in-region-function): New hook. (completion-in-region): Use it. (completion-in-region-functions): Mark obsolete. * lisp/mail/mailabbrev.el (mail-abbrevs-setup): Use abbrev-expand-function. * lisp/abbrev.el (abbrev-expand-function): New hook. (expand-abbrev): Use it. (abbrev-expand-functions): Mark obsolete. * lisp/emacs-lisp/nadvice.el (advice--where-alist): Add :filter-args and :filter-return. * lisp/org/org-agenda.el (org-agenda-mode): * lisp/org/org-indent.el (org-indent-mode): Use the `local' arg of add-hook/remove-hook.
Diffstat (limited to 'lisp/abbrev.el')
-rw-r--r--lisp/abbrev.el15
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index cc7ebe489f7..27cd7089a07 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -532,7 +532,7 @@ This is the first thing that `expand-abbrev' does, and so this may change
the current abbrev table before abbrev lookup happens."
:type 'hook
:group 'abbrev-mode)
-(make-obsolete-variable 'pre-abbrev-expand-hook 'abbrev-expand-functions "23.1")
+(make-obsolete-variable 'pre-abbrev-expand-hook 'abbrev-expand-function "23.1")
(defun clear-abbrev-table (table)
"Undefine all abbrevs in abbrev table TABLE, leaving it empty."
@@ -832,10 +832,12 @@ see `define-abbrev' for details."
value))
(defvar abbrev-expand-functions nil
- "Wrapper hook around `expand-abbrev'.
-The functions on this special hook are called with one argument:
-a function that performs the abbrev expansion. It should return
-the abbrev symbol if expansion took place.")
+ "Wrapper hook around `expand-abbrev'.")
+(make-obsolete-variable 'abbrev-expand-functions 'abbrev-expand-function "24.4")
+
+(defvar abbrev-expand-function #'abbrev--default-expand
+ "Function 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.
@@ -844,6 +846,9 @@ Returns the abbrev symbol, if expansion took place. (The actual
return value is that of `abbrev-insert'.)"
(interactive)
(run-hooks 'pre-abbrev-expand-hook)
+ (funcall abbrev-expand-function))
+
+(defun abbrev--default-expand ()
(with-wrapper-hook abbrev-expand-functions ()
(pcase-let ((`(,sym ,name ,wordstart ,wordend) (abbrev--before-point)))
(when sym