diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index e677e610d..13b0b504a 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -799,19 +799,22 @@ via an indirect buffer." `org-mode' when they're switched to so they 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) - org-startup-indented - org-startup-folded - vc-handled-backends - org-mode-hook - find-file-hook) - (let ((buf (funcall fn file))) - (if buf - (with-current-buffer buf - (add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h - nil 'local))) - buf))) + (if-let (buf (org-find-base-buffer-visiting file)) + buf + (let ((recentf-exclude (list (lambda (_file) t))) + (doom-inhibit-large-file-detection t) + org-startup-indented + org-startup-folded + vc-handled-backends + org-mode-hook + enable-local-variables + find-file-hook) + (let ((buf (funcall fn file))) + (when buf + (with-current-buffer buf + (add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h + nil 'local))) + buf)))) (defadvice! +org--fix-inconsistent-uuidgen-case-a (uuid) "Ensure uuidgen is always lowercase (consistent) regardless of system.