                                                        " Standard: Cpp11}"))
                       "clang-format-3.5"))))))))
 
+(autoload 'company-mode "company" nil t)
 (with-eval-after-load 'company
   (diminish 'company-mode)
   (setq company-idle-delay nil)  ;; 0.1)
+  (when (equal system-type 'windows-nt)
+    (delete 'company-clang company-backends))
   (define-key company-active-map (kbd "\C-n") 'company-select-next)
   (define-key company-active-map (kbd "\C-p") 'company-select-previous)
   (define-key company-active-map (kbd "\C-d") 'company-show-doc-buffer)
   (define-key company-active-map (kbd "M-.") 'company-show-location))
 
-(require 'company)
-(when (equal system-type 'windows-nt)
-  (delete 'company-clang company-backends))
-
-(require 'dumb-jump)
+(autoload 'dumb-jump-go "dumb-jump")
+(autoload 'dumb-jump-back "dumb-jump")
+;; (setq dumb-jump-selector 'helm)
 
 (with-eval-after-load 'lua-mode
   (define-key lua-mode-map (kbd "M-.") 'dumb-jump-go)
   (define-key lua-mode-map (kbd "M-,") 'dumb-jump-back))
 
-(require 'rtags)
-(require 'company-rtags)
-(require 'helm-rtags)
-(require 'popup)
-
-(add-to-list 'company-backends 'company-rtags)
-(setq rtags-display-result-backend 'helm)
-(setq rtags-imenu-syntax-highlighting t)     ;; TODO: doesn't work
+(autoload 'rtags-is-indexed "rtags")
+(autoload 'rtags-imenu "rtags")
+(autoload 'rtags-find-symbol-at-point "rtags")
+(autoload 'rtags-display-summary "rtags")
+
+(with-eval-after-load 'rtags
+  (setq rtags-display-result-backend 'helm)
+  (setq rtags-imenu-syntax-highlighting t)     ;; TODO: doesn't work
+  (set-face-attribute 'rtags-skippedline
+                      nil
+                      :background "gray70")
+
+  (set-face-attribute 'rtags-warnline
+                      nil
+                      :background "#ccccff")
+
+  (set-face-attribute 'rtags-errline
+                      nil
+                      :background "#eeb0b0"))
 
 (defun my-imenu ()
   (interactive)


;; (setq helm-ag-command-option "--smart-case")

(require 'helm-swoop)
(define-key helm-swoop-map (kbd "C-r") 'helm-previous-line)
(define-key helm-swoop-map (kbd "C-s") 'helm-next-line)
(global-set-key (kbd "M-i") 'helm-swoop)

(setq projectile-enable-caching t)

(require 'unkillable-scratch)
(unkillable-scratch 1)

(autoload 'goto-last-change "goto-last-change")
(global-set-key "\C-x\C-\\" 'goto-last-change)

(when (or (equal system-type 'darwin)
