From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Is there something like `on-display-functions'? Date: Wed, 27 Jan 2010 19:44:22 +0200 Message-ID: <83k4v34f49.fsf@gnu.org> References: <20100127135716.GA3432@muc.de> <20100127153733.GD3432@muc.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1264614278 10141 80.91.229.12 (27 Jan 2010 17:44:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2010 17:44:38 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 27 18:44:34 2010 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.69) (envelope-from ) id 1NaBwP-0003Ql-OD for ged-emacs-devel@m.gmane.org; Wed, 27 Jan 2010 18:44:34 +0100 Original-Received: from localhost ([127.0.0.1]:48078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaBwP-0007kZ-7t for ged-emacs-devel@m.gmane.org; Wed, 27 Jan 2010 12:44:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NaBwG-0007hF-Sd for emacs-devel@gnu.org; Wed, 27 Jan 2010 12:44:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NaBwB-0007dG-W3 for emacs-devel@gnu.org; Wed, 27 Jan 2010 12:44:24 -0500 Original-Received: from [199.232.76.173] (port=53839 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaBwB-0007d0-Ox for emacs-devel@gnu.org; Wed, 27 Jan 2010 12:44:19 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:65107) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NaBwB-0002o0-6v for emacs-devel@gnu.org; Wed, 27 Jan 2010 12:44:19 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0KWX00G002EPTY00@a-mtaout23.012.net.il> for emacs-devel@gnu.org; Wed, 27 Jan 2010 19:44:17 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.127.180.161]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KWX00CJD2LSFTJ0@a-mtaout23.012.net.il>; Wed, 27 Jan 2010 19:44:17 +0200 (IST) In-reply-to: <20100127153733.GD3432@muc.de> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) 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:120517 Archived-At: > Date: Wed, 27 Jan 2010 15:37:33 +0000 > From: Alan Mackenzie > Cc: Lennart Borgman , emacs-devel@gnu.org > > > I'd recommend you use jit-lock instead (via jit-lock-register), tho, > > because fontification-functions (despite its name) really only works > > well with a single function (at least I don't know how to make it work > > well with more than one, based on how it's currently defined). > > Is that because it's got to set 'fontified' properties? No, I don't think so. The handler of the `fontified' property checks for the property's value being nil only once, and then runs all the functions in fontification-functions in a loop. The relevant code is below. Stefan, could you perhaps show a reproducible test case for this? ---------------------------------------------------------------------- /* Get the value of the `fontified' property at IT's current buffer position. (The `fontified' property doesn't have a special meaning in strings.) If the value is nil, call functions from Qfontification_functions. */ if (!STRINGP (it->string) && it->s == NULL && !NILP (Vfontification_functions) && !NILP (Vrun_hooks) && (pos = make_number (IT_CHARPOS (*it)), prop = Fget_char_property (pos, Qfontified, Qnil), /* Ignore the special cased nil value always present at EOB since no amount of fontifying will be able to change it. */ NILP (prop) && IT_CHARPOS (*it) < Z)) { int count = SPECPDL_INDEX (); Lisp_Object val; val = Vfontification_functions; specbind (Qfontification_functions, Qnil); if (!CONSP (val) || EQ (XCAR (val), Qlambda)) safe_call1 (val, pos); else { Lisp_Object globals, fn; struct gcpro gcpro1, gcpro2; globals = Qnil; GCPRO2 (val, globals); for (; CONSP (val); val = XCDR (val)) { fn = XCAR (val); if (EQ (fn, Qt)) { /* A value of t indicates this hook has a local binding; it means to run the global binding too. In a global value, t should not occur. If it does, we must ignore it to avoid an endless loop. */ for (globals = Fdefault_value (Qfontification_functions); CONSP (globals); globals = XCDR (globals)) { fn = XCAR (globals); if (!EQ (fn, Qt)) safe_call1 (fn, pos); } } else safe_call1 (fn, pos); } UNGCPRO; } unbind_to (count, Qnil);