Fix #4759: suppressed doom-first-file-hook side-effects

An optimization that minimizes how much work is done when grabbing org
agenda files in the background prevented side-effects in
doom-first-file-hook. This had the indirect effect of preventing
save-place-mode from adding its hook to find-file-hook IF org-agenda was
the first thing you ran at startup.
This commit is contained in:
Henrik Lissner 2021-03-10 20:30:10 -05:00
parent 61ae935fe4
commit 9f08db8e33

View File

@ -611,10 +611,13 @@ mutating hooks on exported output, like formatters."
(defun +org--restart-mode-h ()
"Restart `org-mode', but only once."
(quiet! (org-mode-restart))
(delq! (current-buffer) org-agenda-new-buffers)
(remove-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
'local))
'local)
(delq! (current-buffer) org-agenda-new-buffers)
(let ((file buffer-file-name)
(inhibit-redisplay t))
(kill-buffer)
(find-file file)))
(add-hook! 'org-agenda-finalize-hook
(defun +org-exclude-agenda-buffers-from-workspace-h ()
@ -644,8 +647,9 @@ 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)
find-file-hook
org-mode-hook)
doom-first-file-hook
org-mode-hook
find-file-hook)
(funcall orig-fn file)))
;; HACK With https://code.orgmode.org/bzg/org-mode/commit/48da60f4, inline