Subject: bug#63379: 29.0.60; Indentation not working properly in csharp-mode

From: Eli Zaretskii <[email-masked]>
Date: Sat, 02 Sep 2023 11:59:08 +0300

> From: Aleksey Kliger <[email-masked]>
> 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.

> By the way: (advice-add 'c-guess-basic-syntax :around #'csharp-guess-basic-syntax) 
> means that csharp-guess-basic-syntax runs also in all other c-mode derived modes.  So this error
> also happens if you first edit a .cs file and then a normal .c file and you try to, for example, indent a
> toplevel comment in the C code.  Very frustrating.