Check whether special org-mode files are included in agenda when displaying it

This commit is contained in:
Daniel - 2020-01-05 13:36:37 +01:00
parent 66425ee2b7
commit 243e579973
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
2 changed files with 24 additions and 2 deletions

View File

@ -700,7 +700,8 @@ With given ARG, display files in `db/important-document-path."
;; * Org
(use-package db-org
:commands (db/verify-refile-target
:commands (db/check-special-org-files-in-agenda
db/verify-refile-target
org-reset-checkbox-state-maybe
db/find-parent-task
db/ensure-running-clock
@ -1124,7 +1125,10 @@ in the main agenda view."
;; opening them manually
(mapc #'find-file-noselect org-agenda-files)
(add-hook 'org-agenda-mode-hook #'hl-line-mode 'append)))
(add-hook 'org-agenda-mode-hook #'hl-line-mode 'append)
(advice-add 'org-agenda
:before #'db/check-special-org-files-in-agenda)))
;; Capturing

View File

@ -11,6 +11,24 @@
;;; Agenda Customization
(defun db/check-special-org-files-in-agenda (&rest args)
"Check whether the special org-mode files are part of `org-agenda-files', ignoring ARGS.
The special org-mode files are `db/org-default-work-file',
`db/org-default-home-file', `db/org-default-notes-files', and
`db/org-default-refile-file'."
(declare (ignore args))
(require 'org)
(let ((agenda-files (mapcar #'file-truename (org-agenda-files t))))
(dolist (file '(db/org-default-home-file
db/org-default-work-file
db/org-default-notes-file
db/org-default-refile-file))
(when (and (symbol-value file)
(not (member (file-truename (symbol-value file))
agenda-files)))
(warn "File %s is not part of `org-agenda-files'."
file)))))
(defun db/org-agenda-list-deadlines (&optional match)
;; XXX org-agenda-later does not work, fix this
"Prepare agenda view that only lists upcoming deadlines.