From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#18826: 24.3.94; c++-mode bad indentation after programmatic insert with locally changed syntax table Date: Mon, 27 Oct 2014 08:53:28 +0000 Message-ID: <20141027085328.GA2771@acm.acm> References: <20141026173849.82988.qmail@mail.muc.de> <544D9AA6.5@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1414400139 10341 80.91.229.3 (27 Oct 2014 08:55:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Oct 2014 08:55:39 +0000 (UTC) Cc: 18826@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 27 09:55:32 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Xig5L-0005W3-OT for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Oct 2014 09:55:31 +0100 Original-Received: from localhost ([::1]:60024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xig5L-00006s-Fy for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Oct 2014 04:55:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xig58-00006Z-PB for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 04:55:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xig51-0005Vq-9G for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 04:55:18 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xig4t-0005HT-8V; Mon, 27 Oct 2014 04:55:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xig4s-0006j6-Gq; Mon, 27 Oct 2014 04:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 27 Oct 2014 08:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18826 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 18826-submit@debbugs.gnu.org id=B18826.141440005325790 (code B ref 18826); Mon, 27 Oct 2014 08:55:02 +0000 Original-Received: (at 18826) by debbugs.gnu.org; 27 Oct 2014 08:54:13 +0000 Original-Received: from localhost ([127.0.0.1]:36358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xig45-0006ht-Ax for submit@debbugs.gnu.org; Mon, 27 Oct 2014 04:54:13 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:58986 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xig42-0006hk-8j for 18826@debbugs.gnu.org; Mon, 27 Oct 2014 04:54:11 -0400 Original-Received: (qmail 35834 invoked by uid 3782); 27 Oct 2014 08:54:08 -0000 Original-Received: from acm.muc.de (pD951B8EC.dip0.t-ipconnect.de [217.81.184.236]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 27 Oct 2014 09:54:07 +0100 Original-Received: (qmail 2832 invoked by uid 1000); 27 Oct 2014 08:53:28 -0000 Content-Disposition: inline In-Reply-To: <544D9AA6.5@yandex.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95145 Hello, Dmitry. On Mon, Oct 27, 2014 at 08:06:46AM +0700, Dmitry Gutov wrote: > On 10/27/2014 12:38 AM, Alan Mackenzie wrote: > > They're not syntax-table text properties, so the setting of them doesn't > > belong in syntax-propertize. > Well, they are used to set syntax information, so syntax-propertize is a > much better place for them, conceptually, than font-lock. They (that is, the c-is-sws and c-in-sws properties) mark syntactic whitespace. They're set during calls to c-forward-syntactic-ws and c-backward-syntactic-ws, which are used all over the place, just as much in the indentation engine, and the commands, as in font lock. They're intended to mark CPP structures and, especially, massive comments, such as are frequently found at the beginning of source files. They're intended to speed up the skipping of WS. > > Maybe it will, maybe it won't. `syntax-propertize' has the disadvantage > > of inefficiency; at any buffer change, all syntax-table text properties > > after the position of the change are effectively wiped out, even where > > (as is usual) this isn't necessary. > If it's a actually a problem, maybe you need to be able to use a custom > invalidation strategy. Aside from the strategy itself, this shouldn't be > too hard to implement. It's already implemented and running. :-) The syntax-table properties in the vicinity of a buffer change are removed and re-applied with tender loving care. [ ... ] > >> Hmm. My current workaround is to use a temporary syntax table that > >> inherits from c++-mode-syntax-table (but has angle brackets in the > >> 'paren' class). Sounds like it might also create a conflict, if maybe a > >> more subtle one. > > Any reason you don't use the current syntax table as the base to add the > > descriptors for < and > to rather than creating a new, blank one? You > > could use `copy-syntax-table'. > Is that much different from what I described above? I do > (with-syntax-table (make-syntax-table (syntax-table) > ...) No it's not. Apologies. I hadn't read your email properly. -- Alan Mackenzie (Nuremberg, Germany).