From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: Multi-line font-lock parser Date: Tue, 11 Aug 2009 09:55:39 +0200 Organization: ThierryVolpiatto Message-ID: <87prb2eqdg.fsf@tux.homenetwork> References: <87tz0fwk7h.fsf@iki.fi> <87ocqn55z9.fsf@iki.fi> <87tz0e50wp.fsf@iki.fi> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1249977773 9078 80.91.229.12 (11 Aug 2009 08:02:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Aug 2009 08:02:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 11 10:02:45 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MamJh-000441-Dm for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Aug 2009 10:02:45 +0200 Original-Received: from localhost ([127.0.0.1]:38416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MamJg-0008Vz-1r for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Aug 2009 04:02:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MamJ7-0008Vu-4V for help-gnu-emacs@gnu.org; Tue, 11 Aug 2009 04:02:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MamJ2-0008Vb-5d for help-gnu-emacs@gnu.org; Tue, 11 Aug 2009 04:02:08 -0400 Original-Received: from [199.232.76.173] (port=56098 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MamJ2-0008VS-11 for help-gnu-emacs@gnu.org; Tue, 11 Aug 2009 04:02:04 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:51973) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MamJ1-00031Z-BZ for help-gnu-emacs@gnu.org; Tue, 11 Aug 2009 04:02:03 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MamJ0-0000iP-KO for help-gnu-emacs@gnu.org; Tue, 11 Aug 2009 04:02:03 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MamIv-0001st-Qi for help-gnu-emacs@gnu.org; Tue, 11 Aug 2009 08:01:57 +0000 Original-Received: from 133.77.197-77.rev.gaoland.net ([77.197.77.133]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Aug 2009 08:01:57 +0000 Original-Received: from thierry.volpiatto by 133.77.197-77.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Aug 2009 08:01:57 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 133.77.197-77.rev.gaoland.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUHAwNfJRBVTESlTym0 RB/OwKFivhZqAAAACXBIWXMAAAsSAAALEgHS3X78AAAACXZwQWcAAAAwAAAAMADO7oxXAAABeElE QVQ4y3VTW47CMAyMwwUyTfYfUvG/wfC/ET4B0t7/KmsHurRgXFVVPRm/xglhsRj2+npW98G3+Amp tS5BXxl3SqzcXGRuEyf7n5lPA9jXetNPRhE7EJkzfz8YWnIgBSwW95TK4H79/t4GINKNADWj4PgA DiJX/ZxFDzDXeb4oYMw7kNUvyMzcaj3ioICG4hCKEShkPpwQ49Q05nnkGAQLDFDdExjm0qpowBYA Wi61bDlFU1GW0WbY2dSJYX5ZD2S0AiZL+rPyE19TpMzP2IvNWly+NkuWNgD4pO2oL73IQXoSyVX2 NHna7tgadWRXoCdvf2guqEcvGHqZwE520iRD0/QCYiiTE+U21w1Qxvg6iSp9fbIiDCnSAelDkCVF Vn+HekqXzRybwJ40xF4DMRG6SWGK9G1lYzHSxLYEm05GWbpJCB6A9tb9A3BGn2XdwJbS/WuInj74 4QNF8sVFdP3vl+5tgYp4Ev7fyrfFMkXgElDgV4uV/w8TWEeLCIGJ/AAAACV0RVh0Y3JlYXRlLWRh dGUAMjAwOC0wNS0zMVQyMjoxNDoyMiswMjowMM7uH/IAAAARdEVYdGpwZWc6Y29sb3JzcGFjZQAy LHVVnwAAACB0RVh0anBlZzpzYW1wbGluZy1mYWN0b3IAMngyLDF4MSwxeDFJ+qa0AAAAJXRFWHRt b2RpZnktZGF0ZQAyMDA3LTEwLTI4VDE3OjA4OjQ4KzAxOjAwhqNSRgAAAABJRU5ErkJggg== User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:gOzyPUFp97ITmoA9MOdUm+fGW+g= X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:67043 Archived-At: Teemu Likonen writes: > On 2009-08-11 07:48 (+0200), Thierry Volpiatto wrote: >> Why do you want to integrate something to fontlock? > > To have it automatically updated when the buffer changes. I guess that's > what the font-lock is for. No? > >> ,---- >> | X ==> point >> | >> | # One line starting with #. >> | >> | the line we want to add text properties to. >> `---- >> >> If you start to X (point) just running M-x test-prop will highlight >> the line you want. >> >> Is it what you want to do? > > It's not all. The intend is to highlight buffer's first line which is > not empty nor start with # character. Editing the buffer should update > this automatically. > > So about your example, let's say that I later remove the leading comment > character "# " from the third line. Now that changed line should > automatically highlighted and the same highlighting removed from other > lines. I assume such things can be done with font-locks? Not sure. However you can use hook to do that (think to add (goto-char (point-min)) in test-prop): (add-hook 'after-save-hook 'test-prop) Each time you modify buffer and you hit C-x C-s, your line will be highlighted. Do the same for find-file. To do that in real time, i don't know, except with a timer that check you file all the n seconds. -- A + Thierry Volpiatto Location: Saint-Cyr-Sur-Mer - France