c-init.el
author Luke Hoersten <Luke@Hoersten.org>
Mon, 24 Jun 2013 21:49:23 -0500
changeset 56 7446c9ffe828
parent 44 6e66ab8d9185
child 67 6034a5ace9af
permissions -rw-r--r--
Moved snippets
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     1
;; ~/.emacs.d/c-hook.el
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     2
;; Luke Hoersten <[email protected]>
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     3
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     4
(require 'hoersten-c-style)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     5
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     6
(add-hook
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     7
 'c-mode-common-hook
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     8
 (lambda ()
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     9
   ;; indentation
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    10
   (setq
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    11
    tab-width 3
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    12
    c-basic-offset 3
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    13
    indent-tabs-mode t
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    14
    standard-indent 3
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    15
    whitespace-line-column 120)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    16
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    17
   (setq
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    18
    compile-command "scons "
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    19
    c-hungry-delete-key t)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    20
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    21
   (c-toggle-auto-newline t) ; auto newline
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    22
   (c-subword-mode t)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    23
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    24
   ;; custom keys
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    25
   (local-set-key (kbd "C-c f")   'ff-find-other-file) ; toggle header/source file
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    26
   (local-set-key (kbd "C-c C-c") 'comment-or-uncomment-region)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    27
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    28
   ;; ;; code folding
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    29
   ;; (local-set-key (kbd "C-c v") 'hs-toggle-hiding)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    30
   ;; (local-set-key (kbd "<f1>")  'hs-hide-all)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    31
   ;; (local-set-key (kbd "<f2>")  'hs-show-all)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    32
   ;; (hs-minor-mode t) ; enable hide-show mode
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    33
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    34
   ;; gdb settings
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    35
   (setq
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    36
    gdb-many-windows t                ; gdb many windows
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    37
    gdb-use-separate-io-buffer t      ; gdb stdio output
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    38
    gud-tooltip-mode t)               ; mouse hover variables
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    39
   (local-set-key (kbd "C-c g") 'gdb) ; gdb
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    40
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    41
   ;; auto-close bracing
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    42
   (setq parens-require-spaces nil)
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    43
   (dolist (key '("(" "[")) (define-key (current-local-map) key 'insert-pair))
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    44
   ))
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    45
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    46
(add-to-list 'auto-mode-alist '("\\.ipp$" . c++-mode))
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    47
(add-to-list 'auto-mode-alist '("\\.inl$" . c++-mode))
886afd628fa2 Split off programming language-specific custimizations to separate init files.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    48
44
6e66ab8d9185 Split out some init files.
Luke Hoersten <Luke@Hoersten.org>
parents: 41
diff changeset
    49
(message "Loading c-init...done")
6e66ab8d9185 Split out some init files.
Luke Hoersten <Luke@Hoersten.org>
parents: 41
diff changeset
    50
(provide 'c-init)