From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 02 15:39:34 2023 Received: (at submit) by debbugs.gnu.org; 2 Feb 2023 20:39:34 +0000 Received: from localhost ([127.0.0.1]:35923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNgMo-0002I6-9C for submit@debbugs.gnu.org; Thu, 02 Feb 2023 15:39:34 -0500 Received: from lists.gnu.org ([209.51.188.17]:40618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNgMm-0002Hy-AJ for submit@debbugs.gnu.org; Thu, 02 Feb 2023 15:39:32 -0500 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 1pNgMm-0001dv-1v for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 15:39:32 -0500 Received: from out-216.mta0.migadu.com ([91.218.175.216]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNgMj-0004cS-Da for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 15:39:31 -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=mssdvd.com; s=key1; t=1675370365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=9tndtPYlvkgtG7pDsSVGSfipDFVMwsUYQjJJ+KpgGbY=; b=blEPky2xRRY66tIFmuTPb99jrk4hNo3tO69qRcDZ0+hemLEVJEh0/2DgHM/V0n9Eu4gk0K uC4HAXGRdwvVSIF5U9LColDssQzCLgJSEQDYz30KFlqVxa1LYIOzLO2MoY7MCulUmziT/b O9B7ZroNCAXhyqlwBaIun37x6wuCp40q3GUwVbszwLBaFFRcryFTVBQJGe0KYSYf0v8FCs Yj4F3WvkaQjmGe1m3EasYtIHYFt53To/nFWICp+YuPSuU+6ujMXwEOGKQUgKfqa9Z/vXVD gnr4yXHbVIQeFIxKpAOXlFtn6HvqOg1z3JnYN0e+Syik7HgiL/63JPz4t7CbCQ== From: Davide Masserut To: bug-gnu-emacs@gnu.org Subject: [PATCH] Fix go-ts-mode type switch and select case blocks indentation Date: Thu, 02 Feb 2023 21:37:06 +0100 Message-ID: <87ilgj245n.fsf@mssdvd.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=91.218.175.216; envelope-from=dm@mssdvd.com; helo=out-216.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain; format=flowed Tags: patch This patch add indentation for Go type switch and select case blocks. Current behavior ``` var x any switch x.(type) { case int: println(x) } var c chan int select { case x := <-c: println(x) } ``` Correct behavior ``` var x any switch x.(type) { case int: println(x) } var c chan int select { case x := <-c: println(x) } ``` In GNU Emacs 30.0.50 (build 14, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6) of 2023-02-02 built on T480s Repository revision: bfd338aad9d1e6bf898fc19d23e1a5ca4e696316 Repository branch: master System Description: Arch Linux Configured using: 'configure --sysconfdir=/etc --prefix=/usr --libexecdir=/usr/lib --localstatedir=/var --with-pgtk --with-native-compilation 'CFLAGS=-march=native -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/home/davide/src/emacs-mssdvd-git/src=/usr/src/debug/emacs-mssdvd-git' LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now 'CXXFLAGS=-march=native -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/home/davide/src/emacs-mssdvd-git/src=/usr/src/debug/emacs-mssdvd-git'' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-go-ts-mode-type-switch-and-select-case-blocks-in.patch >From b4d6ed0dcb2536d6345e38edd7fc3ae1661d99b7 Mon Sep 17 00:00:00 2001 From: Davide Masserut Date: Thu, 2 Feb 2023 21:00:02 +0100 Subject: [PATCH] Fix go-ts-mode type switch and select case blocks indentation * lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Add indentation for type switch and select case blocks --- lisp/progmodes/go-ts-mode.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 5f3e1ea3e68..0270b92445d 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -72,6 +72,7 @@ go-ts-mode--indent-rules ((node-is "labeled_statement") no-indent) ((parent-is "argument_list") parent-bol go-ts-mode-indent-offset) ((parent-is "block") parent-bol go-ts-mode-indent-offset) + ((parent-is "communication_case") parent-bol go-ts-mode-indent-offset) ((parent-is "const_declaration") parent-bol go-ts-mode-indent-offset) ((parent-is "default_case") parent-bol go-ts-mode-indent-offset) ((parent-is "expression_case") parent-bol go-ts-mode-indent-offset) @@ -82,6 +83,7 @@ go-ts-mode--indent-rules ((parent-is "labeled_statement") parent-bol go-ts-mode-indent-offset) ((parent-is "literal_value") parent-bol go-ts-mode-indent-offset) ((parent-is "parameter_list") parent-bol go-ts-mode-indent-offset) + ((parent-is "type_case") parent-bol go-ts-mode-indent-offset) ((parent-is "type_spec") parent-bol go-ts-mode-indent-offset) ((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset) (no-node parent-bol 0))) -- 2.39.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 03:24:17 2023 Received: (at 61238) by debbugs.gnu.org; 4 Feb 2023 08:24:17 +0000 Received: from localhost ([127.0.0.1]:40612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pODqL-0007b1-0T for submit@debbugs.gnu.org; Sat, 04 Feb 2023 03:24:17 -0500 Received: from out-58.mta0.migadu.com ([91.218.175.58]:49852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pODqF-0007ap-1I for 61238@debbugs.gnu.org; Sat, 04 Feb 2023 03:24:16 -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=1675499049; 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: in-reply-to:in-reply-to:references:references; bh=H0lRlRNAELGfrJDTDR9l8YUMIyWZqbEc3hDSkxfdjbc=; b=aVXt43j5l4uEZz4EfH7xQnJQZ6wCz8Iqdwnhsegj/6L/SyOWCvx1LFt26f0pXZRYBFhgSN IV37WW1CO5RtVEtshnYNM4x/x2Y0EPN4wtEG2Py0OYALVD3xRDQ1uVRuHv5aLKG8uFN4dC xj1f8tWNKgTjmSjQaT2DN1UX4nJvfpBenJurBkRWlrJah5WQVB2lI+jEmq9vgmzBbJ3K9s T14xSNQAENa7mmrHCNH6ZlOFNHrDlkLz/EjFgLrMBYf/MFsgmw7d7228hfBvRmdG3Lj7ht ZXnO270FwxUoNlxqsnB2gUP9l+msQNjZUUgzsNTWEV99Z/YE1MeUJGy+Xz9EQQ== From: Theodor Thornhill To: Davide Masserut Subject: Re: bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation In-Reply-To: <87ilgj245n.fsf@mssdvd.com> (Davide Masserut's message of "Thu, 02 Feb 2023 21:37:06 +0100") References: <87ilgj245n.fsf@mssdvd.com> Date: Sat, 04 Feb 2023 09:24:08 +0100 Message-ID: <87v8khhm8n.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61238 Cc: 61238@debbugs.gnu.org, eliz@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hey there, Davide, and thanks for the clear bug-report! This looks good to me, but before I install, Maybe you can also add a test for this, similar to the ones in c-ts-mode-tests.el? Also, just checking - is fsf assignment needed for this change? Maybe you've done it already, if so, forgive my ignorance :-) Theo > Tags: patch > > This patch add indentation for Go type switch and select case blocks. > > Current behavior > ``` > var x any > switch x.(type) { > case int: > println(x) > } > > var c chan int > select { > case x := <-c: > println(x) > } > ``` > > Correct behavior > ``` > var x any > switch x.(type) { > case int: > println(x) > } > > var c chan int > select { > case x := <-c: > println(x) > } > ``` > > >>>From b4d6ed0dcb2536d6345e38edd7fc3ae1661d99b7 Mon Sep 17 00:00:00 2001 > From: Davide Masserut > Date: Thu, 2 Feb 2023 21:00:02 +0100 > Subject: [PATCH] Fix go-ts-mode type switch and select case blocks indentation > > * lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Add > indentation for type switch and select case blocks > --- > lisp/progmodes/go-ts-mode.el | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el > index 5f3e1ea3e68..0270b92445d 100644 > --- a/lisp/progmodes/go-ts-mode.el > +++ b/lisp/progmodes/go-ts-mode.el > @@ -72,6 +72,7 @@ go-ts-mode--indent-rules > ((node-is "labeled_statement") no-indent) > ((parent-is "argument_list") parent-bol go-ts-mode-indent-offset) > ((parent-is "block") parent-bol go-ts-mode-indent-offset) > + ((parent-is "communication_case") parent-bol go-ts-mode-indent-offset) > ((parent-is "const_declaration") parent-bol go-ts-mode-indent-offset) > ((parent-is "default_case") parent-bol go-ts-mode-indent-offset) > ((parent-is "expression_case") parent-bol go-ts-mode-indent-offset) > @@ -82,6 +83,7 @@ go-ts-mode--indent-rules > ((parent-is "labeled_statement") parent-bol go-ts-mode-indent-offset) > ((parent-is "literal_value") parent-bol go-ts-mode-indent-offset) > ((parent-is "parameter_list") parent-bol go-ts-mode-indent-offset) > + ((parent-is "type_case") parent-bol go-ts-mode-indent-offset) > ((parent-is "type_spec") parent-bol go-ts-mode-indent-offset) > ((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset) > (no-node parent-bol 0))) From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 05:16:01 2023 Received: (at 61238) by debbugs.gnu.org; 4 Feb 2023 10:16:01 +0000 Received: from localhost ([127.0.0.1]:40739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOFaT-0000kd-Hj for submit@debbugs.gnu.org; Sat, 04 Feb 2023 05:16:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50726) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOFaR-0000kN-0Y for 61238@debbugs.gnu.org; Sat, 04 Feb 2023 05:16:00 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOFaL-0000xP-EV; Sat, 04 Feb 2023 05:15:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=uwWh8QmCzuSKh7TJv2ihzEtcWBccI2lXxx31lNWS1Yk=; b=oDZLMQRg0fG4 jB5aWAW7RzlJ6ToSHdwdplNAU9Azu1oQuGO75NqB8s3ILFRLs8PRp8xXpnlN6QQM8uzj1/xcjCIUa 6ojR+t6dO8oGJewwZg4NPk9SdaHVGichaDWVy0mbM7YpNpVroxY/Fa6PdBiPvSeO4fxGpr6ZfsyR/ K8dW2ApCgAnm+9kEugE57RkM1ThmYWgrxeRg7tgC3g6KC6jgvaTBu7XbRjA8Sva0RwFBbh8z1wZVv BtzdvYH/IGyPh+4SNUY06Efn5JCtYKepljA8tNLjofwd4JgDGIu2pSnNkdCo4O9CrY9OUfyeMCBNv s+fbKE+/BbeWxMIZH2wiyA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOFaK-0001zh-O3; Sat, 04 Feb 2023 05:15:53 -0500 Date: Sat, 04 Feb 2023 12:15:58 +0200 Message-Id: <83tu01u469.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <87v8khhm8n.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 04 Feb 2023 09:24:08 +0100) Subject: Re: bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation References: <87ilgj245n.fsf@mssdvd.com> <87v8khhm8n.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61238 Cc: 61238@debbugs.gnu.org, dm@mssdvd.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: 61238@debbugs.gnu.org, eliz@gnu.org > Date: Sat, 04 Feb 2023 09:24:08 +0100 > > Also, just checking - is fsf assignment needed for this change? Maybe > you've done it already, if so, forgive my ignorance :-) Davide's assignment is already on file, so there's no problem in that department. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 05:40:22 2023 Received: (at 61238) by debbugs.gnu.org; 4 Feb 2023 10:40:22 +0000 Received: from localhost ([127.0.0.1]:40752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOFy2-0001Kq-2Q for submit@debbugs.gnu.org; Sat, 04 Feb 2023 05:40:22 -0500 Received: from out-238.mta0.migadu.com ([91.218.175.238]:44014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOFxw-0001KZ-It for 61238@debbugs.gnu.org; Sat, 04 Feb 2023 05:40:20 -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=1675507214; 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: in-reply-to:in-reply-to:references:references; bh=oDdTbMpTDJ/hPjW1sceeNwHTnFRWN9YKHF2Ri82Yc5I=; b=rcFr9jFibqDhQekLOqf/2t17SjJOAxFhGjTZN5DuWWsHlvRHaZ0jzz+/7tDXLz+6rpaSQh KuW526ZJLbRWSuF4gBIIkN4K2w1Pxx3dLOBc/sRlll/aARX0hcdnIhc1d7zyBGH3Gpm6yF enKih4T2btr1J/IkfWP2lKGcKMVO+mtxKgk0ih7nRfgmEpafZgYTkwRv9m/40bkaOPSAcb pSUNpVkr8/AMVEY1UxB6Ic6awXYsnXnkiQnPezxKy5+vvnfkXsJdfo9FZu345SJ5n/QuZJ ZQxQSP1VyFYg4qSCo0cpLzZshHPi+D78Vg6pXRwCEpmg8wQItHzT8ybAOqAKdQ== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation In-Reply-To: <83tu01u469.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Feb 2023 12:15:58 +0200") References: <87ilgj245n.fsf@mssdvd.com> <87v8khhm8n.fsf@thornhill.no> <83tu01u469.fsf@gnu.org> Date: Sat, 04 Feb 2023 11:40:12 +0100 Message-ID: <87zg9t7lyr.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61238 Cc: 61238@debbugs.gnu.org, dm@mssdvd.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Theodor Thornhill >> Cc: 61238@debbugs.gnu.org, eliz@gnu.org >> Date: Sat, 04 Feb 2023 09:24:08 +0100 >> >> Also, just checking - is fsf assignment needed for this change? Maybe >> you've done it already, if so, forgive my ignorance :-) > > Davide's assignment is already on file, so there's no problem in that > department. Great :-) Theo From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 12:29:58 2023 Received: (at 61238) by debbugs.gnu.org; 4 Feb 2023 17:29:58 +0000 Received: from localhost ([127.0.0.1]:43371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOMMQ-0000n9-C1 for submit@debbugs.gnu.org; Sat, 04 Feb 2023 12:29:58 -0500 Received: from out-21.mta1.migadu.com ([95.215.58.21]:37093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOMMN-0000n0-UL for 61238@debbugs.gnu.org; Sat, 04 Feb 2023 12:29:57 -0500 References: <87ilgj245n.fsf@mssdvd.com> <87v8khhm8n.fsf@thornhill.no> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mssdvd.com; s=key1; t=1675531794; 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: in-reply-to:in-reply-to:references:references; bh=N2pMGdJTnw6ivy7qsZor9DKS8rIjBAL5v8pJR/EFFec=; b=BneC5Ee5PmXofH5SWPq5A3pY/o/RE/I39pstbOeQAXpKGRNqQQK1tV+cxhQa3ulj4nUFfY y/UcqNCcsHkpAUZkytLMwav/wh0XvGZKFX9tu3nlju1/jBVgBTuOU69yzHqhnDWvM74V7W RCLITAKiSlclrQwZi1BjFPZOBzwwtP+JfQK8WOP7vzD0WlwW3VqsYuiE0PNDLpKvYpdVpw i4TTf2O1MiJbC5CLRhs3zHd+iL70urbfH604SbNEFZNyGM1tevOFKJqqR5A7GXjE8viRDA UNS/+ISfWjM1a6g//eTFwH7CkdMaBrpDMxjpqTIzq3TkZzrNOXB45hNR9E8w7A== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Davide Masserut To: Theodor Thornhill Subject: Re: bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation Date: Sat, 04 Feb 2023 18:21:09 +0100 In-reply-to: <87v8khhm8n.fsf@thornhill.no> Message-ID: <87a61t1gq6.fsf@mssdvd.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61238 Cc: 61238@debbugs.gnu.org, eliz@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; format=flowed Theodor Thornhill writes: > Hey there, Davide, and thanks for the clear bug-report! > > This looks good to me, but before I install, Maybe you can also > add a > test for this, similar to the ones in c-ts-mode-tests.el? > > Also, just checking - is fsf assignment needed for this change? > Maybe > you've done it already, if so, forgive my ignorance :-) > > Theo I added the tests and also indentation rules for the "case" and "default" keywords so that they are aligned with their parent. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-go-ts-mode-type-switch-and-select-case-blocks-in.patch >From 90b0f6ce31e60ca36f8625e8386379259d75c8a0 Mon Sep 17 00:00:00 2001 From: Davide Masserut Date: Thu, 2 Feb 2023 21:00:02 +0100 Subject: [PATCH] Fix go-ts-mode type switch and select case blocks indentation * lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Add indentation for type switch and select case blocks * test/lisp/progmodes/go-ts-mode-resources/indent.erts: New .erts file to test indentation of Go constructs and prevent regression of bug fixes. * test/lisp/progmodes/go-ts-mode-tests.el: New file with go-ts-mode tests. --- lisp/progmodes/go-ts-mode.el | 4 ++ .../go-ts-mode-resources/indent.erts | 47 +++++++++++++++++++ test/lisp/progmodes/go-ts-mode-tests.el | 31 ++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 test/lisp/progmodes/go-ts-mode-resources/indent.erts create mode 100644 test/lisp/progmodes/go-ts-mode-tests.el diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 5f3e1ea3e68..95dcf653fc6 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -72,6 +72,7 @@ go-ts-mode--indent-rules ((node-is "labeled_statement") no-indent) ((parent-is "argument_list") parent-bol go-ts-mode-indent-offset) ((parent-is "block") parent-bol go-ts-mode-indent-offset) + ((parent-is "communication_case") parent-bol go-ts-mode-indent-offset) ((parent-is "const_declaration") parent-bol go-ts-mode-indent-offset) ((parent-is "default_case") parent-bol go-ts-mode-indent-offset) ((parent-is "expression_case") parent-bol go-ts-mode-indent-offset) @@ -82,7 +83,10 @@ go-ts-mode--indent-rules ((parent-is "labeled_statement") parent-bol go-ts-mode-indent-offset) ((parent-is "literal_value") parent-bol go-ts-mode-indent-offset) ((parent-is "parameter_list") parent-bol go-ts-mode-indent-offset) + ((parent-is "select_statement") parent-bol 0) + ((parent-is "type_case") parent-bol go-ts-mode-indent-offset) ((parent-is "type_spec") parent-bol go-ts-mode-indent-offset) + ((parent-is "type_switch_statement") parent-bol 0) ((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset) (no-node parent-bol 0))) "Tree-sitter indent rules for `go-ts-mode'.") diff --git a/test/lisp/progmodes/go-ts-mode-resources/indent.erts b/test/lisp/progmodes/go-ts-mode-resources/indent.erts new file mode 100644 index 00000000000..a89d69b307c --- /dev/null +++ b/test/lisp/progmodes/go-ts-mode-resources/indent.erts @@ -0,0 +1,47 @@ +Code: + (lambda () + (go-ts-mode) + (indent-region (point-min) (point-max))) + +Point-Char: | + +Name: Basic + +=-= +package main + +func main() { +} +=-=-= + +Name: Switch and Select + +=-= +package main + +func main() { + var x any + switch x { + case 1: + println("one") + default: + println("default case") + } + + switch x.(type) { + case int: + println("integer") + default: + println("don't know the type") + } + + var c chan int + select { + case x := <-c: + println(x) + default: + println("no communication") + } +} + +=-=-= diff --git a/test/lisp/progmodes/go-ts-mode-tests.el b/test/lisp/progmodes/go-ts-mode-tests.el new file mode 100644 index 00000000000..4bfebcbaac0 --- /dev/null +++ b/test/lisp/progmodes/go-ts-mode-tests.el @@ -0,0 +1,31 @@ +;;; go-ts-mode-tests.el --- Tests for Tree-sitter-based Go mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'ert-x) +(require 'treesit) + +(ert-deftest go-ts-mode-test-indentation () + (skip-unless (treesit-ready-p 'c)) + (ert-test-erts-file (ert-resource-file "indent.erts"))) + +(provide 'go-ts-mode-tests) +;;; go-ts-mode-tests.el ends here -- 2.39.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 13:29:57 2023 Received: (at 61238) by debbugs.gnu.org; 4 Feb 2023 18:29:57 +0000 Received: from localhost ([127.0.0.1]:43453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pONIS-0002MH-W4 for submit@debbugs.gnu.org; Sat, 04 Feb 2023 13:29:57 -0500 Received: from out-142.mta0.migadu.com ([91.218.175.142]:47786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pONIQ-0002M8-DY for 61238@debbugs.gnu.org; Sat, 04 Feb 2023 13:29:56 -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=1675535393; 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: in-reply-to:in-reply-to:references:references; bh=XyDWzPMjDb7AP8oG1V5iUa5fGJGeQSVuK5Azbij9t68=; b=zkRxVYrVFvWMBdR4RYl8+M83Hsbp8fDJaigKaZF/zFuSguaPdt9vdXvvjwW852l2y6Gf8v 004kr2n5LhORPIdElcYB8FqSdowBjHtmrcyV9Ni0jdYY4VeUVtcgVqWWBlEFVwNmYjWx+a 6XX/kiNW3pnS3Q9Y5gd5fecvcxIeI4+js5W2FACdneKvo1O/rpLU1jXDsTtQ5SaKLNlRF6 aVGTl3nrkmCWovTOfPgiW+Qh5jm7sWdgcLiRXlU2JPHASn7k83yvvaP6ycNJNgiVTDP/AK 7uKbwqkxpfSa+pB9o2tbOJ56PEHO2Ax6kRCxjTr5wB4WVcBGYTlVd9znbeiXmQ== From: Theodor Thornhill To: Davide Masserut Subject: Re: bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation In-Reply-To: <87a61t1gq6.fsf@mssdvd.com> References: <87ilgj245n.fsf@mssdvd.com> <87v8khhm8n.fsf@thornhill.no> <87a61t1gq6.fsf@mssdvd.com> Date: Sat, 04 Feb 2023 19:29:50 +0100 Message-ID: <87tu017081.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61238 Cc: 61238@debbugs.gnu.org, eliz@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Davide Masserut writes: > Theodor Thornhill writes: > >> Hey there, Davide, and thanks for the clear bug-report! >> >> This looks good to me, but before I install, Maybe you can also >> add a >> test for this, similar to the ones in c-ts-mode-tests.el? >> >> Also, just checking - is fsf assignment needed for this change? >> Maybe >> you've done it already, if so, forgive my ignorance :-) >> >> Theo Thanks! I've commited and pushed this to the emacs-29 branch. I made a small tweak to the commit message and fixed this: (ert-deftest go-ts-mode-test-indentation () (skip-unless (treesit-ready-p 'c)) (ert-test-erts-file (ert-resource-file "indent.erts"))) Thanks again, Theo From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 10 13:18:49 2023 Received: (at 61238-done) by debbugs.gnu.org; 10 Sep 2023 17:18:49 +0000 Received: from localhost ([127.0.0.1]:51203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfO5B-0001Zo-0x for submit@debbugs.gnu.org; Sun, 10 Sep 2023 13:18:49 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:61617) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfO56-0001ZY-NV for 61238-done@debbugs.gnu.org; Sun, 10 Sep 2023 13:18:47 -0400 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2b9c907bc68so62126411fa.2 for <61238-done@debbugs.gnu.org>; Sun, 10 Sep 2023 10:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694366315; x=1694971115; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=r5rWaaj6+fT2lMoPb5d3CpriCx/ibA4qshm7pCwihzs=; b=M0H/X1MMXaob+mhYOik9L3F6EMSxK7+um+5/sU2EuforOdD4PHPeApbSk4w7IYakwf YwHyaTkNMDwKZRrnuhqzu4u2wVgrV1mzgtnny5nsXFwJgrUOPRlJYn7tzV5MwIYejIB7 rPPLorKNhybJxzVGtmPbdDRGKw6po4YpeEU4l+2+nVpiEvBpsw947Y3qXccHndx3iEvV hpCDMTkI9stYuGzTaOjOH83JAzf1V3JrDF9/skxv5Qc1bGo98yE4fRMyeCPZ37uRVlXz etaPDFbXHWf3PBJ4leKRFoWvHE5ZUa9z9LbHQpY0QbG1deW40PGkJXzR4n2mDGluPuhO BeLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694366315; x=1694971115; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r5rWaaj6+fT2lMoPb5d3CpriCx/ibA4qshm7pCwihzs=; b=XmWzFGtq4m9f4qgVqQI5m1C5O1XUI+HWMi06YKYjGXNN58+4Jx0EUQYO0YmvozOw5q hY9BhPAHsOHOcTySD/StGHvkF7+uxrAo9oCEHVhvL93FXBYM3pB/5dI6cQjWtUfhBVTM rqeUCcZUICfCtx3mvfrIRK944tHlS9WJlipNAZ+KNTtSvYCrtSTjqqdbdN4yw+iQIlYW Wt0tu1CqyXAEPItt2C9Loi1kofYYgYboQ/68QiX4DwKIdN9Cs4Qy+VtJq25v/733iF1K jzkv8ekB4pCsM321zycrGHnkoXZQJ1lkDujNTxmksMMbb2wGZslab41L2OP8Ubtt48tq 8QGQ== X-Gm-Message-State: AOJu0Yx6aE97TyDrq3EX4LB61wKhQGi/Cjm9tNjeCXL5FyPj9cu5Qm+f CSyrFluCW1CXuEmM0nLuBHgv/9jPOE/xAPrrNmN8JAi1 X-Google-Smtp-Source: AGHT+IG2cV7vrcHiY6Rn9P2gpGAVypiewECgwSewBMsAQNY9A64Um/ZGlzUUdLxvsFitGpsECxZIITSQQYuwakvEpxU= X-Received: by 2002:a2e:9588:0:b0:2b9:4413:864e with SMTP id w8-20020a2e9588000000b002b94413864emr6208475ljh.53.1694366314933; Sun, 10 Sep 2023 10:18:34 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 10 Sep 2023 10:18:34 -0700 From: Stefan Kangas In-Reply-To: <87tu017081.fsf@thornhill.no> (Theodor Thornhill's message of "Sat, 04 Feb 2023 19:29:50 +0100") References: <87ilgj245n.fsf@mssdvd.com> <87v8khhm8n.fsf@thornhill.no> <87a61t1gq6.fsf@mssdvd.com> <87tu017081.fsf@thornhill.no> MIME-Version: 1.0 Date: Sun, 10 Sep 2023 10:18:34 -0700 Message-ID: Subject: Re: bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation To: Theodor Thornhill Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61238-done Cc: eliz@gnu.org, 61238-done@debbugs.gnu.org, Davide Masserut X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Theodor Thornhill writes: > Thanks! I've commited and pushed this to the emacs-29 branch. I made a > small tweak to the commit message and fixed this: > > (ert-deftest go-ts-mode-test-indentation () > (skip-unless (treesit-ready-p 'c)) > (ert-test-erts-file (ert-resource-file "indent.erts"))) It seems like this issue was fixed, but it was left open in the bug tracker. I'm therefore closing it now. Please remember to close bug reports when they are fixed. From unknown Mon Jun 23 02:26:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 09 Oct 2023 11:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator