From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61502: 29.0.60; c-ts-mode auto-indent not working Date: Wed, 15 Feb 2023 13:41:47 +0100 Message-ID: <873577qewk.fsf@thornhill.no> References: <87v8k4g8xu.fsf@codeisgreat.org> <83a61ge69s.fsf@gnu.org> <87edqs11db.fsf@thornhill.no> <83a61gc8xx.fsf@gnu.org> <875yc40zhu.fsf@thornhill.no> <838rgzce0c.fsf@gnu.org> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33320"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61502@debbugs.gnu.org, casouri@gmail.com, pankaj@codeisgreat.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 15 13:42:21 2023 Return-path: Envelope-to: geb-bug-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 1pSH76-0008Qv-Gf for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Feb 2023 13:42:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSH6x-0003Jn-3t; Wed, 15 Feb 2023 07:42:14 -0500 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 1pSH6o-0003Ff-M0 for bug-gnu-emacs@gnu.org; Wed, 15 Feb 2023 07:42:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSH6o-0003Zy-9Q for bug-gnu-emacs@gnu.org; Wed, 15 Feb 2023 07:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSH6n-0005HG-U8 for bug-gnu-emacs@gnu.org; Wed, 15 Feb 2023 07:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Feb 2023 12:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61502 X-GNU-PR-Package: emacs Original-Received: via spool by 61502-submit@debbugs.gnu.org id=B61502.167646491520273 (code B ref 61502); Wed, 15 Feb 2023 12:42:01 +0000 Original-Received: (at 61502) by debbugs.gnu.org; 15 Feb 2023 12:41:55 +0000 Original-Received: from localhost ([127.0.0.1]:58135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSH6g-0005Gv-Jk for submit@debbugs.gnu.org; Wed, 15 Feb 2023 07:41:54 -0500 Original-Received: from out-199.mta0.migadu.com ([91.218.175.199]:20827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSH6d-0005Gl-Js for 61502@debbugs.gnu.org; Wed, 15 Feb 2023 07:41:52 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1676464909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q2pTMgc3MGE/z8Js7Hi04SLu009rjNS9fM/DvrROdbM=; b=wNIHruFcGCNKv0rIxWl3Ee4dg3bECA1Zt7uqfswm5l7iAz1ddP2EhfX6+OZ41gr3FtiZB8 BbUCDa77NOtSVjWS8m5Obs8vbkRk2Nt0615ZjlIXu7KKf8S4kFhtjdpO6tj4kt3I5NJXC4 CoZ+wNBkP/Utbwcg/plIYwQKniahxyzciYXZxZ4BA3YIH6fUl37aUkOns7m4GDobVVqokn K3QCzfVkvMzrlUSq6mvIb1duGCMJzUSAQaMu5EQpk7JQE1PIKxPnesJXHWtDJT7ktID6kv eLAGQ/6tvv3UGNQS5bKg6SQztE8xHJC2xtomEgG568f9N2vyENz9o3XAlH4/HQ== In-Reply-To: <838rgzce0c.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255688 Archived-At: Eli Zaretskii writes: >> From: Theodor Thornhill >> Cc: pankaj@codeisgreat.org, casouri@gmail.com, 61502@debbugs.gnu.org >> Date: Tue, 14 Feb 2023 21:21:33 +0100 >>=20 >> int >> main >> { >> for (;;)| >> ``` >>=20 >> Now type RET >>=20 >> ``` >> int >> main >> { >> for (;;) >> | >> ``` >>=20 >> Now type { >>=20 >> ``` >> int >> main >> { >> for (;;) >> {| >> ``` >>=20 >> Now type RET >>=20 >> ``` >> int >> main >> { >> for (;;) >> { >> | >> ``` >>=20 >> Which is what I consider a little confusing. We get different >> indentation with and without the closed scope. > > Any idea why it doesn't choose the 'for' node? That's what a na=C3=AFve > user would expect, I think. That's what any user should expect, IMO. It's due to treesit-node-on. See its docstring: "Return the smallest node covering BEG to END. BEWARE! Calling this function on an empty line that is not inside any top-level construct (function definition, etc.) most probably will give you the root node, because the root node is the smallest node that covers that empty line. You probably want to use `treesit-node-at' instead. Return nil if none was found. If NAMED is non-nil, only look for named node. If PARSER-OR-LANG is a parser, use that parser; if PARSER-OR-LANG is a language, find the first parser for that language in the current buffer, or create one if none exists; If PARSER-OR-LANG is nil, try to guess the language at BEG using `treesit-language-at'." Rather selecting the first node "above" point sounds more reasonable? Theo