Agenda entries are missing properties necessary for view filtering
- Lingua principale
- Emacs Lisp
- Stelle
- 1.6k
- Fork
- 120
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
For agenda entries generated by an `org-ql-block` query, the entries themselves are missing a few properties necessary for filtering the agenda view using Org's built-in functionality. For example, `org-agenda-filter-by-effort` expects a `txt` property for each entry and `org-agenda-filter-by-category` can't find the necessary category at the current point. For fixing filtering by effort, you can advise `org-ql-view--format-element` to inject the required `txt` property (which in turn has the necessary `effort-minutes` property):
```elisp
(defun my/org-ql-view--format-element (orig-fun &rest args)
(if (not args)
""
(let* ((element args)
(properties (cadar element))
(result (apply orig-fun element))
(effort (org-entry-get (plist-get properties :org-marker) "Effort"))
(effort-minutes (if effort (org-duration-to-minutes effort) nil))
;; Attempts to emulate the txt properties of each entry. Only sets
;; effort-minutes.
(txt (if effort-minutes
(propertize "dummy" 'effort-minutes effort-minutes)
"dummy")))
(org-add-props result (list 'txt txt)))))
(advice-add 'org-ql-view--format-element :around #'my/org-ql-view--format-element)
```
Ideally, we would be able to reuse whatever Org does to set these properties and set what is necessary for the filtering commands that don't work (as far as I can tell it's only by effort and category).
Also potentially related to https://github.com/alphapapa/org-ql/issues/294 which mentions the missing `txt` property.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.