(require 'package)

(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))

(setq package-enable-at-startup nil)
(package-initialize)

(setq make-backup-files nil)

; ORG MODE
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)

(setq org-hide-leading-stars t)
(setq org-log-done 'time)
(setq org-todo-keyword-faces
			'(("WORKING" . "orange")))
(setq org-todo-keywords
			'((sequence "TODO" "WORKING" "|" "DONE")))
(setq org-tag-alist '(("research" . ?r)
											("code" . ?c)
											("write" . ?w)
											("kom" . ?k)
											("mail" . ?m)
											("call" . ?t)))

; (setq org-tag-alist '((:startgrouptag)
; 											("activity")
; 											(:grouptags)
; 											("research" . ?r)
; 											("code" . ?c)
; 											("write" . ?w)
; 											(:endgrouptag)
; 											(:startgrouptag)
; 											("kom" ?k)
; 											(:grouptags)
; 											("mail" . ?m)
; 											("call" . ?t)
; 											(:endgrouptag)))

(require 'evil)
(evil-mode t)

;; esc quits
(defun minibuffer-keyboard-quit ()
  "Abort recursive edit.
In Delete Selection mode, if the mark is active, just deactivate it;
then it takes a second \\[keyboard-quit] to abort the minibuffer."
  (interactive)
  (if (and delete-selection-mode transient-mark-mode mark-active)
      (setq deactivate-mark  t)
    (when (get-buffer "*Completions*") (delete-windows-on "*Completions*"))
    (abort-recursive-edit)))
(define-key evil-normal-state-map [escape] 'keyboard-quit)
(define-key evil-visual-state-map [escape] 'keyboard-quit)
(define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
(global-set-key [escape] 'evil-exit-emacs-state)

(define-key evil-normal-state-map (kbd "<return>") 'org-open-at-point)
;; helm settings (TAB in helm window for actions over selected items,
;; C-SPC to select items)
; (require 'helm-config)
; (require 'helm-misc)
; (require 'helm-projectile)
; (require 'helm-locate)
; (setq helm-quick-update t)
; (setq helm-bookmark-show-location t)
; (setq helm-buffers-fuzzy-matching t)

; (after 'projectile
;        (package 'helm-projectile))
; (global-set-key (kbd "M-x") 'helm-M-x)

; (defun helm-my-buffers ()
;   (interactive)
;   (let ((helm-ff-transformer-show-only-basename nil))
;     (helm-other-buffer '(helm-c-source-buffers-list
; 			 helm-c-source-elscreen
; 			 helm-c-source-projectile-files-list
; 			 helm-c-source-ctags
; 			 helm-c-source-recentf
; 			 helm-c-source-locate)
; 		                            "*helm-my-buffers*")))
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(inhibit-startup-screen t)
 '(org-agenda-files
   (quote
    ("~/arbeit/org/entropie.org" "~/arbeit/org/particleFlow.org" "~/arbeit/org/seminar.org" "~/arbeit/org/ideen.org"))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
