From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#25562: 25.1; isearch-forward-word first matches a non-word Date: Tue, 31 Jan 2017 01:24:07 +0200 Organization: LINKOV.NET Message-ID: <877f5cf7xk.fsf@mail.linkov.net> References: <87r33njun7.fsf@inria.fr> <87mvea3feg.fsf@mail.linkov.net> <87fuk1wfri.fsf@mail.linkov.net> <87r33l7yqj.fsf@inria.fr> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1485818954 29180 195.159.176.226 (30 Jan 2017 23:29:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 30 Jan 2017 23:29:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu) Cc: 25562@debbugs.gnu.org To: Antoine Levitt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 31 00:29:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYLNm-0007Ms-7X for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Jan 2017 00:29:10 +0100 Original-Received: from localhost ([::1]:35471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYLNo-0000rc-9q for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Jan 2017 18:29:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYLNi-0000rU-4v for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 18:29:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYLNe-0005y7-Ky for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 18:29:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53275) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYLNe-0005y2-Hc for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 18:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cYLNe-0007qe-B0 for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 18:29:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Jan 2017 23:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25562 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25562-submit@debbugs.gnu.org id=B25562.148581893930154 (code B ref 25562); Mon, 30 Jan 2017 23:29:02 +0000 Original-Received: (at 25562) by debbugs.gnu.org; 30 Jan 2017 23:28:59 +0000 Original-Received: from localhost ([127.0.0.1]:51474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYLNb-0007qF-3K for submit@debbugs.gnu.org; Mon, 30 Jan 2017 18:28:59 -0500 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:43195 helo=homiemail-a17.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYLNZ-0007q5-TM for 25562@debbugs.gnu.org; Mon, 30 Jan 2017 18:28:58 -0500 Original-Received: from homiemail-a17.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a17.g.dreamhost.com (Postfix) with ESMTP id 6730B2B206E; Mon, 30 Jan 2017 15:28:52 -0800 (PST) Original-Received: from localhost.linkov.net (m213-102-76-140.cust.tele2.ee [213.102.76.140]) (Authenticated sender: jurta@jurta.org) by homiemail-a17.g.dreamhost.com (Postfix) with ESMTPA id 8D20D2B206D; Mon, 30 Jan 2017 15:28:51 -0800 (PST) In-Reply-To: <87r33l7yqj.fsf@inria.fr> (Antoine Levitt's message of "Mon, 30 Jan 2017 09:12:20 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128809 Archived-At: >>> I see, thanks for the explanation. That's still unsatisfactory to me.= I >>> think an ideal incremental word search would just start over from the >>> current point each time a new character is typed (that's what most us= ers >>> would expect). Then any non-insertion command would make the user "co= mmit" >>> to the particular search and the incremental search proper would begi= n. Is >>> that compatible with the current design of isearch? >> >> What you describe looks like isearch-barrier used for subsequent \| in= regexps, >> e.g. typing =E2=80=98C-M-s ^\=E2=80=99 and then =E2=80=98\|=E2=80= =99 moves point back to the beginning >> of the search. But wouldn't this make the search too =E2=80=9Cjumpy=E2= =80=9D, especially >> while typing long words? > > My use case of isearch-word is mainly short words, e.g. variable names > such as f in f(x) in latex. I'd guess that's a pretty common pattern. > Even for long words, I think an user would type a word quickly, and be > confused that their first match is not really a match. That offsets the > potential jumpiness (ie what happens when the user is typing the word) > for me. You can try yourself using the minimal patch below that demonstrates your= idea. But from what I see, it's not too good, using the recipe from your top po= st: emacs -Q M-< M-s w i After typing the letter =E2=80=9Ci=E2=80=9D, isearch fails, beeps, flashe= s the screen, with a clear indication that something went wrong. This is more confusin= g for a user, because now a user has to stop and think about what is wrong. Here is the patch to help seeing this in action: diff --git a/lisp/isearch.el b/lisp/isearch.el index 5c48c30..85b9365 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1616,6 +1616,7 @@ (defun word-search-regexp (string &optional lax) =20 Used in `word-search-forward', `word-search-backward', `word-search-forward-lax', `word-search-backward-lax'." + (setq lax nil) (cond ((equal string "") "") ((string-match-p "\\`\\W+\\'" string) "\\W+") @@ -2465,6 +2466,11 @@ (defun isearch-process-search-char (char &optional= count) ;; } and | are special in regexps when preceded by \. ;; Nothing special for + because it matches at least once. (cond + ((eq isearch-regexp-function t) + (goto-char isearch-barrier) + (setq isearch-other-end isearch-barrier + isearch-success t + isearch-error nil)) ((memq char '(?* ??)) (isearch-fallback nil)) ((eq char ?\}) (isearch-fallback t t)) ((eq char ?|) (isearch-fallback t nil t)))