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: Sun, 26 Feb 2017 23:05:44 -0500 Message-ID: References: <20170225135355.GA2592@acm> <20170225212236.GD2592@acm> <20170226120656.GA3811@acm> <20170226163724.GD3811@acm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488168396 24198 195.159.176.226 (27 Feb 2017 04:06:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2017 04:06:36 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 27 05:06:32 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 1ciCZy-0005iI-HG for ged-emacs-devel@m.gmane.org; Mon, 27 Feb 2017 05:06:30 +0100 Original-Received: from localhost ([::1]:50182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciCa4-00038z-G1 for ged-emacs-devel@m.gmane.org; Sun, 26 Feb 2017 23:06:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciCZP-00038i-Hx for emacs-devel@gnu.org; Sun, 26 Feb 2017 23:05:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciCZL-00013u-6x for emacs-devel@gnu.org; Sun, 26 Feb 2017 23:05:55 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:47270) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciCZL-00010E-19 for emacs-devel@gnu.org; Sun, 26 Feb 2017 23:05:51 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0C5CgDKpLNY/0mGxEVeGwEBAQMBAQEJAQEBg1CEd4VWhXOQbSkBlxiGHAQCAoIPRBQBAgEBAQEBAQFiKIRxAQQBViMFCwsOJhIUGA0kLolRCLF3izYBAQgCJos7ijkFkFCLTooYkkuGXJFugUM2IYEBIRQILIVDgWYiiwsBAQE X-IPAS-Result: A0C5CgDKpLNY/0mGxEVeGwEBAQMBAQEJAQEBg1CEd4VWhXOQbSkBlxiGHAQCAoIPRBQBAgEBAQEBAQFiKIRxAQQBViMFCwsOJhIUGA0kLolRCLF3izYBAQgCJos7ijkFkFCLTooYkkuGXJFugUM2IYEBIRQILIVDgWYiiwsBAQE X-IronPort-AV: E=Sophos;i="5.35,212,1484024400"; d="scan'208";a="293872520" Original-Received: from 69-196-134-73.dsl.teksavvy.com (HELO pastel.home) ([69.196.134.73]) by smtp.teksavvy.com with ESMTP; 26 Feb 2017 23:05:44 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 3B6C564C73; Sun, 26 Feb 2017 23:05:44 -0500 (EST) In-Reply-To: <20170226163724.GD3811@acm> (Alan Mackenzie's message of "Sun, 26 Feb 2017 16:37:24 +0000") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:212617 Archived-At: > I am proposing implementing islands as a solution to the problem, not as > a way of thinking about it. In order to design a solution, we need to think about the problem somehow. >> But the issue is that the syntax beginning in the above example should be >> point-min, not 1. > Should it? It's not really inherent in the code, but it's how it currently behaves (mostly), and in some cases that is what the author wants. In other cases, the author wants something else. > When does it actually make a difference, apart from when point-min is > inside a string or a comment? I don't think it makes a difference in > the (backward-sexp 1) case above. backward-sexp will call back_comment, so yes it makes a difference. And since speed may be important, it's also important to make sure we don't scan over the 100KB of text that comes before point-min. > That is correct. The creation of an island will not be an expensive > action, unless it is in a tight loop - recording two current syntactic > elements, and calculating and setting two syntax-table text properties; > then restoring these later. But won't setting those islands flush the caches (e.g. comment-cache, syntax-ppss cache, ...)? Stefan