+
+; https://gist.github.com/belak/ca1c9ae75e53324ee16e2e5289a9c4bc
 (require 'package)
 (add-to-list 'package-archives
-	     '("melpa-stable" . "https://stable.melpa.org/packages/") t)
+             '("melpa" . "https://melpa.org/packages/"))
 (package-initialize)
+
+;; Ensure use-package is installed
+(unless (package-installed-p 'use-package)
+  (package-refresh-contents)
+  (package-install 'use-package))
+
+;; Configure and load use-package
+(setq use-package-always-ensure t)
+
+(eval-when-compile
+  (defvar use-package-verbose t)
+  (require 'use-package))
 
 
 ;; BASIC STUFF ;;

(setq org-log-done 'time)
(global-set-key "\C-cf" 'org-gcal-fetch)
(global-set-key "\C-ck" 'org-gcal-delete-at-point)
(load "~/org-gcal-secret.el")
(load "~/org-gcal.el/org-generic-id.el")
(load "~/org-gcal.el/org-gcal.el")

;(setq org-agenda-custom-commands
;      '(("d" "Dashboard"
;         ((agenda "-f" ((org-agenda-span 7)
;			(org-agenda-remove-tags t)
;			(org-deadline-warning-days 0)))
;          (tags "TODO=\"DONE\"-time")
;          (tags "TODO=\"DONE\"-category")
;	  (tags-todo "URGENT")
;	  (tags-todo "IMPORTANT")))
;	("o" "Time-Flies"
;         ((agenda "TODO=\"DONE\"" ((org-agenda-span 7)
;				   (org-agenda-prefix-format "[x]")
;				   (org-agenda-todo-keyword-format "")
;				   (org-agenda-entry-types '(:scheduled))
;				   (org-deadline-warning-days 0))))
;	 nil
;	 ("~/org/tf-log"))
;	))
(setq org-highest-priority ?A)
(setq org-default-priority ?C)
(setq org-lowest-priority ?C)
; https://emacs.stackexchange.com/questions/53272/show-effort-and-clock-time-in-agenda-view
;; (setq org-agenda-prefix-format '((agenda . " %i %?-12t%-6e% s")
;;                                 (todo . " %i %-12:c %-6e")
;;                                 (tags . " %i %-12:c")
;;                                 (search . " %i %-12:c")))


;; WINDOW AND BUFFER MANAGEMENT ;;

; Line numbers
(global-linum-mode t)
(setq linum-format "%d  ")
;; Ensure use-package is installed
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

; Mouse
(xterm-mouse-mode)
