Update custom setter for special org agenda files

The setter will now complain if the file to be added to `org-agenda-files' does
not exist and is not readable.  It also now uses the proper functions from `org'
to update `org-agenda-files'.
This commit is contained in:
Daniel - 2020-01-05 11:56:05 +01:00
parent c3df9ef92b
commit bd65533b97
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 14 additions and 6 deletions

View File

@ -16,13 +16,21 @@
"Set SYMBOL to VALUE and update `org-agenda-files afterwards.
Remove the old value of SYMBOL from `org-agenda-files and add
the new one instead."
(require 'org)
(when (boundp symbol)
(setq org-agenda-files (cl-delete (symbol-value symbol) org-agenda-files)))
(when (and (boundp symbol)
(symbol-value symbol))
(require 'org)
(org-remove-file (symbol-value symbol)))
(set-default symbol value)
(push value org-agenda-files)
(setq-default org-agenda-files
(cl-delete-duplicates org-agenda-files :test #'cl-equalp)))
(when value
(if (not (and (stringp value)
(file-exists-p value)
(file-readable-p value)))
(user-error "File %s does not exist or is not readable; not setting %s."
value symbol)
(require 'org)
(message "Adding: %s" value)
(with-current-buffer (find-file-noselect value)
(org-agenda-file-to-front 'to-end)))))
(defun db/org-agenda-list-deadlines (&optional match)
;; XXX org-agenda-later does not work, fix this