Thread overview
Emacs and inner functions
Jul 24, 2004
Sean Kelly
Jul 25, 2004
Charlie
Jul 25, 2004
Ben Hinkle
July 24, 2004
I've noticed that the default D mode for emacs wants to format things this way:

# void func()
# {
#      void inner()
#          {
#               blah;
#          }
# }

I can work around this by omitting the closing ")" for the inner function until after I've typed the opening "{" but this is an annoying workaround.  Anyone with more emacs experience than I have know how to get inner function bodies to shift one tab width to the left?

Only other irritating thing is that emacs does weird things with comments and multiline var declarations:

# int   x = 1,
#  y = 2;

I think that's the default.  Obviously I'd kind of like to have the "y" lined up under the "x."


Sean


Sean


July 25, 2004
I noticed this too, you using Bens d-mode ?  He can probably fix it if you ask him nice ;).  Also Nested Comments (/+ +/) , and the keywords, mixin, function ,delegate, and pragma;

Charlie

In article <cdubru$16qe$1@digitaldaemon.com>, Sean Kelly says...
>
>I've noticed that the default D mode for emacs wants to format things this way:
>
># void func()
># {
>#      void inner()
>#          {
>#               blah;
>#          }
># }
>
>I can work around this by omitting the closing ")" for the inner function until after I've typed the opening "{" but this is an annoying workaround.  Anyone with more emacs experience than I have know how to get inner function bodies to shift one tab width to the left?
>
>Only other irritating thing is that emacs does weird things with comments and multiline var declarations:
>
># int   x = 1,
>#  y = 2;
>
>I think that's the default.  Obviously I'd kind of like to have the "y" lined up under the "x."
>
>
>Sean
>
>
>Sean
>
>


July 25, 2004
I'll take a shot - I get annoyed, too, by all the things that it gets wrong. The trouble is I barely know how the C-mode code works so it will take a little while to get into it. The d-mode file is just a set of hooks that the C-mode engine exposes and typically the syntactic constructs unique to D don't have hooks so they end up formatting strangly.

-Ben

Charlie wrote:

> I noticed this too, you using Bens d-mode ?  He can probably fix it if you
> ask
> him nice ;).  Also Nested Comments (/+ +/) , and the keywords, mixin,
> function ,delegate, and pragma;
> 
> Charlie
> 
> In article <cdubru$16qe$1@digitaldaemon.com>, Sean Kelly says...
>>
>>I've noticed that the default D mode for emacs wants to format things this way:
>>
>># void func()
>># {
>>#      void inner()
>>#          {
>>#               blah;
>>#          }
>># }
>>
>>I can work around this by omitting the closing ")" for the inner function
>>until
>>after I've typed the opening "{" but this is an annoying workaround.
>>Anyone with more emacs experience than I have know how to get inner
>>function bodies to shift one tab width to the left?
>>
>>Only other irritating thing is that emacs does weird things with comments and multiline var declarations:
>>
>># int   x = 1,
>>#  y = 2;
>>
>>I think that's the default.  Obviously I'd kind of like to have the "y" lined up under the "x."
>>
>>
>>Sean
>>
>>
>>Sean
>>
>>