fix(org): restart org-mode before indirect buffer

Fix: #5714
This commit is contained in:
Tim Ruffing 2024-01-09 23:14:40 +01:00 committed by Henrik Lissner
parent 19482ee582
commit 1ee429406b

View file

@ -852,6 +852,17 @@ can grow up to be fully-fledged org-mode buffers."
(add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h (add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
nil 'local)))))) nil 'local))))))
(defadvice! +org--restart-mode-before-indirect-buffer-a (base-buffer &rest _)
"Restart `org-mode' in buffers in which the mode has been deferred (see
`+org-defer-mode-in-agenda-buffers-h') before they become the base buffer for an
indirect buffer. This ensures that the buffer is fully functional not only when
the *user* visits it, but also when some code interacts with it via an indirect
buffer as done, e.g., by `org-capture'."
:before #'make-indirect-buffer
(with-current-buffer base-buffer
(when (memq #'+org--restart-mode-h doom-switch-buffer-hook)
(+org--restart-mode-h))))
(defvar recentf-exclude) (defvar recentf-exclude)
(defadvice! +org--optimize-backgrounded-agenda-buffers-a (fn file) (defadvice! +org--optimize-backgrounded-agenda-buffers-a (fn file)
"Prevent temporarily opened agenda buffers from polluting recentf." "Prevent temporarily opened agenda buffers from polluting recentf."