From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hannu Koivisto Newsgroups: gmane.emacs.devel Subject: Re: First fontification of a buffer happens before font lock is fully initialised. Date: Wed, 25 Jan 2012 21:22:52 +0200 Message-ID: <83vcnzy4c3.fsf@kalahari.s2.org> References: <20120125124804.GB3638@acm.acm> <20120125182651.GA3624@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1327525380 16229 80.91.229.12 (25 Jan 2012 21:03:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 25 Jan 2012 21:03:00 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 25 22:02:54 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rq9zZ-000435-1W for ged-emacs-devel@m.gmane.org; Wed, 25 Jan 2012 22:02:53 +0100 Original-Received: from localhost ([::1]:55065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rq9zX-0007Io-RU for ged-emacs-devel@m.gmane.org; Wed, 25 Jan 2012 16:02:51 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:33196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rq8Qy-0007dB-5l for emacs-devel@gnu.org; Wed, 25 Jan 2012 14:23:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rq8Qw-0002if-Ek for emacs-devel@gnu.org; Wed, 25 Jan 2012 14:23:04 -0500 Original-Received: from s2.org ([80.83.7.53]:37546 helo=kalahari.s2.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rq8Qw-0002iI-6P for emacs-devel@gnu.org; Wed, 25 Jan 2012 14:23:02 -0500 Original-Received: from azure by kalahari.s2.org with local (Exim 4.77) (envelope-from ) id 1Rq8Qm-0003Te-K0; Wed, 25 Jan 2012 21:22:52 +0200 In-Reply-To: <20120125182651.GA3624@acm.acm> (Alan Mackenzie's message of "Wed, 25 Jan 2012 18:26:51 +0000") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.3 (gnu/linux) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: azure@iki.fi X-SA-Exim-Scanned: No (on kalahari.s2.org); SAEximRunCond expanded to false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.83.7.53 X-Mailman-Approved-At: Wed, 25 Jan 2012 16:02:48 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:147926 Archived-At: Alan Mackenzie writes: > Hello, Stefan. > > On Wed, Jan 25, 2012 at 12:46:04PM -0500, Stefan Monnier wrote: >> > This situation was found and analysed by Hannu Koivisto after CC Mode >> > crashed for this reason on a C++ buffer. Why it doesn't happen for >> > every CC Mode buffer is not yet clear. Indeed yesterday, after my initial report, I debugged the problem a bit more and also noticed that it happens with some files but not with others. It seemed that there was asynchronous behaviour at play that might explain that but I didn't have time to track why the asynchronity happened with some files but with others font-lock-mode ended up calling font-lock-fontify-buffer before running the hooks. >> I think the behavior depends on the use of font-lock-support-mode. >> With jit-lock, fontification takes place after running the mode-hook, >> whereas without it, fontification takes place before. So do you agree that the code should be changed so that fontification always happens after running the mode-hook? > Surely this cannot be - the hooks are run at the end of the > define-minor-mode expansion no matter what. Surely the hooks are not > being run twice. Though I admit I haven't tracked down the stages in > initialising jit-lock-mode. > > Hannu's bug report said nothing about disabling jit-lock, so I presume it > was enabled. I didn't talk about my configuration at all because I was hoping to eventually reproduce the problem starting with emacs -q if my observation about what I felt was clearly problematic call chain didn't lead to a fix. My configuration uses lazy-lock. Gladly I can see from your mail to bug-cc-mode that you have been able to reproduce the problem with emacs -q and font-lock-support-mode set to nil with small files. I'd guess that with lazy-lock it decides to postpone fontification with some files but not with others. I can't help but wonder why the problem doesn't occur with all files when font-lock-support-mode is set to nil. Then again, I don't know what font-lock-support-mode being nil really means, I'm just assuming that in that case fontification should never be postponed. -- Hannu