Find the answer to your Linux question:
Results 1 to 3 of 3
Hi , Iam new to linux forums. I am using emacs edior for coding c apps. For quite some time i've been having problems with the indenting feature. For eg ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2004
    Posts
    3

    Regarding C lang indenting in emacs


    Hi ,
    Iam new to linux forums. I am using emacs edior for coding c apps.
    For quite some time i've been having problems with the indenting feature.
    For eg ::

    Code:
    int main()
    {
      int i;
      if()
      {
        i=0;
      }
    }
    All programs I write in 'C' have a default left indent of 2 spaces and and syntactically,
    the indent is also 2 spaces.(as you can see after the 'if')

    I want an indent of 8 spaces.
    So I customized .....certain variables in emacs...

    standard indent = 8
    tab always indent = t
    tab stop list = 0 8 16 ...
    c basic offset = 8
    c tab always indent = t
    c insert tab = t
    c syntactic indentation = t

    Still I dint get what i wanted. It would be great if
    some one using emacs..for ''c prg" can help me out in configuring
    my requirement

    Thanks,
    Baskar

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Emacs' C-mode has a small library of built-in indenting styles. Type C-c . (that's Control-C and then period) to choose one in the minibuffer. You can use tab completion to see which ones are available. I think you would want the one that is named "linux". Personally, I tend to use "stroustrup".

  3. #3
    Just Joined!
    Join Date
    May 2004
    Posts
    3
    Hi Dolda,
    Thanks for the information about builtin indentation styles in 'emacs'. It did help me a lot.
    And I went through some docs in GNU.org(It all talks only about using emacs).

    Have you ever come accross any doc in the web, where one can find info about customizing/personalising emacs or builtin/pluggable facilities available ?

    thanks,
    Baskar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •