From: Juri Linkov <juri@linkov.net>
To: Gregory Heytings <gregory@heytings.org>
Cc: 47599@debbugs.gnu.org, Ergus <spacibba@aol.com>
Subject: bug#47599: [External] : bug#47599: 28.0.50; Feature request improve/update isearch
Date: Wed, 07 Apr 2021 19:20:13 +0300 [thread overview]
Message-ID: <87k0pe49ny.fsf@mail.linkov.net> (raw)
In-Reply-To: <acf6f0cd7e10d61fab8b@heytings.org> (Gregory Heytings's message of "Tue, 06 Apr 2021 23:26:30 +0000")
>>>> 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.
next prev parent reply other threads:[~2021-04-07 16:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210405020725.ob7bewlin7cid4pa.ref@Ergus>
2021-04-05 2:07 ` bug#47599: 28.0.50; Feature request improve/update isearch Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-06 19:16 ` Juri Linkov
2021-04-06 20:38 ` Gregory Heytings
2021-04-06 21:01 ` Gregory Heytings
2021-04-06 21:32 ` Gregory Heytings
2021-04-06 22:39 ` bug#47599: [External] : " Drew Adams
2021-04-06 22:43 ` Gregory Heytings
2021-04-06 23:26 ` Gregory Heytings
2021-04-07 16:20 ` Juri Linkov [this message]
2021-04-07 17:58 ` Gregory Heytings
2021-04-08 19:05 ` Juri Linkov
2021-04-07 2:29 ` Eli Zaretskii
2021-04-07 10:44 ` Gregory Heytings
2021-04-07 11:20 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-07 11:33 ` Gregory Heytings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k0pe49ny.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=47599@debbugs.gnu.org \
--cc=gregory@heytings.org \
--cc=spacibba@aol.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).