<commit_before>;;; tools/direnv/config.el -*- lexical-binding: t; -*-

(def-package! direnv
  :after-call (after-find-file dired-initial-position-hook)
  :config
  (when (executable-find "direnv")<commit_msg>tools/direnv: consult direnv less frequently<commit_after>;;; tools/direnv/config.el -*- lexical-binding: t; -*-

(def-package! direnv
  :after-call (after-find-file dired-initial-position-hook)
  :config
  (defun +direnv|init ()
    "Instead of checking for direnv on `post-command-hook', check on
buffer/window/frame switch, which is less expensive."
    (direnv--disable)
    (when direnv-mode
      (add-hook 'doom-switch-buffer-hook #'direnv--maybe-update-environment)
      (add-hook 'doom-switch-window-hook #'direnv--maybe-update-environment)
      (add-hook 'focus-in-hook #'direnv--maybe-update-environment)))
  (add-hook 'direnv-mode-hook #'+direnv|init)

  (when (executable-find "direnv")
{'fraction_non_alphanumeric': 0.1628162816281628, 'fraction_numerical': 0.0, 'mean_word_length': 4.0, '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': '902220', 'n_tokens_mistral': 314, 'n_tokens_neox': 328, 'n_words': 61}