all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Davide Masserut via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 61238@debbugs.gnu.org
Subject: bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation
Date: Thu, 02 Feb 2023 21:37:06 +0100	[thread overview]
Message-ID: <87ilgj245n.fsf@mssdvd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]

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''

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-go-ts-mode-type-switch-and-select-case-blocks-in.patch --]
[-- Type: text/patch, Size: 1638 bytes --]

From b4d6ed0dcb2536d6345e38edd7fc3ae1661d99b7 Mon Sep 17 00:00:00 2001
From: Davide Masserut <dm@mssdvd.com>
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


             reply	other threads:[~2023-02-02 20:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 20:37 Davide Masserut via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-02-04  8:24 ` bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-04 10:15   ` Eli Zaretskii
2023-02-04 10:40     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-04 17:21   ` Davide Masserut via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-04 18:29     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-10 17:18       ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilgj245n.fsf@mssdvd.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=61238@debbugs.gnu.org \
    --cc=dm@mssdvd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.