]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix indent for enums in csharp-mode
authorTheodor Thornhill <theo@thornhill.no>
Sat, 6 May 2023 19:13:15 +0000 (21:13 +0200)
committerTheodor Thornhill <theo@thornhill.no>
Sat, 6 May 2023 19:15:21 +0000 (21:15 +0200)
* lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Check for
keywords containing 'enum' on the line before an opening bracket, and
make it behave like a class-open token.

lisp/progmodes/csharp-mode.el

index 4f7cbc3d51d5a0160f2cfdf678952c31248b5b53..869a207c5674061a0f9bb55dd84be4b9bb117563 100644 (file)
@@ -464,6 +464,15 @@ compilation and evaluation time conflicts."
 
 (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))