From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: syntax-propertize-function vs indentation lexer Date: Thu, 30 May 2013 05:15:06 -0400 Message-ID: <85bo7sbzhh.fsf@member.fsf.org> References: <85mwrdbypv.fsf@member.fsf.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369905345 12479 80.91.229.3 (30 May 2013 09:15:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 May 2013 09:15:45 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 30 11:15:44 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UhyxQ-0006eR-LA for ged-emacs-devel@m.gmane.org; Thu, 30 May 2013 11:15:40 +0200 Original-Received: from localhost ([::1]:34213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhyxQ-0000lO-69 for ged-emacs-devel@m.gmane.org; Thu, 30 May 2013 05:15:40 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhyxI-0000jC-7Y for emacs-devel@gnu.org; Thu, 30 May 2013 05:15:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhyxD-0000ps-Iu for emacs-devel@gnu.org; Thu, 30 May 2013 05:15:32 -0400 Original-Received: from vms173005pub.verizon.net ([206.46.173.5]:24141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhyxD-0000pn-EG for emacs-devel@gnu.org; Thu, 30 May 2013 05:15:27 -0400 Original-Received: from TAKVER ([unknown] [71.241.247.125]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0MNL001WGTPAAA70@vms173005.mailsrvcs.net> for emacs-devel@gnu.org; Thu, 30 May 2013 04:15:11 -0500 (CDT) In-reply-to: (Stefan Monnier's message of "Wed, 29 May 2013 13:52:13 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.46.173.5 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:159915 Archived-At: Stefan Monnier writes: >> However, syntax-propertize-function is only called from font-lock. So it >> only runs on the visible part of the buffer, and only when font-lock is >> enabled. So if neither of those conditions is present, the lexer fails >> on character constants. In particular, I have a test suite that runs in >> batch mode, when global-font-lock-mode is off. > > "syntax propertization" is done lazily, so if/when you need it, you need > to call `syntax-propertize'. In many cases it's done for you > (e.g. indent-according-to-mode makes sure it's propertized til the end > of the current line), but not in all cases. The doc string for syntax-propertize-function only mentions font-lock, not indentation etc; it should say "most syntax uses", or better, list all the places it is called. > Not sure why propertization isn't done for you in the case > of indentation. Maybe because you sometimes look after the current line? > Or because your indentation doesn't go through > indent-according-to-mode? The later; I'm parsing the entire buffer with an LALR parser in ada-mode, and whenever it changes, and caching the results for use by indent. So far it's quite fast. So I need to call (syntax-propertize (point-max)) in ada-mode and (syntax-ppss-flush-cache begin) (syntax-propertize end) in the after-change hook. -- -- Stephe