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

effort-minutes text property not applied to items in org-ql-blocks #468

Open
lyndhurst opened this issue Sep 18, 2024 · 1 comment
Open

Comments

@lyndhurst
Copy link

lyndhurst commented Sep 18, 2024

OS/platform

Linux (Arch based)

Emacs version and provenance

I am a Doom Emacs user.

GNU Emacs v29.4 nil
Doom core v3.0.0-pre HEAD -> master d6bc2b0f1 2024-09-02 01:10:58 -0400
Doom modules v24.10.0-pre HEAD -> master d6bc2b0f1 2024-09-02 01:10:58 -0400

Emacs command

org-agenda-filter-by-effort

Org version and provenance

Package:   org
Source:      Straight
Pinned:      f398724bd53eb6af3cf4187c864ec6f89a22ef59
Build:         grafted, HEAD -> main, replaced f398724 2024-07-17 16:11:14 +0200
Version:     9.6.15

org-ql package version and provenance

Straight, HEAD -> master, origin/master, origin/HEAD d574b60 2024-09-11 01:50:16 -0500

Actions taken

  • Add a few test tasks with an effort property set to 0:30
  • Display those tasks along with others in an org-ql-block
  • Type s e, then =, then 3

Observed results

An error is thrown, see backtrace below.

Expected results

Repeating the same process using the built-in agenda TODO view restricts the agenda to the test tasks with an effort property set to a value of 0:30. I would expect the same behavior.

Backtrace

Debugger entered--Lisp error: (args-out-of-range 0 0)
  get-text-property(0 effort-minutes nil)
  (let ((effort (get-text-property 0 'effort-minutes (org-get-at-bol 'txt)))) (funcall op (or effort (if org-agenda-sort-noeffort-is-high 32767 -1)) value))
  org-agenda-compare-effort(= 30.0)
  (and (org-agenda-compare-effort '= 30.0))
  eval((and (org-agenda-compare-effort '= 30.0)) t)
  (if (eval org-agenda-filter-form t) nil (org-agenda-filter-hide-line type))
  (let* ((tags (org-get-at-bol 'tags)) (cat (org-agenda-get-category)) (txt (or (org-get-at-bol 'txt) ""))) (if (eval org-agenda-filter-form t) nil (org-agenda-filter-hide-line type)))
  (progn (with-no-warnings (defvar tags) (defvar cat) (defvar txt)) (let* ((tags (org-get-at-bol 'tags)) (cat (org-agenda-get-category)) (txt (or (org-get-at-bol 'txt) ""))) (if (eval org-agenda-filter-form t) nil (org-agenda-filter-hide-line type))))
  (progn (progn (with-no-warnings (defvar tags) (defvar cat) (defvar txt)) (let* ((tags (org-get-at-bol 'tags)) (cat (org-agenda-get-category)) (txt (or (org-get-at-bol 'txt) ""))) (if (eval org-agenda-filter-form t) nil (org-agenda-filter-hide-line type)))))
  (if (or (org-get-at-bol 'org-hd-marker) (org-get-at-bol 'org-marker)) (progn (progn (with-no-warnings (defvar tags) (defvar cat) (defvar txt)) (let* ((tags (org-get-at-bol 'tags)) (cat (org-agenda-get-category)) (txt (or (org-get-at-bol ...) ""))) (if (eval org-agenda-filter-form t) nil (org-agenda-filter-hide-line type))))))
  (while (not (eobp)) (if (or (org-get-at-bol 'org-hd-marker) (org-get-at-bol 'org-marker)) (progn (progn (with-no-warnings (defvar tags) (defvar cat) (defvar txt)) (let* ((tags (org-get-at-bol ...)) (cat (org-agenda-get-category)) (txt (or ... ""))) (if (eval org-agenda-filter-form t) nil (org-agenda-filter-hide-line type)))))) (forward-line 1))
  (save-excursion (goto-char (point-min)) (while (not (eobp)) (if (or (org-get-at-bol 'org-hd-marker) (org-get-at-bol 'org-marker)) (progn (progn (with-no-warnings (defvar tags) (defvar cat) (defvar txt)) (let* ((tags ...) (cat ...) (txt ...)) (if (eval org-agenda-filter-form t) nil (org-agenda-filter-hide-line type)))))) (forward-line 1)))
  org-agenda-filter-apply(("+=0:30") effort)
  (let ((prompt (apply #'format (concat "Effort %c " (mapconcat #'(lambda ... ...) efforts " ")) op allowed-keys)) (eff -1)) (while (not (memq eff allowed-keys)) (message prompt) (setq eff (- (read-char-exclusive) 48))) (org-agenda-filter-show-all-effort) (setq org-agenda-effort-filter (append (list (concat (if negative "-" "+") (char-to-string op) (nth (mod (1- eff) 10) efforts))) (if keep current nil))) (org-agenda-filter-apply org-agenda-effort-filter 'effort))
  (if (eq op 95) (progn (org-agenda-filter-show-all-effort) (message "Effort filter removed")) (let ((prompt (apply #'format (concat "Effort %c " (mapconcat #'... efforts " ")) op allowed-keys)) (eff -1)) (while (not (memq eff allowed-keys)) (message prompt) (setq eff (- (read-char-exclusive) 48))) (org-agenda-filter-show-all-effort) (setq org-agenda-effort-filter (append (list (concat (if negative "-" "+") (char-to-string op) (nth (mod ... 10) efforts))) (if keep current nil))) (org-agenda-filter-apply org-agenda-effort-filter 'effort)))
  (let* ((efforts (split-string (or (cdr (assoc-string (concat org-effort-property "_ALL") org-global-properties t)) "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00"))) (allowed-keys (if (null efforts) nil (mapcar #'(lambda (n) (mod n 10)) (number-sequence 1 (length efforts))))) (keep (equal strip-or-accumulate '(16))) (negative (equal strip-or-accumulate '(4))) (current org-agenda-effort-filter) (op nil)) (while (not (memq op '(60 62 61 95))) (setq op (read-char-exclusive "Effort operator? (> = or <)     or press `_' again..."))) (if (eq op 95) (progn (org-agenda-filter-show-all-effort) (message "Effort filter removed")) (let ((prompt (apply #'format (concat "Effort %c " (mapconcat ... efforts " ")) op allowed-keys)) (eff -1)) (while (not (memq eff allowed-keys)) (message prompt) (setq eff (- (read-char-exclusive) 48))) (org-agenda-filter-show-all-effort) (setq org-agenda-effort-filter (append (list (concat (if negative "-" "+") (char-to-string op) (nth ... efforts))) (if keep current nil))) (org-agenda-filter-apply org-agenda-effort-filter 'effort))))
  org-agenda-filter-by-effort(nil)
  funcall-interactively(org-agenda-filter-by-effort nil)
  call-interactively(org-agenda-filter-by-effort nil nil)
  command-execute(org-agenda-filter-by-effort)

Etc.

I did not test seriously, but I do not get the same results with an org-ql-block, and the built-in agenda view when using s r to filter using a regex. No error is thrown, but all tasks are filtered out in the org-ql-block.

@alphapapa
Copy link
Owner

This happens because the effort-minutes text property is not applied by org-ql-view--format-element. It's simply unimplemented. I probably won't have time to get to this soon, so patches welcome.

@alphapapa alphapapa added this to the Future milestone Sep 19, 2024
@alphapapa alphapapa changed the title Filtering org-ql-block using the built-in effort filter throws an error effort-minutes text property not applied to items in org-ql-blocks Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants