From 7320a812e9e0624480406309a3cad18db38ff87a Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 1 Aug 2022 22:19:01 +0300 Subject: [PATCH] Wrap around the search on typing a letter (bug#56535) * doc/emacs/search.texi (Repeat Isearch): Improve values no/no-ding. * lisp/isearch.el (isearch-search-and-update): Try to repeat the search on an error when isearch-wrap-pause is no/no-ding. --- doc/emacs/search.texi | 5 +++-- etc/NEWS | 5 +++++ lisp/isearch.el | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 27d4db85412..582e764c55f 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -228,8 +228,9 @@ customizing the @code{isearch-wrap-pause} user option. If it is @code{t} (the default), signal an error. (Repeating the search will wrap around.) If @code{no}, issue a @code{ding} and wrap immediately after reaching the last match. If @code{no-ding}, wrap immediately, -but don't @code{ding}. Finally, if @code{nil}, never wrap, but just -stop at the last match. +but don't @code{ding}. With the values @code{no} and @code{no-ding} +the search will try to wrap around also on typing a character. +Finally, if @code{nil}, never wrap, but just stop at the last match. @cindex search ring @findex isearch-ring-advance diff --git a/etc/NEWS b/etc/NEWS index b011413cbc3..7aff7921f98 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1457,6 +1457,11 @@ outside the echo area, Emacs will, by default, end the Isearch and yank the text at mouse cursor. But if 'mouse-yank-at-point' is non-nil, the text will now be added to the Isearch instead. ++++ +*** Changes for values 'no' and 'no-ding' of 'isearch-wrap-pause'. +Now with these values the search will wrap around not only on repeating +with 'C-s C-s', but also after typing a character. + +++ *** New user option 'char-fold-override'. Non-nil means that the default definitions of equivalent characters diff --git a/lisp/isearch.el b/lisp/isearch.el index 8f480a87d94..336c5f1bde2 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2838,7 +2838,9 @@ The command accepts Unicode names like \"smiling face\" or isearch-barrier (1+ isearch-other-end))))) (isearch-search) - )) + (when (and (memq isearch-wrap-pause '(no no-ding)) + (not isearch-success)) + (isearch-repeat (if isearch-forward 'forward 'backward))))) (isearch-push-state) (if isearch-op-fun (funcall isearch-op-fun)) (isearch-update)) -- 2.39.2