Re: Org agenda -- checking for invisible tasks after filtering...
Hi Christian, thanks for testing. Christian Schwarzgruber writes: > thanks for that change. But unfortunate this one doesn't work for the > org-agenda-filter-by-* functions. However, it would work for all > org-agenda-filter* functions, if the hook would be called at the end of > `org-agenda-filter-apply`. But I can see what than would happen, the hook > would be called several times when more filter types are set. The added hook is not intrusive and useful, outside the needs related to your patch to org-super-agenda. Adding a hook to a function that is called many times is calling for problems, I don't want to go that way. > A other option would be the call the hook at the end of all the > org-agenda-filter* functions, perhaps. Not sure what you mean (patch welcome just to understand). But again I think we don't need more hooks. Maybe you can explore using post-command-hook in org-super-agenda-mode in a way that checks whether the last command was a filter command and then act from there? Just an idea, not sure it is correct. Best, -- Bastien
Re: Org agenda -- checking for invisible tasks after filtering...
Hi Bestian, Bastien writes: > Yes, this one makes sense, I've added `org-agenda-filter-hook' for > functions that you need to run right after `org-agenda-filter' has > been called. thanks for that change. But unfortunate this one doesn't work for the org-agenda-filter-by-* functions. However, it would work for all org-agenda-filter* functions, if the hook would be called at the end of `org-agenda-filter-apply`. But I can see what than would happen, the hook would be called several times when more filter types are set. A other option would be the call the hook at the end of all the org-agenda-filter* functions, perhaps. -Christian
Re: Org agenda -- checking for invisible tasks after filtering...
Hi Christian, Christian Schwarzgruber writes: > or perhaps add a new hook `org-agenda-filter(-(apply|after))?-hook`? Yes, this one makes sense, I've added `org-agenda-filter-hook' for functions that you need to run right after `org-agenda-filter' has been called. Thanks for the suggestion! Best, -- Bastien
Re: Org agenda -- checking for invisible tasks after filtering...
Hi Bastien, thank you! That would reduce it to one advice. However, I would still need to advice the function org-agenda-filter-apply since it doesn't call `org-agenda-finalize`. Would it make sense to call the hook org-agenda-finalize-hook at the and of org-agenda-filter-apply or perhaps add a new hook `org-agenda-filter(-(apply|after))?-hook`? Calling org-agenda-finalize at the end of org-agenda-filter-apply wont work, because org-agenda-finalize calls org-agenda-filter-apply, and hence, would result in an infinite recursion. org-agenda-filter-remove-all and org-agenda-remove-filter do call org-agenda-finalize, so this way works. Thanks Bastien Bastien writes: > Hi Christian, > > you might want to have a look at org-agenda-finalize-hook, though I'm > not sure it can help, I'm not familiar with org-super-agenda enough. > > HTH,
Re: Org agenda -- checking for invisible tasks after filtering...
Hi Christian, you might want to have a look at org-agenda-finalize-hook, though I'm not sure it can help, I'm not familiar with org-super-agenda enough. HTH, -- Bastien
Re: Org agenda -- checking for invisible tasks after filtering...
Hi Bastien, Bastien writes: > Christian Schwarzgruber writes: > >> The question is now, is it possible to further reduce the advised >> functions to just one advised function. > > I am sorry, I don't understand what change does it imply on Org's > side. Can you explain us a bit more? Nothing need to be changed on Org's side (I guess). I'm just wondering if there is a single spot where I can hook in (advice) to achieve the same as with the currently two advice I use. The project org-super-agenda advices `org-agenda-finalize-entries` and groups the entries. However, when one uses the org filter functionality some groups might be empty, which looks ugly. My implementation to handle that case is to advice the following functions `org-agenda-filter-apply` and `org-agenda-finalize`. Both will call the same function `org-super-agenda--hide-or-show-groups`. If all tasks inside a group have the invisible property set the group gets hidden as well, and vica versa. The author of `org-super-agenda` doesn't like my implementation which uses two advice. But I couldn't find a single spot where I can hook in, and check if all tasks are hidden... Thanks! Christian
Re: Org agenda -- checking for invisible tasks after filtering...
Hi Christian, Christian Schwarzgruber writes: > The question is now, is it possible to further reduce the advised > functions to just one advised function. I am sorry, I don't understand what change does it imply on Org's side. Can you explain us a bit more? Thanks! -- Bastien
Org agenda -- checking for invisible tasks after filtering...
Hey! I'm a contributor of `org-super-agenda` https://github.com/alphapapa/org-super-agenda, `org-super-agenda` lets you group tasks into blocks. However, `org-super-agenda` doesn't consider filtering, which might leave you with empty groups. To solve that, I created a PR (https://github.com/alphapapa/org-super-agenda/pull/77) which advices `org-agenda-filter-apply` and `org-agenda-finalize` (https://github.com/alphapapa/org-super-agenda/pull/77/files#diff-465f82cd8ad2c42f0cebb190be6f58abR305). Both are calling the same function `org-super-agenda--hide-or-show-groups` (https://github.com/alphapapa/org-super-agenda/pull/77/files#diff-465f82cd8ad2c42f0cebb190be6f58abR1114). In that function I check for the property `'invisible`. If all tasks in a group are invisible the group gets hidden too. The question is now, is it possible to further reduce the advised functions to just one advised function. best, Christian