;; Author: Brad Settlemyer ;; Last Modified: 2002-08-18 ;; ;; Stronghold Technologies coding style. ;; - Tabs instead of spaces ;; - Indent class comments ;; - Indent 2 spaces instead of 4 for C++ and CPerl mode ;; Enable tabs and 2 space tab stops (setq-default indent-tabs-mode t) (setq-default tab-width 2) ;; Comment indentation function (defun sti-lineup-comment (langelem) (save-excursion (if (not (vectorp (c-at-toplevel-p))) '0 '2))) ;; No space before { and function sig indents 4 if argument overflow (setq sti-c-style '((c-auto-newline . nil) (c-basic-offset . 2) (c-comment-only-line-offset . 0) (c-echo-syntactic-information-p . nil) (c-hungry-delete-key . t) (c-tab-always-indent . t) (c-toggle-hungry-state . t) (c-hanging-braces-alist . ((substatement-open after) (brace-list-open))) (c-offsets-alist . ((arglist-close . c-lineup-arglist) (case-label . 2) (substatement-open . 0) (block-open . 0) (inclass . ++) (knr-argdecl-intro . -))) (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)))) ;; Construct a hook to be called when entering C mode (defun sti-c-mode () (c-add-style "Stronghold Coding Style" sti-c-style t) (c-set-offset 'comment-intro 'sti-lineup-comment)) (add-hook 'c-mode-common-hook 'sti-c-mode) ;; Setup CPerl Mode indentation (setq cperl-brace-offset -2) (setq cperl-indent-level 2)