From: Alan Mackenzie <acm@muc.de>
Subject: Re: Stop autoindenting!
Date: Thu, 27 May 2004 20:42:26 +0000 [thread overview]
Message-ID: <irj59c.f6.ln@acm.acm> (raw)
In-Reply-To: 5fa025ca.0405261852.1bb4fb9d@posting.google.com
SomeDude <astone42@simla.colostate.edu> wrote on 26 May 2004 19:52:24 -0700:
> 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.
The variable you need to set is c-syntactic-indentation. Either do it
via customize, with M-x customize-group <ret> c <ret> then look for "C
Syntactic Indentation" or put this into your .emacs:
(setq c-syntactic-indentation nil)
> Things like braces seem to jump around to odd places whenever I type
> them in.
Once you've disabled the auto-indentation, and you feel you've got some
semblance of control back, I'd recomment you to start experimenting
gently with auto-indentation. It's one of those things which is
maddening when you're fighting against it all the time, but once you've
got it working how you want, you wonder how you ever managed without it.
> 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.
It is most definitely possible, just as you'd expect in the world's most
configurable program. :-) It's all described in the CC Mode manual
(look for "CC Mode" in the Info directory node) on the page "Customizing
Indentation" and its subpages. It can seem a bit heavy going, though.
I'd recommend you try one of the built-in styles to start with. From a
C++ buffer, do C-c . (that's "control-c dot"), then <tab> to get a list
of alternatives. Try "bsd" style or maybe "ellemtel". If you like one
of these styles, then put (e.g.) the following into your .emacs:
(setq c-default-style "bsd")
(or use the customization feature).
[ .... ]
--
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").
prev parent reply other threads:[~2004-05-27 20:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=irj59c.f6.ln@acm.acm \
--to=acm@muc.de \
/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.
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).