From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#22118: 23.2; Hitting ^W in a search selects the wrong word. Date: Tue, 11 Aug 2020 20:33:41 -0700 Message-ID: References: <20151210092550.6224.qmail@mail.muc.de> <56694D83.3080902@codersco.com> <20151210121027.GA3978@acm.fritz.box> <56697909.9040306@codersco.com> <87k2okbnpk.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16361"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Alan Mackenzie , 22118@debbugs.gnu.org, Jan-Mark To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 12 05:34:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5hWm-000496-Ec for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Aug 2020 05:34:12 +0200 Original-Received: from localhost ([::1]:58556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5hWk-0003lF-O7 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Aug 2020 23:34:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5hWc-0003kd-Hq for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 23:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59150) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k5hWc-00075N-9A for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 23:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k5hWc-0001Vi-58 for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 23:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Aug 2020 03:34: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: patch Original-Received: via spool by 22118-submit@debbugs.gnu.org id=B22118.15972032305756 (code B ref 22118); Wed, 12 Aug 2020 03:34:02 +0000 Original-Received: (at 22118) by debbugs.gnu.org; 12 Aug 2020 03:33:50 +0000 Original-Received: from localhost ([127.0.0.1]:42457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5hWP-0001Ul-Lk for submit@debbugs.gnu.org; Tue, 11 Aug 2020 23:33:49 -0400 Original-Received: from mail-yb1-f194.google.com ([209.85.219.194]:38698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5hWN-0001UP-ME for 22118@debbugs.gnu.org; Tue, 11 Aug 2020 23:33:48 -0400 Original-Received: by mail-yb1-f194.google.com with SMTP id e187so615822ybc.5 for <22118@debbugs.gnu.org>; Tue, 11 Aug 2020 20:33:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc :content-transfer-encoding; bh=bJW1xvHyDGrdwqhnzmb1McB3h+z5U9NNSZ7+Px+fogM=; b=QA1mZOjB77GO2QPpw1x+M0RnDaLWvFaybaQHmZHhkDloL88Y3FIA3B0eCAh1jSkf8I V0RriZYWJiNkgibr5bTxrXupg1ktZMBqjutRH/CdcQ4Rd4SYBizrCskuxeSoiaxgZVft LOfDNAX2fSojvn14hMvmwdM999r9TJpNCwatoujhKl+0+LHuGTzvXN0bSVc3W8CLbloW OsoX/J8/FIidyLbxnSDyydtGcxXqN4NExP0usgTROKno/xgY05aUi/yQgaVFF7h0Aw+4 jjGItutGSZn0rI2LY/euD0we3bM8PLF12Gadw4eDtHplahH4/WIUKc0vOzkAMdHabcmA xFCA== X-Gm-Message-State: AOAM531Lq2Sqcd0kDpwg/iuBuNisJmUKtOF+oL4Dj5yxnGyBqBpmLln0 +I/a6udxt5mhNLsYMjPg19MyRuVQ2uClVSJrWEA= X-Google-Smtp-Source: ABdhPJyDzP54IausduZjetIi6DgXSO+KQHmFdZ/FYPiIUFir5fZeLMAVhiOmd29IIsMuEplKe6DQa4hDygNahRyTczY= X-Received: by 2002:a25:9843:: with SMTP id k3mr52962129ybo.466.1597203222204; Tue, 11 Aug 2020 20:33:42 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 11 Aug 2020 20:33:41 -0700 In-Reply-To: <87k2okbnpk.fsf@mail.linkov.net> (Juri Linkov's message of "Sat, 12 Dec 2015 00:54:47 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:184738 Archived-At: Hi Juri, Is the below patch still relevant? Juri Linkov writes: >> 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))))) > > +(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))))))) > > (defun isearch-yank-char-in-minibuffer (&optional arg) > "Pull next character from buffer into end of search string in minibuff= er." Best regards, Stefan Kangas