 (define-key function-key-map "\e[=" (kbd "C-="))
 (define-key function-key-map "\e[." (kbd "C-."))
 
-(define-key global-map (kbd "RET") 'newline-and-indent)
+(global-set-key (kbd "RET") 'newline-and-indent)
 (global-set-key (kbd "M-r") 'recompile)
 (global-set-key (kbd "M-o") 'other-window)
 (global-set-key (kbd "C-c C-g") 'goto-line)
-
-(global-set-key (kbd "C-.") '(lambda () (interactive)
-                               (if (rtags-is-indexed)
-                                   (rtags-imenu)
-                                 (helm-semantic-or-imenu nil))))
 
 (global-set-key (kbd "C-c m") 'wl)
 

  (autoload 'vc-darcs-find-file-hook "vc-darcs")
  (add-hook 'find-file-hooks 'vc-darcs-find-file-hook))

(use-package ninja-mode :defer t)

(use-package clojure-mode
  :defer t
  :if (not (kelly?))
  :pin melpa-stable)

(use-package cider
  :defer t
  :if (not (kelly?))
  :pin melpa-stable
  :config
  (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
  ;; (setq cider-auto-mode nil)
  ;; (setq nrepl-log-messages nil)
  ;; (setq nrepl-hide-special-buffers t)
  (setq cider-repl-use-pretty-printing t)
  (setq cider-prompt-save-file-on-load nil)
  (add-hook 'cider-mode-hook 'eldoc-mode)
  :init (add-hook 'clojure-mode-hook 'cider-mode))

(use-package pixie-mode
  :defer t
  :config (add-hook 'pixie-mode-hook #'inf-clojure-minor-mode))

(use-package browse-kill-ring
  :config
  (define-key (current-global-map) [remap yank-pop] 'browse-kill-ring)   ;; remap yank-pop
  (setq browse-kill-ring-replace-yank t))

(use-package easy-kill
  :bind (([remap kill-ring-save] . easy-kill)
         ([remap mark-sexp] . easy-mark)))

(use-package whitespace
  :diminish whitespace-mode
  :config
  (setq whitespace-line-column 90)             ;; limit line length
  (setq whitespace-style '(face trailing newline))
  (add-hook 'prog-mode-hook 'whitespace-mode))

(use-package shrink-whitespace
  :bind ("M-\\" . shrink-whitespace))

(use-package expand-region
  :defer t
  :bind ("C-=" . er/expand-region))

(use-package visual-regexp
  :bind ("C-c r" . vr/replace))

(use-package eldoc
  :diminish eldoc-mode
  :init
  (add-hook 'emacs-lisp-mode-hook 'eldoc-mode)
  (add-hook 'lisp-interaction-mode-hook 'eldoc-mode)
  (add-hook 'ielm-mode-hook 'eldoc-mode))

(use-package rainbow-mode
  :defer t
  :diminish rainbow-mode
  :init (add-hook 'emacs-lisp-mode-hook 'rainbow-mode))

;; ;; (load-theme 'tango t)
(set-background-color "gray90")

;;   :bind (("TAB" . company-indent-or-complete-common)
;;          ("M-." . racer-find-definition)))

(setq projectile-enable-caching t)
(projectile-global-mode)
(diminish 'projectile-mode)

(setq helm-projectile-fuzzy-match nil)
(setq projectile-completion-system 'helm)
(helm-projectile-on)

(defun my-helm-projectile-buffers-list ()
  (interactive)
  (unless helm-source-buffers-list
    (setq helm-source-buffers-list
          (helm-make-source "Buffers" 'helm-source-buffers)))
  (helm :sources '(helm-source-buffers-list
                   helm-source-projectile-recentf-list
                   helm-source-projectile-files-list
                   helm-source-recentf
                   helm-source-buffer-not-found)
        :buffer "*helm buffers*"
        :keymap helm-buffer-map
        :truncate-lines helm-buffers-truncate-lines))

(global-set-key (kbd "M-g") (lambda ()
                              (interactive)
                              (helm-do-ag (projectile-project-root))))

(global-set-key (kbd "M-G") (lambda ()
                              (interactive)
                              (helm-do-ag (helm-current-directory))))

(global-set-key (kbd "C-c C-f") 'helm-projectile-find-file)
(global-set-key (kbd "C-x b") 'my-helm-projectile-buffers-list)

(require 'super-save)
(super-save-initialize)

(global-anzu-mode 1)
(diminish 'anzu-mode)

(setenv "PAGER" (executable-find "cat"))
(defun visit-term-buffer ()
  "Create or visit a terminal buffer."
  (interactive)
  (if (not (get-buffer "*shell*"))
      (progn
        (split-window-sensibly (selected-window))
        (other-window 1)
        (shell))
    (switch-to-buffer-other-window "*shell*")))
(global-set-key (kbd "C-c t") 'visit-term-buffer)

(setq avy-background t)
(global-set-key (kbd "C-;") 'avy-goto-word-or-subword-1)
(define-key isearch-mode-map (kbd "C-;") 'avy-isearch)

(define-key helm-map (kbd "C-'") 'ace-jump-helm-line-execute-action)

(toggle-save-place-globally)

(require 'quelpa-use-package)
(setq quelpa-update-melpa-p nil)
(quelpa-use-package-activate-advice)   ;; quelpa-upgrade
(use-package vc-darcs
  :quelpa (vc-darcs :fetcher github :repo "velkyel/vc-darcs")
  :config
