 ;; Smart indent region.
 (defun smart-indent-region ()
   "If the mark is active, indents region.
-    Otherwise it indents the entire file."
+   Otherwise it indents the entire file."
   (interactive)
   (if mark-active
       (indent-region (region-beginning)

                       (region-end))
      ;; Are we at the end of a word?
      (if (looking-at "\\_>")
          (if (long-enough-p)
              (dabbrev-expand nil)
            (if (override-p)
                (progn
                  (dabbrev--reset-global-variables)
                  (dabbrev-expand nil))
              nil))
        (indent-for-tab-command)))))
;; Make dabbrev-replace case insensitive.
(setq dabbrev-case-replace nil)
;; Replace dabbrev-expand with hippie-expand.
;; (global-set-key (kbd "M-/") 'hippie-expand)
;; Bind to tab.
(global-set-key (kbd "C-i") 'smart-tab)
;; Function to enable autosave.

  (interactive)
  (if (and (buffer-file-name) (buffer-modified-p))
      (save-some-buffers t)))

;; Rectangles :)
(cua-selection-mode t)
;; (kbd "C-j") is Ctrl + Enter
(global-set-key (kbd "C-j") 'cua-set-rectangle-mark)
