 ; 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)

(require 'package)
(add-to-list 'package-archives
	     '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)


;; BASIC STUFF ;;

(global-set-key (kbd "M-\\") 'delete-horizontal-space-across-lines)


;; LANGUAGE CONFIGURATION ;;

; Callow
(add-to-list 'auto-mode-alist '("\\.clw\\'" . clojure-mode))

; Golang

; https://github.com/golang/tools/blob/master/gopls/doc/emacs.md
(use-package lsp-mode
  :init
  (setq lsp-keymap-prefix "C-l"))
(add-hook 'go-mode-hook #'lsp-deferred)

;; Set up before-save hooks to format buffer and add/delete imports.
;; Make sure you don't have other gofmt/goimports hooks enabled.
(defun lsp-go-install-save-hooks ()
  (add-hook 'before-save-hook #'lsp-format-buffer t t)
  (add-hook 'before-save-hook #'lsp-organize-imports t t))
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)


;; OTHER ;;

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(org-tag ((t (:foreground "white" :weight bold)))))
