                                    (emacs-uptime "Uptime:%hh"))))
        ))
 
+;; Set font face height. Value is 1/10pt.
+(set-face-attribute 'default nil :height 180)
+
+;; Ensure window is maximized.
+(use-package maxframe
+  :ensure maxframe)
+(add-hook 'window-setup-hook 'maximize-frame t)
+
+(use-package elfeed
+  :ensure elfeed)
+(setq elfeed-feeds
+      '(("http://planet.emacsen.org/atom.xml" blog emacs)
+        ("http://blogs.gnome.org/feed" blog gnome)))
+;; Start off with elfeed.
+
+(use-package bind-key
+  :ensure bind-key)
+
+;; Enable upcase and downcase region (disabled by default).
+(put 'upcase-region 'disabled nil)
+(put 'downcase-region 'disabled nil)
+
+;; From http://pages.sachachua.com/.emacs.d/Sacha.html#sec-1-7-3
+;; Transpose stuff with M-t
+(bind-key "M-t" nil) ;; which used to be transpose-words
+(bind-key "M-t l" 'transpose-lines)
+(bind-key "M-t w" 'transpose-words)
+(bind-key "M-t t" 'transpose-words)
+(bind-key "M-t M-t" 'transpose-words)
+(bind-key "M-t s" 'transpose-sexps)
+
+;; Alternative to grepping repo.
+(bind-key "C-c s r" 'helm-ag-r-from-git-repo)
+;; Alternative to grepping from current location.
+(bind-key "C-c s d" 'helm-ag-r)
+
+(use-package hackernews
+  :ensure hackernews)
+
+(use-package rainbow-delimiters
+  :ensure rainbow-delimiters)
+(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
+
+(use-package hungry-delete
+  :ensure hungry-delete)
+(global-hungry-delete-mode)
+(global-auto-revert-mode)
+(global-font-lock-mode)
+
+(use-package expand-region
+  :ensure expand-region)
+(global-set-key (kbd "C-c w") 'er/expand-region)
+
+(require 'recentf)
+(setq recentf-max-saved-items 200
+      recentf-max-menu-items 15)
+(recentf-mode)
+
+;; Language-aware editing commands. Useful for imenu-menu.
+(semantic-mode 1)
+
+(use-package yasnippet
+  :ensure yasnippet)
+(setq yas-snippet-dirs
+      '("~/.emacs.d/yasnippets/personal"))
+(yas-global-mode 1)
+(yas--initialize)
+
+(use-package helm
+  :ensure helm)
+
+;; From http://tuhdo.github.io/helm-intro.html
+;; must set before helm-config,  otherwise helm use default
+;; prefix "C-x c", which is inconvenient because you can
+;; accidentially pressed "C-x C-c"
+(setq helm-command-prefix-key "C-c h")
+
+(require 'helm-config)
+(require 'helm-files)
+(require 'helm-grep)
+(require 'helm-eshell)
+(require 'helm-buffers)
+
+(use-package helm-ag-r
+  :ensure helm-ag-r)
+(require 'helm-ag-r)
+
+(use-package helm-swoop
+  :ensure helm-swoop)
+(require 'helm-swoop)
+
+(use-package helm-dash
+  :ensure helm-dash)
+(require 'helm-dash)
+(setq helm-dash-browser-func 'eww)
+
+(global-set-key (kbd "M-C-s") 'helm-multi-swoop-all)
+(global-set-key (kbd "C-c i") 'helm-imenu)
+(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebihnd tab to do persistent action
+(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
+(define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z
+(global-set-key (kbd "M-x") 'helm-M-x)
+(global-set-key (kbd "M-y") 'helm-show-kill-ring)
+(global-set-key (kbd "C-x b") 'helm-buffers-list)
+(global-set-key (kbd "C-c f") 'helm-recentf)
+(global-set-key (kbd "C-h ,") 'helm-apropos)
+;; Duplicate line.
+(global-set-key "\C-x\C-d" "\C-a\C- \C-e\M-w\C-j\C-y")
+;; On Mac, this is effectively fn-M-backspace.
+(global-set-key (kbd "M-(") 'kill-word)
+(global-set-key (kbd "C-q") 'previous-buffer)
+(global-set-key (kbd "C-z") 'next-buffer)
+
+(define-key helm-grep-mode-map (kbd "<return>")  'helm-grep-mode-jump-other-window)
+(define-key helm-grep-mode-map (kbd "n")  'helm-grep-mode-jump-other-window-forward)
+(define-key helm-grep-mode-map (kbd "p")  'helm-grep-mode-jump-other-window-backward)
+
+(setq
+ helm-google-suggest-use-curl-p t
+ helm-scroll-amount 4 ; scroll 4 lines other window using M-<next>/M-<prior>
+ helm-quick-update t ; do not display invisible candidates
+ helm-idle-delay 0.01 ; be idle for this many seconds, before updating in delayed sources.
+ helm-input-idle-delay 0.01 ; be idle for this many seconds, before updating candidate buffer
+ helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp.
+
+ helm-split-window-default-side 'below ;; open helm buffer below.
+ helm-split-window-in-side-p t ;; open helm buffer inside current window, not occupy whole other window
+ helm-buffers-favorite-modes (append helm-buffers-favorite-modes
+                                     '(picture-mode artist-mode))
+ helm-buffer-max-length 30
+ helm-candidate-number-limit 200 ; limit the number of displayed canidates
+ helm-M-x-requires-pattern 0     ; show all candidates when set to 0
+ helm-boring-file-regexp-list
+ '("\\.git$" "\\.hg$" "\\.svn$" "\\.CVS$" "\\._darcs$" "\\.la$" "\\.o$" "\\.i$") ; do not show these files in helm buffer
+ helm-ff-file-name-history-use-recentf t
+ helm-move-to-line-cycle-in-source t ; move to end or beginning of source
+                                        ; when reaching top or bottom of source.
+ ido-use-virtual-buffers t      ; Needed in helm-buffers-list
+ helm-buffers-fuzzy-matching t          ; fuzzy matching buffer names when non--nil
+                                        ; useful in helm-mini that lists buffers
+ )
+
+;; Save current position to mark ring when jumping to a different place
+(add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring)
+
+(helm-mode 1)
+
+(defun helm-do-grep-recursive (&optional non-recursive)
+  "Like `helm-do-grep', but greps recursively by default."
+  (interactive "P")
+  (let* ((current-prefix-arg (not non-recursive))
+         (helm-current-prefix-arg non-recursive))
+    (call-interactively 'helm-do-grep)))
+
+;; ggtags code indexing.
+;; https://github.com/leoliu/ggtags
+;; https://github.com/leoliu/ggtags/wiki/Install-Global-with-support-for-exuberant-ctags
+;; Linux
+;; Install exuberant ctags from trunk.
+;; Install GNU Global using ./configure --with-exuberant-ctags=PATH_TO_CTAGS_EXECUTABLE
+;; Mac OS
+;; brew install --HEAD ctags
+;; brew install global --with-exuberant-ctags
+(use-package ggtags
+  :ensure ggtags)
+(use-package helm-gtags
+  :ensure helm-gtags)
+(helm-gtags-mode 1)
+(global-set-key (kbd "M-.") 'helm-gtags-dwim)
+
+(use-package projectile
+  :ensure projectile)
+(projectile-global-mode)
+(setq projectile-enable-caching t)
+
+;; Best way (so far) to search for files in repo.
+(use-package helm-projectile
+  :ensure helm-projectile)
+(require 'helm-projectile)
+(global-set-key (kbd "C-x f") 'helm-projectile)
+
+(require 'ediff)
+(setq ediff-window-setup-function 'ediff-setup-windows-plain)
+(setq ediff-split-window-function 'split-window-horizontally)
+;; ediff-revision cleanup.
+;; From http://www.emacswiki.org/emacs/DavidBoon#toc8
+(defvar my-ediff-bwin-config nil "Window configuration before ediff.")
+(defcustom my-ediff-bwin-reg ?b
+  "*Register to be set up to hold `my-ediff-bwin-config'
+    configuration.")
+
+(defun my-ediff-bsh ()
+  "Function to be called before any buffers or window setup for
+    ediff."
+  (remove-hook 'ediff-quit-hook 'ediff-cleanup-mess)
+  (window-configuration-to-register my-ediff-bwin-reg))
+
+(defun my-ediff-aswh ()
+  "setup hook used to remove the `ediff-cleanup-mess' function.  It causes errors."
+  (remove-hook 'ediff-quit-hook 'ediff-cleanup-mess))
+
+(defun my-ediff-qh ()
+  "Function to be called when ediff quits."
+  (remove-hook 'ediff-quit-hook 'ediff-cleanup-mess)
+  (ediff-cleanup-mess)
+  (jump-to-register my-ediff-bwin-reg))
+
+(add-hook 'ediff-before-setup-hook 'my-ediff-bsh)
+(add-hook 'ediff-after-setup-windows-hook 'my-ediff-aswh);
+(add-hook 'ediff-quit-hook 'my-ediff-qh)
+
 ;; Highlight lines longer than 100 columns.
 (require 'whitespace)
 (setq whitespace-line-column 100


(add-hook 'prog-mode-hook 'ar/prog-mode-hook)

;; Set font face height. Value is 1/10pt.
(set-face-attribute 'default nil :height 180)

;; Ensure window is maximized.
(use-package maxframe
  :ensure maxframe)
(add-hook 'window-setup-hook 'maximize-frame t)

(use-package centered-cursor-mode
  :ensure centered-cursor-mode)
(global-centered-cursor-mode +1)

;; Enabling subword mode (ie. navigate cameCase)
;; From http://www.emacswiki.org/emacs/CamelCase
(global-subword-mode t)

(use-package git-timemachine
  :ensure git-timemachine)
