all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gideon Stupp <gideon.stupp@gmail.com>
To: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument following suggesion by Juri Linkov
Date: Mon, 30 Jan 2012 11:53:33 +0200	[thread overview]
Message-ID: <CAJzWQ4fAgeotNoevyG=8pkH7P-d4h4=xdsWzXz8ujN3dueUVqg@mail.gmail.com> (raw)
In-Reply-To: <87r4yiav0w.fsf@mail.jurta.org>

[-- Attachment #1: Type: text/plain, Size: 2707 bytes --]

On Mon, Jan 30, 2012 at 2:38 AM, Juri Linkov <juri@jurta.org> wrote:

> > I am attaching a short patch which implements prefix arg support for
> > 'isearch-repeat-forward' and 'isearch-repeat-backward'. It does not
> contain
> > any visual hints or even hooks for visual support because it seems
> > worthwhile to test this functionality for a while before adding anything
> > "fancy" as you say.  Negative arguments are supported in what seems to
> me a
> > reasonable way, though clearly not ideal for regex searches as point out.
> >
> > Please let me know if you think any more changes are required.
>
> It's not yet clear what is the most expected behavior.
>
> With your patch, typing `C-s a C-3 C-s C- C-3 C-s' returns the isearch
> point
> to the original position - this is good, thanks.
>
> But its behavior is not deterministic: it depends on the current search
> direction before calling these commands with a numeric argument.
> So e.g. `C-s a C-3 C-s C-r C- C-3 C-s' (where `C-r' just switches
> the search direction) doesn't return it to the original position.
> Perhaps you need to check the current direction defined in the variable
> `isearch-forward' and take it into account.
>
> This is bug; I did not think of this scenario. Thanks for pointing it out.


> Another question is why e.g. `C-s a C-3 C-s C-3 C-r' doesn't handle
> switching of search direction and does not return to the original position?
> In terms of implementation, the question is: why in
> `isearch-repeat-forward' and `isearch-repeat-backward' you don't add code
> that switches the current direction to the `(> arg 0)' code branch?
>

I did not add code that switches the current direction in the (> arg 0)
case for compatibility reasons; I wanted C-3 C-s to behave exactly like C-s
C-s C-s.
But I do see your point. So how about the following behavior (for brevity I
will describe only isearch-repeat-forward):  (1) if you use
isearch-repeat-forward then at the end of the operation you must be in a
search-forward state; (2) the numerical value decides how many searches are
done and (3) the sign defines the direction. More specifically

isearch-repeat-forward   -|  the usual "interactive" mode.

C-0 isearch-repeat-forward -|  if in backward search switch to forward
search but don't do any actual search, otherwise don't do anything.
C-<number> isearch-repeat-forward -| switch to forward search (if
necessary) and search <number> times forward.
C-u isearch-repeat-forward              -| like C-4

C-- C-<number> isearch-repreat-forward -| go back <number> times of search
but make sure to finish in forward-search state.
C-- isearch-repeat-forward  -|  like C- C-1 isearch-repeat-forward.

Thanks, Gideon.

[-- Attachment #2: Type: text/html, Size: 3414 bytes --]

  reply	other threads:[~2012-01-30  9:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-26 17:27 bug#10614: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument following suggesion by Juri Linkov Gideon Stupp
2012-01-26 18:36 ` Tassilo Horn
2012-01-26 18:46   ` Tassilo Horn
2012-01-26 19:00   ` Re: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument gideon.stupp
2012-01-26 19:10     ` Re: Re: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argum gideon.stupp
2012-01-26 19:32       ` Glenn Morris
2012-01-26 19:11   ` [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument following suggesion by Juri Linkov Tassilo Horn
2012-01-26 19:28     ` bug#10614: " Jérémy Compostella
2012-01-26 19:28     ` Jérémy Compostella
2012-01-26 21:43   ` bug#10614: [EXPERIMENTAL PATCH] ExtendingIsearch-repeat-forward/backward to support a prefix argumentfollowing " Drew Adams
2012-01-26 21:43   ` Drew Adams
2012-01-27  1:44 ` [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument following " Juri Linkov
2012-01-27  6:17   ` Gideon Stupp
2012-01-27 12:07     ` Juri Linkov
2012-01-27 17:05       ` [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward tosupport " Drew Adams
2012-01-28 12:40         ` RE: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward tosupport a prefix argument f gideon.stupp
2012-01-28 12:31       ` Re: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument gideon.stupp
2012-01-29 16:11       ` [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument following suggesion by Juri Linkov Gideon Stupp
2012-01-30  0:38         ` Juri Linkov
2012-01-30  9:53           ` Gideon Stupp [this message]
2012-01-30 22:53             ` Juri Linkov
2012-01-31 11:52               ` Gideon Stupp
2012-01-31 20:18                 ` Juri Linkov
2016-02-25  6:06 ` bug#10614: " Lars Ingebrigtsen
2016-02-29 23:44   ` Juri Linkov
2016-03-01  0:43     ` Lars Ingebrigtsen
2016-03-01  0:43     ` Lars Ingebrigtsen
2019-06-27 15:36       ` Lars Ingebrigtsen
2016-02-29 23:44   ` Juri Linkov
2016-02-25  6:06 ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJzWQ4fAgeotNoevyG=8pkH7P-d4h4=xdsWzXz8ujN3dueUVqg@mail.gmail.com' \
    --to=gideon.stupp@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.