remove(org-agenda): remove dynamic agenda files

This commit is contained in:
Kiana Sheibani 2024-08-14 03:44:04 -04:00
parent ead0e33cc8
commit 387dd61536
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -3575,6 +3575,7 @@ A full week-long agenda is usually too cluttered for me to read, so I'll narrow
#+begin_src emacs-lisp
(after! org
(require 'org-roam-dailies) ; Load along with `org' to make this code work
(setq org-agenda-span 'day
org-agenda-start-day nil
org-agenda-start-on-weekday 1 ; 1 = Monday
@ -3585,6 +3586,13 @@ A full week-long agenda is usually too cluttered for me to read, so I'll narrow
(tags habit-down priority-down time-up category-up)
(search category-up))
;; Agenda files
org-agenda-files
(list org-directory
org-roam-directory
(f-join org-roam-directory "school/courses")
(f-join org-roam-directory org-roam-dailies-directory))
;; Make sure agenda is the only window
org-agenda-window-setup 'only-window
org-agenda-restore-windows-after-quit t
@ -3682,23 +3690,7 @@ This "overview" agenda command is very nice. It's so nice, in fact, that it's al
"o A" #'org-agenda)
#+end_src
*** Agenda Files
I have a lot of different subdirectories and groupings in my org directory, but unfortunately directories listed in ~org-agenda-files~ aren't checked recursively! We can solve this by creating a function ~org-agenda-files-function~ to return the agenda files, then advising Org to call that function before getting the agenda files.
#+begin_src emacs-lisp
(defun org-agenda-files-function ()
(require 'find-lisp)
(find-lisp-find-files org-directory "\.org$"))
(defvar org-agenda-files-function #'org-agenda-files-function
"The function to determine the org agenda files.")
(defadvice! ~/org-agenda-files (&rest _)
"Set `org-agenda-files' before Org fetches them."
:before #'org-agenda-files
(setq org-agenda-files (funcall org-agenda-files-function)))
#+end_src
** Citations