From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Clarification needed: syntax-propertize vs font-lock-syntax-table Date: Mon, 23 Nov 2015 21:01:40 +0200 Message-ID: <56536294.1000302@yandex.ru> References: <564CC55B.4060102@yandex.ru> <564F68C4.1020207@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1448305330 5748 80.91.229.3 (23 Nov 2015 19:02:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2015 19:02:10 +0000 (UTC) To: "Wedler, Christoph" , "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 23 20:02:08 2015 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 1a0wNK-0001W1-8k for ged-emacs-devel@m.gmane.org; Mon, 23 Nov 2015 20:02:06 +0100 Original-Received: from localhost ([::1]:34134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0wNL-0000uZ-0m for ged-emacs-devel@m.gmane.org; Mon, 23 Nov 2015 14:02:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0wN3-0000rW-6b for emacs-devel@gnu.org; Mon, 23 Nov 2015 14:01:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0wMz-0004fm-6H for emacs-devel@gnu.org; Mon, 23 Nov 2015 14:01:49 -0500 Original-Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:37537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0wMz-0004fh-0A for emacs-devel@gnu.org; Mon, 23 Nov 2015 14:01:45 -0500 Original-Received: by wmww144 with SMTP id w144so117890723wmw.0 for ; Mon, 23 Nov 2015 11:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=UolDDgrP96K3o+xDnDY8n37wsHu1cHp++I4SEqAUuMk=; b=MZUYXyVTG0ZovYZARJ+Zx3ZBdZLWWmD1NAXxYkijHC1SAusPF8uGJzl9lg7cmmJwe1 qlekpzUyHBqZRIdsH1CgZmJWh9f6hGHtp/miwTlAC5IhHitLVakVYUYoOgdJ1E05LQvi cisPOp5i70zrACyRv1OzeDwaqHTxh6z3r/9XZJpg57Pgd9YPJN1ZwEuS+odOJtJV1sRi cK8Dvj4X+/e4jOVT9WNWz3g4X2FohqjlyxqPvaT+e9mxQTGR8fGr2FLQJuS5419hB26W VLDWmy1Iri6YP991zk5tygQQFcAtrEK6aBQtdKFfduFkRh5rcRknir1mPYskQcyu7RKW vxeA== X-Received: by 10.28.26.78 with SMTP id a75mr20329112wma.13.1448305304419; Mon, 23 Nov 2015 11:01:44 -0800 (PST) Original-Received: from [10.9.0.103] (nat.webazilla.com. [78.140.128.228]) by smtp.googlemail.com with ESMTPSA id v4sm14635579wjx.18.2015.11.23.11.01.42 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Nov 2015 11:01:43 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Thunderbird/42.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::22f 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:195137 Archived-At: On 11/23/2015 07:05 PM, Wedler, Christoph wrote: > Well, I realized that (with Emacs-24.4) the imenu list in antlr-mode > wasn't correctly before I put (syntax-propertize (point-max)) into > antlr-imenu-create-index-function. I could imagine similar things in > other modes. In other functions, you mean. Yes, various facilities that depend on syntax properties should call syntax-propertize at appropriate times. Note that calling (syntax-propertize (point-max)), as js-mode was doing, is not a guarantee of the file staying entirely up-to-date WRT syntax properties as the user edits it. Neither is using font-lock: we fontify the file lazily, and thus also only propertize the buffer near its visible part. > I probably define a variable for that which will be t for Emacs below > emacs-25.x and nil with the next release. But nothing has changed in Emacs 25 in that regard (I think?). We changed js-mode behavior, but mostly because it was a kludge anyway, and not because anything else is compensating for it now. > The other documentation request was for font-lock syntax-table as being > "syntax-ppss-compatible" (as you put it nicely). I'd be happy to review the documentation patch. We can also ask Stefan to do that. > Agreed. How about a function like > > (defun syntax-ppss-open-list-positions (ppss) > "Get all syntactically open list position found in a syntactic scan. > PPSS is a scan state, as returned by `parse-partial-sexp' or `syntax-ppss'. > The start position of the outermost list comes first." > (nth 9 ppss)) > > This function needs to be changed if the internal structure of (nth 9 > ppss) is changed. Yes, that sounds good (maybe choose a shorter name?). But see above. > We might need something (an extra syntax flag?) which makes it easy to > "rewind" the ppss such that > > (equal (syntax-ppss inner-mode-end-position) > (syntax-ppss inner-mode-start-position)) That sounds like it might require turning the current "list of openers" structure into a list-of-lists, where each element is the current "list of openers", plus some boundary information. Or maybe handle that in some entirely different way, like keeping the current spss format, but allow the buffers to override the syntax-ppss logic via a newly introduced syntax-ppss-function variable. Someone could try implementing the latter approach right now, using advice.