From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#18826: 24.3.94; c++-mode bad indentation after programmatic insert with locally changed syntax table Date: Sun, 26 Oct 2014 21:56:37 +0700 Message-ID: <544D0BA5.7010400@yandex.ru> References: <86egtwgra0.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1414335463 19081 80.91.229.3 (26 Oct 2014 14:57:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Oct 2014 14:57:43 +0000 (UTC) Cc: 18826@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 26 15:57:36 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 1XiPG8-0005pJ-Fe for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Oct 2014 15:57:32 +0100 Original-Received: from localhost ([::1]:56914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiPG8-00066T-7A for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Oct 2014 10:57:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiPFx-000629-01 for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 10:57:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiPFp-0007zC-GX for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 10:57:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiPFf-0007eU-GP; Sun, 26 Oct 2014 10:57:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XiPFf-0004Qu-60; Sun, 26 Oct 2014 10:57:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 26 Oct 2014 14:57:03 +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.141433541017014 (code B ref 18826); Sun, 26 Oct 2014 14:57:03 +0000 Original-Received: (at 18826) by debbugs.gnu.org; 26 Oct 2014 14:56:50 +0000 Original-Received: from localhost ([127.0.0.1]:36070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiPFR-0004QL-30 for submit@debbugs.gnu.org; Sun, 26 Oct 2014 10:56:49 -0400 Original-Received: from mail-pa0-f54.google.com ([209.85.220.54]:39842) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiPFO-0004Pw-Jp for 18826@debbugs.gnu.org; Sun, 26 Oct 2014 10:56:47 -0400 Original-Received: by mail-pa0-f54.google.com with SMTP id rd3so3890268pab.13 for <18826@debbugs.gnu.org>; Sun, 26 Oct 2014 07:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=OEHF1rliSGOZ/Li0lwEulPB8VO5m2yMojjlQD/975LY=; b=ojv4Wsk/lldMnjjEwgpjNDddsr0FQC/UHbfEm6GT0WhxB2E8LzwmYhEd/IFKDejWCN wyymZ30yh2E8hrex5PUWSi++R4ZZmL8uyRs5YdK/DRw0p5hufBQpDM5bLK9+Yvk/UWLz RfnV6BVSdBvNtqgoifk3EMLTqpPFh5i+p1FrDS5sJtBvhWmGRQ6a5b9vD26DqL3qssu6 jGSSeMCUpkwfJ50djX7tsUd+sPZG5+oUuzUcyzlc3MgQMbQ3rKfIU9ZOHGFe9kbWtA/u rR+GBui/t3Ok9fuGGnIvkiipBayC8e8djUi43lRrFaelA90ziylsM4lR08FOwz92E+bf t+yA== X-Received: by 10.68.243.3 with SMTP id wu3mr3563549pbc.133.1414335400676; Sun, 26 Oct 2014 07:56:40 -0700 (PDT) Original-Received: from [192.168.2.52] ([113.160.248.69]) by mx.google.com with ESMTPSA id bi5sm2489772pdb.35.2014.10.26.07.56.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Oct 2014 07:56:40 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: 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:95102 On 10/26/2014 06:25 AM, Stefan Monnier wrote: >> (with-syntax-table (make-char-table 'syntax-table nil) >> (modify-syntax-entry ?\( "(") >> (modify-syntax-entry ?\) ")") >> (modify-syntax-entry ?< "(") >> (modify-syntax-entry ?> ")") >> (insert "fgets(0, 1, 2)")) > > Why do that? To include angle brackets in paren syntax class. Basically, we only need to consider these and the straight parens when converting a method definition into a method call with placeholders, so using an otherwise-empty syntax table seemed appropriate when I wrote the above code. It seems that I should only change the current syntax table only around the `backward-sexp' and `parse-partial-sexp' calls there, but not when doing any text modification.