init.el
changeset 55 d4adcd3d5ef9
parent 54 e1b82f67f96e
child 56 7446c9ffe828
equal deleted inserted replaced
54:e1b82f67f96e 55:d4adcd3d5ef9
    38 
    38 
    39 
    39 
    40 ;;; Darwin
    40 ;;; Darwin
    41 (if (string-match "darwin" (emacs-version))
    41 (if (string-match "darwin" (emacs-version))
    42     (progn
    42     (progn
    43       (setq-default mac-command-modifier 'meta)))
    43       (setq-default
       
    44        mac-command-modifier 'meta
       
    45        ns-pop-up-frames nil
       
    46        ispell-program-name "/usr/local/bin/aspell")))
    44 
    47 
    45 ;;; Xorg
    48 ;;; Xorg
    46 (if window-system
    49 (if window-system
    47     (progn
    50     (progn
    48       (defun get-font ()
    51       (defun get-font ()
    73 (eshell)
    76 (eshell)
    74 
    77 
    75 ;;;; Mode-Specific ;;;;
    78 ;;;; Mode-Specific ;;;;
    76 
    79 
    77 ;;; text-mode
    80 ;;; text-mode
    78 (add-hook 'fundamental-mode-hook 'flyspell-mode t)             ; spellcheck text
    81 (add-hook 'fundamental-mode-hook 'flyspell-mode t)      ; spellcheck text
    79 (add-hook 'fundamental-mode-hook 'turn-on-auto-fill)           ; autofill text
    82 (add-hook 'fundamental-mode-hook 'turn-on-auto-fill)    ; autofill text
    80 
    83 
    81 ;;; ido-mode
    84 ;;; ido-mode
    82 (ido-mode t)                                            ; file/buffer selector
    85 (ido-mode t)                                            ; file/buffer selector
    83 (setq-default
    86 (setq-default
    84  ido-enable-flex-matching t                             ; fuzzy matching for ido mode
    87  ido-enable-flex-matching t                             ; fuzzy matching for ido mode
   126  (lambda ()
   129  (lambda ()
   127    (ido-mode t)
   130    (ido-mode t)
   128    (ibuffer-switch-to-saved-filter-groups "default")))
   131    (ibuffer-switch-to-saved-filter-groups "default")))
   129 
   132 
   130 
   133 
   131 ;;;; Requires ;;;;
   134 ;;;; Requires and Packages ;;;;
   132 
   135 
   133 (add-to-list 'load-path "~/.emacs.d/thirdparty") ; set default third party path
   136 ;;; custom inits
   134 
       
   135 ;;; language init
       
   136 (require 'c-init)             ; c specific elisp
   137 (require 'c-init)             ; c specific elisp
   137 (require 'haskell-init)       ; haskell specific elisp
       
   138 (require 'color-theme-init)   ; color theme specific elisp
       
   139 (require 'rainbow-delimiters) ; multi-colored parens
       
   140 
       
   141 ;;; function init
       
   142 (require 'align-with-spaces)  ; use only spaces for alignment
   138 (require 'align-with-spaces)  ; use only spaces for alignment
   143 (require 'pastebin-region)    ; send selected text to pastebin
   139 (require 'pastebin-region)    ; send selected text to pastebin
   144 (require 'move-line)          ; move line up or down
   140 (require 'move-line)          ; move line up or down
   145 
   141 (require 'uniquify)           ; unique buffer names with dirs
   146 ;;; yasnippets
   142 
   147 (add-to-list 'load-path "~/.emacs.d/thirdparty/yasnippet")
   143 ;;; uniquify
   148 (require 'yasnippet)
       
   149 (setq-default yas-prompt-functions '(yas-ido-prompt yas-dropdown-prompt)) ; use ido for multiple snippets
       
   150 (setq-default yas-snippet-dirs '("~/.emacs.d/thirdparty/yasnippet/snippets"
       
   151                                  "~/.emacs.d/thirdparty/snippets"))
       
   152 (yas-global-mode t)
       
   153 
       
   154 ;;; java-mode
       
   155 (add-hook 'java-mode-hook (lambda () (setq whitespace-line-column 140)))
       
   156 
       
   157 ;;; zencoding-mode - html
       
   158 (require 'zencoding-mode)
       
   159 (add-hook 'sgml-mode-hook 'zencoding-mode) ; Auto-start on any markup modes
       
   160 (add-to-list 'auto-mode-alist '("\\.tpl\\'" . html-mode))
       
   161 
       
   162 ;;; unique buffer names with dirs
       
   163 (require 'uniquify)
       
   164 (setq
   144 (setq
   165  uniquify-buffer-name-style 'post-forward
   145  uniquify-buffer-name-style 'post-forward
   166  uniquify-separator ":")
   146  uniquify-separator ":")
       
   147 
       
   148 ;;; packages
       
   149 (package-initialize)
       
   150 (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
       
   151 (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)
       
   152 
       
   153 ;; install
       
   154 (let ((ensure-installed
       
   155        (lambda (name)
       
   156          (unless (package-installed-p name) (package-install name))))
       
   157       (packages
       
   158        '(flymake-haskell-multi ghc ghci-completion haskell-mode js2-mode
       
   159          rainbow-delimiters rainbow-mode scion solarized-theme
       
   160          yasnippet zencoding-mode)))
       
   161   (mapc ensure-installed packages))
       
   162 
       
   163 ;;; color-theme
       
   164 (setq-default
       
   165  custom-safe-themes
       
   166  '("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4"
       
   167    "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" default))
       
   168 (load-theme 'solarized-light)
       
   169 
       
   170 ;;; yasnippets
       
   171 (setq-default yas-prompt-functions '(yas-ido-prompt yas-dropdown-prompt)) ; use ido for multiple snippets
       
   172 (setq-default yas-snippet-dirs
       
   173               '("~/.emacs.d/thirdparty/yasnippet/snippets"
       
   174                 "~/.emacs.d/thirdparty/snippets"))
       
   175 (yas-global-mode t)
       
   176 
       
   177 ;;; java-mode
       
   178 (add-hook 'java-mode-hook (lambda () (setq whitespace-line-column 140)))
       
   179 
       
   180 ;;; js2-mode
       
   181 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
       
   182 (add-hook 'js-mode-hook 'js2-minor-mode)
       
   183 
       
   184 ;;; zencoding-mode - html
       
   185 (add-hook 'sgml-mode-hook 'zencoding-mode) ; Auto-start on any markup modes
       
   186 (add-to-list 'auto-mode-alist '("\\.tpl\\'" . html-mode))
   167 
   187 
   168 ;;; coding-modes map
   188 ;;; coding-modes map
   169 (mapc
   189 (mapc
   170  (lambda (x)
   190  (lambda (x)
   171    (add-hook x 'linum-mode)
   191    (add-hook x 'linum-mode)
   174    c-mode-common-hook
   194    c-mode-common-hook
   175    python-mode-hook
   195    python-mode-hook
   176    haskell-mode-hook
   196    haskell-mode-hook
   177    clojure-mode-hook
   197    clojure-mode-hook
   178    emacs-lisp-mode-hook))
   198    emacs-lisp-mode-hook))
       
   199 
       
   200 ;;; haskell-mode
       
   201 (add-hook
       
   202  'haskell-mode-hook
       
   203  (lambda ()
       
   204    ;; (ghc-init)
       
   205    (turn-on-haskell-indent)
       
   206    (capitalized-words-mode)
       
   207    (turn-on-haskell-doc-mode)
       
   208    (turn-on-haskell-decl-scan)
       
   209    (imenu-add-menubar-index)
       
   210    (setq
       
   211     haskell-font-lock-haddock t
       
   212     haskell-stylish-on-save t
       
   213     ;; haskell-tags-on-save t
       
   214     haskell-program-name "ghci"
       
   215     haskell-indent-offset 4
       
   216     whitespace-line-column 78)
       
   217    ))