summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorTheodor Thornhill <theo@thornhill.no>2023-05-06 21:13:15 +0200
committerTheodor Thornhill <theo@thornhill.no>2023-05-06 21:15:21 +0200
commite205f68717e960a929e5657e8351ba6ef0e5f480 (patch)
tree3e061d61f3aa9a1d05eb63a3a7e5f8cdf3ea24ff /lisp
parentdfde902f3b9c7eea7e58e09c4d52c1346ef52ee4 (diff)
downloademacs-e205f68717e960a929e5657e8351ba6ef0e5f480.tar.gz
Fix indent for enums in csharp-mode
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/csharp-mode.el9
1 files changed, 9 insertions, 0 deletions
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 @@ 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))