* bug#63879: 29.0.90; [PATCH] Fix rust-ts-mode indentation for else-if
@ 2023-06-03 23:18 Yuan Fu
2023-06-03 23:58 ` Randy Taylor
0 siblings, 1 reply; 4+ messages in thread
From: Yuan Fu @ 2023-06-03 23:18 UTC (permalink / raw)
To: 63879; +Cc: dev
[-- Attachment #1: Type: text/plain, Size: 130 bytes --]
X-Debbugs-CC: dev@rjt.dev
Example:
fn main() {
if true {
()
} else if true {
()
}
}
Yuan
[-- Attachment #2: rust-ts-mode.patch --]
[-- Type: application/octet-stream, Size: 2081 bytes --]
From d412e7d597d15a94b6725e231f392518138cc550 Mon Sep 17 00:00:00 2001
From: Yuan Fu <casouri@gmail.com>
Date: Sat, 3 Jun 2023 16:13:05 -0700
Subject: [PATCH] Fix rust-ts-mode indentation for else-if
This change fixes the indentation for code like this:
fn main() {
if true {
()
} else if true {
()
}
}
Before this change, the else-if's are indented one more level than it
should, because it's nested in the if node:
fn main() {
if true {
()
} else if true {
()
}
}
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules): Replace
parent-bol with standalone-parent.
---
lisp/progmodes/rust-ts-mode.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index be06acde3e3..ca295212640 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -74,7 +74,7 @@ rust-ts-mode--indent-rules
((parent-is "source_file") column-0 0)
((node-is ")") parent-bol 0)
((node-is "]") parent-bol 0)
- ((node-is "}") (and parent parent-bol) 0)
+ ((node-is "}") (and parent standalone-parent) 0)
((and (parent-is "comment") c-ts-common-looking-at-star)
c-ts-common-comment-start-after-first-star -1)
((parent-is "comment") prev-adaptive-prefix 0)
@@ -82,7 +82,7 @@ rust-ts-mode--indent-rules
((parent-is "await_expression") parent-bol rust-ts-mode-indent-offset)
((parent-is "array_expression") parent-bol rust-ts-mode-indent-offset)
((parent-is "binary_expression") parent-bol rust-ts-mode-indent-offset)
- ((parent-is "block") parent-bol rust-ts-mode-indent-offset)
+ ((parent-is "block") standalone-parent rust-ts-mode-indent-offset)
((parent-is "declaration_list") parent-bol rust-ts-mode-indent-offset)
((parent-is "enum_variant_list") parent-bol rust-ts-mode-indent-offset)
((parent-is "field_declaration_list") parent-bol rust-ts-mode-indent-offset)
--
2.33.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#63879: 29.0.90; [PATCH] Fix rust-ts-mode indentation for else-if
2023-06-03 23:18 bug#63879: 29.0.90; [PATCH] Fix rust-ts-mode indentation for else-if Yuan Fu
@ 2023-06-03 23:58 ` Randy Taylor
2023-06-04 5:12 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Randy Taylor @ 2023-06-03 23:58 UTC (permalink / raw)
To: Yuan Fu; +Cc: 63879
On Saturday, June 3rd, 2023 at 19:18, Yuan Fu <casouri@gmail.com> wrote:
> X-Debbugs-CC: dev@rjt.dev
>
> Example:
>
> fn main() {
> if true {
> ()
> } else if true {
> ()
> }
> }
>
>
> Yuan
I can't reproduce this on emacs-29 (with and without -Q) with the example you gave.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#63879: 29.0.90; [PATCH] Fix rust-ts-mode indentation for else-if
2023-06-03 23:58 ` Randy Taylor
@ 2023-06-04 5:12 ` Eli Zaretskii
2023-06-05 7:43 ` Yuan Fu
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2023-06-04 5:12 UTC (permalink / raw)
To: Randy Taylor; +Cc: casouri, 63879
> Cc: 63879@debbugs.gnu.org
> Date: Sat, 03 Jun 2023 23:58:16 +0000
> From: Randy Taylor <dev@rjt.dev>
>
> I can't reproduce this on emacs-29 (with and without -Q) with the example you gave.
Neither can I, FWIW.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#63879: 29.0.90; [PATCH] Fix rust-ts-mode indentation for else-if
2023-06-04 5:12 ` Eli Zaretskii
@ 2023-06-05 7:43 ` Yuan Fu
0 siblings, 0 replies; 4+ messages in thread
From: Yuan Fu @ 2023-06-05 7:43 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Randy Taylor, 63879, 63879-done
> On Jun 3, 2023, at 10:12 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> Cc: 63879@debbugs.gnu.org
>> Date: Sat, 03 Jun 2023 23:58:16 +0000
>> From: Randy Taylor <dev@rjt.dev>
>>
>> I can't reproduce this on emacs-29 (with and without -Q) with the example you gave.
>
> Neither can I, FWIW.
Oh well, I went back and can’t reproduce this anymore either, even with the real code I was writing that prompted this. Sorry for the noise.
Yuan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-05 7:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-03 23:18 bug#63879: 29.0.90; [PATCH] Fix rust-ts-mode indentation for else-if Yuan Fu
2023-06-03 23:58 ` Randy Taylor
2023-06-04 5:12 ` Eli Zaretskii
2023-06-05 7:43 ` Yuan Fu
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.