Split off programming language-specific custimizations to separate init files.
authorLuke Hoersten <Luke@Hoersten.org>
Wed, 18 May 2011 09:30:28 -0500
changeset 40 886afd628fa2
parent 39 5a7c0a0cab49
child 41 14679e8ab2ae
Split off programming language-specific custimizations to separate init files.
c-init.el
haskell-init.el
hoersten-c-style.el
init.el
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c-init.el	Wed May 18 09:30:28 2011 -0500
@@ -0,0 +1,50 @@
+;; ~/.emacs.d/c-hook.el
+;; Luke Hoersten <[email protected]>
+
+(require 'hoersten-c-style)
+
+(add-hook
+ 'c-mode-common-hook
+ (lambda ()
+   ;; indentation
+   (setq
+    tab-width 3
+    c-basic-offset 3
+    indent-tabs-mode t
+    standard-indent 3
+    whitespace-line-column 120)
+
+   (setq
+    compile-command "scons "
+    c-hungry-delete-key t)
+
+   (c-toggle-auto-newline t) ; auto newline
+   (c-subword-mode t)
+
+   ;; custom keys
+   (local-set-key (kbd "C-c f")   'ff-find-other-file) ; toggle header/source file
+   (local-set-key (kbd "C-c C-c") 'comment-or-uncomment-region)
+
+   ;; ;; code folding
+   ;; (local-set-key (kbd "C-c v") 'hs-toggle-hiding)
+   ;; (local-set-key (kbd "<f1>")  'hs-hide-all)
+   ;; (local-set-key (kbd "<f2>")  'hs-show-all)
+   ;; (hs-minor-mode t) ; enable hide-show mode
+
+   ;; gdb settings
+   (setq
+    gdb-many-windows t                ; gdb many windows
+    gdb-use-separate-io-buffer t      ; gdb stdio output
+    gud-tooltip-mode t)               ; mouse hover variables
+   (local-set-key (kbd "C-c g") 'gdb) ; gdb
+
+   ;; auto-close bracing
+   (setq parens-require-spaces nil)
+   (dolist (key '("(" "[")) (define-key (current-local-map) key 'insert-pair))
+   ))
+
+(add-to-list 'auto-mode-alist '("\\.ipp$" . c++-mode))
+(add-to-list 'auto-mode-alist '("\\.inl$" . c++-mode))
+
+(message "Loading C hook...done")
+(provide 'c-hook)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/haskell-init.el	Wed May 18 09:30:28 2011 -0500
@@ -0,0 +1,27 @@
+;; ~/.emacs.d/haskell-init.el
+;; Luke Hoersten <[email protected]>
+
+;; scion
+(if (file-exists-p "~/.cabal/share/scion-0.1.0.10/emacs")
+    (progn
+      (add-to-list 'load-path "~/.cabal/share/scion-0.1.0.10/emacs")
+      (require 'scion)
+      (setq scion-program "~/.cabal/bin/scion-server")
+      (add-hook
+       'haskell-mode-hook
+       (lambda ()
+         (scion-mode 1)
+         (scion-flycheck-on-save 1)
+         (setq scion-completing-read-function 'ido-completing-read)))))
+
+(add-hook
+ 'haskell-mode-hook
+ (lambda ()
+   (haskell-indentation-mode nil)
+   (haskell-indent-mode t)
+   (capitalized-words-mode t)
+   (haskell-doc-mode t)
+   (setq
+    haskell-indent-offset 4
+    whitespace-line-column 78))
+ t) ; append instead of prepend else haskell-mode overwrites these settings
--- a/hoersten-c-style.el	Mon May 16 21:07:24 2011 -0500
+++ b/hoersten-c-style.el	Wed May 18 09:30:28 2011 -0500
@@ -30,48 +30,8 @@
 
 ;; c-like language settings (c, c++, java, etc.)
 ;;(require 'doxymacs)
-(setq-default
- c-hungry-delete-key t       ; enable hungry delete
- c-default-style "hoersten") ; load c-style
-
-(add-hook
- 'c-mode-common-hook
- (lambda ()
-   ;; indentation
-   (setq
-    tab-width 3
-    c-basic-offset 3
-    indent-tabs-mode t
-    standard-indent 3
-    whitespace-line-column 120)
-
-   (c-toggle-auto-newline t) ; auto newline
-   (c-subword-mode t)
-
-   ;; custom keys
-   (local-set-key (kbd "C-c f")   'ff-find-other-file) ; toggle header/source file
-   (local-set-key (kbd "C-c C-c") 'comment-or-uncomment-region)
-
-   ;; ;; code folding
-   ;; (local-set-key (kbd "C-c v") 'hs-toggle-hiding)
-   ;; (local-set-key (kbd "<f1>")  'hs-hide-all)
-   ;; (local-set-key (kbd "<f2>")  'hs-show-all)
-   ;; (hs-minor-mode t) ; enable hide-show mode
-
-   ;; gdb settings
-   (setq
-    gdb-many-windows t                ; gdb many windows
-    gdb-use-separate-io-buffer t      ; gdb stdio output
-    gud-tooltip-mode t)               ; mouse hover variables
-   (local-set-key (kbd "C-c g") 'gdb) ; gdb
-
-   ;; auto-close bracing
-   (setq parens-require-spaces nil)
-   (dolist (key '("(" "[")) (define-key (current-local-map) key 'insert-pair))
-   ))
-
-(add-to-list 'auto-mode-alist '("\\.ipp$" . c++-mode))
-(add-to-list 'auto-mode-alist '("\\.inl$" . c++-mode))
+(setq-default c-default-style "hoersten") ; load c-style
+(c-set-style "hoersten")
 
 (message "Loading Hoersten C style...done")
-(provide 'hoersten-c-style)
\ No newline at end of file
+(provide 'hoersten-c-style)
--- a/init.el	Mon May 16 21:07:24 2011 -0500
+++ b/init.el	Wed May 18 09:30:28 2011 -0500
@@ -4,7 +4,6 @@
 
 ;;;; General ;;;;
 (add-to-list 'load-path "~/.emacs.d")            ; set default emacs load path
-(add-to-list 'load-path "~/.emacs.d/thirdparty") ; set default third party path
 
 (setq-default
  ediff-split-window-function
@@ -14,6 +13,7 @@
  truncate-lines t                         ; truncate, not wrap, lines
  indent-tabs-mode nil                     ; only uses spaces for indentation
  split-width-threshold 181                ; min width to split window horizontially
+ split-height-threshold 120               ; min width to split window vertically
  reb-re-syntax 'string)                   ; use string syntax for regexp builder
 
 (put 'set-goal-column 'disabled nil)      ; enable goal column setting
@@ -30,7 +30,6 @@
 (show-paren-mode t)                       ; show matching paren
 (transient-mark-mode t)                   ; show highlighting
 (global-font-lock-mode t)                 ; syntax highlighting
-(setq-default compile-command "scons ")   ; compile command
 (global-set-key (kbd "C-c c") 'compile)   ; compile
 (global-set-key (kbd "C-c r") 'recompile) ; recompile
 (global-set-key
@@ -41,8 +40,7 @@
 (if (string-match "darwin" (emacs-version))
     (progn
       (setq-default ns-command-modifier 'control)
-      (tabbar-mode nil)
-      (menu-bar-mode t)))
+      (tabbar-mode nil)))
 
 ;;; Xorg
 (if window-system
@@ -101,32 +99,6 @@
 ;;; python-mode
 (add-hook 'python-mode-hook (lambda () (setq indent-tabs-mode t)))
 
-;;; haskell-mode
-;; scion
-(if (file-exists-p "~/.cabal/share/scion-0.1.0.10/emacs")
-    (progn
-      (add-to-list 'load-path "~/.cabal/share/scion-0.1.0.10/emacs")
-      (require 'scion)
-      (setq scion-program "~/.cabal/bin/scion-server")
-      (add-hook
-       'haskell-mode-hook
-       (lambda ()
-         (scion-mode 1)
-         (scion-flycheck-on-save 1)
-         (setq scion-completing-read-function 'ido-completing-read)))))
-
-(add-hook
- 'haskell-mode-hook
- (lambda ()
-   (haskell-indentation-mode nil)
-   (haskell-indent-mode t)
-   (capitalized-words-mode t)
-   (haskell-doc-mode t)
-   (setq
-    haskell-indent-offset 4
-    whitespace-line-column 120))
- t) ; append instead of prepend else haskell-mode overwrites these settings
-
 ;;; org-mode
 (add-hook
  'org-mode-hook
@@ -155,11 +127,17 @@
 
 ;;;; Requires ;;;;
 
-(require 'hoersten-c-style)   ; load c specific lisp
+(add-to-list 'load-path "~/.emacs.d/thirdparty") ; set default third party path
+
+;;; language init
+(require 'c-init)             ; c specific elisp
+(require 'haskell-init)       ; haskell specific elisp
+(require 'vala-mode)          ; vala programming language
+
+;;; function init
 (require 'align-with-spaces)  ; use only spaces for alignment
 (require 'pastebin-region)    ; send selected text to pastebin
 (require 'move-line)          ; move line up or down
-(require 'vala-mode)          ; vala programming language
 (require 'rainbow-delimiters) ; multi-colored parens
 
 ;;; yasnippets