indenting C-Code

indenting C-Code

Post by Andreas Vol » Wed, 22 May 2002 14:32:00



Hy,

I'm working for some time with Xemacs and I love it. But I have a problem
with configuring the indent function of xemacs. Indent produces the
following code:

/** if second argument is not a number **/
  if (atoi(argv[2]) < 0)
    {  <= (This)
    printf("%s", arguments);
    printf("%s ist keine zul?ssige Tabbreite\n", argv[2]);
    exit(EXIT_FAILURE);
  }

But I want that it look like this:

/** if second argument is not a number **/
  if (atoi(argv[2]) < 0)
  {  <= (should look this)
    printf("%s", arguments);
    printf("%s ist keine zul?ssige Tabbreite\n", argv[2]);
    exit(EXIT_FAILURE);
  }

I think this must be a simple thing to do it, but I could not find the
option to change it. I hope someone could help me...

thanks
Andreas

 
 
 

indenting C-Code

Post by those who know me have no need of my nam » Wed, 22 May 2002 15:13:48



Quote:>I'm working for some time with Xemacs and I love it. But I have a problem
>with configuring the indent function of xemacs. Indent produces the
>following code:

you want the `styles' section of the cc-mode manual.

--
bringing you boring signatures for 17 years

 
 
 

indenting C-Code

Post by Tarun Ramakrishna Elankat » Thu, 23 May 2002 16:17:17


Install cc-mode (must be alread there) and try c-set-style for a list of
available styles
 
 
 

indenting C-Code

Post by Allen M. Cohe » Wed, 29 May 2002 13:32:37


Try "M-x customize-group
cc-mode


Quote:> Install cc-mode (must be alread there) and try c-set-style for a list of
> available styles

 
 
 

indenting C-Code

Post by Larry Daffne » Wed, 05 Jun 2002 06:39:57


  AV> Hy, I'm working for some time with Xemacs and I love it. But I
  AV> have a problem with configuring the indent function of
  AV> xemacs. Indent produces the following code:

[ examples snipped ]
  AV> I think this must be a simple thing to do it, but I could not
  AV> find the option to change it. I hope someone could help me...

The solution is to set the offset for substatement-open to 0. You can
do this by adding the cons (substatement-open . 0) to your
c-offsets-alist, if you're using the cc-styles type interface, or
adding (c-set-offset 'substatement-open 0) to your c-mode-hook, if
you're going that route.

(note: you can find out what syntactic element you're on with \C-c\C-s
in cc-mode. Then, just set the appropriate offset for the element it
returns.)

HTH
-Larry

--

|   http://www.veryComputer.com/~vizzie/   |     #include <disclaimer.h>    |
           Reality is a crutch for people who can't cope with *.
                                 -- Lily Tomlin

 
 
 

1. how to indent a large C-code???

Hi,

I have a quite simple question, but definitely i'm unable
to find the response myself:

How can I indent a multi-line selection of a C code file,
or even the whole file???
I have the auto-indent when i'm typing things and I have it
with TAB, but what's the command to perform this multi-line
relative indentation?

Thanks in advance!

* ** *** ***** Happy New Year 1997 Bonne Annee ***** *** ** *

   Timour JGENTI                 Institut Francais du Petrole      

-> http://www.mygale.org/00/timlcf/  <<<<<- Have Fun!

2. Dumb question: PM queues messages, right?

3. browsing a c-code with xemacs

4. ZoneAlarm blocking client???

5. Adding C-code plug-ins to Emacs?

6. WTB: an A1200, or 3000, or 4000...

7. No C-code Color Highlighting

8. Writing color text to console

9. C++ comments in C-code

10. Adding C-code plug-ins to Emacs?

11. how to auto indent the c++ code?

12. xemacs 19.13 help custom indent c code

13. Problems indenting fortran codes