bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63141: Incorrect indentation in csharp-mode


From: Theodor Thornhill
Subject: bug#63141: Incorrect indentation in csharp-mode
Date: Sat, 06 May 2023 12:03:15 +0200

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Wed, 03 May 2023 06:44:47 +0200
>> From: Theodor Thornhill <theo@thornhill.no>
>> CC: jcs090218@gmail.com, 63141@debbugs.gnu.org, jostein@kjonigsen.net
>> 
>> 
>> 
>> On 2 May 2023 14:57:03 CEST, Eli Zaretskii <eliz@gnu.org> wrote:
>> >> Date: Sat, 29 Apr 2023 13:02:12 +0200
>> >> From: Theodor Thornhill <theo@thornhill.no>
>> >> CC: jcs090218@gmail.com, 63141@debbugs.gnu.org, jostein@kjonigsen.net
>> >> 
>> >> >> I agree. It's not a bug, but could absolutely be a missing 
>> >> >> feature/consideration. I'd be happy to review a patch with the 
>> >> >> proposed changes, though.
>> >> >
>> >> >The patch I can envision is to change the default c-offsets-alist.
>> >> >But IMO we should only do that if many/most C# programs use the style
>> >> >suggested by the OP.
>> >> 
>> >> Agreed :)
>> >
>> >So, what's the way forward here? do we change the defaults?
>> 
>> I think so. Ill try to get to it today :)
>
> Ping!

Thanks!

Jen-Chieh, can you test this?

diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 4f7cbc3d51d..869a207c567 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -464,6 +464,15 @@ csharp-at-lambda-header
 
 (defun csharp-guess-basic-syntax (orig-fun &rest args)
   (cond
+   (;; enum
+    (save-excursion
+      (goto-char (c-point 'boi))
+      (and
+       (eq (char-after) ?\{)
+       (save-excursion
+         (goto-char (c-point 'iopl))
+         (looking-at ".*enum.*"))))
+    `((class-open ,(c-point 'iopl))))
    (;; Attributes
     (save-excursion
       (goto-char (c-point 'iopl))

Theo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]