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: Fri, 10 Feb 2017 01:28:55 +0200 Organization: LINKOV.NET Message-ID: <87h943lzg8.fsf@localhost> References: <87r33njun7.fsf@inria.fr> <87mvea3feg.fsf@mail.linkov.net> <87fuk1wfri.fsf@mail.linkov.net> <87r33l7yqj.fsf@inria.fr> <877f5cf7xk.fsf@mail.linkov.net> <83o9ynx604.fsf@gnu.org> <83h94fw86x.fsf@gnu.org> <87zii6u4cr.fsf@mail.linkov.net> 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 1486683022 29022 195.159.176.226 (9 Feb 2017 23:30:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 9 Feb 2017 23:30:22 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (x86_64-pc-linux-gnu) Cc: 25562@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 10 00:30:17 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 1cbyAK-000720-Oj for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Feb 2017 00:30:16 +0100 Original-Received: from localhost ([::1]:40783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbyAN-0008BU-8v for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Feb 2017 18:30:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbyAD-00088r-6M for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 18:30:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbyA7-0000Hf-E1 for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 18:30:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35371) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cbyA7-0000HE-BR for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 18:30:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cbyA7-0003p2-3F for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 18:30:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Feb 2017 23:30: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.148668296714626 (code B ref 25562); Thu, 09 Feb 2017 23:30:02 +0000 Original-Received: (at 25562) by debbugs.gnu.org; 9 Feb 2017 23:29:27 +0000 Original-Received: from localhost ([127.0.0.1]:33570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cby9W-0003nq-RX for submit@debbugs.gnu.org; Thu, 09 Feb 2017 18:29:27 -0500 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:59705 helo=homiemail-a18.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cby9U-0003nh-LH for 25562@debbugs.gnu.org; Thu, 09 Feb 2017 18:29:25 -0500 Original-Received: from homiemail-a18.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTP id C62A8258065; Thu, 9 Feb 2017 15:29:22 -0800 (PST) Original-Received: from localhost.linkov.net (m83-180-111-97.cust.tele2.ee [83.180.111.97]) (Authenticated sender: jurta@jurta.org) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTPA id 2E78D258062; Thu, 9 Feb 2017 15:29:21 -0800 (PST) In-Reply-To: <87zii6u4cr.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 01 Feb 2017 02:44:36 +0200") 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:129170 Archived-At: >>> I agree it's an ill defined problem ; but then, so is isearching for = foo\|bar. >>> >>> I disabled the beeping and screen flashing, so it doesn't bother me, = but I get the point. >>> >>> In the end, it's mostly a matter of personal convenience. The patched= behavior suits me better, and seems >>> more consistent with the way regexp are handled. >> >> Did you try typing RET right after "C-s M-s w", then typing the word >> to search, and then typing "C-s C-s" again to repeat that? This might >> be better suited to your needs, I think, and it doesn't require any >> changes. > > Since incrementality of word search is not well-defined, > it makes sense to type the word in non-incremental mode indeed. > > One problem I noticed is that it's not easy to get back to incremental > mode: after typing a word in non-incremental mode =E2=80=98M-s w RET it= =E2=80=99 > typing =E2=80=98C-s=E2=80=99 in the minibuffer doesn't go back to incre= mental mode. IIRC, it was supposed to work this way, i.e.: =E2=80=98M-s w RET it RET=E2=80=99 to quit isearch and search the word no= nincrementally, as documented in (info "(emacs) Word Search") =E2=80=98M-s w RET it C-s=E2=80=99 to enter the word and continue searchi= ng incrementally, as documented in the docstrings of =E2=80=98isearch-forward-exit-minibuff= er=E2=80=99 and =E2=80=98isearch-reverse-exit-minibuffer=E2=80=99, but at some point the = implementation deviated from its documentation. Here is the patch to restore it: diff --git a/lisp/isearch.el b/lisp/isearch.el index 4b35f25..23ca18c 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -638,6 +638,9 @@ (defvar isearch-recursive-edit nil) ;; Should isearch be terminated after doing one search? (defvar isearch-nonincremental nil) =20 +;; New value of isearch-nonincremental after isearch-edit-string. +(defvar isearch-new-nonincremental nil) + ;; New value of isearch-forward after isearch-edit-string. (defvar isearch-new-forward nil) =20 @@ -1228,7 +1231,7 @@ (defmacro with-isearch-suspended (&rest body) "Exit Isearch mode, run BODY, and reinvoke the pending search. You can update the global isearch variables by setting new values to `isearch-new-string', `isearch-new-message', `isearch-new-forward', -`isearch-new-regexp-function', `isearch-new-case-fold'." +`isearch-new-nonincremental', `isearch-new-regexp-function', `isearch-ne= w-case-fold'." ;; This code is very hairy for several reasons, explained in the code. ;; Mainly, isearch-mode must be terminated while editing and then rest= arted. ;; If there were a way to catch any change of buffer from the minibuff= er, @@ -1236,7 +1239,7 @@ (defmacro with-isearch-suspended (&rest body) ;; Editing doesn't back up the search point. Should it? `(condition-case nil (progn - (let ((isearch-nonincremental isearch-nonincremental) + (let ((isearch-new-nonincremental isearch-nonincremental) =20 ;; Locally bind all isearch global variables to protect them ;; from recursive isearching. @@ -1315,6 +1318,7 @@ (defmacro with-isearch-suspended (&rest body) (setq isearch-string isearch-new-string isearch-message isearch-new-message isearch-forward isearch-new-forward + isearch-nonincremental isearch-new-nonincremental isearch-regexp-function isearch-new-regexp-function isearch-case-fold-search isearch-new-case-fold multi-isearch-current-buffer multi-isearch-current-buffer-new @@ -1405,22 +1409,22 @@ (defun isearch-edit-string () =20 (defun isearch-nonincremental-exit-minibuffer () (interactive) - (setq isearch-nonincremental t) + (setq isearch-new-nonincremental t) (exit-minibuffer)) -;; Changing the value of `isearch-nonincremental' has no effect here, -;; because `isearch-edit-string' ignores this change. Thus marked as ob= solete. +;; It makes no sense to change the value of `isearch-new-nonincremental' +;; from nil to t during `isearch-edit-string'. Thus marked as obsolete= . (make-obsolete 'isearch-nonincremental-exit-minibuffer 'exit-minibuffer = "24.4") =20 (defun isearch-forward-exit-minibuffer () "Resume isearching forward from the minibuffer that edits the search s= tring." (interactive) - (setq isearch-new-forward t) + (setq isearch-new-forward t isearch-new-nonincremental nil) (exit-minibuffer)) =20 (defun isearch-reverse-exit-minibuffer () "Resume isearching backward from the minibuffer that edits the search = string." (interactive) - (setq isearch-new-forward nil) + (setq isearch-new-forward nil isearch-new-nonincremental nil) (exit-minibuffer)) =20