>>>>> On Mon, 06 Jun 2005 17:12:58 +0800, Raymond <[EMAIL PROTECTED]> said:

ra> But in my lab. The code was written by VI. And all C/C++ code is indented
ra> by TAB. Just like this:

ra> int main(int argc, char* argv[]) { <TAB>std::cout << "Hello world!"
ra> <TAB><TAB><<std::endl; <TAB>return 0;
ra> }

I use the following settings (without TABS), I have modified to use TABS. Give
it a try, this might just work for you too.

;;------------------------ START [put this in .emacs] -------------------------
;;-----------------------------------------------------------------------------
;; Local C/C++ style
;;-----------------------------------------------------------------------------
;; insert HARD tabs on indentation
(setq indent-tabs-mode t)
(defconst dky-style
  '((tab-width                          . 4)
    (c-basic-offset                     . 4)
    (c-tab-always-indent                . t)
    (c-comment-only-line-offset         . 0)
    (c-hanging-braces-alist             . ((substatement-open after)
                                           (brace-list-open)))
    (c-hanging-colons-alist             . ((member-init-intro before)
                                           (inher-intro)
                                           (case-label after)
                                           (label after)
                                           (access-label after)))
    (c-cleanup-list                             . (scope-operator
                                                   empty-defun-braces
                                                   defun-close-semi))
    (c-offsets-alist                    . ((arglist-close . c-lineup-arglist)
                                           (substatement-open . 0)
                                           (case-label            . +)
                                           (block-open            . 0)
                                           (inline-open           . 0)
                                           (inline-close          . 0)
                                           (knr-argdecl-intro . -)
                                           (member-init-intro . +)
                                           (access-label          . -1000)
                                           (statement-block-intro . +)))
    (indent-tabs-mode                   . nil)
    (c-echo-syntactic-information-p     . nil)
    (comment-style                      . multi-line))
  "*User defined C/C++ Programming Style")
(c-add-style "dky" dky-style t)
(setq c-default-style "dky")
;;------------------------ END -------------------------


-dk

-- 
Name : Dhruva Krishnamurthy (dk)
Phone: +91-(0)80-22999190
Proud FSF member: #1935
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to