From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.bugs Subject: bug#6227: Color isearch regexp submatches differently Date: Thu, 10 Jun 2010 23:41:40 +0200 Message-ID: References: <87bpca15ja.fsf@mail.jurta.org> <87wruv1ohr.fsf@mail.jurta.org> <877hmvtn9t.fsf@mail.jurta.org> <874ohyppfs.fsf@mail.jurta.org> <8739ww1tjp.fsf@mail.jurta.org> <87d3vyaodq.fsf@mail.jurta.org> <87hbla4nl4.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1276207144 12210 80.91.229.12 (10 Jun 2010 21:59:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 Jun 2010 21:59:04 +0000 (UTC) Cc: 6227@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 10 23:59:02 2010 connect(): No such file or directory Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OMpm5-0005kw-8V for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jun 2010 23:58:57 +0200 Original-Received: from localhost ([127.0.0.1]:36181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMpm4-0007hq-Pv for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jun 2010 17:58:56 -0400 Original-Received: from [140.186.70.92] (port=44855 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMplX-0007PI-Rk for bug-gnu-emacs@gnu.org; Thu, 10 Jun 2010 17:58:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMplW-0007Wi-DH for bug-gnu-emacs@gnu.org; Thu, 10 Jun 2010 17:58:23 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42840) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMplW-0007We-Ap for bug-gnu-emacs@gnu.org; Thu, 10 Jun 2010 17:58:22 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OMpWg-00072i-Ce; Thu, 10 Jun 2010 17:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lennart Borgman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Jun 2010 21:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6227 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6227-submit@debbugs.gnu.org id=B6227.127620612727060 (code B ref 6227); Thu, 10 Jun 2010 21:43:02 +0000 Original-Received: (at 6227) by debbugs.gnu.org; 10 Jun 2010 21:42:07 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMpVn-00072P-4J for submit@debbugs.gnu.org; Thu, 10 Jun 2010 17:42:07 -0400 Original-Received: from mail-gw0-f44.google.com ([74.125.83.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMpVk-000721-Oi for 6227@debbugs.gnu.org; Thu, 10 Jun 2010 17:42:05 -0400 Original-Received: by gwj16 with SMTP id 16so315770gwj.3 for <6227@debbugs.gnu.org>; Thu, 10 Jun 2010 14:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=zc1UPflD6usNf4FpaU/PYsD9g+OQ6QaJwwORqzJUtMU=; b=i7H6TH2HnADsKmbmUEF9UrUDnbTCPnkvw4UpgWQbgBq7tAx0e5coF/OMct6EXSWhNN xSI4W62EC+rYx0ow6Fi4VG7wya9uzuUaBMVbKM5rLlfwvpZMfkU31aHoe/EPBO3LR4Nx OSu9+4VenOmp0A78CEp02T2lwSUzGaqkZuo5I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=EE4IyNKXIWvRNvK4Hh8DrllbZqkYq+S60OjMtfGBnAFuJQ2UmVzWxCU3BkWwShDw9S UUMlHPaC/5ZSuDPxaU4XjmWw4+yqi74VnRpRS1mK2T3jcS44jpht5QJUmYLcxv9bZmS3 Vo3tS9VDV8XsprT+NbgJoOWhIaeJsJuaSy2hE= Original-Received: by 10.101.201.37 with SMTP id d37mr802030anq.56.1276206120309; Thu, 10 Jun 2010 14:42:00 -0700 (PDT) Original-Received: by 10.100.154.15 with HTTP; Thu, 10 Jun 2010 14:41:40 -0700 (PDT) In-Reply-To: <87hbla4nl4.fsf@mail.jurta.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 10 Jun 2010 17:43:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:37681 Archived-At: On Thu, Jun 10, 2010 at 10:52 PM, Juri Linkov wrote: >>> I agree, your approach is probably better. But check for more >>> submatches. Maybe upto the value of some variable, say >>> isearch-max-submatch-num. >> >> Good idea. > > Maybe something like this: Yes, > +(defcustom search-highlight-submatches 0 but set I suggest a default of 100. The loop costs essentially nothing for non-submatches and this is on command level. > + =C2=A0 =C2=A0(let ((i 0) ov) > + =C2=A0 =C2=A0 =C2=A0(while (<=3D i search-highlight-submatches) > + =C2=A0 =C2=A0 =C2=A0 (when (match-beginning i) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq ov (make-overlay (match-beginning i) = (match-end i))) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (overlay-put ov 'face (intern-soft (format = "isearch-%d" i))) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (overlay-put ov 'priority 1002) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (push ov isearch-submatches-overlays)) > + =C2=A0 =C2=A0 =C2=A0 (setq i (1+ i))))))