summaryrefslogtreecommitdiff
path: root/.emacs
blob: 64268df9fa7db4c77432b1558bc5c17d4f9f9f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
(require 'package)

(add-to-list 'package-archives
             '("marmaled" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))

(package-initialize)

(defun ensure-package-installed (&rest packages)
  "Assure every package is installed, ask for installation if it’s not.

Return a list of installed packages or nil for every skipped package."
  (mapcar
   (lambda (package)
     ;; (package-installed-p 'evil)
     (if (package-installed-p package)
         nil
       (if (y-or-n-p (format "Package %s is missing. Install it? " package))
           (package-install package)
         package)))
   packages))

;; make sure to have downloaded archive description.
;; Or use package-archive-contents as suggested by Nicolas Dudebout
(or (file-exists-p package-user-dir)
    (package-refresh-contents))

(ensure-package-installed 'color-theme 'evil 'evil-dvorak 'undo-tree 'zenburn-theme 'magit 'haskell-mode 'keychain-environment 'nix-mode 'mic-paren)

(package-initialize)

(add-to-list 'load-path "~/.nix-profile/share/emacs/site-lisp/")
(add-to-list 'load-path "/run/current-system/sw/share/emacs/site-lisp/")

(menu-bar-mode -1)
(scroll-bar-mode -1)

(require 'evil)
(evil-mode 1)

(require 'color-theme)
(color-theme-initialize)
(if (daemonp)
    (add-hook 'after-make-frame-functions
              (lambda (frame)
                (with-selected-frame frame
                  (color-theme-ld-dark))))
  (color-theme-ld-dark)
  )

(global-undo-tree-mode)

(set-default-font "DejaVu Sans Mono")
(tool-bar-mode -1)

(global-set-key (kbd "RET") 'newline-and-indent)
(global-set-key (kbd "M-g") 'magit-status)

(setq backup-directory-alist `(("." . "~/.saves")))
(setq delete-old-versions t
      kept-new-versions 6
      kept-old-versions 2
      version-control t)

;; (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(eval-after-load "haskell-mode"
  '(progn
     (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-lift)
     (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)))

(custom-set-variables
 '(haskell-font-lock-symbols nil))
(add-hook 'haskell-mode-hook
	  (custom-set-faces
	   '(font-lock-type-face ((t (:foreground "PaleGreen" :weight bold))))
	   '(font-lock-function-face ((t (:foreground "LightSkyBlue" :weight bold))))
	   )
	  )
(add-hook 'haskell-mode-hook
	  'haskell-indentation-mode
	  )