<commit_before>;; editor/god/autoload/god.el -*- lexical-binding: t; -*-

(defvar +god-default-color (face-background 'cursor)
  "Default cursor and bar color.")

(defvar +god-read-only-mode-color "Gray"
  "Cursor and bar color when `read-only-mode' is enabled.")

(defvar +god-overwrite-mode-color "Yellow"
  "Cursor and bar color when `overwrite-mode' is enabled.")

(defvar +god-fill-overflow-color "IndianRed"
  "Cursor and bar color when fill column width has been exceeded.")

;;;###autoload
(defvar +god-default-exempt-major-modes
  '(Custom-mode
    Info-mode
    ag-mode
    calculator-mode
    calendar-mode
    cider-test-report-mode
    compilation-mode
    debugger-mode
    dired-mode
    edebug-mode
    ediff-mode
    eww-mode
    geben-breakpoint-list-mode
    git-commit-mode
    grep-mode
    ibuffer-mode
    magit-popup-mode
    org-agenda-mode
    pdf-outline-buffer-mode
    recentf-dialog-mode
    sldb-mode
    sly-db-mode
    vc-annotate-mode
    wdired-mode)
  "Major modes in which `god-local-mode' will not be enabled on
initialization.")

;;;###autoload
(defun +god--configure-cursor-and-modeline-h ()
  "Configure cursor type, cursor color and doom-modeline bar color depending on mode."
  (let* ((is-fill-overflow (> (current-column) fill-column))
         (previous-cursor-color (face-background 'cursor))
         (previous-modeline-color (and (facep 'doom-modeline-bar)
                                       (face-background 'doom-modeline-bar)))
         (is-god-mode (and (boundp 'god-local-mode)
                           god-local-mode))
         (next-cursor-type
          (cond (buffer-read-only 'box)
                ((and overwrite-mode is-god-mode) 'hollow)
                ((or is-god-mode overwrite-mode) 'box)
                (t 'bar)))
         (next-cursor-and-modeline-color
          (cond (buffer-read-only +god-read-only-mode-color)
                (is-fill-overflow +god-fill-overflow-color)
                (overwrite-mode +god-overwrite-mode-color)
                (t +god-default-color))))
    (setq cursor-type next-cursor-type)
    (unless (eq previous-cursor-color next-cursor-and-modeline-color)
      (set-cursor-color next-cursor-and-modeline-color))
    (when (and (facep 'doom-modeline-bar)<commit_msg>Use bound-and-true-p instead of (and (boundp ...))<commit_after>;; editor/god/autoload/god.el -*- lexical-binding: t; -*-

(defvar +god-default-color (face-background 'cursor)
  "Default cursor and bar color.")

(defvar +god-read-only-mode-color "Gray"
  "Cursor and bar color when `read-only-mode' is enabled.")

(defvar +god-overwrite-mode-color "Yellow"
  "Cursor and bar color when `overwrite-mode' is enabled.")

(defvar +god-fill-overflow-color "IndianRed"
  "Cursor and bar color when fill column width has been exceeded.")

;;;###autoload
(defvar +god-default-exempt-major-modes
  '(Custom-mode
    Info-mode
    ag-mode
    calculator-mode
    calendar-mode
    cider-test-report-mode
    compilation-mode
    debugger-mode
    dired-mode
    edebug-mode
    ediff-mode
    eww-mode
    geben-breakpoint-list-mode
    git-commit-mode
    grep-mode
    ibuffer-mode
    magit-popup-mode
    org-agenda-mode
    pdf-outline-buffer-mode
    recentf-dialog-mode
    sldb-mode
    sly-db-mode
    vc-annotate-mode
    wdired-mode)
  "Major modes in which `god-local-mode' will not be enabled on
initialization.")

;;;###autoload
(defun +god--configure-cursor-and-modeline-h ()
  "Configure cursor type, cursor color and doom-modeline bar color depending on mode."
  (let* ((is-fill-overflow (> (current-column) fill-column))
         (previous-cursor-color (face-background 'cursor))
         (previous-modeline-color (and (facep 'doom-modeline-bar)
                                       (face-background 'doom-modeline-bar)))
         (is-god-mode (bound-and-true-p god-local-mode))
         (next-cursor-type
          (cond (buffer-read-only 'box)
                ((and overwrite-mode is-god-mode) 'hollow)
                ((or is-god-mode overwrite-mode) 'box)
                (t 'bar)))
         (next-cursor-and-modeline-color
          (cond (buffer-read-only +god-read-only-mode-color)
                (is-fill-overflow +god-fill-overflow-color)
                (overwrite-mode +god-overwrite-mode-color)
                (t +god-default-color))))
    (setq cursor-type next-cursor-type)
    (unless (eq previous-cursor-color next-cursor-and-modeline-color)
      (set-cursor-color next-cursor-and-modeline-color))
    (when (and (facep 'doom-modeline-bar)
{'fraction_non_alphanumeric': 0.13442044953724108, 'fraction_numerical': 0.0, 'mean_word_length': 2.4412433661865047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5917673', 'n_tokens_mistral': 1522, 'n_tokens_neox': 1482, 'n_words': 317}