www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Emacs and inner functions

reply Sean Kelly <sean f4.ca> writes:
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
Jul 24 2004
parent reply Charlie <Charlie_member pathlink.com> writes:
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

Jul 24 2004
parent Ben Hinkle <bhinkle4 juno.com> writes:
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


Jul 25 2004