mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
* 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.
This commit is contained in:
parent
04754d3612
commit
d36ed1c8e7
11 changed files with 709 additions and 674 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue