This commit is contained in:
Adam Porter 2017-08-05 03:49:38 -05:00
parent 9dfb9b98c0
commit 4202315283

View file

@ -5,12 +5,9 @@
;;;; Commands ;;;; Commands
(defun org-agenda-ng--test-agenda () (defun org-agenda-ng--agenda (&key filter-fns)
(interactive)
(with-current-buffer (find-buffer-visiting "~/org/main.org") (with-current-buffer (find-buffer-visiting "~/org/main.org")
(let* ((tree (cddr (org-element-parse-buffer 'headline))) (let* ((tree (cddr (org-element-parse-buffer 'headline)))
(filter-fns '((org-agenda-ng--todo-p "TODO")
(org-agenda-ng--date-p :deadline < "2017-08-05")))
(entries (--> (org-agenda-ng--filter-tree tree :filter-fns filter-fns) (entries (--> (org-agenda-ng--filter-tree tree :filter-fns filter-fns)
(mapcar #'org-agenda-ng--element-to-string it))) (mapcar #'org-agenda-ng--element-to-string it)))
(result-string (org-agenda-finalize-entries entries 'agenda)) (result-string (org-agenda-finalize-entries entries 'agenda))
@ -22,6 +19,17 @@
(read-only-mode 1) (read-only-mode 1)
(pop-to-buffer (current-buffer)))))) (pop-to-buffer (current-buffer))))))
(defun org-agenda-ng--test-agenda ()
(interactive)
(org-agenda-ng--agenda
:filter-fns '((org-agenda-ng--todo-p "TODO")
(org-agenda-ng--date-p :deadline < "2017-08-05"))))
(defun org-agenda-ng--todo-list ()
(interactive)
(org-agenda-ng--agenda
:filter-fns '((org-agenda-ng--todo-p "TODO"))))
;;;; Functions ;;;; Functions
(defun org-agenda-ng--filter-tree (tree &key filter-fns) (defun org-agenda-ng--filter-tree (tree &key filter-fns)
@ -57,7 +65,11 @@ Its property list should be the second item in the list, as returned by `org-ele
(org-link-display-format it))) (org-link-display-format it)))
(todo-keyword (--> (org-element-property :todo-keyword element) (todo-keyword (--> (org-element-property :todo-keyword element)
(org-agenda-ng--add-todo-face it))) (org-agenda-ng--add-todo-face it)))
(string (s-join " " (list todo-keyword title)))) (tags (--> (org-element-property :tags element)
(s-join ":" it)
(s-wrap it ":")
(org-add-props it nil 'face 'org-tag)))
(string (s-join " " (list todo-keyword title tags))))
;; Add all the necessary properties and faces to the whole string ;; Add all the necessary properties and faces to the whole string
(--> string (--> string
(org-add-props it properties)))) (org-add-props it properties))))