mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Merge from origin/emacs-29
232a57a3e3; * doc/lispref/debugging.texi (Debugging): Add cross-ref...c65ddf26a3; doc/lispref/debugging.texi: Add reference to Profiler d...6f884d3aedAdd 5 docstrings to abbrev.el (bug#67153)b4d990bd63; Clarify wording about arguments in doc stringsc20ae7a30f; Improve cross-references in description of 'pcase'42181b65df; * src/editfns.c (Fline_beginning_position): Doc fix.5f3309f6b0; Improve indexing in ELisp manual4e406bb420Fix CBZ file detection in doc-view-mode
This commit is contained in:
commit
6c367f0ad4
6 changed files with 62 additions and 12 deletions
|
|
@ -122,6 +122,9 @@ Otherwise display all the abbrevs."
|
|||
found))
|
||||
|
||||
(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))
|
||||
(with-current-buffer (get-buffer-create "*Abbrevs*")
|
||||
(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))
|
||||
|
||||
(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
|
||||
(cond
|
||||
((or (and (null arg) (use-region-p))
|
||||
|
|
@ -353,7 +370,7 @@ Don't use this function in a Lisp program; use `define-abbrev' instead."
|
|||
(if (or (null exp)
|
||||
(not (abbrev-expansion name table))
|
||||
(y-or-n-p (format "%s expands into \"%s\"; redefine? "
|
||||
name (abbrev-expansion name table))))
|
||||
name (abbrev-expansion name table))))
|
||||
(define-abbrev table (downcase name) exp))))
|
||||
|
||||
(defun inverse-add-mode-abbrev (n)
|
||||
|
|
@ -393,6 +410,19 @@ to define an abbrev by specifying the abbreviation in the minibuffer."
|
|||
(inverse-add-abbrev global-abbrev-table "Global" n))
|
||||
|
||||
(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)
|
||||
(save-excursion
|
||||
(forward-word (1+ (- arg)))
|
||||
|
|
@ -1102,6 +1132,8 @@ Presumes that `standard-output' points to `current-buffer'."
|
|||
(insert ")\n"))
|
||||
|
||||
(defun abbrev--describe (sym)
|
||||
"Describe abbrev SYM.
|
||||
Print on `standard-output' the abbrev, count of use, expansion."
|
||||
(when (symbol-value sym)
|
||||
(prin1 (symbol-name sym))
|
||||
(if (null (abbrev-get sym :system))
|
||||
|
|
@ -1243,11 +1275,12 @@ which see."
|
|||
(setq font-lock-multiline nil))
|
||||
|
||||
(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.
|
||||
(if (eq query 'query)
|
||||
(and save-abbrevs abbrevs-changed)
|
||||
;; Maybe save abbrevs, and record whether we either saved them or
|
||||
;; asked to.
|
||||
(and save-abbrevs
|
||||
abbrevs-changed
|
||||
(prog1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue