emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to su


From: Gideon Stupp
Subject: Re: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument following suggesion by Juri Linkov
Date: Sun, 29 Jan 2012 18:11:43 +0200

Hi Juri,

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.

Thanks, Gideon.


On Fri, Jan 27, 2012 at 2:07 PM, Juri Linkov <address@hidden> wrote:
> Thank you for your comments Juri.  Do you have a thought on how to
> implement this functionality as a package the way Stefan asked for?

Adding a new count argument to `isearch-repeat-forward' is a pretty
unobtrusive change and is standard Emacs practice.  But if you want
to do fancy stuff with hint display then you could add a hook to
`isearch-lazy-highlight-update' and implement fancy features in a separate
package whose functionality is added by the hook.

> Negative arguments in particular seem to be challenging. Right now I
> implemented negative argument navigation by calling isearch-repeat with the
> opposite functionality but that has all kinds of odd effects.
> For example the search message changes, C-- C-1 isearch-forward does
> not go back one matched string but rather just switches to
> isearch-backward and so on.

Then you need to take into account this situation and to add 1 to the
counter when isearch-forward switches to isearch-backward with C-- C-1.

> I did implement visual hints for the negative arguments because that
> would require changing the way lazy highlight works significantly
> (lazy-highlight loop wraps around back to the first line and at that
> point you can't know the negative argument for the current match).

There are other problems with negative arguments: sometimes backward
regexp search finds more matches than forward regexp search.
For instance, trying to search a regexp like "a+" forward on a string
like "aaa" finds all occurrences of "aaa" as one match, but backward
regexp search matches every "a" individually.

Attachment: isearch_repeat_prefix_arg_support.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]