Global-git-commit-mode loads term, vterm, eshell, dired eagerly

What happened?

global-git-commit-mode in doom-first-file-hook loads term, vterm, eshell, dired

What did you expect to happen?

Those 4 libraries shouldn’t be loaded so early.

Steps to reproduce

  1. From the CLI, emacs test.txt
  2. Check loaded libraries: M-: (-intersection '(term vterm dired eshell) features)

System information


Loading data dump...

I don’t really know the reason, the issue is indirectly caused by with-editor (a dependency of git-commit)'s code:

(eval-when-compile
  (progn (require 'dired nil t)
         (require 'eshell nil t)
         (require 'term nil t)
         (condition-case err
             (require 'vterm nil t)
           (error (message "Error(vterm): %S" err)))
         (require 'warnings nil t)))

The problem doesn’t appear when I test agains vanilla Doom (:term (vterm) enabled) or personal config (it’s runnable without installing Doom) with vterm installed, just only when Doom + my config, has anyone run to this before?

Edit: fixed from with-editor's commit 48996e3116dadee06c8c68b1a0fe6ad8fd5317e0, but I’m still not sure why it’s not always reproducible.