| 1 |
;;--------------------------------------------------------------------------- |
|---|
| 2 |
;; |
|---|
| 3 |
;; Emacs-Options for Videolan CodingStyle programming |
|---|
| 4 |
;; |
|---|
| 5 |
;; paste the following lines in your .emacs file |
|---|
| 6 |
;; |
|---|
| 7 |
;;--------------------------------------------------------------------------- |
|---|
| 8 |
|
|---|
| 9 |
;; associate c-mode with file extension '.c' or '.h' in vlc trunk tree |
|---|
| 10 |
(setq auto-mode-alist |
|---|
| 11 |
(append |
|---|
| 12 |
'((".*vlc-trunk.*/.*\\.[ch]$" . c-mode) |
|---|
| 13 |
) auto-mode-alist)) |
|---|
| 14 |
|
|---|
| 15 |
;; define videolan c style settings |
|---|
| 16 |
(defconst videolan-c-style |
|---|
| 17 |
'((c-tab-always-indent . t) |
|---|
| 18 |
(c-comment-only-line-offset . 4) |
|---|
| 19 |
(c-hanging-braces-alist . ((substatement-open before after) |
|---|
| 20 |
(brace-list-open))) |
|---|
| 21 |
(c-hanging-colons-alist . ((member-init-intro before) |
|---|
| 22 |
(inher-intro) |
|---|
| 23 |
(case-label after) |
|---|
| 24 |
(label after) |
|---|
| 25 |
(access-label after))) |
|---|
| 26 |
(c-cleanup-list . (scope-operator |
|---|
| 27 |
empty-defun-braces |
|---|
| 28 |
defun-close-semi)) |
|---|
| 29 |
|
|---|
| 30 |
(c-offsets-alist . ((string . -1000) |
|---|
| 31 |
(c . c-lineup-C-comments) |
|---|
| 32 |
(defun-open . 0) |
|---|
| 33 |
(defun-close . 0) |
|---|
| 34 |
(defun-block-intro . +) |
|---|
| 35 |
(class-open . 0) |
|---|
| 36 |
(class-close . 0) |
|---|
| 37 |
(inline-open . 0) |
|---|
| 38 |
(inline-close . 0) |
|---|
| 39 |
(topmost-intro . 0) |
|---|
| 40 |
(topmost-intro-cont . 0) |
|---|
| 41 |
(member-init-intro . +) |
|---|
| 42 |
(member-init-cont . 0) |
|---|
| 43 |
(inher-intro . +) |
|---|
| 44 |
(inher-cont . 0) |
|---|
| 45 |
(block-open . 0) |
|---|
| 46 |
(block-close . 0) |
|---|
| 47 |
(brace-list-open . +) |
|---|
| 48 |
(brace-list-close . 0) |
|---|
| 49 |
(brace-list-intro . +) |
|---|
| 50 |
(brace-list-entry . 0) |
|---|
| 51 |
(statement . 0) |
|---|
| 52 |
(statement-cont . +) |
|---|
| 53 |
(statement-block-intro . +) |
|---|
| 54 |
(statement-case-intro . +) |
|---|
| 55 |
(statement-case-open . +) |
|---|
| 56 |
(substatement . +) |
|---|
| 57 |
(substatement-open . +) |
|---|
| 58 |
(case-label . +) |
|---|
| 59 |
(access-label . -) |
|---|
| 60 |
(label . -1000) |
|---|
| 61 |
(do-while-closure . 0) |
|---|
| 62 |
(else-clause . 0) |
|---|
| 63 |
(comment-intro . 0) |
|---|
| 64 |
(arglist-intro . +) |
|---|
| 65 |
(arglist-cont . 0) |
|---|
| 66 |
(arglist-cont-nonempty . c-lineup-arglist) |
|---|
| 67 |
(arglist-close . 0) |
|---|
| 68 |
(stream-op . +) |
|---|
| 69 |
(inclass . +) |
|---|
| 70 |
(cpp-macro . -1000) |
|---|
| 71 |
(friend . 0) |
|---|
| 72 |
(objc-method-intro . 0) |
|---|
| 73 |
(objc-method-args-cont . 0) |
|---|
| 74 |
(objc-method-call-cont . 0))) |
|---|
| 75 |
|
|---|
| 76 |
(c-basic-offset . 4) |
|---|
| 77 |
(c-echo-syntactic-information-p . t) |
|---|
| 78 |
) |
|---|
| 79 |
"Videolan C Programming Style") |
|---|
| 80 |
|
|---|
| 81 |
;; Customizations for c-mode |
|---|
| 82 |
(defun videolan-mode-hook () |
|---|
| 83 |
;; add the Videolan c style and set it for the current buffer |
|---|
| 84 |
(local-set-key "\r" 'newline-and-indent) |
|---|
| 85 |
(c-add-style "vlc" videolan-c-style t) |
|---|
| 86 |
(c-set-offset 'member-init-intro '++) |
|---|
| 87 |
|
|---|
| 88 |
;; other customizations |
|---|
| 89 |
(setq tab-width 4 |
|---|
| 90 |
;; this will make sure spaces are used instead of tabs |
|---|
| 91 |
indent-tabs-mode nil) |
|---|
| 92 |
;; we like auto-newline and hungry-delete |
|---|
| 93 |
(c-toggle-auto-newline-state 1) |
|---|
| 94 |
(custom-set-variables |
|---|
| 95 |
'(c-hanging-semi&comma-criteria nil)) |
|---|
| 96 |
) |
|---|
| 97 |
|
|---|
| 98 |
(add-hook 'c-mode-hook 'videolan-mode-hook) |
|---|