[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63379: 29.0.60; Indentation not working properly in csharp-mode
From: |
Theodor Thornhill |
Subject: |
bug#63379: 29.0.60; Indentation not working properly in csharp-mode |
Date: |
Sat, 02 Sep 2023 19:17:12 +0200 |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Aleksey Kliger <akliger@gmail.com>
>> Date: Fri, 1 Sep 2023 22:10:18 -0400
>>
>> This seems to be due to
>> https://github.com/emacs-mirror/emacs/commit/dfc850ca0223ffd1d2048657ea6d20c971865d51
>
> You mean, you haven't updated your Git since February?
>
>> specifically (backward-up-list 1 t t) seems to emit that error message:
>>
>> ;; Assume called interactively; don't signal an error.
>> (user-error "At top level")
>>
>> Easy reproduction: edit a csharp file, go to some toplevel line (e.g. "using
>> System;" that is pervasive
>> in a lot of C# code) and run c-indent-line-or-region.
>
> Theo, could you please look into this? TIA.
>
Yeah, I think this is a simple enough fix. Should I install this on
master, 29 branch?
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 37bb84ab5ba..1e5cb20bda9 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -493,7 +493,7 @@ csharp-guess-basic-syntax
;; Next non-whitespace character should be '{'
(goto-char (c-point 'boi))
(unless (eq (char-after) ?{)
- (backward-up-list 1 t t))
+ (ignore-errors (backward-up-list 1 t t)))
(save-excursion
;; 'new' should be part of the line
(goto-char (c-point 'iopl))
Theo