From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kai.grossjohann@uni-duisburg.de (Kai =?iso-8859-1?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.help Subject: Re: C formatting Date: Sat, 28 Dec 2002 12:05:56 +0100 Organization: University of Dortmund, Germany Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <844r8y2yjv.fsf@lucy.cs.uni-dortmund.de> References: <3E0CED7C.7020002@free.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1041073927 3795 80.91.224.249 (28 Dec 2002 11:12:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 28 Dec 2002 11:12:07 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18SEsw-0000z5-00 for ; Sat, 28 Dec 2002 12:12:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18SErU-000208-01 for gnu-help-gnu-emacs@m.gmane.org; Sat, 28 Dec 2002 06:10:36 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!p50876b5f.dip.t-dialin.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: p50876b5f.dip.t-dialin.net (80.135.107.95) Original-X-Trace: fu-berlin.de 1041073567 8341845 80.135.107.95 (16 [73968]) User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu) Cancel-Lock: sha1:Q3VlT/3rtKbZVXZk58QHC4PUT3E= Original-Xref: shelby.stanford.edu gnu.emacs.help:108529 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5059 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5059 Oodini writes: > I ma desesperatly playing in my .emacs with the following statements, > but no luck: I suggest to try C-c C-o on the first line that has wrong indentation and to follow the prompts. Then hit TAB to reindent the line. When you like the indentation, you can use C-x ESC ESC and then M-p/M-n to retrieve the right c-set-offset statement. That's what you can put in the hook, below: > (setq c-mode-hook > (function > (lambda () > (setq c-basic-offset 0) > (setq c-indent-level 5) > (setq c-continued-statement-offset 5) > (setq c-argdecl-indent 0) > (setq c-brace-offset -5) > (setq c-label-offset -5) > ) > ) > ) This is not a good idea to do, either, as you are overriding old values for the hook. Never use setq on a hook. Always use add-hook instead. Here's my suggestion, fill in the missing c-set-offset statements here: (defun oodini-c-indent-setup () (setq c-basic-offset 5) (c-set-offset ...)) (add-hook 'c-mode-hook 'oodini-c-indent-setup) You didn't say which version of Emacs you are using. I'm assuming Emacs 21. Probably the above works for Emacs 20, too. -- Ambibibentists unite!