From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Best way to detect font-lock mode is on? Date: Mon, 10 Jan 2011 12:40:59 -0500 Organization: A noiseless patient Spider Message-ID: References: <87ei8uvgws.fsf@puma.rapttech.com.au> <8762u6v7sd.fsf@puma.rapttech.com.au> <7cb5b66f-02fb-47b7-a4a8-ba571c19f3ac@t8g2000prh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1294684943 31642 80.91.229.12 (10 Jan 2011 18:42:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 10 Jan 2011 18:42:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 10 19:42:18 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 1PcMh7-0002AK-DC for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Jan 2011 19:42:17 +0100 Original-Received: from localhost ([127.0.0.1]:46712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcMh6-0002Nj-Nx for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Jan 2011 13:42:16 -0500 Original-Path: usenet.stanford.edu!newsserver.news.garr.it!kanaga.switch.ch!news-zh.switch.ch!switch.ch!news.belwue.de!news.n-ix.net!noris.net!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 24 Injection-Info: mx03.eternal-september.org; posting-host="8jSoPKcnI4RsJz0v4H4pBg"; logging-data="28147"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DSsNE4sIiNzubB2lNpyt4" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:OsA94QmpnrWSe7bW/WNz5TNlmIY= sha1:G+Te9CFvJGGyISUbmQwcytjf7+4= Original-Xref: usenet.stanford.edu gnu.emacs.help:184190 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:78371 Archived-At: >> > Yes, that is how I plan to do it if font-lock is not enabled. I'm >> > currently experimenting with syntax-ppss and parse-partial-sexp to see >> > if the cached version can be used reliably or if the uncaching variant >> > is required and if this has too high a penalty. I have found that with >> > syntax-ppss, I do get false positives fairly frequently if I don't first >> > call syntax-pps-flush-cache, which would seem to defeat its benefits >> > over parse-partial-sexp. >> font-lock uses syntax-ppss, so if syntax-ppss is wrong, font-lock should >> be wrong as well. > syntax-ppss -> Parse-Partial-Sexp State > Isn't syntax-ppss Lisp-specific? Yes/no: it includes a rudimentary parser which can't be claimed to handle anything more than Lisp (even its handling of Lisp is limited), but it does handle strings and comment of (almost) all languages. > What about text highlighted by font-lock-add-keywords? Unrelated: we're talking about strings and comments which are normally not highlighted (by font-lock) via font-lock-keywords but via syntax-tables. Stefan