Path: utzoo!utgpu!watmath!iuvax!cica!tut.cis.ohio-state.edu!ZAYANTE.PA.DEC.COM!mellon From: mellon@ZAYANTE.PA.DEC.COM (Ted Lemon) Newsgroups: gnu.emacs.bug Subject: Bug in c-mode.el Message-ID: <8907290534.AA01190@zayante.pa.dec.com> Date: 29 Jul 89 05:34:14 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 63 I have my c-mode indentation set up as follows: (progn (setq c-indent-level 4) (setq c-continued-statement-offset 4) (setq c-brace-offset -4) (setq c-argdecl-indent 1) (setq c-auto-newline nil)) When I do a ``switch'' in C, emacs indents the case statements incorrectly. Similarly, emacs indents my label statements incorrectly. Sample: switch( foo ) { case bar : farf(); break; case blef : farkle(); break; default : printf( "foo bar!\n" ); } The correct indentation is: switch( foo ) { case bar : farf(); break; case blef : farkle(); break; default : printf( "foo bar!\n" ); } The problem turns out to be quite trivial. c-mode doesn't believe that there can be a space between the label and the colon. The following diff shows the required changes to fix this bug: ------------------------------------------------------------------------------- zayante% diff c-mode-new-somewhat.el /usr/local/emacs/lisp/c-mode.el 315d314 < (skip-chars-forward " \t\n") 406c405 < '(?w ?_ ? ))))) --- > '(?w ?_))))) 433c432 < (looking-at "#\\|/\\*\\|case[ \t\n].*:\\|[a-zA-Z0-9_$]*[ \t\n]*:")) --- > (looking-at "#\\|/\\*\\|case[ \t\n].*:\\|[a-zA-Z0-9_$]*:")) 644d642 < (skip-chars-forward " \t") ------------------------------------------------------------------------------- _MelloN_