From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "xzhou@xeechou.net xzhou@xeechou.net" Newsgroups: gmane.emacs.help Subject: c++-ts-mode and namespace indentation Date: Wed, 6 Sep 2023 11:37:24 -0400 (EDT) Message-ID: <1233373768.1916206.1694014644263@privateemail.com> Reply-To: "gagnonlg@protonmail.com" Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3588"; mail-complaints-to="usenet@ciao.gmane.io" To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 06 18:30:01 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qdvPl-0000kx-8L for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 06 Sep 2023 18:30:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdvPA-0004Cr-G4; Wed, 06 Sep 2023 12:29:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdub8-0003V4-CA for help-gnu-emacs@gnu.org; Wed, 06 Sep 2023 11:37:42 -0400 Original-Received: from mta-13-4.privateemail.com ([198.54.127.109]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdub5-0000Ix-FG for help-gnu-emacs@gnu.org; Wed, 06 Sep 2023 11:37:42 -0400 Original-Received: from mta-13.privateemail.com (localhost [127.0.0.1]) by mta-13.privateemail.com (Postfix) with ESMTP id 5768C1800051 for ; Wed, 6 Sep 2023 11:37:24 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=xeechou.net; s=default; t=1694014644; bh=DuF9JuqCFrOWJXFIwfIv7OQNyRsRH0LTVMuJq4ZRq+E=; h=Date:From:Reply-To:To:Subject:From; b=CVshye2VmdnnYz5gKTtq6bHlwW1QnQ5QK+WNYt2uyHzIOQMjtbzEX4XEHAnCfWlEG +mfl/qd/UGgxK5G5HYfWvcO/xvtiJzqKWlMfB0cI05nHWh/R0XiF+/92UyNw1E6SDA +Wu0OSawigsaGkCaYSkblCIvOSgXdnEuCfpyps2MamQ9BrxURElSDWAvQjKAGXgI2n EIqfAAB6gRIIzWgfX5+8tChnfUyS+f3Do9Ds4mITQAuMg1jKf4oJFEKL4gLJXJbRyC m2Uf5SmiSTBcFSQLNr7PMwtAp8oka797uimSk5LJX1GTDzKXDQyXDIOQvUG7CuzEvS fXXRSFAQMQSKg== Original-Received: from APP-20 (unknown [10.50.14.244]) by mta-13.privateemail.com (Postfix) with ESMTPA for ; Wed, 6 Sep 2023 11:37:24 -0400 (EDT) X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.6-Rev49 X-Originating-Client: open-xchange-appsuite X-Virus-Scanned: ClamAV using ClamSMTP Received-SPF: pass client-ip=198.54.127.109; envelope-from=xzhou@xeechou.net; helo=MTA-13-4.privateemail.com X-Spam_score_int: 0 X-Spam_score: -0.0 X-Spam_bar: / X-Spam_report: (-0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_REPLYTO=2.095, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 06 Sep 2023 12:29:22 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145082 Archived-At: > Date: Thu, 24 Aug 2023 09:04:55 +0000 > From: Louis-Guillaume Gagnon > > I've recently switched to the new c++-ts-mode (a game changer for source > code featuring deeply nested templates!). I'm quite pleased with it, but > I can't figure out how to make it such that a namespace block doesn't > increase the indentation level. I previously achieved this with > (c-set-offset 'innamespace 0); Can anyone spell out how to achieve this > under treesitter? Hi, I managed to create an simple function to archive the same goal (defun my/indent-rules () `(;;here is my custom rules ((parent-is "namespace_definition") parent-bol 0) ,@(alist-get 'bsd (c-ts-mode--indent-styles 'cpp))) ) Then you would simply (setq c-ts-mode-indent-style #'my-indent-style). I followed some guides here: https://casouri.github.io/note/2023/tree-sitter-starter-guide/html-manual/Parser_002dbased-Indentation.html. Regards, Xichen