Remove directory-dirs function

This is redundant with code that already exists in Emacs.
This commit is contained in:
Kiana Sheibani 2024-03-08 18:48:59 -05:00
parent 49d2ecb7ea
commit ed2b1796ab
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -3087,20 +3087,9 @@ The ~org-agenda~ dispatcher is occasionally useful, but most of the time when I
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. 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 #+begin_src emacs-lisp
(defun directory-dirs (dir)
"Recursively find all subdirectories of DIR, ignoring dotfiles."
(let* ((dir (directory-file-name dir))
(files (directory-files dir nil nil t))
(dirs (list dir)))
(dolist (file files)
(unless (= (aref file 0) ?.)
(let ((file (concat dir "/" file)))
(when (file-directory-p file)
(appendq! dirs (directory-dirs file))))))
dirs))
(defun org-agenda-files-function () (defun org-agenda-files-function ()
(directory-dirs org-directory)) (require 'find-lisp)
(find-lisp-find-files org-directory "\.org$"))
(defvar org-agenda-files-function #'org-agenda-files-function (defvar org-agenda-files-function #'org-agenda-files-function
"The function to determine the org agenda files.") "The function to determine the org agenda files.")