From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?J=C3=B8rgen?= Kvalsvik Newsgroups: gmane.emacs.bugs Subject: bug#74507: [PATCH] Indent compounds c-ts-mode when { is not BOL Date: Fri, 29 Nov 2024 10:04:36 +0100 Message-ID: <6f6fbda2-ce84-4f85-8727-9d652473c6cb@lambda.is> References: <87r071yov3.fsf@lambda.is> <66722213-91AB-45C1-BD99-2BF823485E63@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34335"; mail-complaints-to="usenet@ciao.gmane.io" Cc: theo@thornhill.no, 74507@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 29 10:05:25 2024 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 1tGwwG-0008lD-Qh for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Nov 2024 10:05:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGwvw-0003HB-4M; Fri, 29 Nov 2024 04:05:04 -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 1tGwvu-0003GV-Az for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2024 04:05:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tGwvu-00022F-0z for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2024 04:05:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=zy8cnkrwnssK8mNhqJSRHHk8yHIP3in0PVOpvUQfvUM=; b=n1d833EpFT2AuUZL9ctJcrA+dKNFYJPMJZgMWf9wHI5KYjto9MILeht9pY3tAzv6BXNQngzjhZrNcvfUawi0wVH5LyadLOjOdzEn1AoGkspcilPpequ+XKG/py+L5sg4bUWJmsIv3VlZydx/+nmzV/++NNNi3W/fJvac5H9xUjf3Bdkkbicj8QKYkkY4BjQticUvjwkcpFwwY+HV8chPthppnnfzbnXbo90Ey6mHQ/EqkLsQdDJ55h5U6/3CMvyNVYQ3nKgl8bQo+uV3NfEFmNf1/svlS+IaNms39UBHT3z/a/moZZjaHKRbxphwnlm+Sjt+u/jDOWwbzagb+vBs9A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tGwvt-0003vU-T0 for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2024 04:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?J=C3=B8rgen?= Kvalsvik Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Nov 2024 09:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74507 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74507-submit@debbugs.gnu.org id=B74507.173287109015068 (code B ref 74507); Fri, 29 Nov 2024 09:05:01 +0000 Original-Received: (at 74507) by debbugs.gnu.org; 29 Nov 2024 09:04:50 +0000 Original-Received: from localhost ([127.0.0.1]:40920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGwvi-0003uy-Gf for submit@debbugs.gnu.org; Fri, 29 Nov 2024 04:04:50 -0500 Original-Received: from mx.kolabnow.com ([212.103.80.154]:47786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGwvf-0003ue-J5 for 74507@debbugs.gnu.org; Fri, 29 Nov 2024 04:04:48 -0500 Original-Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 30C603069ABC; Fri, 29 Nov 2024 10:04:41 +0100 (CET) Authentication-Results: ext-mx-out013.mykolab.com (amavis); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :mime-version:date:date:message-id:received:received:received; s=dkim20240523; t=1732871080; x=1734685481; bh=zy8cnkrwnssK8mNh qJSRHHk8yHIP3in0PVOpvUQfvUM=; b=UDiui5VAQA/KTDedTdXke9twzxNdeWiw 97rjRzdBiJzHyh9Z3wXrjLboAs+a00NctEJHvzt+5yiREC7qqO/pNtSIoL3Qaa0x 2EauNEIftiKk2dVWVTw/AQpE+5jKs+GuaJeAZAwk+VyiHFQa3hfr2iMbzF8h5mBe zIJNoUFKBbA/RSh2dpa1GlU2/3zx18sj6WAGq/37uiuqwGsd58WmSwio0vLfPW10 uLFNGqZLi1vmR9atCF+am5ZFMBpbNBsaNemDX6E+fwAT8JH9luAAXXa4DmYyS64x Ff4WdICzDIgMshem/Xn4m6gSWlB+S4RFAX+1T5mE8mOCYMbfOFT2HQ== X-Virus-Scanned: amavis at mykolab.com Original-Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out013.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id XmabUwHwZxQ9; Fri, 29 Nov 2024 10:04:40 +0100 (CET) Original-Received: from int-mx009.mykolab.com (unknown [10.9.13.9]) by mx.kolabnow.com (Postfix) with ESMTPS id E73E63069AB9; Fri, 29 Nov 2024 10:04:38 +0100 (CET) Original-Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx009.mykolab.com (Postfix) with ESMTPS id 79FAA24CD962; Fri, 29 Nov 2024 10:04:38 +0100 (CET) Content-Language: en-US In-Reply-To: <66722213-91AB-45C1-BD99-2BF823485E63@gmail.com> 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:296088 Archived-At: On 11/29/24 05:56, Yuan Fu wrote: > > >> On Nov 24, 2024, at 1:15 AM, Jørgen Kvalsvik wrote: >> >> Tags: patch >> >> Tags: patch >> >> >> I found that the coumpounded statements are anchored to the wrong object >> when 1. the compound is not at beginning-of-line and 2. it is not >> preceeded by a construct such as fndecl/for/if/while/etc., which differs >> from how c-mode indents it. >> >> Non-BOL compound statements is actually quite common with macros and >> testing frameworks (see the test case). For example, you want this to >> indent: >> >> TEST_CASE(1) { >> assert (...); >> } >> >> The heuristic is quite course - it simply checks if the grandparent is >> function-definition or not, which is really if this node is a top-level >> sibling in the function body. If that is the case, the old rules should >> apply and standalone-parent should be the guide; otherwise, it should be >> the parent-BOL. This feels a bit shaky but does seem to work well for >> the test cases, and can be refined in the future. >> >> <0001-Indent-compounds-c-ts-mode-when-is-not-BOL.patch> > > Thank you very much! Especially for the test case ;-) What’s the progress of your copyright assignment? Has it completed? As Eli says, I have submitted the paperwork. > > I’m working on refactoring the indentation rules for c-ts-mode. Let me see if I can integrate this situation into the new rules I’m writing. > > Yuan Splendid, thanks.