From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#22118: 23.2; Hitting ^W in a search selects the wrong word. Date: Sat, 12 Dec 2015 00:54:47 +0200 Organization: LINKOV.NET Message-ID: <87k2okbnpk.fsf@mail.linkov.net> References: <20151210092550.6224.qmail@mail.muc.de> <56694D83.3080902@codersco.com> <20151210121027.GA3978@acm.fritz.box> <56697909.9040306@codersco.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1449875302 12028 80.91.229.3 (11 Dec 2015 23:08:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Dec 2015 23:08:22 +0000 (UTC) Cc: Alan Mackenzie , 22118@debbugs.gnu.org To: Jan-Mark Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 12 00:08:11 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a7WnK-0000Fr-1b for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Dec 2015 00:08:10 +0100 Original-Received: from localhost ([::1]:49807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7WnJ-0000s5-CI for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Dec 2015 18:08:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7WnF-0000ru-P3 for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2015 18:08:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7WnC-0005tl-Ng for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2015 18:08:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34908) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7WnC-0005th-KY for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2015 18:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1a7WnC-000864-HR for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2015 18:08: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: Fri, 11 Dec 2015 23:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22118 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22118-submit@debbugs.gnu.org id=B22118.144987523831064 (code B ref 22118); Fri, 11 Dec 2015 23:08:02 +0000 Original-Received: (at 22118) by debbugs.gnu.org; 11 Dec 2015 23:07:18 +0000 Original-Received: from localhost ([127.0.0.1]:35176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7WmU-00084y-Iw for submit@debbugs.gnu.org; Fri, 11 Dec 2015 18:07:18 -0500 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:52435 helo=homiemail-a13.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1a7WmS-00084k-NO for 22118@debbugs.gnu.org; Fri, 11 Dec 2015 18:07:16 -0500 Original-Received: from homiemail-a13.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTP id 4D2DC334076; Fri, 11 Dec 2015 15:07:16 -0800 (PST) Original-Received: from localhost.linkov.net (m83-180-31-224.cust.tele2.ee [83.180.31.224]) (Authenticated sender: jurta@jurta.org) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTPA id 27481334072; Fri, 11 Dec 2015 15:07:14 -0800 (PST) In-Reply-To: <56697909.9040306@codersco.com> (Jan-Mark's message of "Thu, 10 Dec 2015 14:07:21 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu) 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:109875 Archived-At: > I would say, either update the text window too or disallow using ^W > after a failure. I agree that the current behavior is not ideal. The problem is that it's difficult to make it more intuitive to work with different workflows such as when failing not at the end of the buffer but due to a non-existent string, e.g. typing =E2=80=98zzz C-w C-w C-w=E2= =80=99. Please try this patch that takes into account such possible scenarios. However, I don't agree this is a bug, I think it just provides a more useful behavior, so perhaps it shouldn't be installed to emacs-25. diff --git a/lisp/isearch.el b/lisp/isearch.el index 66fab0e..e9a99ea 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1959,6 +1959,8 @@ (defun isearch-mouse-2 (click) (when (functionp binding) (call-interactively binding))))) =20 +(defvar isearch-yank-prev-point nil) + (defun isearch-yank-internal (jumpform) "Pull the text from point to the point reached by JUMPFORM. JUMPFORM is a lambda expression that takes no arguments and returns @@ -1969,7 +1971,14 @@ (defun isearch-yank-internal (jumpform) (save-excursion (and (not isearch-forward) isearch-other-end (goto-char isearch-other-end)) - (buffer-substring-no-properties (point) (funcall jumpform))))) + (and (not isearch-success) isearch-yank-prev-point + (goto-char isearch-yank-prev-point)) + (buffer-substring-no-properties + (point) + (prog1 + (setq isearch-yank-prev-point (funcall jumpform)) + (when isearch-success + (setq isearch-yank-prev-point nil))))))) =20 (defun isearch-yank-char-in-minibuffer (&optional arg) "Pull next character from buffer into end of search string in minibuff= er."