From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: CC Mode lambda function help Date: Fri, 9 Oct 2020 10:57:03 +0000 Message-ID: <20201009105703.GA4027@ACM> References: <87h7rlr2hl.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5522"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 09 12:58:50 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQq6s-0001JR-Nt for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Oct 2020 12:58:50 +0200 Original-Received: from localhost ([::1]:57668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQq6r-0001yg-QJ for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Oct 2020 06:58:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQq5K-0000L7-Kl for emacs-devel@gnu.org; Fri, 09 Oct 2020 06:57:14 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:50681 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1kQq5F-0006ZV-BR for emacs-devel@gnu.org; Fri, 09 Oct 2020 06:57:14 -0400 Original-Received: (qmail 63712 invoked by uid 3782); 9 Oct 2020 10:57:04 -0000 Original-Received: from acm.muc.de (p4fe15b4c.dip0.t-ipconnect.de [79.225.91.76]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Fri, 09 Oct 2020 12:57:03 +0200 Original-Received: (qmail 6124 invoked by uid 1000); 9 Oct 2020 10:57:03 -0000 Content-Disposition: inline In-Reply-To: <87h7rlr2hl.fsf@thornhill.no> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/09 06:57:04 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:257257 Archived-At: Hello, Theodor. I just noticed your post from a fortnight ago. Sorry I didn't notice it earlier. On Fri, Sep 25, 2020 at 23:05:42 +0200, Theodor Thornhill wrote: > Hello! > I am reworking the csharp mode found at > https://github.com/josteink/csharp-mode, and I have some problems I am > really struggling to fix, or find information about in the manual (if > it is there): OK. Version numbers? ;-) What does "the" manual mean? If it doesn't mean the CC Mode manual, then it should. It's available in .../emacs/info/ccmode.info, or some very similar address. It contains a wealth of information, being largely written by myself. :-) > 1. Lambda functions > Consider this code: > ``` > AsyncTest.Run(async () => > { > Something xyz = > new SomethingMore(); > }); > ``` > Right now this indents as: > ``` > AsyncTest.Run(async () => > { > Something xyz = > new SomethingMore(); > }); > ``` > I cannot find what c-lang-defconst to configure, or what c-style-alist > combination to pick to get this. Any pointer to what is wrong would be > super helpful. OK, just to be quite clear, c-lang-defconsts are intended for the use of hackers maintaining CC Mode or modes derived from it (as you are doing), to specify modes. They are not for users' configuration, for which see things like "styles" and c-offsets-alist and other things in the configuration section of the CC Mode manual. I think it likely you have run into a configuration bug, possibly an old bug, where a "syntactic offset" was inappropriately set. To see the syntactic symbol(s) for a source line, put point on it and do C-c C-s. To see the offset currently configured for that/those symbol(s), do C-c C-o (again, see the CC Mode manual for any needed explanations). Running the CC Mode head on Emacs master, I don't see the problems you're having. But I haven't yet downloaded the branch from github that you mention. > 2. Attributes > Consider this code: > ``` > [DllImport("something.dll")] > public extern int GetSomething(); > ``` > Gets indented as: > ``` > [DllImport("something.dll")] > public extern int GetSomething(); > ``` > This I attribute (pun intended) to vsemi, since when one is added: > ``` > [DllImport("something.dll")]; // <-- notice this > public extern int GetSomething(); > ``` > It behaves correctly. In addition, that semi fixes fontification for the > method name. I would like not to use the 'statement-cont', since that > only looks like a symptom, rather than a fix. > I'd love some pointers to how I would best handle this. I think you know the answer: fix csharp--at-vsemi-p. It seems intended to detect the attribute in square brackets and signal a virtual semicolon. Why is it not working? > To reproduce this, you have to (unfortunately...) clone the > abovementioned repo, checkout the 'rework' branch, then byte compile > that file. I am sorry there is no quicker way to get to that code. > These snippets should be enough to illustrate my issues. I hope this answer from me is at least somewhat helpful. > Have a lovely day, Yourself, too! > Theodor Thornhill -- Alan Mackenzie (Nuremberg, Germany).