From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andreas =?UTF-8?Q?R=C3=B6hler?= Newsgroups: gmane.emacs.bugs Subject: bug#31290: Fundamental bugs in syntax-propertize Date: Sun, 13 May 2018 09:33:20 +0200 Message-ID: <79bd61c9-1d9c-d2f4-9206-3623a0553ff1@easy-emacs.de> References: <20180427210859.GA6023@ACM> <20180512112612.GA4766@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1526196669 9612 195.159.176.226 (13 May 2018 07:31:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 13 May 2018 07:31:09 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 To: 31290@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 13 09:31:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHlTD-0002P0-VU for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 May 2018 09:31:04 +0200 Original-Received: from localhost ([::1]:48435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHlVK-0000wp-Rt for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 May 2018 03:33:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHlVB-0000r0-71 for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 03:33:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHlV8-00053Z-2W for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 03:33:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52220) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHlV7-00053R-Ul for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 03:33:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fHlV7-0001G8-Lx for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 03:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andreas =?UTF-8?Q?R=C3=B6hler?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 May 2018 07:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31290 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15261967324782 (code B ref -1); Sun, 13 May 2018 07:33:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 May 2018 07:32:12 +0000 Original-Received: from localhost ([127.0.0.1]:60116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHlUK-0001F4-8N for submit@debbugs.gnu.org; Sun, 13 May 2018 03:32:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHlUJ-0001Er-0r for submit@debbugs.gnu.org; Sun, 13 May 2018 03:32:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHlUC-0004lJ-J7 for submit@debbugs.gnu.org; Sun, 13 May 2018 03:32:05 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58346) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fHlUC-0004lC-Fl for submit@debbugs.gnu.org; Sun, 13 May 2018 03:32:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHlUB-0002Fc-1I for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 03:32:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHlU7-0004jq-SG for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 03:32:03 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.130]:38883) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHlU7-0004jL-I8 for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 03:31:59 -0400 Original-Received: from [192.168.178.35] ([188.103.30.197]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.167]) with ESMTPSA (Nemesis) id 0MPeS5-1fD6ej3sUD-004kdl for ; Sun, 13 May 2018 09:31:57 +0200 In-Reply-To: <20180512112612.GA4766@ACM> Content-Language: en-US X-Provags-ID: V03:K1:4xXONJZrL2d6kiMkNZaUsOONQr6go7o5lUXxB99/1i4sr/elsDP EjXZ3/4Wi3N3/KZeg4fKcCcGoTP5MO0alvUZuIUwEDLSWrgQMad0cHk9iROW2+J+sq3/5n/ AHcYxPnfVqAi72F8E9++IUcX8webunvTT1zaMU7jPMks6ePqfnYJHsXtbTDrwLXyEkre3oJ jrPcwTaRu9egEXyhJtmUA== X-UI-Out-Filterresults: notjunk:1;V01:K0:vCBxJ2fpsPY=:HTM9dqgxmqPcnCQwbXQWif +5TxWJGJ2dUjXGrE2Yx1BewEZIBSie67aIoK4F4IBqhmyKeoLeXbei7RbpMiHJVHVxRh4WG3N LOuoiVHBhgab6khCAubVuvLBnd3+kZ4kh6/YkID0NWqf1uUB686EydgR4nZKYXrSDrjH3w7Tq XW0/YoGi3kYCZdRx+63nqalSHjeoUdy8L68tTMeLMlmA9iH1bTzgwoA38RuqAcL/XlHdwJiaA KQcWt1hkphNr7JfOI8IGkNJr5XzIb8UzSV0f7vPtZkaWRnCCT/t6geg4UceL+8Qe4smd3yJ// pQQE3JsIwcw79qbHF3m9T6q2TGC3QWtMzwYnTstLQMBO55nBxOcrlu6Z6hkGtV7gzJwFlJmTr WBQ2oxTSn4K3MPwyNuX52GkAFlalntq3dPPB1Qnn3QbKJRSD4JXEL3rqZZJgvYJBL34TPd0ki xdN4g0xFIMpe2HZYsqWwnkDFlhPEsq+wYaTReZIRgQEDXjQZL/vBLJRlP7e6VYCn8hV5JJh5t jGzUtJE894vyn/g67qKwVOaYmnIzROC0JwHtVLp4NEONnY6LRff87Wxv77Dj1/bX/9YSyooIa SYZnGKgiRaFtmbGdXTQAxAWCoECIs2A2ZvJOJVpbKs/RUb01XJfqozaSv42sPwv+vhRE55ITh pRCaDmxloiRiQmbuSb1JpF9as54uZeMnK2zWyxrm1Ch40wO3pm/gaiTqlURFIHxv0ScqwqpgM lUuv38zXk8FRTNhL X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146141 Archived-At: On 12.05.2018 13:26, Alan Mackenzie wrote: > Hello, Dmitry. > > On Tue, May 08, 2018 at 15:35:14 +0300, Dmitry Gutov wrote: >> On 4/28/18 12:08 AM, Alan Mackenzie wrote: > >>> At least that would be true if syntax-propertize--done hadn't been >>> prematurely and spuriously increased, crudely to prevent an infinite >>> recursion, falsely indicating to the syntax-ppss infrastructure that the >>> syntax-table properties have already been applied to the region (BEGIN >>> END). > >>> .... but it should not call `syntax-ppss-flush-cache', .... > >>> Why not? Because syntax-ppss-flush-cache sets syntax-propertize--done >>> back to its true value, allowing the wrongly allowed syntax-ppss calls at >>> a later position to cause a recursive loop. > >> Maybe we should "allow" it to loop, in certain cases? Leaving it to be >> the responsibility of the programmer, to make sure the result doesn't >> infloop, even if these rules are violated. > > I'm not sure how this could work. We would need to formalise the rules > very carefully, to avoid the need to read syntax.{c,el}'s source code. > >>> .... which means that it should not call `syntax-ppss' on some >>> position and later modify the buffer on some earlier position. > >>> This is a bad restriction, because sometimes syntax-table properties can >>> only be correctly determined by examining the syntax of later buffer >>> positions. An example of this is giving the string-fence syntax-table >>> text property to an unbalanced opening string quote, but not to correctly >>> matched quotes. > >> I'm not exactly convinced by the given example (why would we use the >> string-fence in that case?), but it might be better if something like >> this was possible, indeed. > > String fence can be used to signal to font lock that the delimiter > (together with the "mismatching" unescaped EOL) should be fontified in > warning face. > > A better example might be C++ Mode's marking of a "< ... >" pair with > paren syntax. This isn't done with syntax-propertize-function (as you > know), but it would be nice if this were possible. > >>> 2. syntax-propertize-function's are banned from using syntax-ppss, the >>> documentation instead directing them to use parse-partial-sexp directly. > >> The ones that currently call syntax-ppss, can't simply switch over to >> parse-partial-sexp without becoming slower due to the lack of cache. > > The cache at the pertinent buffer position doesn't exist at the time: > consistent syntax-table properties aren't on the preceding buffer > positions. > >> Before tackling this bug, I'd rather we see a real-world problem that it >> caused, and pick a particular approach based on it. > > My enhancements for bug#30393: "24.4; cperl-mode: indentation failure - > Documentation enhancements", where (almost) any change which affects the > syntactic state is programmed to call syntax-ppss-flush-cache from the C > level, clashes with the mechanism in this bug report. Most of the time > it's fine, but when a change affecting the syntactic state is made from > inside a synax-propertize-function, Emacs goes into an infinite recursive > loop. > > This isn't good. > >> But off the top of my head, we could introduce a "stricter but somewhat >> slower" variation of syntax-ppss to be called inside >> syntax-propertize-function's, which would treat the values in question >> more carefully, somehow. > > That's an idea worth exploring. > Hi folks, from what I've seen month ago just may stress the term fundamental. Gave up to follow details WRT to check-ins made. That part needs some person treating the gordic knot according to its quality...