   (call-process-shell-command
    (concat "xprop -f _GTK_THEME_VARIANT 8u -set _GTK_THEME_VARIANT \"" variant "\" -name \"" (current-frame-name) "\"")))
 
-(if (window-system)
-    (set-gtk-theme "dark"))
+(when (window-system)
+  (set-gtk-theme "dark"))
 
 (load-theme 'photon t)
 
-;; Set default fonts
-(if (member "Inconsolata" (font-family-list))
-    (progn
-      (set-face-attribute 'default nil :family "Inconsolata" :height 135)
-      (set-face-attribute 'fixed-pitch nil :family "Inconsolata" :height 135))
-  (when (memq system-type '(cygwin windows-nt ms-dos))
-    (progn (set-face-attribute 'default nil :family "Consolas" :height 110)
-           (set-face-attribute 'fixed-pitch nil :family "Consolas" :height 110))))
 
-(if (member "DejaVu Sans" (font-family-list))
-    (set-face-attribute 'variable-pitch nil :family "DejaVu Sans" :height 110))
+;;; Default fonts
 
-;; Mouse scrolling
+(defun set-monospace-font (family height)
+  (set-face-attribute 'default nil :family family :height height)
+  (set-face-attribute 'fixed-pitch nil :family family :height height))
+
+(cond ((member "Roboto Mono" (font-family-list))
+       (set-monospace-font "Roboto Mono" 110))
+      ((member "Inconsolata" (font-family-list))
+       (set-monospace-font "Inconsolata" 135))
+      ((memq system-type '(cygwin windows-nt ms-dos))
+       (set-monospace-font "Consolas" 110)))
+
+(cond ((member "Cantarell" (font-family-list))
+       (set-face-attribute 'variable-pitch nil :family "Cantarell" :height 120))
+      ((member "DejaVu Sans" (font-family-list))
+       (set-face-attribute 'variable-pitch nil :family "DejaVu Sans" :height 110)))
+
+
+;;; Scrolling
+
 (setq mouse-wheel-scroll-amount '(3 ((shift) . 1))
       mouse-wheel-progressive-speed nil
-      mouse-wheel-follow-mouse 't)
-
-;; Keyboard scrolling
-(setq scroll-step 1
+      mouse-wheel-follow-mouse 't
+      ;; Keyboard scrolling
+      scroll-step 1
       scroll-conservatively 10000)
-
-;; Horizontal scrolling (`C-PgUp' & `C-PgDn')
+;; Enable horizontal scroll (`C-PgUp' + `C-PgDn')
 (put 'scroll-left 'disabled nil)
-
-;; Character encoding
-(set-language-environment "UTF-8")
-(set-default-coding-systems 'utf-8-unix)
-
-;; Update buffers and `dired' when files change on disk
-(global-auto-revert-mode t)
-(add-hook 'dired-mode-hook 'auto-revert-mode)
-
-;; Backups and save cursor position
-(setq backup-directory-alist `(("." . ,(concat user-emacs-directory "backup")))
-      backup-by-copying t
-      delete-old-versions t
-      version-control t
-      save-place-file (concat user-emacs-directory "places")
-      undo-tree-history-directory-alist `(("." . ,(concat user-emacs-directory "undo")))
-      undo-tree-auto-save-history t)
-(save-place-mode 1)
-
-(setq user-mail-address "av@axvr.io"
-      user-full-name "Alex Vear")
 
 
 ;;; Programming
 
-;; Indentation settings
+;; Indentation.
 (setq-default indent-tabs-mode nil)
 (setq-default tab-width 4)
-;; TODO configure indentation for each major mode
-
-;; TODO Behaviour similar to `textwidth' in Vim:
-;; `auto-fill-mode' and `fill-column'
+;; TODO: configure indentation for each major mode.
+;; TODO: behaviour similar to `textwidth' in Vim: `auto-fill-mode' and `fill-column'.
 
 (setq require-final-newline 'ask)
 (add-hook 'prog-mode-hook (lambda () (setq show-trailing-whitespace t)))

           (setq-default cursor-type 'bar))
  (xterm-mouse-mode 1))

(setq inhibit-startup-screen t)
(setq initial-scratch-message "")
(setq frame-title-format "GNU Emacs")


(defun current-frame-name ()
  "Return the name of the current GUI frame."

(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http://" "https://")))
  (add-to-list 'package-archives (cons "melpa" (concat proto "melpa.org/packages/")) t))

(setq package-archive-priorities
      '(("gnu" . 10)
        ("melpa" . 5))
      package-enable-at-startup nil)

(when (< emacs-major-version 27)
  (package-initialize))

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package)
  (require 'use-package-ensure)
  (setq use-package-always-ensure t))

(use-package undo-propose
  :config (global-set-key (kbd "C-c u") 'undo-propose))

(use-package clojure-mode :defer t)
(use-package markdown-mode :defer t)
(use-package restclient :mode ("\\.http\\'" . restclient-mode))
(use-package ledger-mode :defer t)  ; FIXME: make `ledger-mode-clean-buffer' sort in reverse order.

(use-package org
  :defer t
  :hook (org-mode . org-indent-mode)
  :config
  ;; TODO set org directory for org-agenda
  (require 'org-man))

;; TODO: sly/slime, paredit, inf-clojure, gerbil, gambit, magit

(custom-set-variables
 ;; custom-set-variables was added by Custom.
