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:
parent
6853196017
commit
3dbf994871
1 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue