refactor(org): +org-exclude-agenda-buffers-from-workspace-h

This commit is contained in:
Henrik Lissner 2024-08-31 22:07:57 -04:00
parent a8f116bb6b
commit b2ce4f0afc
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -787,30 +787,26 @@ via an indirect buffer."
(defvar recentf-exclude) (defvar recentf-exclude)
(defadvice! +org--optimize-backgrounded-agenda-buffers-a (fn file) (defadvice! +org--optimize-backgrounded-agenda-buffers-a (fn file)
"Disable a lot of org-mode's startup processes for temporary agenda buffers. "Disable `org-mode's startup processes for temporary agenda buffers.
This includes preventing them from polluting recentf. Prevents recentf pollution as well. However, if the user tries to visit one of
these buffers they'll see a gimped, half-broken org buffer, so to avoid that,
However, if the user tries to visit one of these buffers they'll see a install a hook to restart `org-mode' when they're switched to so they can grow
gimped, half-broken org buffer. To avoid that, install a hook to restart up to be fully-fledged org-mode buffers."
`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 :around #'org-get-agenda-file-buffer
(if-let (buf (org-find-base-buffer-visiting file)) (if-let (buf (org-find-base-buffer-visiting file))
buf buf
(let ((recentf-exclude (list (lambda (_file) t))) (let ((recentf-exclude '(always))
(doom-inhibit-large-file-detection t) (doom-inhibit-large-file-detection t)
org-startup-indented (doom-inhibit-local-var-hooks t)
org-startup-folded (org-inhibit-startup t)
vc-handled-backends vc-handled-backends
org-mode-hook
enable-local-variables enable-local-variables
find-file-hook) find-file-hook)
(let ((buf (funcall fn file))) (when-let ((buf (delay-mode-hooks (funcall fn file))))
(when buf
(with-current-buffer buf (with-current-buffer buf
(add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h (add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
nil 'local))) nil 'local))
buf)))) buf))))
(defadvice! +org--fix-inconsistent-uuidgen-case-a (uuid) (defadvice! +org--fix-inconsistent-uuidgen-case-a (uuid)