From: Juri Linkov <juri@linkov.net>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 25562@debbugs.gnu.org, Antoine Levitt <antoine.levitt@gmail.com>
Subject: bug#25562: 25.1; isearch-forward-word first matches a non-word
Date: Thu, 02 Feb 2017 02:51:08 +0200 [thread overview]
Message-ID: <87zii52y8j.fsf@mail.linkov.net> (raw)
In-Reply-To: <87tw8dztn5.fsf@drachen> (Michael Heerdegen's message of "Wed, 01 Feb 2017 18:51:42 +0100")
> I tried it. Works as I would expect in *scratch* and dired, but hmm,
> not in Info (the prompt just doesn't contain "pending" there). I tried
> with emacs -Q, and in any buffer I started a word search and just began
> typing characters.
Thanks for discovering the problem in Info, it will be fixed by the next patch.
It seems to work while I used it to search for the mentions of the word
“pending” in the Emacs manual - there is no one, so we could document it
in (info "(emacs) Word Search") with the second patch below.
> BTW, a different question: when I delete characters from my input (with
> backspace) in a word search and then add some new characters, I somehow
> expected that isearch would return to that "pending" state. But I got
> the jumpy (nonlax) incremental search behavior instead. I don't have an
> opinion about that, just wanted to mention it.
“Pending” is not displayed in the prompt while deleting with backspace
since this state in not stored in isearch-cmds. But I see no problem
because “pending” appears again when you continue typing new characters.
diff --git a/lisp/info.el b/lisp/info.el
index e32b6b3..3eb2021 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2107,11 +2107,10 @@ (defun Info-isearch-search ()
(cond
(isearch-regexp-function
;; Lax version of word search
- (let ((lax (not (or isearch-nonincremental
- (eq (length string)
- (length (isearch--state-string
- (car isearch-cmds))))))))
- (if (functionp isearch-regexp-function)
+ (let ((lax (isearch--lax-regexp-function-p string)))
+ (when lax
+ (setq isearch-adjusted t))
+ (if (functionp isearch-regexp-function)
(funcall isearch-regexp-function string lax)
(word-search-regexp string lax))))
(isearch-regexp string)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5c48c30..856738e 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2718,11 +2718,11 @@ (defun isearch-search-fun ()
Can be changed via `isearch-search-fun-function' for special needs."
(funcall (or isearch-search-fun-function 'isearch-search-fun-default)))
-(defun isearch--lax-regexp-function-p ()
+(defun isearch--lax-regexp-function-p (&optional string)
"Non-nil if next regexp-function call should be lax."
(not (or isearch-nonincremental
(null (car isearch-cmds))
- (eq (length isearch-string)
+ (eq (length (or string isearch-string))
(length (isearch--state-string
(car isearch-cmds)))))))
@@ -2741,6 +2741,8 @@ (defun isearch-search-fun-default ()
(if isearch-forward #'re-search-forward #'re-search-backward)
(cond (isearch-regexp-function
(let ((lax (isearch--lax-regexp-function-p)))
+ (when lax
+ (setq isearch-adjusted t))
(if (functionp isearch-regexp-function)
(funcall isearch-regexp-function string lax)
(word-search-regexp string lax))))
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index b728258..1296b3b 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -609,6 +609,8 @@ Word Search
so that the matching can proceed incrementally as you type. This
additional laxity does not apply to the lazy highlight
(@pxref{Incremental Search}), which always matches whole words.
+While you are typing the search string, @samp{Pending} appears in the
+search prompt until you use a search repeating key like @kbd{C-s}.
The word search commands don't perform character folding, and
toggling lax whitespace matching (@pxref{Lax Search, lax space
next prev parent reply other threads:[~2017-02-02 0:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-28 11:23 bug#25562: 25.1; isearch-forward-word first matches a non-word Antoine Levitt
2017-01-29 0:29 ` Juri Linkov
2017-01-29 6:52 ` Antoine Levitt
2017-01-30 0:30 ` Juri Linkov
2017-01-30 8:12 ` Antoine Levitt
2017-01-30 23:24 ` Juri Linkov
2017-01-31 3:28 ` Eli Zaretskii
[not found] ` <CABfD5m0NxLQ5rbfXcXvxXLDK6c_88Rzsu-bwRj8gJNdh3cinSw@mail.gmail.com>
[not found] ` <CABfD5m1wB_z3aLsW_vOj0Vx6+1H48bUeWs46ORW0fFBUsNB0ew@mail.gmail.com>
2017-01-31 7:57 ` Antoine Levitt
2017-01-31 15:38 ` Eli Zaretskii
2017-02-01 0:44 ` Juri Linkov
2017-02-09 23:28 ` Juri Linkov
2017-02-14 23:28 ` Juri Linkov
2017-01-31 16:45 ` Michael Heerdegen
2017-01-31 16:51 ` Michael Heerdegen
2017-02-01 0:38 ` Juri Linkov
2017-02-01 17:51 ` Michael Heerdegen
2017-02-02 0:51 ` Juri Linkov [this message]
2017-02-02 21:07 ` Michael Heerdegen
2017-02-03 11:04 ` Michael Heerdegen
2017-02-03 13:06 ` Eli Zaretskii
2017-02-03 14:16 ` Michael Heerdegen
2017-02-05 23:48 ` Juri Linkov
2017-02-07 20:02 ` Michael Heerdegen
2017-02-09 22:35 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zii52y8j.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=25562@debbugs.gnu.org \
--cc=antoine.levitt@gmail.com \
--cc=michael_heerdegen@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.