Xref: utzoo gnu.emacs:1661 comp.emacs:6921
Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!uceng!kamat
From: kamat@uceng.UC.EDU (Govind N. Kamat)
Newsgroups: gnu.emacs,comp.emacs
Subject: Re: indentation in C mode (summary)
Message-ID: 
Date: 26 Sep 89 15:34:02 GMT
References: 
Followup-To: gnu.emacs
Organization: College of Engg., University of Cincinnati
Lines: 50
In-reply-to: kamat@uceng.UC.EDU's message of 12 Sep 89 22:28:42 GMT

In article  I'd asked:

   I'd like my C indentation to look like this:

   char *
   function(arg)
	int arg;

   The GNU Emacs manual says that this is supposed to be the default
   style, setting no indentation variables; however, I seem to end up
   with:

   char *
     function(arg)
   int arg;

Well, I received quite a few messages, all asking me to summarize
anything discovered.  Alas, I got no solutions :) and so I poked
around in the code myself.  The following seems to work for me:

Apply this patch to c-mode.el.  You will also have to build the binary
again since c-mode is listed in loadup.el.  Alternatively, I guess you
could reload c-mode in your .emacs.  If your taste runs to having the
argument declarations align on the left margin, set the variable
c-argdecl-indent to 0.

Let me know if you find this breaks anything.


*** c-mode.el.OLD	Tue Sep 19 21:41:32 1989
--- c-mode.el	Tue Sep 19 21:41:43 1989
***************
*** 385,391 ****
  		 ;; Now add a little if this is a continuation line.
  		 (+ basic-indent (if (or (bobp)
  					 (memq (preceding-char) '(?\) ?\; ?\})))
! 				     0 c-continued-statement-offset)))))
  	    ((/= (char-after containing-sexp) ?{)
  	     ;; line is expression, not statement:
  	     ;; indent to just after the surrounding open.
--- 385,391 ----
  		 ;; Now add a little if this is a continuation line.
  		 (+ basic-indent (if (or (bobp)
  					 (memq (preceding-char) '(?\) ?\; ?\})))
! 				     0 0)))))
  	    ((/= (char-after containing-sexp) ?{)
  	     ;; line is expression, not statement:
  	     ;; indent to just after the surrounding open.

--
Govind N. Kamat 			College of Engineering
kamat@uceng.UC.EDU			University of Cincinnati
					Cincinnati, OH 45221, USA