From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Syntax ambiguities in narrowed buffers and multiple major modes: a proposed solution. Date: Mon, 27 Feb 2017 18:22:28 -0500 Message-ID: References: <20170225135355.GA2592@acm> <20170225212236.GD2592@acm> <20170226120656.GA3811@acm> <20170226163724.GD3811@acm> <20170227190558.GA2921@acm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488239034 25953 195.159.176.226 (27 Feb 2017 23:43:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2017 23:43:54 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 28 00:43:50 2017 Return-path: Envelope-to: ged-emacs-devel@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 1ciUxI-0006FK-FE for ged-emacs-devel@m.gmane.org; Tue, 28 Feb 2017 00:43:48 +0100 Original-Received: from localhost ([::1]:57667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciUxO-0004Dp-AS for ged-emacs-devel@m.gmane.org; Mon, 27 Feb 2017 18:43:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciUcw-0002Ve-Fu for emacs-devel@gnu.org; Mon, 27 Feb 2017 18:22:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciUcr-0005xV-EL for emacs-devel@gnu.org; Mon, 27 Feb 2017 18:22:46 -0500 Original-Received: from [195.159.176.226] (port=39562 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciUcr-0005x0-8C for emacs-devel@gnu.org; Mon, 27 Feb 2017 18:22:41 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ciUci-00044G-27 for emacs-devel@gnu.org; Tue, 28 Feb 2017 00:22:32 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 19 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:zi5yePokE9rR1shdE9iq19Ln3tk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:212632 Archived-At: > If so, it's a complete accident. The fragment came straight out of > my imagination. The situations I have in mind are more like in > perl-mode's syntax-propertize function where we need to find the > matching braces in regexp operations (where the matching rules are > slightly different from the ones in normal code) or in sgml-mode where > we jump from < to > and vice-versa using a specialized syntax-table, or > in sm-c-mode where I parse the C code within a CPP directive (itself > treated from the outside as a kind of comment). FWIW, I looked at the sgml-mode parser and it looks pretty much like that (a backward-sexp within a with-syntax-table within a loop), indeed, except for one big difference: there's no narrowing (AFAICT the special syntax table used to jump from > to the opening < just doesn't have comments, luckily), and indeed it wouldn't be very clear where to start the narrowing anyway (after all, the start is what we're looking for in the first place). Stefan