 
 
 ;;; `+modeline-checker'
-(progn
-  (def-modeline-var! +modeline-checker nil
-    "Displays color-coded error status & icon for the current buffer."
-    :local t)
-
-  (add-hook! '(flycheck-status-changed-functions
-               flycheck-mode-hook)
-    (defun +modeline-checker-update (&optional status)
-      "Update flycheck text via STATUS."
-      (setq +modeline-checker
-            (pcase status
-              (`finished
-               (if flycheck-current-errors
-                   (let-alist (flycheck-count-errors flycheck-current-errors)
-                     (let ((error (or .error 0))
-                           (warning (or .warning 0))
-                           (info (or .info 0)))
-                       (+modeline-format-icon "do_not_disturb_alt"
-                                              (number-to-string (+ error warning info))
-                                              (cond ((> error 0)   'error)
-                                                    ((> warning 0) 'warning)
-                                                    ('success))
-                                              (format "Errors: %d, Warnings: %d, Debug: %d"
-                                                      error
-                                                      warning
-                                                      info))))
-                 (+modeline-format-icon "check" "" 'success)))
-              (`running     (+modeline-format-icon "access_time" "*" 'font-lock-comment-face "Running..."))
-              (`errored     (+modeline-format-icon "sim_card_alert" "!" 'error "Errored!"))
-              (`interrupted (+modeline-format-icon "pause" "!" 'font-lock-comment-face "Interrupted"))
-              (`suspicious  (+modeline-format-icon "priority_high" "!" 'error "Suspicious")))))))
+(def-modeline-var! +modeline-checker nil
+  "Displays color-coded error status & icon for the current buffer."
+  :local t)
+
+(add-hook! '(flycheck-status-changed-functions
+             flycheck-mode-hook)
+  (defun +modeline-checker-update (&optional status)
+    "Update flycheck text via STATUS."
+    (setq +modeline-checker
+          (pcase status
+            (`finished
+             (if flycheck-current-errors
+                 (let-alist (flycheck-count-errors flycheck-current-errors)
+                   (let ((error (or .error 0))
+                         (warning (or .warning 0))
+                         (info (or .info 0)))
+                     (+modeline-format-icon "do_not_disturb_alt"
+                                            (number-to-string (+ error warning info))
+                                            (cond ((> error 0)   'error)
+                                                  ((> warning 0) 'warning)
+                                                  ('success))
+                                            (format "Errors: %d, Warnings: %d, Debug: %d"
+                                                    error
+                                                    warning
+                                                    info))))
+               (+modeline-format-icon "check" "" 'success)))
+            (`running     (+modeline-format-icon "access_time" "*" 'font-lock-comment-face "Running..."))
+            (`errored     (+modeline-format-icon "sim_card_alert" "!" 'error "Errored!"))
+            (`interrupted (+modeline-format-icon "pause" "!" 'font-lock-comment-face "Interrupted"))
+            (`suspicious  (+modeline-format-icon "priority_high" "!" 'error "Suspicious"))))))
 
 
 ;;; `+modeline-selection-info'
-(progn
-  (defsubst +modeline--column (pos)
-    "Get the column of the position `POS'."
-    (save-excursion (goto-char pos)
-                    (current-column)))
-
-  (def-modeline-var! +modeline-selection-info
-    '(:eval
-      (when (or mark-active
-                (and (bound-and-true-p evil-local-mode)
-                     (eq evil-state 'visual)))
-        (cl-destructuring-bind (beg . end)
-            (if (boundp 'evil-local-mode)
-                (cons evil-visual-beginning evil-visual-end)
-              (cons (region-beginning) (region-end)))
-          (propertize
-           (let ((lines (count-lines beg (min end (point-max)))))
-             (concat " "
-                     (cond ((or (bound-and-true-p rectangle-mark-mode)
-                                (and (bound-and-true-p evil-visual-selection)
-                                     (eq 'block evil-visual-selection)))
-                            (let ((cols (abs (- (+modeline--column end)
-                                                (+modeline--column beg)))))
-                              (format "%dx%dB" lines cols)))
-                           ((and (bound-and-true-p evil-visual-selection)
-                                 (eq evil-visual-selection 'line))
-                            (format "%dL" lines))
-                           ((> lines 1)
-                            (format "%dC %dL" (- end beg) lines))
-                           ((format "%dC" (- end beg))))
-                     (when (derived-mode-p 'text-mode)
-                       (format " %dW" (count-words beg end)))
-                     " "))
-           'face (if (+modeline-active) 'success)))))
-    "Information about the current selection, such as how many characters and
+(defsubst +modeline--column (pos)
+  "Get the column of the position `POS'."
+  (save-excursion (goto-char pos)
+                  (current-column)))
+
+(def-modeline-var! +modeline-selection-info
+  '(:eval
+    (when (or (and (bound-and-true-p evil-local-mode)
+                   (eq evil-state 'visual))
+              mark-active)
+      (cl-destructuring-bind (beg . end)
+          (if (bound-and-true-p evil-visual-selection)
+              (cons evil-visual-beginning evil-visual-end)
+            (cons (region-beginning) (region-end)))
+        (propertize
+         (let ((lines (count-lines beg (min end (point-max)))))
+           (concat " "
+                   (cond ((or (bound-and-true-p rectangle-mark-mode)
+                              (and (bound-and-true-p evil-visual-selection)
+                                   (eq 'block evil-visual-selection)))
+                          (let ((cols (abs (- (+modeline--column end)
+                                              (+modeline--column beg)))))
+                            (format "%dx%dB" lines cols)))
+                         ((and (bound-and-true-p evil-visual-selection)
+                               (eq evil-visual-selection 'line))
+                          (format "%dL" lines))
+                         ((> lines 1)
+                          (format "%dC %dL" (- end beg) lines))
+                         ((format "%dC" (- end beg))))
+                   (when (derived-mode-p 'text-mode)
+                     (format " %dW" (count-words beg end)))
+                   " "))
+         'face (if (+modeline-active) 'success)))))
+  "Information about the current selection, such as how many characters and
 lines are selected, or the NxM dimensions of a block selection.")
 
-  (defun +modeline-add-selection-segment-h ()
-    (add-to-list '+modeline-format-left '+modeline-selection-info 'append))
-  (defun +modeline-remove-selection-segment-h ()
-    (delq! '+modeline-selection-info +modeline-format-left))
-
-  (if (featurep 'evil)
-      (progn
-        (add-hook 'evil-visual-state-entry-hook #'+modeline-add-selection-segment-h)
-        (add-hook 'evil-visual-state-exit-hook #'+modeline-remove-selection-segment-h))
-    (add-hook 'activate-mark-hook #'+modeline-add-selection-segment-h)
-    (add-hook 'deactivate-mark-hook #'+modeline-remove-selection-segment-h)))
+(defun +modeline-add-selection-segment-h ()
+  (add-to-list '+modeline-format-left '+modeline-selection-info 'append))
+(defun +modeline-remove-selection-segment-h ()
+  (delq! '+modeline-selection-info +modeline-format-left))
+
+(if (featurep 'evil)
+    (progn
+      (add-hook 'evil-visual-state-entry-hook #'+modeline-add-selection-segment-h)
+      (add-hook 'evil-visual-state-exit-hook #'+modeline-remove-selection-segment-h))
+  (add-hook 'activate-mark-hook #'+modeline-add-selection-segment-h)
+  (add-hook 'deactivate-mark-hook #'+modeline-remove-selection-segment-h))
 
 
 ;;; `+modeline-encoding'

    " " +modeline-buffer-identification)
  '("" +modeline-modes))

;; TODO (def-modeline! pdf ...)
;; TODO (def-modeline! helm ...)



;;
;;; Faces

(defface doom-modeline-bar '((t (:inherit highlight)))
  "Face used for left-most bar on the mode-line of an active window.")

(defface doom-modeline-bar-inactive '((t (:inherit mode-line-inactive)))
  "Face used for left-most bar on the mode-line of an inactive window.")

(defface doom-modeline-highlight
  '((t (:inherit mode-line-highlight)))
  "Face used for highlighted modeline panels (like search counts).")

(defface doom-modeline-alternate-highlight
  '((t (:inherit mode-line-highlight)))
  "Alternative face used for highlighted modeline panels (like search counts).")

