dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]Emacs Named style for dotGNU


From: Charles Shuller
Subject: [DotGNU]Emacs Named style for dotGNU
Date: Thu, 31 Oct 2002 17:17:16 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020923

Hello All --

Fist let me say I'm not an emacs developer in any way shape or form, but in case there are other emacs users out there, here is a named style to make things conform to dotGNU conventions, as I understand them.

To install, append the following to your .emacs file in your home directory. It will cause the dotGNU style to load by default


;;Define dotgnu-c-style, autoloads with all CC modes
;;So change if you want to load it yourself somehow
(defconst dotgnu-c-style
  '((c-tab-always-indent        . t)
    (c-comment-only-line-offset . 4)
    (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        . 4)
                                   (block-open        . 0)
                                   (knr-argdecl-intro . -)
                                   (defun-block-intro . +)
                                   (block-open        . 0)
                                   (block-close       . 0)
                                   (innamespace       . 0)
                                   (topmost-intro     . 0)
                                   (inclass           . 0)
                                   (inline-open       . +)
                                   (inher-cont        . +)))
    (c-echo-syntactic-information-p . t)
    )
  "DotGNU C Programming Style")

;; offset customizations not in dotgnu-c-style
(setq c-offsets-alist '((member-init-intro . ++)))

;; Customizations for all modes in CC Mode.
(defun dotgnu-c-mode-common-hook ()
  ;; add my personal style and set it for the current buffer
  (c-add-style "DOTGNU" dotgnu-c-style t)
  ;; other customizations
  (setq tab-width 4
        ;; this will make sure spaces are used instead of tabs
        indent-tabs-mode nil)
  ;; we like auto-newline and hungry-delete
  (c-toggle-auto-hungry-state 1)
  ;; key bindings for all supported languages.  We can put these in
  ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
  ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
  (define-key c-mode-base-map "\C-m" 'c-context-line-break)
  )

(add-hook 'c-mode-common-hook 'dotgnu-c-mode-common-hook)

(setq auto-mode-alist (cons '("\\.cs\\'" . c++-mode)
                            auto-mode-alist))




--
Charles Shuller
Jabber ID: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]