Re: Org agenda -- checking for invisible tasks after filtering...

2020-02-17 Thread Bastien
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...

2020-02-17 Thread Christian Schwarzgruber
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...

2020-02-17 Thread Bastien
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...

2020-02-17 Thread Christian Schwarzgruber
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...

2020-02-16 Thread Bastien
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...

2020-02-16 Thread Christian Schwarzgruber
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...

2020-02-03 Thread Bastien
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