hoersten-c-style.el
author Luke Hoersten <Luke@Hoersten.org>
Fri, 04 Dec 2009 22:38:21 -0600
changeset 13 7dc464c4e2d3
parent 10 eb4d42b61a62
child 15 7b7afa6e09a6
permissions -rw-r--r--
Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
0fda818a8b6a Added doxymacs and provides for requires.
Luke Hoersten <Luke@Hoersten.org>
parents: 1
diff changeset
     1
;; ~/.emacs.d/hoersten-c-style.el
0fda818a8b6a Added doxymacs and provides for requires.
Luke Hoersten <Luke@Hoersten.org>
parents: 1
diff changeset
     2
;; Luke Hoersten <[email protected]>
0
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     3
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     4
;; hoersten c++-style
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     5
(c-add-style "hoersten"
1
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
     6
             '(;; indentation
7
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
     7
               (indent-tabs-mode       . t)
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
     8
               (tab-width              . 3)
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
     9
               (c-basic-offset         . 3)
0
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    10
1
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    11
               ;; brace cleanups
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    12
               (c-cleanup-list
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    13
                brace-else-brace
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    14
                brace-elseif-brace
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    15
                brace-catch-brace
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    16
                empty-defun-braces
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    17
                defun-close-semi
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    18
                list-close-comma
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    19
                scope-operator)
0
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    20
1
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    21
               ;; syntactic symbols
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    22
               (c-offsets-alist
7
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
    23
                (substatement-open     . 0)
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
    24
                (inline-open           . 0)
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
    25
                (case-label            . +)
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
    26
                (innamespace           . 0)
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
    27
                (arglist-cont-nonempty . +)
de2d02049ed6 Added fix for multiline function signature indentation.
Luke Hoersten <Luke@Hoersten.org>
parents: 6
diff changeset
    28
                (cpp-macro             . -))))
0
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    29
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    30
;; c-like language settings (c, c++, java, etc.)
6
5f0680e88468 Added recompile key and removed doxymacs dep because of bug in Ubuntu package.
Luke Hoersten <Luke@Hoersten.org>
parents: 5
diff changeset
    31
;;(require 'doxymacs)
0
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    32
(setq-default c-hungry-delete-key t)                             ; enable hungry delete
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    33
(setq-default c-default-style "hoersten")                        ; load c-style
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    34
(add-hook 'c-mode-common-hook
4
0fda818a8b6a Added doxymacs and provides for requires.
Luke Hoersten <Luke@Hoersten.org>
parents: 1
diff changeset
    35
          (lambda ()
1
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    36
            ;; indentation
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    37
            (setq tab-width 3)
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    38
            (setq c-basic-offset 3)
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    39
            (setq indent-tabs-mode t)
4
0fda818a8b6a Added doxymacs and provides for requires.
Luke Hoersten <Luke@Hoersten.org>
parents: 1
diff changeset
    40
            (setq standard-indent 3)
10
eb4d42b61a62 Tweaking whitespace handling
Luke Hoersten <Luke@Hoersten.org>
parents: 9
diff changeset
    41
            (setq whitespace-line-column 120)
0
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    42
1
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    43
            (c-toggle-auto-newline t)                            ; auto newline
4
0fda818a8b6a Added doxymacs and provides for requires.
Luke Hoersten <Luke@Hoersten.org>
parents: 1
diff changeset
    44
            (c-subword-mode t)
6
5f0680e88468 Added recompile key and removed doxymacs dep because of bug in Ubuntu package.
Luke Hoersten <Luke@Hoersten.org>
parents: 5
diff changeset
    45
            ;;(doxymacs-mode t)
5f0680e88468 Added recompile key and removed doxymacs dep because of bug in Ubuntu package.
Luke Hoersten <Luke@Hoersten.org>
parents: 5
diff changeset
    46
            ;;(doxymacs-font-lock)
0
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    47
1
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    48
            ;; custom keys
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    49
            (local-set-key (kbd "C-c f")   'ff-find-other-file)  ; toggle header/source file
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    50
            (local-set-key (kbd "C-c C-c") 'comment-or-uncomment-region)
0
c25fee3c92e9 Initial commit.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    51
1
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    52
            ;; code folding
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    53
            (local-set-key (kbd "C-c v") 'hs-toggle-hiding)
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    54
            (local-set-key (kbd "<f1>")  'hs-hide-all)
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    55
            (local-set-key (kbd "<f2>")  'hs-show-all)
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    56
            (hs-minor-mode t)                                    ; enable hide-show mode
5
59b1838be594 Added electric braces and minor tweaks.
Luke Hoersten <Luke@Hoersten.org>
parents: 4
diff changeset
    57
13
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    58
            ;; gdb settings
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    59
            (setq gdb-many-windows t)                            ; gdb many windows
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    60
            (setq gdb-use-separate-io-buffer t)                  ; gdb stdio output
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    61
            (setq gud-tooltip-mode t)                            ; mouse hover variables
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    62
            (local-set-key (kbd "C-c g") 'gdb)                   ; gdb
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    63
5
59b1838be594 Added electric braces and minor tweaks.
Luke Hoersten <Luke@Hoersten.org>
parents: 4
diff changeset
    64
            ;; auto-close bracing
6
5f0680e88468 Added recompile key and removed doxymacs dep because of bug in Ubuntu package.
Luke Hoersten <Luke@Hoersten.org>
parents: 5
diff changeset
    65
            (dolist (key '("(" "[")) (define-key (current-local-map) key 'insert-pair))
4
0fda818a8b6a Added doxymacs and provides for requires.
Luke Hoersten <Luke@Hoersten.org>
parents: 1
diff changeset
    66
            ))
1
ede059431d20 Minor updates.
Luke Hoersten <Luke@Hoersten.org>
parents: 0
diff changeset
    67
13
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    68
(add-to-list 'auto-mode-alist '("\\.ipp$" . c++-mode))
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    69
(add-to-list 'auto-mode-alist '("\\.inl$" . c++-mode))
7dc464c4e2d3 Cleaned up emacs.el quite a bit and added better unique file naming. Added capital greek letters in unicode.
Luke Hoersten <Luke@Hoersten.org>
parents: 10
diff changeset
    70
4
0fda818a8b6a Added doxymacs and provides for requires.
Luke Hoersten <Luke@Hoersten.org>
parents: 1
diff changeset
    71
(provide 'hoersten-c-style)