   :bind (("M-<up>" . drag-stuff-up)
          ("M-<down>" . drag-stuff-down)))
 
-(use-package whitespace
-  :defer 5
-  ;; Automatically remove whitespace on saving.
-  :hook ((before-save . whitespace-cleanup)
-         (prog-mode . whitespace-mode))
-  :config
-  ;; When nil, fill-column is used instead.
-  (vsetq whitespace-line-column nil)
-  ;; Highlight empty lines, TABs, blanks at beginning/end, lines
-  ;; longer than fill-column, and trailing blanks.
-  (vsetq whitespace-style '(face empty tabs lines-tail trailing))
-  (vsetq show-trailing-whitespace t)
-  (set-face-attribute 'whitespace-line nil
-                      :foreground "DarkOrange1"
-                      :background "default"))
-
-(use-package smartparens
-  :ensure t
-  :defer 0.01
-  ;; Add to minibuffer also.
-  :hook ((minibuffer-setup . smartparens-mode)
-         (prog-mode . smartparens-strict-mode)
-         (eshell-mode . smartparens-strict-mode))
-  :config
-  (require 'smartparens-config)
-  (require 'smartparens-html)
-  (require 'smartparens-python)
-
-  (defun ar/kill-region-advice-fun (orig-fun &rest r)
-    "Advice function around `kill-region' (ORIG-FUN and R)."
-    (if (or (null (nth 2 r)) ;; Consider kill-line (C-k).
-            mark-active)
-        (apply orig-fun r)
-      ;; Kill entire line.
-      (let ((last-command (lambda ())) ;; Override last command to avoid appending to kill ring.
-            (offset (- (point)
-                       (line-beginning-position))))
-        (apply orig-fun (list (line-beginning-position)
-                              (line-end-position)
-                              nil))
-        (delete-char 1)
-        (forward-char (min offset
-                           (- (line-end-position)
-                              (line-beginning-position)))))))
-
-  (advice-add 'kill-region
-              :around
-              'ar/kill-region-advice-fun)
-
-  ;; I prefer keeping C-w to DWIM kill, provided by
-  ;; `ar/kill-region-advice-fun'. Removing remap.
-  ;;   (define-key smartparens-strict-mode-map [remap kill-region] nil)
-
-  (defun ar/smartparens-wrap-square-bracket (arg)
-    "[] equivalent of `paredit-wrap-round'."
-    (interactive "P")
-    (save-excursion
-      (unless (sp-point-in-symbol)
-        (backward-char))
-      (sp-wrap-with-pair "["))
-    (insert " "))
-
-  :bind (:map smartparens-strict-mode-map
-              ([remap kill-region] . kill-region)
-              ("C-c <right>" . sp-forward-slurp-sexp)
-              ("C-c <left>" . sp-forward-barf-sexp)
-              ("M-[" . sp-rewrap-sexp)
-              :map smartparens-mode-map
-              ("M-]" . ar/smartparens-wrap-square-bracket)))
+(add-hook 'emacs-startup-hook
+          (lambda ()
+            (use-package whitespace
+              :defer 5
+              ;; Automatically remove whitespace on saving.
+              :hook ((before-save . whitespace-cleanup)
+                     (prog-mode . whitespace-mode))
+              :config
+              ;; When nil, fill-column is used instead.
+              (vsetq whitespace-line-column nil)
+              ;; Highlight empty lines, TABs, blanks at beginning/end, lines
+              ;; longer than fill-column, and trailing blanks.
+              (vsetq whitespace-style '(face empty tabs lines-tail trailing))
+              (vsetq show-trailing-whitespace t)
+              (set-face-attribute 'whitespace-line nil
+                                  :foreground "DarkOrange1"
+                                  :background "default"))
+            (use-package smartparens
+              :ensure t
+              :defer 0.01
+              ;; Add to minibuffer also.
+              :hook ((minibuffer-setup . smartparens-mode)
+                     (prog-mode . smartparens-strict-mode)
+                     (eshell-mode . smartparens-strict-mode))
+              :config
+              (require 'smartparens-config)
+              (require 'smartparens-html)
+              (require 'smartparens-python)
+
+              (defun ar/kill-region-advice-fun (orig-fun &rest r)
+                "Advice function around `kill-region' (ORIG-FUN and R)."
+                (if (or (null (nth 2 r)) ;; Consider kill-line (C-k).
+                        mark-active)
+                    (apply orig-fun r)
+                  ;; Kill entire line.
+                  (let ((last-command (lambda ())) ;; Override last command to avoid appending to kill ring.
+                        (offset (- (point)
+                                   (line-beginning-position))))
+                    (apply orig-fun (list (line-beginning-position)
+                                          (line-end-position)
+                                          nil))
+                    (delete-char 1)
+                    (forward-char (min offset
+                                       (- (line-end-position)
+                                          (line-beginning-position)))))))
+
+              (advice-add 'kill-region
+                          :around
+                          'ar/kill-region-advice-fun)
+
+              ;; I prefer keeping C-w to DWIM kill, provided by
+              ;; `ar/kill-region-advice-fun'. Removing remap.
+              ;;   (define-key smartparens-strict-mode-map [remap kill-region] nil)
+
+              (defun ar/smartparens-wrap-square-bracket (arg)
+                "[] equivalent of `paredit-wrap-round'."
+                (interactive "P")
+                (save-excursion
+                  (unless (sp-point-in-symbol)
+                    (backward-char))
+                  (sp-wrap-with-pair "["))
+                (insert " "))
+
+              :bind (:map smartparens-strict-mode-map
+                          ([remap kill-region] . kill-region)
+                          ("C-c <right>" . sp-forward-slurp-sexp)
+                          ("C-c <left>" . sp-forward-barf-sexp)
+                          ("M-[" . sp-rewrap-sexp)
+                          :map smartparens-mode-map
+                          ("M-]" . ar/smartparens-wrap-square-bracket)))))
 
 
 (use-package region-bindings-mode


      ;; comint-magic-space needs to be whitelisted to ensure we receive company-begin events in eshell.
      (when (boundp 'company-begin-commands)
       (setq-local company-begin-commands
                  (append company-begin-commands (list 'comint-magic-space))))

      (bind-key "C-l" #'ar/eshell-cd-to-parent eshell-mode-map))
    :config

;;;; Less important END

;;;; Hydra START

(add-hook 'emacs-startup-hook
          (lambda ()
            (use-package hydra
              :ensure t
              :defer 5
              :config
              (vsetq hydra-is-helpful t)
              (defhydra hydra-search (:color blue)
                "search"
                ("d" ar/helm-ag "search directory")
                ("f" ar/find-dired-current-dir "find file")
                ("a" ar/find-all-dired-current-dir "find all files")
                ("i" ar/helm-ag-insert "insert match")
                ("q" nil "quit"))
              (defhydra hydra-quick-insert (:color blue)
                "
Quick insert: _w_eb bookmark _b_acklog bookmark
              _t_odo _d_one
"
                ("w" ar/helm-org-add-bookmark nil)
                ("b" ar/helm-org-add-backlog-link nil)
                ("t" ar/org-add-todo nil)
                ("d" ar/org-add-done nil)
                ("q" nil nil :color blue))

              (defun ar/hydra-open-dwim ()
                "Choose \"open\" hydra based on current mode."
                (interactive)
                (cond ((derived-mode-p 'c-mode) (hydra-open-c-mode/body))
                      ((derived-mode-p 'prog-mode) (hydra-open-prog-mode/body))
                      (t (hydra-open/body))))

              (defhydra hydra-open-c-mode (:color blue)
                "open"
                ("o" ff-find-other-file "other")
                ("e" ar/platform-open-in-external-app "externally")
                ("u" ar/platform-open-file-at-point "url at point")
                ("b" ar/file-open-closest-build-file "build file")
                ("q" nil "cancel"))

              (defhydra hydra-open (:color blue)
                "
Open: _p_oint _e_xternally
"
                ("e" ar/platform-open-in-external-app nil)
                ("p" ar/platform-open-file-at-point nil)
                ("q" nil "cancel"))

              (defhydra hydra-open-prog-mode (:color blue)
                "open"
                ("o" ff-find-other-file "other")
                ("e" ar/platform-open-in-external-app "externally")
                ("u" ar/platform-open-file-at-point "url at point")
                ("b" ar/file-open-closest-build-file "build file")
                ("q" nil "cancel"))

              (defhydra hydra-git-gutter (:pre (git-gutter-mode +1))
                "
Git: _n_ext     _s_tage  _d_iff
     _p_revious _k_ill _q_uit
"
                ("n" git-gutter:next-hunk nil)
                ("p" git-gutter:previous-hunk nil)
                ("s" git-gutter:stage-hunk nil)
                ("k" (lambda ()
                       (interactive)
                       (git-gutter:revert-hunk)
                       (call-interactively #'git-gutter:next-hunk)) nil)
                ("d" git-gutter:popup-hunk nil)
                ("q" nil nil :color blue))
              :bind (("C-c s" . hydra-search/body)
                     ("C-c x" . hydra-quick-insert/body)
                     ("C-c o" . ar/hydra-open-dwim)
                     ("C-c g" . hydra-git-gutter/body)))))
;;;; Hydra END

;;;; Buffers START
