aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles A. Roelli2018-10-25 21:01:53 +0200
committerCharles A. Roelli2018-10-25 21:01:53 +0200
commitc3adbc88a00f2c8fa773d46bfcf4571c9ebde8fb (patch)
treefb2d3056fd31d878c8eb9c275603f6ba6caa55f1
parent6ca71ceb687d238f6bdfd483e32b5c6d54bf6d1a (diff)
downloademacs-c3adbc88a00f2c8fa773d46bfcf4571c9ebde8fb.tar.gz
emacs-c3adbc88a00f2c8fa773d46bfcf4571c9ebde8fb.zip
Improve 'isearch-delete-char' documentation (Bug#32990)
* doc/emacs/search.texi (Basic Isearch): Index 'isearch-delete-char', its keybinding and the isearch "input item" concept, and define the latter. (Error in Isearch): Clarify the different uses of DEL and C-M-w during isearch. * lisp/isearch.el (isearch-delete-char): Correct its documentation and link to the Info node '(emacs)Basic Isearch' which explains less technically how this function works in everyday usage.
-rw-r--r--doc/emacs/search.texi33
-rw-r--r--lisp/isearch.el13
2 files changed, 29 insertions, 17 deletions
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 053603e54fc..58a76580d76 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -99,10 +99,18 @@ text that matches the search string---using the @code{isearch} face
99that customize this highlighting. The current search string is also 99that customize this highlighting. The current search string is also
100displayed in the echo area. 100displayed in the echo area.
101 101
102 If you make a mistake typing the search string, type @key{DEL}. 102@cindex isearch input item
103Each @key{DEL} cancels the last character of the search string. 103@cindex input item, isearch
104@xref{Error in Isearch}, for more about dealing with unsuccessful 104@findex isearch-delete-char
105search. 105@kindex DEL @r{(Incremental search)}
106 If you make a mistake typing the search string, type @key{DEL}
107(@code{isearch-delete-char}). Each @key{DEL} cancels the last input
108item entered during the search. Emacs records a new @dfn{input item}
109whenever you type a command that changes the search string, the
110position of point, the success or failure of the search, the direction
111of the search, the position of the other end of the current search
112result, or the ``wrappedness'' of the search. @xref{Error in
113Isearch}, for more about dealing with unsuccessful search.
106 114
107@cindex exit incremental search 115@cindex exit incremental search
108@cindex incremental search, exiting 116@cindex incremental search, exiting
@@ -283,14 +291,15 @@ string that failed to match is highlighted using the face
283@code{isearch-fail}. 291@code{isearch-fail}.
284 292
285 At this point, there are several things you can do. If your string 293 At this point, there are several things you can do. If your string
286was mistyped, you can use @key{DEL} to erase some of it and correct 294was mistyped, use @key{DEL} to cancel a previous input item
287it, or you can type @kbd{M-e} and edit it. If you like the place you 295(@pxref{Basic Isearch}), @kbd{C-M-w} to erase one character at a time,
288have found, you can type @key{RET} to remain there. Or you can type 296or @kbd{M-e} to edit it. If you like the place you have found, you
289@kbd{C-g}, which removes from the search string the characters that 297can type @key{RET} to remain there. Or you can type @kbd{C-g}, which
290could not be found (the @samp{T} in @samp{FOOT}), leaving those that 298removes from the search string the characters that could not be found
291were found (the @samp{FOO} in @samp{FOOT}). A second @kbd{C-g} at 299(the @samp{T} in @samp{FOOT}), leaving those that were found (the
292that point cancels the search entirely, returning point to where it 300@samp{FOO} in @samp{FOOT}). A second @kbd{C-g} at that point cancels
293was when the search started. 301the search entirely, returning point to where it was when the search
302started.
294 303
295@cindex quitting (in search) 304@cindex quitting (in search)
296@kindex C-g @r{(Incremental search)} 305@kindex C-g @r{(Incremental search)}
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 31571e11cd5..b180e63d8e8 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1956,11 +1956,14 @@ and reads its face argument using `hi-lock-read-face-name'."
1956 1956
1957 1957
1958(defun isearch-delete-char () 1958(defun isearch-delete-char ()
1959 "Discard last input item and move point back. 1959 "Undo last input item during a search.
1960Last input means the last character or the last isearch command 1960
1961that added or deleted characters from the search string, 1961An input item is the result of a command that pushes a new state
1962moved point, toggled regexp mode or case-sensitivity, etc. 1962of isearch (as recorded by the `isearch--state' structure) to
1963If no previous match was done, just beep." 1963`isearch-cmds'. Info node `(emacs)Basic Isearch' explains when
1964Emacs records a new input item.
1965
1966If no input items have been entered yet, just beep."
1964 (interactive) 1967 (interactive)
1965 (if (null (cdr isearch-cmds)) 1968 (if (null (cdr isearch-cmds))
1966 (ding) 1969 (ding)