Using benchmark-init, I see that helm files (helm-elisp, helm-mode, helm, etc.) are being required, but I don't have "(require 'helm)" or "(require 'helm-config)" or "(helm-mode 1)" anywhere in my init file. I'm using use-package, and all helm-related packages are deferred, including helm. Is there some direct way I can figure out where helm is being required from? I also want to find out where semantic is being required from.
I don't know of any standard way of doing this. However, you can fairly simply advice
require so that it keeps trace of who calls it.
(defvar my/require-tree nil) (defun require--advice (orig-fun feature &rest args) (setq my/require-tree (append my/require-tree (list (let ((my/require-tree (list feature))) (apply orig-fun feature args) my/require-tree))))) (advice-add 'require :around 'require--advice)
If you put this at the beginning of your init file, you should at the end get something like this in the
((org (calendar (cal-menu (calendar))) (find-func) (format-spec) (org-macs) (org-compat (org-macs)) (ob-emacs-lisp (ob (org-macs) (org-compat) (ob-eval (org-macs)) (ob-core (ob-eval) (org-macs) (org-compat)) (ob-comint (ob-core) (org-compat) (comint)) (ob-exp (ob-core)))) ;;... ) (tramp ;;... ))
NB: You can use C-hv
my/require-treeRET to see the contents of the variable in a nicely formatted way.