Allow to list Org Mode files in projects not being searched by default

This commit is contained in:
Daniel - 2020-09-20 14:48:18 +02:00
parent bdc8a53fe3
commit d9e74f6e54
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 22 additions and 1 deletions

View File

@ -2,7 +2,6 @@
;;; Commentary:
;; XXX: update org-agenda-text-search-extra-files when creating and removing projects
;;; Code:
@ -116,6 +115,28 @@ project diary, and updating projectile's cache."
(expand-file-name short-name
projects-main-project-directory)))
(defun projects--org-files ()
"Return all Org Mode files in all known projects, recursively."
(mapcan #'(lambda (dir)
(directory-files-recursively (expand-file-name dir projects-main-project-directory)
".*\\.org" nil))
(projects-existing-projects)))
(defvar org-agenda-text-search-extra-files) ; to keep the byte-compiler happy
(defun projects-find-unsearched-org-files ()
"Find Org Mode files in known projects that are not searched by default.
This is done by checking all org Mode files in every project
whether it is included in `org-agenda-text-search-extra-files'."
(require 'org)
(let ((extra-files (make-hash-table :test #'equal)))
(mapc #'(lambda (entry)
(when (stringp entry)
(puthash (file-truename entry) t extra-files)))
org-agenda-text-search-extra-files)
(cl-remove-if #'(lambda (org-file)
(gethash (file-truename org-file) extra-files nil))
(projects--org-files))))
(provide 'db-projects)