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: Sun, 1 Dec 2024 10:51:38 +0100 Message-ID: <2b677735-ecc0-4fb6-be60-533bfbcc962a@lambda.is> References: <87r071yov3.fsf@lambda.is> <86serabhgw.fsf@gnu.org> <1e4fcc9a-4f69-4c3a-b9d6-716d61129e31@lambda.is> <60820855-5672-4083-B7B5-38FF5259BBF4@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------9qcD07ZIw5QZbEx7jLBAXrkr" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30254"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 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 Sun Dec 01 10:52:17 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 1tHgcj-0007gA-5t for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 10:52:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHgcY-000396-2v; Sun, 01 Dec 2024 04:52:06 -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 1tHgcV-00038T-8C for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 04:52:03 -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 1tHgcV-0007YE-0I for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 04:52:03 -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=Hwjk1AOa2WOBdexVaMAiNIXL3iB1n7jlbSvZFT7BCMM=; b=tEwipxWRrRLxJzcTiC0LLrpNHW+mhBGrmEt0ZgzA27ry8/RQcB37a4H0sV3Qfr/GdAV5JbZ2QxTt0ZfBesy8KZNw/AUeYsxd7zde1NCNS7j+CF5wOoiJvCOO9ZTA7mIV1MTA4vXrw6py3E6rU9kinzCnh46hNfLFbUIga91cYEjRAy+5aFNd2QNhgQHzcHPDToQVjWQNCCZj2u8VHHCB1pEL8D+KbBfcwSvmyo/Hj7MGa71DlRPHDeblEx+Dyiw+6/qn+BnK7/nHwdEbBSWvitE5eKVEIH2eUlbwl1GGWk8Tss4AfTUi4EIHdhX6vaEcRFHV/ScjafphX1kvoZchpQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHgcT-0006oj-Uv for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 04:52: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: Sun, 01 Dec 2024 09:52: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.173304671226184 (code B ref 74507); Sun, 01 Dec 2024 09:52:01 +0000 Original-Received: (at 74507) by debbugs.gnu.org; 1 Dec 2024 09:51:52 +0000 Original-Received: from localhost ([127.0.0.1]:50316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHgcK-0006oF-6c for submit@debbugs.gnu.org; Sun, 01 Dec 2024 04:51:52 -0500 Original-Received: from mx.kolabnow.com ([212.103.80.154]:58316) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHgcH-0006nz-CB for 74507@debbugs.gnu.org; Sun, 01 Dec 2024 04:51:51 -0500 Original-Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id CC8FD306C8B0; Sun, 1 Dec 2024 10:51:43 +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= in-reply-to:from:from:content-language:references:subject :subject:mime-version:date:date:message-id:content-type :content-type:received:received:received; s=dkim20240523; t= 1733046701; x=1734861102; bh=Hwjk1AOa2WOBdexVaMAiNIXL3iB1n7jlbSv ZFT7BCMM=; b=bAUD6bsOYBaSSQQzt7qZiSQzgdQpbNLxfZBNmaa/qLgk7Y2DuOM HFYTL1GQYW6qzqYfDvXRYsm7x0vwDH+jsJvQMvsSISpVvBwVL3YxxMTpZQT2h9ZW RJyLbg2S8ATLX0UohVIsKiDZxgZK4xVFY9S+VyKvJsm3otwm+IPGeIcfDU8Z+M6N QKvmORufCcdIIEVbP/f39u9RhZic4LnVdgfEsaHv++hLj6ROCaR4fSYFTzpEQOXq 0OZ3ObJO99xCas5mdp+KYo1DD47pJdkShQA+H9pyChHDyI3J98iShoKpHl77MlEM lMMmritR5fF/DsM6E8+h7X9hQk5rczLj3pA== 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 bfpvxzw2Lzxt; Sun, 1 Dec 2024 10:51:41 +0100 (CET) Original-Received: from int-mx009.mykolab.com (unknown [10.9.13.9]) by mx.kolabnow.com (Postfix) with ESMTPS id C78003069ABC; Sun, 1 Dec 2024 10:51:39 +0100 (CET) Original-Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx009.mykolab.com (Postfix) with ESMTPS id 679F327F99C0; Sun, 1 Dec 2024 10:51:39 +0100 (CET) Content-Language: en-US In-Reply-To: <60820855-5672-4083-B7B5-38FF5259BBF4@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:296230 Archived-At: This is a multi-part message in MIME format. --------------9qcD07ZIw5QZbEx7jLBAXrkr Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12/1/24 10:25, Yuan Fu wrote: > > >> On Nov 30, 2024, at 12:49 PM, Jørgen Kvalsvik wrote: >> >> On 11/30/24 01:16, Yuan Fu wrote: >>>> On Nov 29, 2024, at 1:05 AM, Jørgen Kvalsvik wrote: >>>> >>>> On 11/29/24 08:57, Eli Zaretskii wrote: >>>>>> Cc: theo@thornhill.no,casouri@gmail.com >>>>>> From: Jørgen Kvalsvik >>>>>> Date: Sun, 24 Nov 2024 10:15:12 +0100 >>>>>> >>>>>> * lisp/progmodes/c-ts-mode.el (c-ts-mode--parent-is-not-top-compound): >>>>>> New function. >>>>>> (c-ts-mode--indent-styles): Use it. >>>>>> * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New compound >>>>>> statement test. >>>>> Please make sure the lines here are not too long (see CONTRIBUTE for >>>>> details). >>>>>> +(defun c-ts-mode--parent-is-not-top-compound (_n parent &rest _) >>>>>> + "Matches when PARENT is not the top level compound statement, >>>>>> +the {} that immediately follows the signature." >>>>> The first line of a doc string should be a single complete sentence. >>>>> Thanks. >>>> >>>> Ok. Yuan, would you like me to submit a revision? >>> Since your assignment is already done, let’s just apply your patch, and I’ll rebase my changes on top of yours. So yeah, do send the revision patch, thanks! >>> Yuan >> >> Certainly - I posted it on the bug tracker. > > Thanks Jørgen. What did you use to generate the patch? For some reason I can’t apply it. My git skill isn’t that great so it could be my problem. If you can apply it fine maybe you can share the command you used? I used git format-patch HEAD~1, and I just tested applying it to master with `git am 0001-Indent-compounds-in-c-ts-mode-when-is-not-BOL.patch' which worked. > > BTW, the commit title is missing. When you add the title, you can also add the bug number. For example: > > Improve c-ts-mode indentation for macros (bug#74507) > > Yuan Sure. I've attached a new patch with the bug in it. I tested it and it applies cleanly with `git am 0001-Improve-c-ts-mode-compound-indents-bug-74507.patch' --------------9qcD07ZIw5QZbEx7jLBAXrkr Content-Type: text/x-patch; charset=UTF-8; name="0001-Improve-c-ts-mode-compound-indents-bug-74507.patch" Content-Disposition: attachment; filename="0001-Improve-c-ts-mode-compound-indents-bug-74507.patch" Content-Transfer-Encoding: base64 RnJvbSBhNmFmODUyOThkZTk5Y2RiZmM3OGM5NTY1OTIyNGM5ZGQ3ZTZhNGMxIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/Sj1DMz1COHJnZW49MjBLdmFsc3Zp az89IDxqQGxhbWJkYS5pcz4KRGF0ZTogVHVlLCAxOSBOb3YgMjAyNCAwODowMTowMSArMDEw MApTdWJqZWN0OiBbUEFUQ0hdIEltcHJvdmUgYy10cy1tb2RlIGNvbXBvdW5kIGluZGVudHMg KGJ1ZyM3NDUwNykKClByb3Blcmx5IGluZGVudCB0aGUgYm9keSBvZiBjb21wb3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