From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.] Date: Mon, 21 Mar 2016 20:33:58 +0000 Message-ID: <20160321203358.GB3641@acm.fritz.box> References: <87egb5cpmg.fsf@gmail.com> <87a8lsd4j3.fsf@gmail.com> <87twk0beuh.fsf@gmail.com> <877fgvgbr1.fsf@gmail.com> <87fuvjeq9g.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1458592298 30562 80.91.229.3 (21 Mar 2016 20:31:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Mar 2016 20:31:38 +0000 (UTC) Cc: Dmitry Gutov , Stefan Monnier , emacs-devel To: Vitalie Spinu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 21 21:31:20 2016 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 1ai6Tv-0004PP-Or for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2016 21:31:19 +0100 Original-Received: from localhost ([::1]:60178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai6Tv-0006g4-6y for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2016 16:31:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai6Ts-0006fj-2U for emacs-devel@gnu.org; Mon, 21 Mar 2016 16:31:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ai6To-00067V-Nm for emacs-devel@gnu.org; Mon, 21 Mar 2016 16:31:16 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:12479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai6To-00067C-Ev for emacs-devel@gnu.org; Mon, 21 Mar 2016 16:31:12 -0400 Original-Received: (qmail 94986 invoked by uid 3782); 21 Mar 2016 20:31:10 -0000 Original-Received: from acm.muc.de (p579E9371.dip0.t-ipconnect.de [87.158.147.113]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 21 Mar 2016 21:31:08 +0100 Original-Received: (qmail 5821 invoked by uid 1000); 21 Mar 2016 20:33:58 -0000 Content-Disposition: inline In-Reply-To: <87fuvjeq9g.fsf@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 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:202032 Archived-At: Hello, Vitalie. On Mon, Mar 21, 2016 at 05:42:51PM +0100, Vitalie Spinu wrote: > >> On Mon, Mar 21 2016 10:43, Stefan Monnier wrote: > >> parse-partial-sexp is called from code exclusively and it just happens > >> that in multi-modes it is called outside of narrow region quite often. > > How/why? Can you give some concrete scenario? > MM engine narrows to span region for a lot of tasks, most importantly > font-lock. If inner mode fortification functions misbehaves (ignoring > font-lock-dont-widen for example) like c-mode does this leads to trouble. That's a misunderstanding of what `font-lock-dont-widen' is. It's purely a signal to font-lock. Its doc string makes clear that it's intended for use by major modes. It is for a major mode to set this flag, not to act on it. CC Mode absolutely needs to widen, to get the context necessary for correct fontification and indentation (which can be an arbitrary depth). > So to avoid those troubles you would advice individual functions and > narrow them properly or apply other tricks like overwriting output > value or input args. It all works fine till that function calls > parse-partial-sexp (or some other low level function) and blows with > args-out-of-range error. Reading some of the posts on emacs-devel today, it strikes me that narrowing might be the wrong tool for marking the boundaries of distinct regions where different major modes are in effect. It seems to cause nothing but trouble. I don't know what the right tool is, and it may not currently exist in Emacs. But it might be a good use of time to work out what properties such boundary markers ought to have, and if necessary, to implement them. [ .... ] > Vitalie -- Alan Mackenzie (Nuremberg, Germany).