<commit_before>;;; ui/posframe/config.el -*- lexical-binding: t; -*-

(when (version< emacs-version "26")
  (error "The :ui posframe module requires Emacs 26+"))


(def-package! posframe
  :defer t
  :config
  (add-hook 'doom-cleanup-hook #'posframe-delete-all)
  (add-hook 'doom-escape-hook #'+posframe|delete-on-escape))


(def-package! company-childframe
  :when (featurep! :completion company)
  :after company
  :config
  (company-childframe-mode 1)
  (after! desktop
    (push '(company-childframe-mode . nil) desktop-minor-mode-table)))


(def-package! ivy-posframe
  :when (featurep! :completion ivy)
  :after ivy
  :preface
  ;; This function searches the entire `obarray' just to populate
  ;; `ivy-display-functions-props'. There are 15k entries in mine! This is
  ;; wasteful, so...
  (advice-add #'ivy-posframe-setup :override #'ignore)
  :config
  ;; ... let's do it manually
  (dolist (fn (list 'ivy-posframe-display-at-frame-bottom-left
                    'ivy-posframe-display-at-frame-center
                    'ivy-posframe-display-at-point
                    'ivy-posframe-display-at-frame-bottom-window-center
                    'ivy-posframe-display
                    'ivy-posframe-display-at-window-bottom-left
                    'ivy-posframe-display-at-window-center
                    '+posframe-ivy-display-at-frame-center-near-bottom))
    (push (list fn :cleanup 'ivy-posframe-cleanup) ivy-display-functions-props))

  (push '(t . +posframe-ivy-display-at-frame-center-near-bottom) ivy-display-functions-alist)
  (push '(swiper . nil) ivy-display-functions-alist)
  (ivy-posframe-enable)

  (setq ivy-height 16
        ivy-fixed-height-minibuffer nil
        ivy-posframe-parameters `((min-width . 90)
                                  (internal-border-width . 10)))
  (unless ivy-posframe-font
    (setq ivy-posframe-font (font-spec :family (font-get doom-font :family) :size 18))))


;; TODO helm-posframe?
<commit_msg>ui/posframe: silence emacs version output in company-childframe-mode<commit_after>;;; ui/posframe/config.el -*- lexical-binding: t; -*-

(when (version< emacs-version "26")
  (error "The :ui posframe module requires Emacs 26+"))


(def-package! posframe
  :defer t
  :config
  (add-hook 'doom-cleanup-hook #'posframe-delete-all)
  (add-hook 'doom-escape-hook #'+posframe|delete-on-escape))


(def-package! company-childframe
  :when (featurep! :completion company)
  :after company
  :config
  (setq company-childframe-notification nil)
  (company-childframe-mode 1)
  (after! desktop
    (push '(company-childframe-mode . nil) desktop-minor-mode-table)))


(def-package! ivy-posframe
  :when (featurep! :completion ivy)
  :after ivy
  :preface
  ;; This function searches the entire `obarray' just to populate
  ;; `ivy-display-functions-props'. There are 15k entries in mine! This is
  ;; wasteful, so...
  (advice-add #'ivy-posframe-setup :override #'ignore)
  :config
  ;; ... let's do it manually
  (dolist (fn (list 'ivy-posframe-display-at-frame-bottom-left
                    'ivy-posframe-display-at-frame-center
                    'ivy-posframe-display-at-point
                    'ivy-posframe-display-at-frame-bottom-window-center
                    'ivy-posframe-display
                    'ivy-posframe-display-at-window-bottom-left
                    'ivy-posframe-display-at-window-center
                    '+posframe-ivy-display-at-frame-center-near-bottom))
    (push (list fn :cleanup 'ivy-posframe-cleanup) ivy-display-functions-props))

  (push '(t . +posframe-ivy-display-at-frame-center-near-bottom) ivy-display-functions-alist)
  (push '(swiper . nil) ivy-display-functions-alist)
  (ivy-posframe-enable)

  (setq ivy-height 16
        ivy-fixed-height-minibuffer nil
        ivy-posframe-parameters `((min-width . 90)
                                  (internal-border-width . 10)))
  (unless ivy-posframe-font
    (setq ivy-posframe-font (font-spec :family (font-get doom-font :family) :size 18))))


;; TODO helm-posframe?

{'fraction_non_alphanumeric': 0.14043824701195218, 'fraction_numerical': 0.007470119521912351, 'mean_word_length': 2.6954921803127876, 'pattern_counts': {'":': 0, '<': 5, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3601649', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1335, 'n_words': 271}