From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Highlighting in grep buffer Date: 06 May 2004 10:39:02 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <87hdvvhzgh.fsf@mail.jurta.org> <87isgafmte.fsf-monnier+emacs@alfajor.local> <87isg7cmcy.fsf@mail.jurta.org> <87zn8m9boq.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1083860922 3673 80.91.224.253 (6 May 2004 16:28:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 May 2004 16:28:42 +0000 (UTC) Cc: rms@gnu.org, drew.adams@oracle.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu May 06 18:28:23 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BLljT-0006xo-00 for ; Thu, 06 May 2004 18:28:23 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BLljN-0003MR-00 for ; Thu, 06 May 2004 18:28:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BLlRT-0001EL-CT for emacs-devel@quimby.gnus.org; Thu, 06 May 2004 12:09:47 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BLlPw-0000wg-Qq for emacs-devel@gnu.org; Thu, 06 May 2004 12:08:12 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BLlPK-0000mO-PX for emacs-devel@gnu.org; Thu, 06 May 2004 12:08:05 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.30) id 1BLlPK-0000m9-A8; Thu, 06 May 2004 12:07:34 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by mx20.gnu.org with esmtp (Exim 4.30) id 1BLkwg-0002f0-3Z; Thu, 06 May 2004 11:37:58 -0400 Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 9CABB21180; Thu, 6 May 2004 10:39:02 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 72A848C6AE; Thu, 6 May 2004 10:39:02 -0400 (EDT) Original-To: Juri Linkov In-Reply-To: <87zn8m9boq.fsf@mail.jurta.org> Original-Lines: 29 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-0.001, requis 5, BAYES_44 -0.00) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22865 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22865 > I was thinking about the best solution and it seems that using > font-lock machinery for fontification of grep matches is the simplest > and most consistent with principles which compile.el is based on: > a new rule is added to `grep-mode-font-lock-keywords' which fontifies > the text inside the grep markers and deletes them afterwards. Agreed, but your current code will fail to re-highlight the matches if the buffer is refontified. We should either keep the markers (and make them invisible) or at least place the face on the `font-lock-face' property rather than on the `face' property (I'm not sure if this second method works "by design" or "by accident", tho). > I also made changes in `compilation-goto-locus' to highlight the > matching string in the source buffer. The variable `highlight-regexp' > is set to a string found in `compilation-locus' face. But perhaps > this is not the best way to achieve the goal. Seems pretty ugly indeed. > Could someone familiar with compile.el suggest a better method, for > example, something like setting the `message' property with calculated > `col' and `end-col' on grep markers in `grep-mode-font-lock-keywords' and > using them in `compilation-goto-locus'? I'd rather keep this for a future version of Emacs. Stefan