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

Empty groups shown when blocked entries are hidden from org-agenda #135

Open
123unix opened this issue Jan 25, 2020 · 7 comments
Open

Empty groups shown when blocked entries are hidden from org-agenda #135

123unix opened this issue Jan 25, 2020 · 7 comments

Comments

@123unix
Copy link

@123unix 123unix commented Jan 25, 2020

When using org-enforce-todo-dependencies setting to hide blocked entries from the regular org-agenda Empty groups (which otherwise would contain the blocked entries) are shown for today.

Empty groups for the following days are hidden alright, unlike the non-hiding today's empty groups.

What could be the problem?

Where does the code decide whether to display empty groups?

Note: I am using additional custom function in the org-blocker-hook for some extra blocking - could that be a problem? The hook is set before org-super-agenda is loaded though.

@123unix
Copy link
Author

@123unix 123unix commented Jan 25, 2020

OK, I can consider this a feature!

Suppose you have a single Important task for which you add a non-important subtask and have org-enforce-todo-dependencies set to t.

Then, the Important group becomes empty, but it is NOT hidden, thus reminding you that you've got something really important being blocked by some obscure stuff further down in Agenda.

Loading

@alphapapa
Copy link
Owner

@alphapapa alphapapa commented Jan 26, 2020

I don't know how org-enforce-todo-dependencies works internally. I probably won't add special support for hiding groups that appear empty when it's enabled, because it would probably add significant complexity for little benefit.

I don't know anything about org-blocker-hook.

Loading

@iliakur
Copy link

@iliakur iliakur commented Dec 24, 2020

I think I've found a simple solution. Org sets a text property org-todo-blocked to the value invisible, so we can write a predicate that checks for this using get-text-property:

(defun blocked-invisible-p (item)
         "Check if item is blocked and invisible."
         (eq (get-text-property 0 'org-todo-blocked item) 'invisible))

This doesn't seem like it's relying on super internal/obscure funtionality, should be reliable to use.

Based on the description of what you are trying to achieve, I think you can set your org-super-agenda-groups to the following (it's a simplifed version of a value I use, so it's tested):

'((:name none :discard (:pred blocked-invisible-p))
  (:auto-parent t))

Without :name none the header is shown even though the group is empty.

This all assumes the following org configuration:

(setq org-enforce-todo-dependencies t)
(setq org-agenda-dim-blocked-tasks 'invisible)

Loading

@alphapapa
Copy link
Owner

@alphapapa alphapapa commented Dec 24, 2020

@iliakur Thanks for researching that. That should make it simple to support.

Loading

@iliakur
Copy link

@iliakur iliakur commented Dec 24, 2020

@alphapapa I'd be interested in adding support for that if you could help out with development/testing setup. I've never worked with Cask before, for example, or with elisp tests for that matter 👼

Do you have thoughts for what the interface should be for this? Should it be one of those auto- predicates for example?

Loading

@alphapapa
Copy link
Owner

@alphapapa alphapapa commented Dec 24, 2020

I don't use Cask for this project anymore; I should delete the file.

You can set up a sandbox and run the tests like this:

$ make sandbox=.sandbox install-deps=t install-linters=t
$ make sandbox=.sandbox all

I don't know what the best interface would be for this. It might need to be a filter that runs on items before they are processed, enabled with an option, rather than being a selector.

Loading

@iliakur
Copy link

@iliakur iliakur commented Dec 31, 2020

Just a headsup, I won't have time for this in January, will revisit my plans for February and update things here.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants