all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Theodor Thornhill <theo@thornhill.no>
Cc: emacs-devel@gnu.org
Subject: Re: CC Mode lambda function help
Date: Fri, 9 Oct 2020 10:57:03 +0000	[thread overview]
Message-ID: <20201009105703.GA4027@ACM> (raw)
In-Reply-To: <87h7rlr2hl.fsf@thornhill.no>

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).



  reply	other threads:[~2020-10-09 10:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 21:05 CC Mode lambda function help Theodor Thornhill
2020-10-09 10:57 ` Alan Mackenzie [this message]
2020-10-09 12:43   ` Theodor Thornhill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201009105703.GA4027@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.