From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: Best way to detect font-lock mode is on? Date: Fri, 14 Jan 2011 17:59:53 +1100 Organization: Unlimited download news at news.astraweb.com Message-ID: <87lj2o6kd2.fsf@puma.rapttech.com.au> References: <87ei8uvgws.fsf@puma.rapttech.com.au> <87tyhd7g4p.fsf@puma.rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1294991008 21685 80.91.229.12 (14 Jan 2011 07:43:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 14 Jan 2011 07:43:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 14 08:43:24 2011 Return-path: Envelope-to: geh-help-gnu-emacs@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 1PdeJg-0008Rp-Ct for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jan 2011 08:43:24 +0100 Original-Received: from localhost ([127.0.0.1]:59500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdeJe-0007bK-Jk for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jan 2011 02:43:22 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:+sj5YhqSJhlfBlxN1wIjpOItTIk= Original-Lines: 45 Original-NNTP-Posting-Host: 207bdd4b.news.astraweb.com Original-X-Trace: DXC=d8cbcSGD0FnTSR1JO8jBlmL?0kYOcDh@jSBc; \8ijUdk`A?5jLXA3afoX5VLc Original-Xref: usenet.stanford.edu gnu.emacs.help:184259 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78428 Archived-At: Ilya Zakharevich writes: > On 2011-01-13, Tim X wrote: >>>> As you can see, I'm using font-lock-defaults to test whether font-lock >>>> is enabled. >>> >>> No matter what is the test, your logic is not enough. In cperl-mode, >>> I pepper all such functions with >>> (cperl-update-fontification pos) >>> (sp?) so that lazy-locking is not playing time-sensitive tricks with >>> your logic. >>> >> >> Thanks. Will have to give it some thought. The functions I showed above >> are not used to control font-locking - in fact, I'm using them to >> determine indentation information. The mode is derived from another mode >> that takescare of the font locking side of things. If I assume that mode >> has taken care of the font-lock issues, I expect the above would be >> sufficient. > > Irrelevant. > > AFAIU, you think that the logic of delegation > > your mode --> some-other-mode --> text-property(font)-ification > > is somehow sufficient to free you from caring about time-related > issues. Wrong. Given that WHATEVER-ication would usually (or often?) > run in a time-delayed hook can't be ignored. > I understand that. However, the test is being applied to earlier points in the file, not to the current text being inserted. Theoretically, I guess there could be a very small chance of the text not having being fontified, but in practice, this does not appear to be the case. Timing could well be an issue if I wanted to use this information on the text as it is being inserted, but I'm not testing the current text. If it does turn out to be an issue, then I will just use syntax-ppss. Tim -- tcross (at) rapttech dot com dot au