Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add effort properties for agenda elements #415

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions org-ql-view.el
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,8 @@ return an empty string."
(file-name-sans-extension
(file-name-nondirectory buffer-file-name))))))
""))
(effort-string (org-element-property (intern (concat ":" (upcase org-effort-property))) element))
(effort (when effort-string (org-duration-to-minutes effort-string)))
(priority-string (-some->> (org-element-property :priority element)
(char-to-string)
(format "[#%s]")
Expand All @@ -926,6 +928,9 @@ return an empty string."
'org-category category
'todo-state todo-keyword
'tags tag-list
'txt (org-add-props string nil
'effort effort-string
'effort-minutes effort)
'org-habit-p habit-property)))))

(defun org-ql-view--add-faces (element)
Expand Down
14 changes: 14 additions & 0 deletions tests/test-org-ql.el
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,20 @@ with keyword arg NOW in PLIST."
(cl-loop while (re-search-forward org-heading-regexp nil t)
sum 1)))))

(describe "Agenda"

(require 'org-agenda)

(it "Sets effort properties for formatted element"
(let* ((element (car (org-ql-select org-ql-test-buffer '(effort 30))))
(item (org-ql-view--format-element element)))
(with-temp-buffer
(goto-char (point-min))
(insert item)
(expect
(org-agenda-compare-effort #'= 30.0)
:to-equal t)))))

(describe "Caching"

(it "Clears value cache after buffer changes"
Expand Down
Loading