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.
This commit is contained in:
Charles A. Roelli 2018-10-25 21:01:53 +02:00
parent 6ca71ceb68
commit c3adbc88a0
2 changed files with 29 additions and 17 deletions

View file

@ -99,10 +99,18 @@ text that matches the search string---using the @code{isearch} face
that customize this highlighting. The current search string is also that customize this highlighting. The current search string is also
displayed in the echo area. displayed in the echo area.
If you make a mistake typing the search string, type @key{DEL}. @cindex isearch input item
Each @key{DEL} cancels the last character of the search string. @cindex input item, isearch
@xref{Error in Isearch}, for more about dealing with unsuccessful @findex isearch-delete-char
search. @kindex DEL @r{(Incremental search)}
If you make a mistake typing the search string, type @key{DEL}
(@code{isearch-delete-char}). Each @key{DEL} cancels the last input
item entered during the search. Emacs records a new @dfn{input item}
whenever you type a command that changes the search string, the
position of point, the success or failure of the search, the direction
of the search, the position of the other end of the current search
result, or the ``wrappedness'' of the search. @xref{Error in
Isearch}, for more about dealing with unsuccessful search.
@cindex exit incremental search @cindex exit incremental search
@cindex incremental search, exiting @cindex incremental search, exiting
@ -283,14 +291,15 @@ string that failed to match is highlighted using the face
@code{isearch-fail}. @code{isearch-fail}.
At this point, there are several things you can do. If your string At this point, there are several things you can do. If your string
was mistyped, you can use @key{DEL} to erase some of it and correct was mistyped, use @key{DEL} to cancel a previous input item
it, or you can type @kbd{M-e} and edit it. If you like the place you (@pxref{Basic Isearch}), @kbd{C-M-w} to erase one character at a time,
have found, you can type @key{RET} to remain there. Or you can type or @kbd{M-e} to edit it. If you like the place you have found, you
@kbd{C-g}, which removes from the search string the characters that can type @key{RET} to remain there. Or you can type @kbd{C-g}, which
could not be found (the @samp{T} in @samp{FOOT}), leaving those that removes from the search string the characters that could not be found
were found (the @samp{FOO} in @samp{FOOT}). A second @kbd{C-g} at (the @samp{T} in @samp{FOOT}), leaving those that were found (the
that point cancels the search entirely, returning point to where it @samp{FOO} in @samp{FOOT}). A second @kbd{C-g} at that point cancels
was when the search started. the search entirely, returning point to where it was when the search
started.
@cindex quitting (in search) @cindex quitting (in search)
@kindex C-g @r{(Incremental search)} @kindex C-g @r{(Incremental search)}

View file

@ -1956,11 +1956,14 @@ and reads its face argument using `hi-lock-read-face-name'."
(defun isearch-delete-char () (defun isearch-delete-char ()
"Discard last input item and move point back. "Undo last input item during a search.
Last input means the last character or the last isearch command
that added or deleted characters from the search string, An input item is the result of a command that pushes a new state
moved point, toggled regexp mode or case-sensitivity, etc. of isearch (as recorded by the `isearch--state' structure) to
If no previous match was done, just beep." `isearch-cmds'. Info node `(emacs)Basic Isearch' explains when
Emacs records a new input item.
If no input items have been entered yet, just beep."
(interactive) (interactive)
(if (null (cdr isearch-cmds)) (if (null (cdr isearch-cmds))
(ding) (ding)