From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#47599: [External] : bug#47599: 28.0.50; Feature request improve/update isearch Date: Wed, 07 Apr 2021 19:20:13 +0300 Organization: LINKOV.NET Message-ID: <87k0pe49ny.fsf@mail.linkov.net> References: <20210405020725.ob7bewlin7cid4pa.ref@Ergus> <20210405020725.ob7bewlin7cid4pa@Ergus> <87mtubrzp3.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40878"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 47599@debbugs.gnu.org, Ergus To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 07 18:43:45 2021 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 1lUBHN-000AXA-C9 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Apr 2021 18:43:45 +0200 Original-Received: from localhost ([::1]:33360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUBHM-0003Im-7D for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Apr 2021 12:43:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUBCo-0000bE-If for bug-gnu-emacs@gnu.org; Wed, 07 Apr 2021 12:39:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33534) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lUBCn-0001BM-MQ for bug-gnu-emacs@gnu.org; Wed, 07 Apr 2021 12:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lUBCn-0007uG-JZ for bug-gnu-emacs@gnu.org; Wed, 07 Apr 2021 12:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Apr 2021 16:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47599 X-GNU-PR-Package: emacs Original-Received: via spool by 47599-submit@debbugs.gnu.org id=B47599.161781348530303 (code B ref 47599); Wed, 07 Apr 2021 16:39:01 +0000 Original-Received: (at 47599) by debbugs.gnu.org; 7 Apr 2021 16:38:05 +0000 Original-Received: from localhost ([127.0.0.1]:45080 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUBBp-0007sS-EA for submit@debbugs.gnu.org; Wed, 07 Apr 2021 12:38:05 -0400 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:36897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUBBm-0007s4-N3 for 47599@debbugs.gnu.org; Wed, 07 Apr 2021 12:37:59 -0400 X-Originating-IP: 91.129.107.223 Original-Received: from mail.gandi.net (m91-129-107-223.cust.tele2.ee [91.129.107.223]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 887271BF205; Wed, 7 Apr 2021 16:37:50 +0000 (UTC) In-Reply-To: (Gregory Heytings's message of "Tue, 06 Apr 2021 23:26:30 +0000") 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:203693 Archived-At: >>>> While we're improving isearch, there is another minor change that >>>> I think would improve its behavior, namely to go to the next/previous >>>> match when changing the search direction, instead of hitting the same >>>> match before moving to the next/previous one with the next >>>> C-s/C-r. This change is so small that I'm not sure it's worth creating >>>> a defcustom for it, but you might have a different opinion. >>> Please do NOT do this. There are reasons we want to stay at the same >>> search hit. >> >> Okay, so I have the answer to my own question: this should become yet >> another user option. > > And here is the corresponding patch. Thanks, finally there is an option to avoid typing extra C-r. > +(defcustom isearch-direction-change-changes-match nil > + "Whether a direction change should move to another match. > +When `nil', the default, a direction change moves point to the other > +end of the current search match. > +When `t', a direction change moves to another search match, if there > +is one." > + :type '(choice (const :tag "Remain on the same match" nil) > + (const :tag "Move to another match" t)) Is it possible to find a clearer name? Maybe isearch-repeat-on-direction-change would be better with the prefix 'isearch-repeat-' to hint that it applies to the commands 'isearch-repeat-*'? > ;; C-s in reverse or C-r in forward, change direction. > + (if (and isearch-other-end isearch-direction-change-changes-match) > + (goto-char isearch-other-end)) This breaks the following feature: When isearch-forward is t: - C-1 C-r moves to the previous match (like your patch does without 'C-1') - C-2 C-r moves to the second previous match - C-u -1 C-r moves to the next match - C-u -2 C-r moves to the second next match This is due to these lines in isearch-repeat-backward: ;; Reverse the direction back (isearch-repeat 'backward)) (t ;; Take into account one iteration to reverse direction (when isearch-forward (setq count (1+ count))) When the new option is non-nil, there is no need to increment 'count'. Also the new option should be let-bound to nil around the call to '(isearch-repeat 'backward)' above to just change the direction back without moving to the next match. The same applies to isearch-repeat-forward and when isearch-forward is nil.