Refactor coding style definition

Old definition is still there, commented out. This is bad practice for
version control, but makes it easier for later modifications
gerrit-package
Gergely Polonkai 8 years ago
parent adf5f39439
commit cc4a3e8a62

@ -92,83 +92,118 @@
(defvaralias 'c-basic-offset 'tab-width)
(defvaralias 'cperl-indent-level 'tab-width)
(c-add-style "my"
'(
(c-basic-offset . 4)
(c-offsets-alist
(arglist-cont . 0)
(arglist-intro . ++)
(block-close . 0)
(brace-entry-open . 0)
(brace-list-close . 0)
(brace-list-intro . +)
(case-label . +)
(class-close . 0)
(defun-block-intro . +)
(defun-close . 0)
(defun-open . 0)
(inclass . +)
(statement . 0)
(statement-block-intro . +)
(statement-case-intro . +)
(statement-cont . 4)
(substatement-open . 0)
(topmost-intro . 0)
(topmost-intro-cont . 0)
(access-label . -)
(annotation-top-cont . 0)
(annotation-var-cont . +)
(arglist-close . c-lineup-close-paren)
(arglist-cont-nonempty . c-lineup-arglist)
(block-open . 0)
(brace-list-entry . 0)
(brace-list-open . 0)
(c . c-lineup-C-comments)
(catch-clause . 0)
(class-open . 0)
(comment-intro . c-lineup-comment)
(composition-close . 0)
(composition-open . 0)
(cpp-define-intro c-lineup-cpp-define +)
(cpp-macro . -1000)
(cpp-macro-cont . +)
(do-while-closure . 0)
(else-clause . 0)
(extern-lang-close . 0)
(extern-lang-open . 0)
(friend . 0)
(func-decl-cont . +)
(incomposition . +)
(inexpr-class . +)
(inexpr-statement . +)
(inextern-lang . +)
(inher-cont . c-lineup-multi-inher)
(inher-intro . +)
(inlambda . c-lineup-inexpr-block)
(inline-close . 0)
(inline-open . +)
(inmodule . +)
(innamespace . +)
(knr-argdecl . 0)
(knr-argdecl-intro . +)
(label . 2)
(lambda-intro-cont . +)
(member-init-cont . c-lineup-multi-inher)
(member-init-intro . +)
(module-close . 0)
(module-open . 0)
(namespace-close . 0)
(namespace-open . 0)
(objc-method-args-cont . c-lineup-ObjC-method-args)
(objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +)
(objc-method-intro .
[0])
(statement-case-open . 0)
(stream-op . c-lineup-streamop)
(string . -1000)
(substatement . +)
(substatement-label . 2)
(template-args-cont c-lineup-template-args +))))
;(c-add-style "my"
; '(
; (c-basic-offset . 4)
; (c-offsets-alist
; (arglist-cont . 0)
; (arglist-intro . ++)
; (block-close . 0)
; (brace-entry-open . 0)
; (brace-list-close . 0)
; (brace-list-intro . +)
; (case-label . +)
; (class-close . 0)
; (defun-block-intro . +)
; (defun-close . 0)
; (defun-open . 0)
; (inclass . +)
; (statement . 0)
; (statement-block-intro . +)
; (statement-case-intro . +)
; (statement-cont . 4)
; (substatement-open . 0)
; (topmost-intro . 0)
; (topmost-intro-cont . 0)
; (access-label . -)
; (annotation-top-cont . 0)
; (annotation-var-cont . +)
; (arglist-close . c-lineup-close-paren)
; (arglist-cont-nonempty . c-lineup-arglist)
; (block-open . 0)
; (brace-list-entry . 0)
; (brace-list-open . 0)
; (c . c-lineup-C-comments)
; (catch-clause . 0)
; (class-open . 0)
; (comment-intro . c-lineup-comment)
; (composition-close . 0)
; (composition-open . 0)
; (cpp-define-intro c-lineup-cpp-define +)
; (cpp-macro . -1000)
; (cpp-macro-cont . +)
; (do-while-closure . 0)
; (else-clause . 0)
; (extern-lang-close . 0)
; (extern-lang-open . 0)
; (friend . 0)
; (func-decl-cont . +)
; (incomposition . +)
; (inexpr-class . +)
; (inexpr-statement . +)
; (inextern-lang . +)
; (inher-cont . c-lineup-multi-inher)
; (inher-intro . +)
; (inlambda . c-lineup-inexpr-block)
; (inline-close . 0)
; (inline-open . +)
; (inmodule . +)
; (innamespace . +)
; (knr-argdecl . 0)
; (knr-argdecl-intro . +)
; (label . 2)
; (lambda-intro-cont . +)
; (member-init-cont . c-lineup-multi-inher)
; (member-init-intro . +)
; (module-close . 0)
; (module-open . 0)
; (namespace-close . 0)
; (namespace-open . 0)
; (objc-method-args-cont . c-lineup-ObjC-method-args)
; (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +)
; (objc-method-intro .
; [0])
; (statement-case-open . 0)
; (stream-op . c-lineup-streamop)
; (string . -1000)
; (substatement . +)
; (substatement-label . 2)
; (template-args-cont c-lineup-template-args +))))
(defun my-c-initialization-hook ()
(define-key c-mode-base-map (kbd "C-m") 'c-context-line-break))
(add-hook 'c-initialization-hook 'my-c-initialization-hook)
(setq c-offset-alist '((member-init-intro . ++)))
(defconst my-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 . +)
(arglist-intro . ++)
(substatement-open . 0)
(case-label . 4)
(block-open . 0)
(knr-argdecl-intro . -)))
(c-echo-syntactic-information-p . t))
"My C Programming Style")
(c-add-style "PERSONAL" my-c-style)
(defun my-c-mode-common-hook ()
(c-set-style "PERSONAL")
(setq tab-width 4
indent-tabs-mode nil)
(c-toggle-auto-newline 1))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(add-hook 'after-init-hook 'global-company-mode)
(setq rcirc-default-nick "GergelyPolonkai")
(setq rcirc-default-user-name "polesz")

Loading…
Cancel
Save