<commit_before>;; -*- lexical-binding: t -*-

(defun my-company//adjust-company-box-theme-faces ()
  "Make `company-box' candidates adhere to the color theme instead of using a
hardcoded bright white text color."
  (when (memq 'zenburn custom-enabled-themes)
    (custom-theme-set-faces
     'zenburn
     '(company-box-candidate ((t (:inherit default)))))))
<commit_msg>Workaround for occasional errors about dead company-box frames<commit_after>;; -*- lexical-binding: t -*-

(defun my-company//adjust-company-box-theme-faces ()
  "Make `company-box' candidates adhere to the color theme instead of using a
hardcoded bright white text color."
  (when (memq 'zenburn custom-enabled-themes)
    (custom-theme-set-faces
     'zenburn
     '(company-box-candidate ((t (:inherit default)))))))

;; Sometimes the `company-box' frame dies, which causes an error about a dead
;; frame whenever the popup would get displayed. This change checks for that
;; condition and pretends that no such frame was created yet if the current
;; frame is dead. This not only avoids the errors but also allows the package to
;; recover from the condition as it will create a new frame.
(with-eval-after-load 'el-patch
  (el-patch-feature company-box)
  (with-eval-after-load 'company-box
    (el-patch-defun company-box--get-frame ()
      "Return the child frame."
      (el-patch-swap
        (frame-parameter nil 'company-box-frame)
        (let ((frame (frame-parameter nil 'company-box-frame)))
          (when (frame-live-p frame) frame))))))

{'fraction_non_alphanumeric': 0.12303664921465969, 'fraction_numerical': 0.0, 'mean_word_length': 3.605421686746988, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2853543', 'n_tokens_mistral': 449, 'n_tokens_neox': 434, 'n_words': 159}