init.el
changeset 32 68b57950fa11
parent 31 27930e0310d6
child 33 3be3d7b4cae4
equal deleted inserted replaced
31:27930e0310d6 32:68b57950fa11
     1 ;; ~/.emacs.d/init.el (~/.emacs)
     1 ;; ~/.emacs.d/init.el (~/.emacs)
     2 ;; Luke Hoersten <[email protected]>
     2 ;; Luke Hoersten <[email protected]>
     3 
     3 
     4 ;;;; General
     4 
       
     5 ;;;; General ;;;;
     5 (add-to-list 'load-path "~/.emacs.d")     ; set default emacs load path
     6 (add-to-list 'load-path "~/.emacs.d")     ; set default emacs load path
     6 
     7 
     7 (setq-default
     8 (setq-default
     8  ediff-split-window-function
     9  ediff-split-window-function
     9   'split-window-horizontally              ; diff horizontally
    10   'split-window-horizontally              ; diff horizontally
    34 (global-set-key (kbd "C-c r") 'recompile) ; recompile
    35 (global-set-key (kbd "C-c r") 'recompile) ; recompile
    35 (global-set-key
    36 (global-set-key
    36  (kbd "C-c C-c")
    37  (kbd "C-c C-c")
    37  'comment-or-uncomment-region)            ; toggle region comment
    38  'comment-or-uncomment-region)            ; toggle region comment
    38 
    39 
    39 ;;; X stuff
    40 ;;; Darwin
       
    41 (if (string-match "darwin" (emacs-version))
       
    42     (progn
       
    43       (setq-default ns-command-modifier 'control)
       
    44       (tabbar-mode nil)
       
    45       (menu-bar-mode t)))
       
    46 
       
    47 ;;; Xorg
    40 (if window-system
    48 (if window-system
    41     (progn
    49     (progn
       
    50       (defun get-font ()
       
    51         "Get appropriate font based on system and hostname."
       
    52         (cond
       
    53          ((string-match "darwin" (emacs-version)) "Menlo-12")
       
    54          ((string-match "HoldenCaulfield" (system-name)) "monospace-7")
       
    55          ("monospace-10")))
       
    56 
    42       (tool-bar-mode -1)      ; remove tool bar
    57       (tool-bar-mode -1)      ; remove tool bar
    43       (scroll-bar-mode -1)    ; remove scroll bar
    58       (scroll-bar-mode -1)    ; remove scroll bar
    44       (visual-line-mode t)    ; word wrap break on whitespace
    59       (visual-line-mode t)    ; word wrap break on whitespace
    45       (global-hl-line-mode t) ; highlight current line
    60       (global-hl-line-mode t) ; highlight current line
       
    61       (set-frame-font (get-font))
    46 
    62 
    47       ;; twilight theme
    63       ;; twilight theme
    48       (require 'color-theme)
    64       (require 'color-theme)
    49       (load "color-theme-twilight")
    65       (load "color-theme-twilight")
    50       (color-theme-twilight)
    66       (color-theme-twilight)
    51       ))
    67       ))
    52 
    68 
    53 ;;; terminal
    69 ;;; terminal
    54 (global-set-key (kbd "C-c s") 'eshell) ; start shell
    70 (global-set-key (kbd "C-c s") 'eshell) ; start shell
    55 (add-hook 'eshell-mode-hook '(lambda ()
    71 (add-hook 'eshell-mode-hook '(lambda () (setenv "TERM" "emacs"))) ; enable colors
    56     (progn
       
    57       (setenv "PATH" "~/.cabal/bin:$PATH") ; haskell cabal
       
    58       (setenv "TERM" "emacs"))))           ; enable colors
       
    59 
       
    60 ;;; OS specific configs
       
    61 (cond
       
    62  ((string-match "linux" (emacs-version)) (require 'linux))
       
    63  ((string-match "darwin" (emacs-version)) (require 'darwin))
       
    64  )
       
    65 
    72 
    66 
    73 
    67 ;;;; Mode-Specific
    74 ;;;; Mode-Specific ;;;;
    68 
    75 
    69 ;;; linum-mode - line numbers
    76 ;;; linum-mode - line numbers
    70 (mapc
    77 (mapc
    71  (lambda (x)
    78  (lambda (x)
    72    (add-hook x 'linum-mode))
    79    (add-hook x 'linum-mode))
   115    (haskell-doc-mode t)
   122    (haskell-doc-mode t)
   116    (setq
   123    (setq
   117     haskell-font-lock-symbols 'unicode
   124     haskell-font-lock-symbols 'unicode
   118     haskell-indent-offset 4
   125     haskell-indent-offset 4
   119     whitespace-line-column 87))
   126     whitespace-line-column 87))
   120  t ; append instead of prepend else haskell-mode overwrites these settings
   127  t) ; append instead of prepend else haskell-mode overwrites these settings
   121  )
   128 
   122 
   129 
   123 ;;; org-mode
   130 ;;; org-mode
   124 (add-hook
   131 (add-hook
   125  'org-mode-hook
   132  'org-mode-hook
   126  (lambda ()
   133  (lambda ()
   127    (local-set-key (kbd "M-p") 'org-move-item-up)
   134    (local-set-key (kbd "M-p") 'org-move-item-up)
   128    (local-set-key (kbd "M-S-p") 'org-move-subtree-up)
   135    (local-set-key (kbd "M-S-p") 'org-move-subtree-up)
   129    (local-set-key (kbd "M-n") 'org-move-item-down)
   136    (local-set-key (kbd "M-n") 'org-move-item-down)
   130    (local-set-key (kbd "M-S-n") 'org-move-subtree-down)))
   137    (local-set-key (kbd "M-S-n") 'org-move-subtree-down)))
   131 
   138 
       
   139 ;;; ibuffer
       
   140 (global-set-key (kbd "C-x C-b") 'ibuffer) ; better buffer browser
       
   141 (setq-default
       
   142  ibuffer-saved-filter-groups
       
   143  '(("Hoersten"
       
   144     ("Emacs Configs" (saved . "Emacs Configs"))))
   132 
   145 
   133 ;;;; Requires
   146  ibuffer-saved-filters
       
   147  '(("Emacs Configs"
       
   148     ((filename . "\\.emacs\\.d/.*\\.el$")))
       
   149    ("gnus" ((or (mode . message-mode) (mode . mail-mode) (mode . gnus-group-mode) (mode . gnus-summary-mode) (mode . gnus-article-mode))))
       
   150    ("programming" ((or (mode . emacs-lisp-mode) (mode . cperl-mode) (mode . c-mode) (mode . java-mode) (mode . idl-mode) (mode . lisp-mode))))
       
   151    ))
       
   152 
       
   153 
       
   154 ;;;; Requires ;;;;
   134 
   155 
   135 (require 'hoersten-align-with-spaces) ; use only spaces for alignment
   156 (require 'hoersten-align-with-spaces) ; use only spaces for alignment
   136 (require 'hoersten-pastebin-region)   ; send selected text to pastebin
   157 (require 'hoersten-pastebin-region)   ; send selected text to pastebin
   137 (require 'hoersten-c-style)           ; load c specific lisp
   158 (require 'hoersten-c-style)           ; load c specific lisp
   138 (require 'vala-mode)                  ; vala programming language
   159 (require 'vala-mode)                  ; vala programming language