[comp.emacs] indentation in C mode

kamat@uceng.UC.EDU (Govind N. Kamat) (09/13/89)

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;

And perhaps I can ask one more question of you "GNUru's":  we have
some terminals using ^h for erasure, and others with "delete" keys.
Now I use the key-translate-table to set emacs up correctly, but is
there some way I could get the tty setup information communicated to
emacs automatically?

Please reply by e-mail, and if there is enough interest, I'll post a
summary.  Thanks for your help!

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

kamat@uceng.UC.EDU (Govind N. Kamat) (09/26/89)

In article <KAMAT.89Sep12182842@uceng.UC.EDU> 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