all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: astone42@simla.colostate.edu (SomeDude)
Subject: Stop autoindenting!
Date: 26 May 2004 19:52:24 -0700	[thread overview]
Message-ID: <5fa025ca.0405261852.1bb4fb9d@posting.google.com> (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++;
      }
}

             reply	other threads:[~2004-05-27  2:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-27  2:52 SomeDude [this message]
2004-05-27 18:07 ` Stop autoindenting! Michael Slass
2004-05-27 19:28 ` Stefan Monnier
2004-05-27 20:42 ` Alan Mackenzie

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=5fa025ca.0405261852.1bb4fb9d@posting.google.com \
    --to=astone42@simla.colostate.edu \
    /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.