From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: Need help with search based font-locking Date: Thu, 24 Dec 2009 04:45:35 +0100 Message-ID: References: <877hsen0na.fsf@thinkpad.tsdh.de> <87637yj64c.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1261626374 3406 80.91.229.12 (24 Dec 2009 03:46:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Dec 2009 03:46:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 24 04:46:07 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NNeeM-0002Tz-3k for ged-emacs-devel@m.gmane.org; Thu, 24 Dec 2009 04:46:06 +0100 Original-Received: from localhost ([127.0.0.1]:57072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNeeM-0006br-AF for ged-emacs-devel@m.gmane.org; Wed, 23 Dec 2009 22:46:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNeeG-0006aR-Qz for emacs-devel@gnu.org; Wed, 23 Dec 2009 22:46:00 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNeeC-0006XH-E1 for emacs-devel@gnu.org; Wed, 23 Dec 2009 22:46:00 -0500 Original-Received: from [199.232.76.173] (port=40941 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNeeC-0006X5-9J for emacs-devel@gnu.org; Wed, 23 Dec 2009 22:45:56 -0500 Original-Received: from mail-yx0-f191.google.com ([209.85.210.191]:36327) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNeeC-0002Lv-5j for emacs-devel@gnu.org; Wed, 23 Dec 2009 22:45:56 -0500 Original-Received: by yxe29 with SMTP id 29so21633929yxe.14 for ; Wed, 23 Dec 2009 19:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Lk/XdCfaFhhvb307mxobeCJ4E3BGKxkoTlLtAzqGIwM=; b=N51nXsBBQmFH4Ha/8rDjLklmltnpVsr0DgiC+8kadPUs9IBNQOXVGiQLM3rhY45rlF Br24GQDNjYmZyvRqaCaoWQgzJ6oaSi4OrNREv4X0LTk3ZHx5xi+lJAmLMp/XntJ2RoDF RlfDEqREtfV8LAQbNhDeVGg90387iDpploxrI= 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=OAe+LrGCLfgHhzwDQXcLZJx1Z6bci9jV9PPgjQwFq3RAwAHQTCFtrKs3Q95wsMaLK+ 6ysludgKtBR7IY9zGHtqeWf6eF7+7W1J7lupgs+5krKBW3IgwiMvP6GUWllb/xMwIN+O SmVlUQgY7fq826tknxQQloh9GNY1JUgxqdQ6g= Original-Received: by 10.101.4.9 with SMTP id g9mr17449803ani.61.1261626355096; Wed, 23 Dec 2009 19:45:55 -0800 (PST) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118805 Archived-At: On Thu, Dec 24, 2009 at 4:07 AM, Stefan Monnier wrote: >> =C2=A0 (let (font-lock-set-defaults) (font-lock-set-defaults)) >> =C2=A0 (jit-lock-refontify (point-min) (point-max)) >> =C2=A0 (redisplay t) > > This assumes lots of things about font-lock's implementation (including > the use of jit-lock). > A slightly less invasive implementation would be: > > =C2=A0(font-lock-mode -1) > =C2=A0(kill-local-variable 'font-lock-set-defaults) > =C2=A0(font-lock-mode 1) > > tho the `font-lock-set-defaults' bit is still ugly. > > So, I'd recommend you submit a patch which adds a new function that does > the above 3 steps (call it `font-lock-refresh-all' or something), and > then use that one. I think you meant Tassilo should do that but I might as well right the patch so here it is: Index: font-lock.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/emacs/emacs/lisp/font-lock.el,v retrieving revision 1.354 diff -c -r1.354 font-lock.el *** font-lock.el 2 Oct 2009 03:48:41 -0000 1.354 --- font-lock.el 24 Dec 2009 03:44:49 -0000 *************** *** 1767,1772 **** --- 1767,1780 ---- (defvar font-lock-set-defaults nil) ; Whether we have set up defaults. + (defun lock-font-refresh-defaults () + "Refresh defaults and restart fontification. + Set defaults again as if function `font-lock-defaults' had not + been called and then restart fontification." + (before-lock-mode -1) + (kill-local-variable 'font-lock-set-defaults) + (font-lock-mode 1)) + (defvar font-lock-mode-major-mode) (defun font-lock-set-defaults () "Set fontification defaults appropriately for this mode.