unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Stop autoindenting!
@ 2004-05-27  2:52 SomeDude
  2004-05-27 18:07 ` Michael Slass
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: SomeDude @ 2004-05-27  2:52 UTC (permalink / raw)


I've got a pretty unique coding style for C\C++ that I like. I think
it makes my code easy to read and understand (especially once syntax
highlighting is enabled). Unfortunatly, it doesn't conform to any of
the predefined styles set by emacs. What I'd like to do is turn off
all forms of autoindentation and get the tab key to work like it would
in any normal word processor so that I can manually format my code.
Things like braces seem to jump around to odd places whenever I type
them in. Rebinding tab and entering text mode makes it work exactly
like I want it to except text mode doesn't include syntax highlighting
which I'd like to have. If it were possible to somehow program emacs
to my own style that'd be cool too, but I don't know how to do that\if
it'd be possible.

As an example of my style would be something like this:

This would be in a .h file:

class LIB_SomeClass : public LIB_BaseClass
{
    public:
    //const
        const int LIB_SomeClass__SOME_CONSTANT = 0xFF;
    //type
        enum LIB_SomeClass__Colors
        {
            COLOR_RED = 0,
            COLOR_GREEN,
            COLOR_BLUE
        };

        struct LIB_SomeClass__ImaginaryNum
        {
            int a, b;
        };

    //- [Constructor] -
    LIB_SomeClass();

    //- [Methods] -
    bool ExampleMethod();
    int  AnotherMethod(int i, double d, string str);

    private:
    //Vars
        int _i, _j, _k;
        string _exampleMember;
}

This would be in a .cpp:
/* Program: <ProgName>
   Author:  <Name>
   Descr:   <Description of this class>
   Other:   <Other header info>
*/

//---------------------------------------------- [Constructor] -
LIB_SomeClass::LIB_SomeClass
{
    //Vars
        int functionVariable;
        string anotherVariable;

    //Loop through a for loop, just as an example
        for(int i = 0; i < 300; i++)
        {
            SomeFunction();
            ReallyLongFunctionWithManyParameters(_i, _j, _k,
                _examplemember, functionVariable, anotherVariable);
            );
        }
}
//--------------------------------------------------- [Methods] -
bool LIB_SomeClass::ExampleMethod()
{
    //Do something to make this method look legit
        CallAnotherFunction();
}
//... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
int LIB_SomeClass::AnotherMethod(int i, double d, string str)
{
    //Const
        const int A_CONSTANT = 500;

    //Another random loop:
      while(_j != A_CONSTANT)
      {
          ExampleMethod();
          i++;
      }
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-05-27 20:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-27  2:52 Stop autoindenting! SomeDude
2004-05-27 18:07 ` Michael Slass
2004-05-27 19:28 ` Stefan Monnier
2004-05-27 20:42 ` Alan Mackenzie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).