lang/org: change recentf/persp clobbering fix

This commit is contained in:
Henrik Lissner 2018-05-11 20:16:19 +02:00
parent 9b1385b725
commit b6e2599358
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -319,10 +319,14 @@ between the two."
(t . ,(cond (IS-MAC "open -R \"%s\"") (t . ,(cond (IS-MAC "open -R \"%s\"")
(IS-LINUX "xdg-open \"%s\""))))) (IS-LINUX "xdg-open \"%s\"")))))
(after! recentf ;; Don't clobber recentf or current workspace with agenda files
;; Don't clobber recentf with agenda files (defun +org|exclude-agenda-buffers-from-workspace ()
(defun +org-is-agenda-file (filename) (let (persp-autokill-buffer-on-remove)
(cl-find (file-truename filename) org-agenda-files (persp-remove-buffer org-agenda-new-buffers (get-current-persp) nil)))
:key #'file-truename (add-hook 'org-agenda-finalize-hook #'+org|exclude-agenda-buffers-from-workspace)
:test #'equal))
(push #'+org-is-agenda-file recentf-exclude))) (defun +org*exclude-agenda-buffers-from-recentf (orig-fn &rest args)
(let ((recentf-exclude (list (lambda (_file) t))))
(apply orig-fn args)))
(advice-add #'org-get-agenda-file-buffer
:around #'+org*exclude-agenda-buffers-from-recentf))