mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Add 5 docstrings to abbrev.el (bug#67153)
* lisp/abbrev.el (prepare-abbrev-list-buffer, add-abbrev) (inverse-add-abbrev, abbrev--describe) (abbrev--possibly-save): Add doc strings.
This commit is contained in:
parent
b4d990bd63
commit
6f884d3aed
1 changed files with 36 additions and 3 deletions
|
|
@ -122,6 +122,9 @@ Otherwise display all the abbrevs."
|
||||||
found))
|
found))
|
||||||
|
|
||||||
(defun prepare-abbrev-list-buffer (&optional local)
|
(defun prepare-abbrev-list-buffer (&optional local)
|
||||||
|
"Return buffer listing abbreviations and expansions for each abbrev table.
|
||||||
|
|
||||||
|
If LOCAL is non-nil, include in the buffer only the local abbrevs."
|
||||||
(let ((local-table local-abbrev-table))
|
(let ((local-table local-abbrev-table))
|
||||||
(with-current-buffer (get-buffer-create "*Abbrevs*")
|
(with-current-buffer (get-buffer-create "*Abbrevs*")
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
|
|
@ -333,6 +336,20 @@ Don't use this function in a Lisp program; use `define-abbrev' instead."
|
||||||
(add-abbrev global-abbrev-table "Global" arg))
|
(add-abbrev global-abbrev-table "Global" arg))
|
||||||
|
|
||||||
(defun add-abbrev (table type arg)
|
(defun add-abbrev (table type arg)
|
||||||
|
"Define abbrev in TABLE, whose expansion is ARG words before point.
|
||||||
|
Read the abbreviation from the minibuffer, with prompt TYPE.
|
||||||
|
|
||||||
|
ARG of zero means the entire region is the expansion.
|
||||||
|
|
||||||
|
A negative ARG means to undefine the specified abbrev.
|
||||||
|
|
||||||
|
TYPE is an arbitrary string used to prompt user for the kind of
|
||||||
|
abbrev, such as \"Global\", \"Mode\". (This has no influence on the
|
||||||
|
choice of the actual TABLE).
|
||||||
|
|
||||||
|
See `inverse-add-abbrev' for the opposite task.
|
||||||
|
|
||||||
|
Don't use this function in a Lisp program; use `define-abbrev' instead."
|
||||||
(let ((exp
|
(let ((exp
|
||||||
(cond
|
(cond
|
||||||
((or (and (null arg) (use-region-p))
|
((or (and (null arg) (use-region-p))
|
||||||
|
|
@ -393,6 +410,19 @@ to define an abbrev by specifying the abbreviation in the minibuffer."
|
||||||
(inverse-add-abbrev global-abbrev-table "Global" n))
|
(inverse-add-abbrev global-abbrev-table "Global" n))
|
||||||
|
|
||||||
(defun inverse-add-abbrev (table type arg)
|
(defun inverse-add-abbrev (table type arg)
|
||||||
|
"Define the word before point as an abbrev in TABLE.
|
||||||
|
Read the expansion from the minibuffer, using prompt TYPE, define
|
||||||
|
the abbrev, and then expand the abbreviation in the current
|
||||||
|
buffer.
|
||||||
|
|
||||||
|
ARG means use the ARG-th word before point as the abbreviation.
|
||||||
|
Negative ARG means use the ARG-th word after point.
|
||||||
|
|
||||||
|
TYPE is an arbitrary string used to prompt user for the kind of
|
||||||
|
abbrev, such as \"Global\", \"Mode\". (This has no influence on the
|
||||||
|
choice of the actual TABLE).
|
||||||
|
|
||||||
|
See also `add-abbrev', which performs the opposite task."
|
||||||
(let (name exp start end)
|
(let (name exp start end)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(forward-word (1+ (- arg)))
|
(forward-word (1+ (- arg)))
|
||||||
|
|
@ -1102,6 +1132,8 @@ Presumes that `standard-output' points to `current-buffer'."
|
||||||
(insert ")\n"))
|
(insert ")\n"))
|
||||||
|
|
||||||
(defun abbrev--describe (sym)
|
(defun abbrev--describe (sym)
|
||||||
|
"Describe abbrev SYM.
|
||||||
|
Print on `standard-output' the abbrev, count of use, expansion."
|
||||||
(when (symbol-value sym)
|
(when (symbol-value sym)
|
||||||
(prin1 (symbol-name sym))
|
(prin1 (symbol-name sym))
|
||||||
(if (null (abbrev-get sym :system))
|
(if (null (abbrev-get sym :system))
|
||||||
|
|
@ -1243,11 +1275,12 @@ which see."
|
||||||
(setq font-lock-multiline nil))
|
(setq font-lock-multiline nil))
|
||||||
|
|
||||||
(defun abbrev--possibly-save (query &optional arg)
|
(defun abbrev--possibly-save (query &optional arg)
|
||||||
|
"Hook function for use by `save-some-buffer-functions'.
|
||||||
|
|
||||||
|
Maybe save abbrevs, and record whether we either saved them or asked to."
|
||||||
;; Query mode.
|
;; Query mode.
|
||||||
(if (eq query 'query)
|
(if (eq query 'query)
|
||||||
(and save-abbrevs abbrevs-changed)
|
(and save-abbrevs abbrevs-changed)
|
||||||
;; Maybe save abbrevs, and record whether we either saved them or
|
|
||||||
;; asked to.
|
|
||||||
(and save-abbrevs
|
(and save-abbrevs
|
||||||
abbrevs-changed
|
abbrevs-changed
|
||||||
(prog1
|
(prog1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue