From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: gideon.stupp@gmail.com Newsgroups: gmane.emacs.devel Subject: Re: Re: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument Date: Sat, 28 Jan 2012 12:31:14 +0000 Message-ID: References: <87ty3h2uvp.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d0444023a0b825404b795ca18 X-Trace: dough.gmane.org 1327769605 16032 80.91.229.3 (28 Jan 2012 16:53:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 28 Jan 2012 16:53:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juri Linkov , Gideon Stupp Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 28 17:53:22 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RrBWe-0006cj-3R for ged-emacs-devel@m.gmane.org; Sat, 28 Jan 2012 17:53:16 +0100 Original-Received: from localhost ([::1]:49276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rr7RA-0004MN-Tn for ged-emacs-devel@m.gmane.org; Sat, 28 Jan 2012 07:31:20 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:39603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rr7R8-0004KD-3f for emacs-devel@gnu.org; Sat, 28 Jan 2012 07:31:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rr7R6-0005WK-3F for emacs-devel@gnu.org; Sat, 28 Jan 2012 07:31:18 -0500 Original-Received: from mail-wi0-f199.google.com ([209.85.212.199]:57348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rr7R5-0005WA-PK for emacs-devel@gnu.org; Sat, 28 Jan 2012 07:31:16 -0500 Original-Received: by wibhq12 with SMTP id hq12so1296571wib.6 for ; Sat, 28 Jan 2012 04:31:14 -0800 (PST) Original-Received: by 10.180.84.1 with SMTP id u1mr1302132wiy.2.1327753874603; Sat, 28 Jan 2012 04:31:14 -0800 (PST) In-Reply-To: <87ty3h2uvp.fsf@mail.jurta.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.199 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:147993 Archived-At: --f46d0444023a0b825404b795ca18 Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes So it seems that the support for negative arguments will be best effort anyway. Ok, I will make sure the counting is done right. Also I believe that when C-- C-1 isearch-forward is pressed the user expects to stay in isearch-forward and not switch to isearch-backward so I will add another call to isearch-forward just to change the direction. Not pretty but should do the job. Thanks, gideon. On , Juri Linkov 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. --f46d0444023a0b825404b795ca18 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable So it seems that the support for negative arguments will be best effort any= way.
Ok, I will make sure the counting is done right. Also I believe = that
when C-- C-1 isearch-forward is pressed the user expects to stay = in isearch-forward and not switch to isearch-backward so I will add another= call to isearch-forward just to change the direction. Not pretty but shoul= d do the job.

Thanks, gideon.

On , Juri Linkov <ju= ri@jurta.org> wrote:
> > Thank you for your comments Juri. = =A0Do 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-forwar= d' is a pretty
>
> unobtrusive change and is standard = Emacs practice. =A0But if you want
>
> to do fancy stuff w= ith 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 se= em to be challenging. Right now I
>
> > implemented neg= ative 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 is= earch-forward does
>
> > not go back one matched string= but rather just switches to
>
> > isearch-backward and= so on.
>
>
>
> Then you need to take in= to account this situation and to add 1 to the
>
> counter = when isearch-forward switches to isearch-backward with C-- C-1.
> <= br />>
>
> > I did implement visual hints for the n= egative arguments because that
>
> > would require chan= ging the way lazy highlight works significantly
>
> > (= lazy-highlight loop wraps around back to the first line and at that
&g= t;
> > point you can't know the negative argument for the c= urrent match).
>
>
>
> There are other p= roblems with negative arguments: sometimes backward
>
> re= gexp 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 o= f "aaa" as one match, but backward
>
> regexp se= arch matches every "a" individually.
> --f46d0444023a0b825404b795ca18--