Make doom-first-*-hooks trigger less aggressively

This fixes a class of issues where doom-first-file-hook would fire even
for files not opened interactively (e.g. via org-agenda reading agenda
files or helpful scraping definitions from source files).

In instances like these, hooks like find-file-hook or pre-command-hook
are set to nil to speed up this process and reduce noise, but many
packages add to these hooks when they are loaded; these are lost when
their lexical values fall out of scope, leading to odd errors (like the
one in #4759).

Fixes #4759 (again)
First brought up in hlissner/doom-emacs@9f08db8
This commit is contained in:
Henrik Lissner 2021-04-14 17:31:31 -04:00
parent 241e040e4d
commit 0683861f3f
2 changed files with 29 additions and 18 deletions

View file

@ -647,7 +647,6 @@ can grow up to be fully-fledged org-mode buffers."
:around #'org-get-agenda-file-buffer
(let ((recentf-exclude (list (lambda (_file) t)))
(doom-inhibit-large-file-detection t)
doom-first-file-hook
org-mode-hook
find-file-hook)
(funcall orig-fn file)))