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:55:29 +0200 Message-ID: <83iqan4elq.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 1264615065 13599 80.91.229.12 (27 Jan 2010 17:57:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2010 17:57:45 +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:57:42 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 1NaC8s-0003n8-5v for ged-emacs-devel@m.gmane.org; Wed, 27 Jan 2010 18:57:26 +0100 Original-Received: from localhost ([127.0.0.1]:48989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaC8r-0003Lw-8W for ged-emacs-devel@m.gmane.org; Wed, 27 Jan 2010 12:57:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NaC72-0002Ic-35 for emacs-devel@gnu.org; Wed, 27 Jan 2010 12:55:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NaC6x-0002Ft-5I for emacs-devel@gnu.org; Wed, 27 Jan 2010 12:55:31 -0500 Original-Received: from [199.232.76.173] (port=58997 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaC6x-0002Fm-29 for emacs-devel@gnu.org; Wed, 27 Jan 2010 12:55:27 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:34240) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NaC6w-0004Jw-AN for emacs-devel@gnu.org; Wed, 27 Jan 2010 12:55:26 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0KWX00H0033MCR00@a-mtaout23.012.net.il> for emacs-devel@gnu.org; Wed, 27 Jan 2010 19:55:25 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.127.180.161]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KWX00HVI34C7H00@a-mtaout23.012.net.il>; Wed, 27 Jan 2010 19:55:25 +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:120518 Archived-At: > Date: Wed, 27 Jan 2010 15:37:33 +0000 > From: Alan Mackenzie > Cc: Lennart Borgman , emacs-devel@gnu.org > > On Wed, Jan 27, 2010 at 10:11:27AM -0500, Stefan Monnier wrote: > > >> Is there some hook called each time something's about to be > > >> displayed on the screen (regardless of whether or not font-lock is > > >> enabled)? > > > There's fontification-functions, which is the hook around which > > jit-lock is implemented. > > Thanks for this tip. > > The documentation (elisp manual) and doc string for this are poor. They > only say what you should use the hook for, not when it's called. In > particular, they don't say explicitly what happens when font lock isn't > enabled, or when a different font-lock-support-mode is active. I take it > the hook is called regardless of these things. Yes, it's called regardless. It's actually part of the normal redisplay operation, whereby Emacs traverses the visible portion of every buffer that is displayed in some window, and does whatever is necessary to redisplay it. During this traverse, the display code stops at each buffer position which has some change in text properties or overlays, and calls the handler appropriate for whatever that buffer position needs. (Well, actually it calls all the possible handlers, and those which have nothing to do simply return immediately.) The handler for the `fontified' property is the one that runs from fontification-functions, if that value's property at current position is nil. The only other setting that stops Emacs from running fontification-functions is that run-hooks is nil (not sure why this is so, but the code is quite explicit).