mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
lang/org: close agenda buffers after org-agenda
Experimental. Running org-agenda would leave leftover open buffers, this hook cleans them up.
This commit is contained in:
@ -241,6 +241,14 @@ between the two."
|
||||
;; Don't open separate windows
|
||||
(map-put org-link-frame-setup 'file 'find-file)
|
||||
|
||||
(defun +org|cleanup-agenda-files ()
|
||||
"Close leftover agenda buffers after they've been indexed by org-agenda."
|
||||
(cl-loop for file in org-agenda-files
|
||||
for buf = (get-file-buffer file)
|
||||
if (and file (not (get-buffer-window buf)))
|
||||
do (kill-buffer buf)))
|
||||
(add-hook 'org-agenda-finalize-hook #'+org|cleanup-agenda-files)
|
||||
|
||||
;; Let OS decide what to do with files when opened
|
||||
(setq org-file-apps
|
||||
`(("\\.org$" . emacs)
|
||||
|
Reference in New Issue
Block a user