1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Improve documentation of 'expand-abbrev' and wrapper hooks

* lisp/simple.el (filter-buffer-substring-functions)
(buffer-substring--filter): Add a link to 'with-wrapper-hook' as
the place to look for documentation of wrapper hooks.
* lisp/minibuffer.el (completion-in-region-functions)
(completion--in-region): Add a link to 'with-wrapper-hook' as the
place to look for documentation of wrapper hooks.
* lisp/abbrev.el (expand-abbrev, abbrev--default-expand): Clarify
the doc strings.  (Bug#24540)

* doc/lispref/text.texi (Buffer Contents): Mention
'with-wrapper-hook's doc string as the place to learn about that
obsolete facility.
This commit is contained in:
Eli Zaretskii 2016-09-26 19:02:01 +03:00
parent c14a1d4580
commit 9fc9988d4d
4 changed files with 16 additions and 9 deletions

View file

@ -232,7 +232,9 @@ using a function specified by the variable
@code{filter-buffer-substring-function}, and returns the result. @code{filter-buffer-substring-function}, and returns the result.
The default filter function consults the obsolete wrapper hook The default filter function consults the obsolete wrapper hook
@code{filter-buffer-substring-functions}, and the obsolete variable @code{filter-buffer-substring-functions} (see the documentation string
of the macro @code{with-wrapper-hook} for the details about this
obsolete facility), and the obsolete variable
@code{buffer-substring-filters}. If both of these are @code{nil}, it @code{buffer-substring-filters}. If both of these are @code{nil}, it
returns the unaltered text from the buffer, i.e., what returns the unaltered text from the buffer, i.e., what
@code{buffer-substring} would return. @code{buffer-substring} would return.

View file

@ -837,16 +837,17 @@ Takes no argument and should return the abbrev symbol if expansion took place.")
"Expand the abbrev before point, if there is an abbrev there. "Expand the abbrev before point, if there is an abbrev there.
Effective when explicitly called even when `abbrev-mode' is nil. Effective when explicitly called even when `abbrev-mode' is nil.
Before doing anything else, runs `pre-abbrev-expand-hook'. Before doing anything else, runs `pre-abbrev-expand-hook'.
Calls `abbrev-expand-function' with no argument to do the work, Calls the value of `abbrev-expand-function' with no argument to do
and returns whatever it does. (This should be the abbrev symbol the work, and returns whatever it does. (That return value should
if expansion occurred, else nil.)" be the abbrev symbol if expansion occurred, else nil.)"
(interactive) (interactive)
(run-hooks 'pre-abbrev-expand-hook) (run-hooks 'pre-abbrev-expand-hook)
(funcall abbrev-expand-function)) (funcall abbrev-expand-function))
(defun abbrev--default-expand () (defun abbrev--default-expand ()
"Default function to use for `abbrev-expand-function'. "Default function to use for `abbrev-expand-function'.
This respects the wrapper hook `abbrev-expand-functions'. This also respects the obsolete wrapper hook `abbrev-expand-functions'.
\(See `with-wrapper-hook' for details about wrapper hooks.)
Calls `abbrev-insert' to insert any expansion, and returns what it does." Calls `abbrev-insert' to insert any expansion, and returns what it does."
(with-wrapper-hook abbrev-expand-functions () (with-wrapper-hook abbrev-expand-functions ()
(pcase-let ((`(,sym ,name ,wordstart ,wordend) (abbrev--before-point))) (pcase-let ((`(,sym ,name ,wordstart ,wordend) (abbrev--before-point)))

View file

@ -1925,7 +1925,8 @@ variables.")
(exit-minibuffer)) (exit-minibuffer))
(defvar completion-in-region-functions nil (defvar completion-in-region-functions nil
"Wrapper hook around `completion--in-region'.") "Wrapper hook around `completion--in-region'.
\(See `with-wrapper-hook' for details about wrapper hooks.)")
(make-obsolete-variable 'completion-in-region-functions (make-obsolete-variable 'completion-in-region-functions
'completion-in-region-function "24.4") 'completion-in-region-function "24.4")
@ -1969,7 +1970,8 @@ if there was no valid completion, else t."
(defun completion--in-region (start end collection &optional predicate) (defun completion--in-region (start end collection &optional predicate)
"Default function to use for `completion-in-region-function'. "Default function to use for `completion-in-region-function'.
Its arguments and return value are as specified for `completion-in-region'. Its arguments and return value are as specified for `completion-in-region'.
This respects the wrapper hook `completion-in-region-functions'." Also respects the obsolete wrapper hook `completion-in-region-functions'.
\(See `with-wrapper-hook' for details about wrapper hooks.)"
(with-wrapper-hook (with-wrapper-hook
;; FIXME: Maybe we should use this hook to provide a "display ;; FIXME: Maybe we should use this hook to provide a "display
;; completions" operation as well. ;; completions" operation as well.

View file

@ -4009,7 +4009,8 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]."
(defvar filter-buffer-substring-functions nil (defvar filter-buffer-substring-functions nil
"This variable is a wrapper hook around `buffer-substring--filter'.") "This variable is a wrapper hook around `buffer-substring--filter'.
\(See `with-wrapper-hook' for details about wrapper hooks.)")
(make-obsolete-variable 'filter-buffer-substring-functions (make-obsolete-variable 'filter-buffer-substring-functions
'filter-buffer-substring-function "24.4") 'filter-buffer-substring-function "24.4")
@ -4050,7 +4051,8 @@ that are special to a buffer, and should not be copied into other buffers."
(defun buffer-substring--filter (beg end &optional delete) (defun buffer-substring--filter (beg end &optional delete)
"Default function to use for `filter-buffer-substring-function'. "Default function to use for `filter-buffer-substring-function'.
Its arguments and return value are as specified for `filter-buffer-substring'. Its arguments and return value are as specified for `filter-buffer-substring'.
This respects the wrapper hook `filter-buffer-substring-functions', Also respects the obsolete wrapper hook `filter-buffer-substring-functions'
\(see `with-wrapper-hook' for details about wrapper hooks),
and the abnormal hook `buffer-substring-filters'. and the abnormal hook `buffer-substring-filters'.
No filtering is done unless a hook says to." No filtering is done unless a hook says to."
(with-wrapper-hook filter-buffer-substring-functions (beg end delete) (with-wrapper-hook filter-buffer-substring-functions (beg end delete)