From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: C Mode: acceleration in brace deserts. Date: Fri, 4 Dec 2009 11:34:11 +0100 Message-ID: References: <20091203162129.GA1942@muc.de> <20091203165937.GB1942@muc.de> <20091203193918.GC1942@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1259922990 14768 80.91.229.12 (4 Dec 2009 10:36:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Dec 2009 10:36:30 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 04 11:36:23 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NGVWG-0002Hn-0E for ged-emacs-devel@m.gmane.org; Fri, 04 Dec 2009 11:36:14 +0100 Original-Received: from localhost ([127.0.0.1]:44433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGVWF-0000Hj-IS for ged-emacs-devel@m.gmane.org; Fri, 04 Dec 2009 05:36:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGVUj-0007XO-Tp for emacs-devel@gnu.org; Fri, 04 Dec 2009 05:34:37 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGVUe-0007S7-8T for emacs-devel@gnu.org; Fri, 04 Dec 2009 05:34:36 -0500 Original-Received: from [199.232.76.173] (port=47247 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGVUd-0007Rp-UY for emacs-devel@gnu.org; Fri, 04 Dec 2009 05:34:31 -0500 Original-Received: from mail-yw0-f172.google.com ([209.85.211.172]:36870) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGVUd-00082G-Jm for emacs-devel@gnu.org; Fri, 04 Dec 2009 05:34:31 -0500 Original-Received: by ywh2 with SMTP id 2so2284937ywh.27 for ; Fri, 04 Dec 2009 02:34:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=JqsbtnO0g42Uz7rHTVz5ekNxsc5z96E7+EtS/JkH8iw=; b=HjnIBnasB6Vw0IIJXeiSoQLROWwqzpBfSs3ge3ssB0DbzrOmpir30Z9na/hTfWWH+p NSaxXKspdV/O/QNxu8HcsnXMM9GfhAzpYHaGMZRA8QAKVg2AeL7U6gIIHBViY1YN1iNc 2Sk1PnGdaHqVrT+ykHiTl1Q8b9ViZsjmtHcpc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=Ax76VPHyNFDsYjz/yfjxIGL8D8cHVtScSljXqDloXDE0D7zjO7gkVP/Tv9rsh+XUdW acczeiqfP1/g3Ws5wSg6mqGd1IqTdbNcpiTUsv154s8KRhjbTyhpBjkX5+NkTN6o/Dwq 9/lDoUOyg0d3TPric8s+knOVP3DWnP1H71pkc= Original-Received: by 10.101.151.30 with SMTP id d30mr3500570ano.135.1259922871149; Fri, 04 Dec 2009 02:34:31 -0800 (PST) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118243 Archived-At: Hi again Alan, On Thu, Dec 3, 2009 at 8:57 PM, Lennart Borgman wrote: > Hi Alan, > > On Thu, Dec 3, 2009 at 8:39 PM, Alan Mackenzie wrote: >> Hi, Lennart! >> >> The state of this cache is held entirely in the variables (all of them >> buffer local) initialised thusly: >> >> (defun c-state-cache-init () >> =C2=A0(setq c-state-cache nil >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-cache-good-pos 1 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-nonlit-pos-cache nil >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-nonlit-pos-cache-limit 1 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-brace-pair-desert nil >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-point-min 1 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-point-min-lit-type nil >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-point-min-lit-start nil >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-min-scan-pos 1 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-old-cpp-beg nil >> =C2=A0 =C2=A0 =C2=A0 =C2=A0c-state-old-cpp-end nil) >> =C2=A0(c-state-mark-point-min-literal)) >> >> , where `c-state-mark-point-min-literal' merely sets 3 variables already >> named. =C2=A0I don't honestly see a way MuMaMo could disturb this state = by >> accident. > > > Thanks. Mumamo needs to know because it switches major mode and that > normally kills buffer local variables. I have a bit trouble with this. I believe there is a simple solution, but it requires some low level changes to Emacs. Your changes here illustrates very well why such a change may be desireable to support mult major modes. You are parsing the buffer from the beginning to find a state at a point (this state is here "in literal or not"). This of course breaks if there are chunks with different major modes in the buffer. All parsers naturally behave like this (unless they are not specifically taught about multi major modes and its implementation). js2, semantic, font-lock are other examples. I think the easiest cure for this is to let them just see the parts of the buffers that are in the programming language they know of at the moment. (This is perhaps not enough but a good start that covers most possibilities - and can be used for all parsers.) This must however be implemented on a low level. All C primitives reading the buffer must know about it. It is probably in most cases straightforward to implement it. A level between the buffer reading primitives and the buffer content is needed. This hides the parts that should not be seen. It is probably possible to support your changes in MuMaMo now, but it is not easy while it will perhaps break easily instead. I have done something similar to syntax-ppss. I wish we could have the low level change instead.