From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Stop autoindenting! Date: Thu, 27 May 2004 20:42:26 +0000 Organization: muc.de e.V. -- private internet access Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <5fa025ca.0405261852.1bb4fb9d@posting.google.com> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1085726211 22140 80.91.224.253 (28 May 2004 06:36:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 May 2004 06:36:51 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 28 08:36:43 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BTayw-0006zJ-00 for ; Fri, 28 May 2004 08:36:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BTaRi-0002Eg-Cs for geh-help-gnu-emacs@m.gmane.org; Fri, 28 May 2004 02:02:22 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 50 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1085722861 66740 193.149.49.134 (28 May 2004 05:41:01 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 28 May 2004 05:41:01 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:123538 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:18834 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:18834 SomeDude 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 c 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 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").