summaryrefslogtreecommitdiff
path: root/.emacs
blob: 27eb5ce9f30a64d118ea3ef30770ad633e9a9e02 (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
(require 'package)

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


(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)

;; activate installed packages
(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)