Henner Zeller <[EMAIL PROTECTED]> writes:

| Hi,
| two short remarks; I usually put these lines in every file I write
| 
| /* Emacs:
|  * Local variables:
|  * c-basic-offset: 8
|  * End:
|  * vi:set tabstop=8 shiftwidth=8 nowrap:
|  */

the problem is that is not enough... I have:

in my .emacs file:

 ;;; Common hook
(defun my-c-mode-common-hook ()
  ;; Set return Style
  (local-set-key [return] 'newline-and-indent)
  (local-set-key [S-return] 'newline)
  (c-set-style "CC-MODE")
  (setq compile-command "make -k")
  )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;; C++ mode hook
(defun my-c++-mode-hook ()
  ;; Style parameters
  (setq c-basic-offset 8)
  (c-set-offset 'innamespace 0)
  (imenu-add-to-menubar "Index")
  (c-toggle-auto-state 0)
)  
(add-hook 'c++-mode-hook 'my-c++-mode-hook)


(custom-set-variables
 '(c-default-style "linux")
 '(c-cleanup-list (quote (brace-else-brace brace-elseif-brace
 empty-defun-braces list-close-comma scope-operator)))
 '(c-hanging-braces-alist (quote ((defun-open before after)
 (defun-close before after) (class-open after) (class-close before)
 (inline-open after) (inline-close before after) (block-open after)
 (block-close before after) (substatement-open after)
 (statement-case-open) (extern-lang-open) (extern-lang-close)
 (brace-list-open) (brace-list-close) (brace-list-intro)
 (brace-entry-open) (inexpr-class-open) (inexpr-class-close))))
 '(c++-mode-hook (quote (my-c++-mode-hook)) t)
 '(c-comment-continuation-stars " ")
 '(c-indent-comments-syntactically-p t)
 '(c-tab-always-indent t)
 '(c-echo-syntactic-information-p t)
 '(c-strict-syntax-p t)
 '(c-style-variables-are-local-p t)
 '(c-hanging-colons-alist (quote ((case-label) (label after)
 (access-label after) (member-init-intro before) (inher-intro))))
)


and since this is my setup it is also defining the coding style we use
in LyX. (more or less)

c-basic-offset is only part of it.

-- 
        Lgb

Reply via email to