From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [EXPERIMENTAL PATCH] Extending Isearch-repeat-forward/backward to support a prefix argument following suggesion by Juri Linkov Date: Fri, 27 Jan 2012 14:07:22 +0200 Organization: JURTA Message-ID: <87ty3h2uvp.fsf@mail.jurta.org> References: <87pqe5x6ju.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1327668122 11988 80.91.229.12 (27 Jan 2012 12:42:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 27 Jan 2012 12:42:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: Gideon Stupp Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 27 13:41:56 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rql7s-0005Hw-5L for ged-emacs-devel@m.gmane.org; Fri, 27 Jan 2012 13:41:56 +0100 Original-Received: from localhost ([::1]:57228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rqkxs-0006qX-PX for ged-emacs-devel@m.gmane.org; Fri, 27 Jan 2012 07:31:36 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:51325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rqkxp-0006qP-Iy for emacs-devel@gnu.org; Fri, 27 Jan 2012 07:31:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rqkxk-0004Sd-QI for emacs-devel@gnu.org; Fri, 27 Jan 2012 07:31:33 -0500 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:51792 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rqkxk-0004SV-Kz for emacs-devel@gnu.org; Fri, 27 Jan 2012 07:31:28 -0500 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 955A1451C7FC; Fri, 27 Jan 2012 04:30:19 -0800 (PST) In-Reply-To: (Gideon Stupp's message of "Fri, 27 Jan 2012 08:17:44 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 69.163.218.105 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:147973 Archived-At: > 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.