 ;; core-ui.el --- draw me like one of your French editors
 
-(defvar doom-ui-fringe-size '3
-  "Default fringe width")
-
-(defvar doom-ui-theme 'doom-one
-  "The color theme currently in use.")
-
-(defvar doom-ui-font
-  (font-spec :family "Fira Mono" :size 12)
-  "The font currently in use.")
-
-(defvar doom-ui-variable-pitch-font
-  (font-spec :family "Fira Sans" :size 12)
-  "The font currently in use.")
-
-(defvar doom-ui-unicode-font
-  (font-spec :family "DejaVu Sans Mono" :size 12)
-  "Fallback font for unicode glyphs.")
+(defvar doom-ui-fringe-size '3 "Default fringe width")
 
 (setq bidi-display-reordering nil ; disable bidirectional text for tiny performance boost
-      blink-matching-paren nil ; don't blink--too distracting
-      cursor-in-non-selected-windows nil
-      echo-keystrokes 0.02
+      blink-matching-paren nil    ; don't blink--too distracting
+      cursor-in-non-selected-windows nil  ; hide cursors in other windows
+      echo-keystrokes 0.02        ; show typed keys in minibuffer
       frame-inhibit-implied-resize t
       ;; remove continuation arrow on right fringe
       fringe-indicator-alist (delq (assq 'continuation fringe-indicator-alist)

  (add-hook! highlight-indent-guides-mode
    (if highlight-indent-guides-mode
        (progn
          (doom|highlight-indent-guides-adjust-whitespace)
          (add-hook 'after-save-hook 'doom|highlight-indent-guides-adjust-whitespace nil t))
      (remove-hook 'after-save-hook 'doom|highlight-indent-guides-adjust-whitespace t)
      (delete-trailing-whitespace)))

  ;; If all else fails, this package tries to guess the indentation, but does it
  ;; naively, so get default indentation from editorconfig instead.
  (defun doom*highlight-indentation-guess-offset (&rest _)
    (when (featurep 'editorconfig)
      (setq-local highlight-indentation-offset
                  (string-to-int (gethash 'indent_size (editorconfig-get-properties))))))
  (advice-add 'highlight-indentation-guess-offset :before 'doom*highlight-indentation-guess-offset))

;; Some modes don't adequately highlight numbers, therefore...
(package! highlight-numbers :commands highlight-numbers-mode)

;; Line highlighting (built-in)
(package! hl-line :ensure nil
  :config
  ;; stickiness doesn't play nice with emacs 25+
  (setq hl-line-sticky-flag nil
        global-hl-line-sticky-flag nil)

  ;; Remember whether hl-line was initially on or off in the current buffer
  (defvar-local doom--hl-line-mode nil)
  (defun doom|hl-line-on ()  (if doom--hl-line-mode (hl-line-mode +1)))
  (defun doom|hl-line-off () (if doom--hl-line-mode (hl-line-mode -1)))
  (add-hook! hl-line-mode (if hl-line-mode (setq doom--hl-line-mode t))))

;; A faster (or equal, in the worst case) line number plugin than `linum'. I've
;; modified it to highlight the current line, and fixed some glaring problems
;; with nlinum and frames.
(package! nlinum
  :commands nlinum-mode
  :preface (defvar nlinum-format "%4d ")

      split-width-threshold nil      ; favor horizontal splits
      uniquify-buffer-name-style nil
      use-dialog-box nil             ; always avoid GUI
      visible-cursor nil
      x-stretch-cursor t
      ;; no beeping or blinking please
      ring-bell-function 'ignore
      visible-bell nil
      ;; Ask for confirmation on quit only if real buffers exist
      confirm-kill-emacs (lambda (_) (if (doom-real-buffers-list) (y-or-n-p "››› Quit?") t)))

(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no

;; auto-enabled in Emacs 25+; I'd rather enable it manually
(global-eldoc-mode -1)

;; A minor mode for toggling the mode-line
(defvar doom--hidden-modeline-format nil
  "The modeline format to use when `doom-hide-modeline-mode' is active. Don't
set this directly. Bind it in `let' instead.")
(defvar-local doom--old-modeline-format nil
  "The old modeline format, so `doom-hide-modeline-mode' can revert when it's
disabled.")
(define-minor-mode doom-hide-modeline-mode
  "Minor mode to hide the mode-line in the current buffer."
  :init-value nil
  :global nil
  (if doom-hide-modeline-mode
      (setq doom--old-modeline-format mode-line-format
            mode-line-format doom--hidden-modeline-format)
    (setq mode-line-format doom--old-modeline-format
          doom--mode-line nil))
  (force-mode-line-update))
;; Ensure major-mode or theme changes don't overwrite these variables
(put 'doom--old-modeline 'permanent-local t)
(put 'doom-hide-modeline-mode 'permanent-local t)


;;
