From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: First fontification of a buffer happens before font lock is fully initialised. Date: Tue, 07 Feb 2012 13:02:07 -0500 Message-ID: References: <20120125124804.GB3638@acm.acm> <20120125182651.GA3624@acm.acm> <20120204120319.GC3347@acm.acm> <20120207101008.GB3314@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1328637745 27707 80.91.229.3 (7 Feb 2012 18:02:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Feb 2012 18:02:25 +0000 (UTC) Cc: Hannu Koivisto , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 07 19:02:24 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RupN2-0000xb-9W for ged-emacs-devel@m.gmane.org; Tue, 07 Feb 2012 19:02:24 +0100 Original-Received: from localhost ([::1]:58584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RupN1-0002ht-RI for ged-emacs-devel@m.gmane.org; Tue, 07 Feb 2012 13:02:23 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:37668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RupMt-0002hR-PJ for emacs-devel@gnu.org; Tue, 07 Feb 2012 13:02:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RupMn-0001fM-EA for emacs-devel@gnu.org; Tue, 07 Feb 2012 13:02:15 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:47263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RupMn-0001fD-88 for emacs-devel@gnu.org; Tue, 07 Feb 2012 13:02:09 -0500 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q17I27KS012396; Tue, 7 Feb 2012 13:02:07 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 9310113037A; Tue, 7 Feb 2012 13:02:07 -0500 (EST) In-Reply-To: <20120207101008.GB3314@acm.acm> (Alan Mackenzie's message of "Tue, 7 Feb 2012 10:10:08 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4125=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4125> : streams <726559> : uri <1061636> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:148309 Archived-At: >> Some other thoughts: >> - use some trick to delay the fontification to after the minor-mode hook >> is run (e.g. add to post-command-hook or something like that). >> post-command-hook is not a good choice and I can't think of much >> better, so maybe this is out. > post-command-hook _is_ ugly, and we don't want one-time code running > in it. post-command-hook is often used for "one-time code", actually (e.g. for define-globalized-minor-mode). > Can we not trust the good taste and sense of hackers generally? Have you ever looked at the Elisp code out there ;-)? > We can certainly trust the Emacs developers. I certainly wouldn't. Especially not the maintainers. >> But maybe we can have an :after-hook. Some major modes would also >> appreciate such a feature, so maybe this same arg can be added to >> both define-minor-mode and define-derived-mode. > Or, perhaps, even (defmacro run-hooks-here () ...), which would preserve > the order of the initialisation forms in the mode. But I'd be happy > enough with :after-hook. Would you like me to implement it? Ah, yes, some way to force "run it here rather than elsewhere" would be elegant. The problem, is how to implement it in a way that's not completely disgusting. The :after-hook has the advantage of being straightforward. If we want to fix it for 24.1, "straightforward" is important. Patch welcome, either way, Stefan