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: Sat, 29 Aug 2020 09:48:57 -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> <878sejgxwp.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000001bb05f05ae06f21c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27261"; 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, Juri Linkov To: Jan-Mark Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 29 18:50:10 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 1kC43N-0006zv-Uv for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Aug 2020 18:50:10 +0200 Original-Received: from localhost ([::1]:39948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kC43M-00046R-Pp for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Aug 2020 12:50:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kC43G-00046J-Ab for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2020 12:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37492) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kC43G-0001CH-1J for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2020 12:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kC43F-0000Ux-Vt for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2020 12:50:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Aug 2020 16:50:01 +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.15987197481844 (code B ref 22118); Sat, 29 Aug 2020 16:50:01 +0000 Original-Received: (at 22118) by debbugs.gnu.org; 29 Aug 2020 16:49:08 +0000 Original-Received: from localhost ([127.0.0.1]:49038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kC42O-0000Tg-2Z for submit@debbugs.gnu.org; Sat, 29 Aug 2020 12:49:08 -0400 Original-Received: from mail-yb1-f193.google.com ([209.85.219.193]:33973) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kC42K-0000T3-26 for 22118@debbugs.gnu.org; Sat, 29 Aug 2020 12:49:06 -0400 Original-Received: by mail-yb1-f193.google.com with SMTP id u6so1512645ybf.1 for <22118@debbugs.gnu.org>; Sat, 29 Aug 2020 09:49:03 -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; bh=DBuxzgPfuRDu/r+nYReHm1bWv2wyIXEbQQwVnfNCfbE=; b=nhgoA03X0OI8glX31DHvl3vmXSjcVkoaI6hzpERmqtRqrRGixPb4oIck47IP0zN3ty Y+jsRinhKupPzDAmLncpHLniKKn6FHzzm1B1nIGzIOmT98jhRuEJywBibtFkRWEPVbL/ EnAXRSjv3is8T/9J1Kdp71I03sSIf9+q3SB99FtlVvb5BHEPbR2gLSWrHtXVPqpR2p6w 91ZYzByP2dNRQ6Mxmgw9kS5MtkY7C0TXmNghDYuu12BGyfNCNjZhBrdLNlo6UzPhMA9V mqQVKQ0WEtJLA0iR2rTRh/9qNqtjMTIPGxauqP6wzvBwlm8HHedeMPsy9MNl0c6E3YgY xMWQ== X-Gm-Message-State: AOAM532oktyvCdQn/KHuypsP2rtIrop1a5525GyjjrjBGukoqp6F3Dzb qYdOAi+EcTWRv0/sEdHkEEXSfYgNzq3q6niMKIU= X-Google-Smtp-Source: ABdhPJzLwI2I1WT65XgbaHAbN7sc6AJtuoWFW6TrLac/To9yeAAifmLOqD+LJVOJBC0hv4MmZb9TwtHUkylB/mOQkI8= X-Received: by 2002:a25:4609:: with SMTP id t9mr9155694yba.231.1598719738404; Sat, 29 Aug 2020 09:48:58 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 29 Aug 2020 09:48:57 -0700 In-Reply-To: (Jan-Mark's message of "Thu, 13 Aug 2020 18:53:33 +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:186660 Archived-At: --0000000000001bb05f05ae06f21c Content-Type: text/plain; charset="UTF-8" Juri Linkov writes: >> Is the below patch still relevant? > > I don't know. My patch tried to make the behavior in case of error > slightly more useful, but now I see nothing useful in it because > after a failure it makes no sense to type C-w C-w C-w ... > > I don't recommend making code in isearch.el more complicated to handle > useless cases. So I won't complain if you'll close this report. :-) Jan-Mark writes: >> OK, thanks. Any objections to closing this? > I don't remember even what this was about. But ^W should not add words at the cursor if the > search failed to match. Which is different from the search failing because it is at the last > match (about to warp to the first match again). > > If the word 'aapX' is not in my text, 'aap noot' is, and I search for 'aapX' it brings me to > 'aap noot' with a failure notice. If I than type ^W it should not start looking for 'aapX noot'. > Just take the ^W out of the game in cases like this. I mean if 'aapX' cannot be found (even > once) why should you allow people to look for 'aapX noot'? > > I still feel it is a bug, but I agree that it will not hit many people often. I have this once > every 1000 hours (estimate). So it's not a big bug. But a bug nonetheless. > > If there is bigger bugs to fry, close it, if it is an easy fix (should be?) I'd say fix it first. Thanks. Juri feels that we should close this bug as a wontfix because it is not worth complicating the isearch code over this. Testing this again, I'm leaning more towards fixing the bug. I think there is definitely a bug here (the recipe in OP is still reproducible on master), but it is very minor. We also already have a proposed fix. I considered also the use case when you have 'isearch-wrapped' set to a non-nil value, which would make yank after last occurrence more useful. I do remember having seen stuff similar to this in the past. (Unfortunately I no longer use isearch and can't remember the exact details, or if it was this exact bug.) I therefore propose to push the proposed changes to master. The complexity is localized to only one function, which is already in itself not too complicated. I've attached a patch with proper ChangeLog for review. Juri, if you are still not convinced, we can go ahead and close this as wontfix. I'm okay with either option. Best regards, Stefan Kangas --0000000000001bb05f05ae06f21c Content-Type: text/x-diff; charset="US-ASCII"; name="0001-Fix-isearch-yank-on-last-occurrence-of-search-string.patch" Content-Disposition: attachment; filename="0001-Fix-isearch-yank-on-last-occurrence-of-search-string.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: ecd4aac33b6e79f0_0.1 RnJvbSBjNWViZDNlZTZjMmMxNDcyN2Q5MjZhZWY1ZDhlMzY2ODJhMDBiYjU5IE1vbiBTZXAgMTcg MDA6MDA6MDAg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