aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2020-09-27 08:57:17 +0300
committerEli Zaretskii2020-09-27 08:57:17 +0300
commitc37370a7a0f329d13cf00a06e446514be09a7bab (patch)
tree57b3ac3274ae1df4372020b25f1d1f7f7ca4ce81
parent768676f74f093e75e2d7e04e18e1fd1836d1e7e9 (diff)
downloademacs-c37370a7a0f329d13cf00a06e446514be09a7bab.tar.gz
emacs-c37370a7a0f329d13cf00a06e446514be09a7bab.zip
Improve documentation of the 'abbrev-suggest' feature
* lisp/abbrev.el (abbrev-suggest, abbrev-suggest-hint-threshold) (abbrev-suggest-show-report): Improve wording of the doc strings. * doc/emacs/abbrevs.texi (Abbrevs Suggestions): Fix the typo in the node name. Improve wording. * doc/emacs/emacs.texi (Top): Add the new node in the @detailmenu section. * etc/NEWS: Improve wording of the NEWS entry for 'abbrev-suggest'.
-rw-r--r--doc/emacs/abbrevs.texi39
-rw-r--r--doc/emacs/emacs.texi1
-rw-r--r--etc/NEWS10
-rw-r--r--lisp/abbrev.el27
4 files changed, 41 insertions, 36 deletions
diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi
index 0dda977833f..e3766aae9e8 100644
--- a/doc/emacs/abbrevs.texi
+++ b/doc/emacs/abbrevs.texi
@@ -28,7 +28,7 @@ Automatic Typing}.
28* Abbrev Concepts:: Fundamentals of defined abbrevs. 28* Abbrev Concepts:: Fundamentals of defined abbrevs.
29* Defining Abbrevs:: Defining an abbrev, so it will expand when typed. 29* Defining Abbrevs:: Defining an abbrev, so it will expand when typed.
30* Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion. 30* Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
31* Abbrevs Suggestions:: Get suggestions about defined abbrevs. 31* Abbrevs Suggestions:: Get automatic suggestions about defined abbrevs.
32* Editing Abbrevs:: Viewing or editing the entire list of defined abbrevs. 32* Editing Abbrevs:: Viewing or editing the entire list of defined abbrevs.
33* Saving Abbrevs:: Saving the entire list of abbrevs for another session. 33* Saving Abbrevs:: Saving the entire list of abbrevs for another session.
34* Dynamic Abbrevs:: Abbreviations for words already in the buffer. 34* Dynamic Abbrevs:: Abbreviations for words already in the buffer.
@@ -224,34 +224,35 @@ changing this function you can make arbitrary changes to
224the abbrev expansion. @xref{Abbrev Expansion,,, elisp, The Emacs Lisp 224the abbrev expansion. @xref{Abbrev Expansion,,, elisp, The Emacs Lisp
225Reference Manual}. 225Reference Manual}.
226 226
227@node Abbrev Suggestions 227@node Abbrevs Suggestions
228@section Abbrev Suggestions 228@section Abbrevs Suggestions
229 229
230 You can get abbrev suggestions when you manually type text for which 230 You can get abbrev suggestions when you manually type text for which
231there is currently an active defined abbrev. For example, if there is 231there is currently an active defined abbrev. For example, if there is
232an abbrev @samp{foo} with the expansion @samp{find outer otter}, and 232an abbrev @samp{foo} with the expansion @samp{find outer otter}, and
233you manually type @samp{find outer otter}, the abbrev suggestion 233you manually type @samp{find outer otter}, Emacs can notice this and
234feature will notice this and show a hint in the echo area when you 234show a hint in the echo area when you have stopped typing.
235have stopped typing.
236 235
237@vindex abbrev-suggest 236@vindex abbrev-suggest
238 Enable the abbrev suggestion feature by setting 237 To enable the abbrev suggestion feature, customize the option
239@code{abbrev-suggest} to @code{t}. 238@code{abbrev-suggest} to a non-@code{nil} value.
240 239
241@vindex abbrev-suggest-hint-threshold 240@vindex abbrev-suggest-hint-threshold
242 Controls when to suggest an abbrev to the user. The variable 241 The variable @code{abbrev-suggest-hint-threshold} controls when to
243defines the number of characters that the user must save in order to 242suggest an abbrev to the user. This variable defines the minimum
244get a suggestion. For example, if the user types @samp{foo bar} 243savings (in terms of the number of characters the user will not have
245(seven characters) and there is an abbrev @samp{fubar} defined (five 244to type) required for Emacs to suggest using an abbrev. For example,
246characters), the user will not get any suggestion unless the threshold 245if the user types @samp{foo bar} (seven characters) and there is an
247is set to the number 2 or lower. With the default value 3, the user 246abbrev @samp{fubar} defined (five characters), the user will not get
248would not get any suggestion, because the savings in using the abbrev 247any suggestion unless the threshold is set to the number 2 or lower.
249are not above the threshold. If you always want to get abbrev 248With the default value 3, the user would not get any suggestion in
250suggestions, set this variable to 0. 249this example, because the savings in using the abbrev are below
250the threshold. If you always want to get abbrev suggestions, set this
251variable's value to zero.
251 252
252@findex abbrev-suggest-show-report 253@findex abbrev-suggest-show-report
253 The command @code{abbrev-suggest-show-report} can be used to show a 254 The command @code{abbrev-suggest-show-report} displays a buffer with
254buffer with all abbrev suggestions from the current editing session. 255all the abbrev suggestions shown during the current editing session.
255This can be useful if you get several abbrev suggestions and don't 256This can be useful if you get several abbrev suggestions and don't
256remember them all. 257remember them all.
257 258
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 6aed7bd92a5..566229b2f32 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -908,6 +908,7 @@ Abbrevs
908* Abbrev Concepts:: Fundamentals of defined abbrevs. 908* Abbrev Concepts:: Fundamentals of defined abbrevs.
909* Defining Abbrevs:: Defining an abbrev, so it will expand when typed. 909* Defining Abbrevs:: Defining an abbrev, so it will expand when typed.
910* Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion. 910* Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
911* Abbrevs Suggestions:: Get automatic suggestions about defined abbrevs.
911* Editing Abbrevs:: Viewing or editing the entire list of defined abbrevs. 912* Editing Abbrevs:: Viewing or editing the entire list of defined abbrevs.
912* Saving Abbrevs:: Saving the entire list of abbrevs for another session. 913* Saving Abbrevs:: Saving the entire list of abbrevs for another session.
913* Dynamic Abbrevs:: Abbreviations for words already in the buffer. 914* Dynamic Abbrevs:: Abbreviations for words already in the buffer.
diff --git a/etc/NEWS b/etc/NEWS
index 0cbbae41861..202cd689d33 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1274,12 +1274,12 @@ of conditionals.
1274** Abbrev mode 1274** Abbrev mode
1275 1275
1276+++ 1276+++
1277*** Abbrev can now suggest pre-existing abbrevs based on typed text. 1277*** Emacs can now suggest to use an abbrev based on text you type.
1278A new user option, 'abbrev-suggest', enables the new abbrev suggestion 1278A new user option, 'abbrev-suggest', enables the new abbrev suggestion
1279feature. When enabled, if a user manually type a piece of text that 1279feature. When enabled, if a user manually types a piece of text that
1280could have been written by using an abbrev, a hint will be displayed 1280could have saved enough typing by using an abbrev, a hint will be
1281in the echo area, mentioning the abbrev that could have been used 1281displayed in the echo area, mentioning the abbrev that could have been
1282instead. 1282used instead.
1283 1283
1284 1284
1285* New Modes and Packages in Emacs 28.1 1285* New Modes and Packages in Emacs 28.1
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 75cc43941f4..dc52a220125 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -825,22 +825,23 @@ see `define-abbrev' for details."
825Takes no argument and should return the abbrev symbol if expansion took place.") 825Takes no argument and should return the abbrev symbol if expansion took place.")
826 826
827(defcustom abbrev-suggest nil 827(defcustom abbrev-suggest nil
828 "Non-nil means suggest abbrevs to the user. 828 "Non-nil means suggest using abbrevs to save typing.
829By enabling this option, if abbrev mode is enabled and if the 829When abbrev mode is active and this option is non-nil, Emacs will
830user has typed some text that exists as an abbrev, suggest to the 830suggest in the echo area to use an existing abbrev if doing so
831user to use the abbrev by displaying a message in the echo area." 831will save enough typing. See `abbrev-suggest-hint-threshold' for
832the definition of \"enough typing\"."
832 :type 'boolean 833 :type 'boolean
833 :version "28.1") 834 :version "28.1")
834 835
835(defcustom abbrev-suggest-hint-threshold 3 836(defcustom abbrev-suggest-hint-threshold 3
836 "Threshold for when to inform the user that there is an abbrev. 837 "Threshold for when to suggest to use an abbrev to save typing.
837The threshold is the number of characters that differ between the 838The threshold is the amount of typing, in terms of the number of
838length of the abbrev and the length of the expansion. The 839characters, that would be saved by using the abbrev. The
839thinking is that if the expansion is only one or a few characters 840thinking is that if the expansion is only a few characters
840longer than the abbrev, the benefit of informing the user is not 841longer than the abbrev, the benefit of informing the user is not
841that big. If you always want to be informed, set this value to 842significant. If you always want to be informed about existing
842`0' or less. This setting only applies if `abbrev-suggest' is 843abbrevs for the text you type, set this value to zero or less.
843non-nil." 844This setting only applies if `abbrev-suggest' is non-nil."
844 :type 'number 845 :type 'number
845 :version "28.1") 846 :version "28.1")
846 847
@@ -945,7 +946,9 @@ typed."
945 total)) 946 total))
946 947
947(defun abbrev-suggest-show-report () 948(defun abbrev-suggest-show-report ()
948 "Show the user a report of abbrevs he could have used." 949 "Show a buffer with the list of abbrevs you could have used.
950This shows the abbrevs you've \"missed\" because you typed the
951full text instead of the abbrevs that expand into that text."
949 (interactive) 952 (interactive)
950 (let ((totals (abbrev--suggest-get-totals)) 953 (let ((totals (abbrev--suggest-get-totals))
951 (buf (get-buffer-create "*abbrev-suggest*"))) 954 (buf (get-buffer-create "*abbrev-suggest*")))