unofficial mirror of emacs-orgmode@gnu.org
 help / color / Atom feed
* tags-todo org-agenda-custom-command weirdness
@ 2020-06-13 14:40 Stig Brautaset
  2020-06-13 16:19 ` Stig Brautaset
  2020-06-15  3:16 ` Kyle Meyer
  0 siblings, 2 replies; 6+ messages in thread
From: Stig Brautaset @ 2020-06-13 14:40 UTC (permalink / raw)
  To: emacs-orgmode


Hi,

I'm seeing some weirdness with tags-todo vs tags custom agenda commands.
Below is the smallest case I've managed to narrow it down to. I would
*expect* that all the a1-4 commands return the same results, and that
the b1-4 return the same results. That is not what I'm seeing, however.

(setq-default org-agenda-custom-commands
	      '(("a1" "A1" tags-todo "-PROJ/TODO")
                ("a2" "A2" tags "-PROJ/TODO")
		("a3" "A3" ((tags-todo "-PROJ/TODO")))
		("a4" "A4" ((tags "-PROJ/TODO")))
		
		("b1" "B1" tags-todo "-PROJ/DONE")
		("b2" "B2" tags "-PROJ/DONE")
		("b3" "B3" ((tags-todo "-PROJ/DONE")))
		("b4" "B4" ((tags "-PROJ/DONE")))))


The effect of a1 & a2 appears identical to eachother, and a3 & a4 too,
but a1-2 and a3-4 differ (in that the former seems to include scheduled
items, but the latter does not.)

What I'm seeing for b1-4 is even weirder. Here I observe b1, b2 and b4
have identical behaviour[*], but b3 is the odd one out: while the other
three return a list of DONE non-project tasks, b3 doesn't find anything.

[*] I suspect the reason b2 and b4 are identical is that I have no
scheduled DONE tasks.

I also see this with =m= vs =M= in the org-agenda menu. I see it even
when starting emacs with -q, so it appears to not be some spectactular
breakage on my part. Is anyone else seing this?


Stig


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: tags-todo org-agenda-custom-command weirdness
  2020-06-13 14:40 tags-todo org-agenda-custom-command weirdness Stig Brautaset
@ 2020-06-13 16:19 ` Stig Brautaset
  2020-06-15  3:16 ` Kyle Meyer
  1 sibling, 0 replies; 6+ messages in thread
From: Stig Brautaset @ 2020-06-13 16:19 UTC (permalink / raw)
  To: emacs-orgmode

Stig Brautaset <stig@brautaset.org> writes:

> Hi,
>
> I'm seeing some weirdness with tags-todo vs tags custom agenda commands.

I forgot to mention my Emacs / Org versions:

- GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.4.0, NS appkit-1894.40 Version 10.15.4 (Build 19E287)) of 2020-04-18
- Org mode version 9.3.7 (9.3.7-2-g706970-elpaplus @ /Users/stig/.emacs.d/elpa/org-plus-contrib-20200608/)

Stig


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: tags-todo org-agenda-custom-command weirdness
  2020-06-13 14:40 tags-todo org-agenda-custom-command weirdness Stig Brautaset
  2020-06-13 16:19 ` Stig Brautaset
@ 2020-06-15  3:16 ` Kyle Meyer
  2020-06-15 18:52   ` Stig Brautaset
  1 sibling, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2020-06-15  3:16 UTC (permalink / raw)
  To: Stig Brautaset; +Cc: emacs-orgmode

Stig Brautaset writes:

> I'm seeing some weirdness with tags-todo vs tags custom agenda commands.
> Below is the smallest case I've managed to narrow it down to. I would
> *expect* that all the a1-4 commands return the same results, and that
> the b1-4 return the same results. That is not what I'm seeing, however.
>
> (setq-default org-agenda-custom-commands
>             '(("a1" "A1" tags-todo "-PROJ/TODO")
>               ("a2" "A2" tags "-PROJ/TODO")
>               ("a3" "A3" ((tags-todo "-PROJ/TODO")))
>               ("a4" "A4" ((tags "-PROJ/TODO")))
>               
>               ("b1" "B1" tags-todo "-PROJ/DONE")
>               ("b2" "B2" tags "-PROJ/DONE")
>               ("b3" "B3" ((tags-todo "-PROJ/DONE")))
>               ("b4" "B4" ((tags "-PROJ/DONE")))))
>

I agree with your expectation that a1-4 should be the same.  Why do you
expect that b1-4 would be?  Shouldn't tags-todo consider only none-DONE
todo items, in the same spirit as m versus M?  In other words, I'd
expect b1 and b3 to be empty by definition.

> The effect of a1 & a2 appears identical to eachother, and a3 & a4 too,
> but a1-2 and a3-4 differ (in that the former seems to include scheduled
> items, but the latter does not.)

It's helpful if you provide a minimal test file.  I've tried to come up
with one that I think should capture what you're describing.

--8<---------------cut here---------------start------------->8---
* TODO h1                                                               :PROJ:
* TODO h2
* DONE h3                                                               :PROJ:
* DONE h4
* TODO h5                                                               :PROJ:
SCHEDULED: <2020-06-14 Sun>
* TODO h6
SCHEDULED: <2020-06-14 Sun>
* DONE h7                                                               :PROJ:
SCHEDULED: <2020-06-14 Sun>
* DONE h8
SCHEDULED: <2020-06-14 Sun>
--8<---------------cut here---------------end--------------->8---

With that, a1-4 all show:

    scratch:    TODO h2
    scratch:    TODO h6

That doesn't match what you're seeing.  I'm testing with 706970 checked
out, the commit you reported in your follow-up message.

> What I'm seeing for b1-4 is even weirder. Here I observe b1, b2 and b4
> have identical behaviour[*], but b3 is the odd one out: while the other
> three return a list of DONE non-project tasks, b3 doesn't find anything.
>
> [*] I suspect the reason b2 and b4 are identical is that I have no
> scheduled DONE tasks.

For b2 and b4, I see

    scratch:    DONE h4
    scratch:    DONE h8

b1 and b3 are empty, which I think is expected given the tags-todo type.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: tags-todo org-agenda-custom-command weirdness
  2020-06-15  3:16 ` Kyle Meyer
@ 2020-06-15 18:52   ` Stig Brautaset
  2020-06-16  5:11     ` Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Stig Brautaset @ 2020-06-15 18:52 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> writes:

> Stig Brautaset writes:
>
>> I'm seeing some weirdness with tags-todo vs tags custom agenda commands.
>> Below is the smallest case I've managed to narrow it down to. I would
>> *expect* that all the a1-4 commands return the same results, and that
>> the b1-4 return the same results. That is not what I'm seeing, however.
>>
>> (setq-default org-agenda-custom-commands
>>             '(("a1" "A1" tags-todo "-PROJ/TODO")
>>               ("a2" "A2" tags "-PROJ/TODO")
>>               ("a3" "A3" ((tags-todo "-PROJ/TODO")))
>>               ("a4" "A4" ((tags "-PROJ/TODO")))
>>               
>>               ("b1" "B1" tags-todo "-PROJ/DONE")
>>               ("b2" "B2" tags "-PROJ/DONE")
>>               ("b3" "B3" ((tags-todo "-PROJ/DONE")))
>>               ("b4" "B4" ((tags "-PROJ/DONE")))))
>>
>
> I agree with your expectation that a1-4 should be the same.  Why do you
> expect that b1-4 would be?  Shouldn't tags-todo consider only none-DONE
> todo items, in the same spirit as m versus M?  In other words, I'd
> expect b1 and b3 to be empty by definition.

I expected b1-4 to all yield the same result because I expect
`tags-todo` to search all TODO-items, not just TODO items where the
state is "TODO".


>> The effect of a1 & a2 appears identical to eachother, and a3 & a4 too,
>> but a1-2 and a3-4 differ (in that the former seems to include scheduled
>> items, but the latter does not.)
>
> It's helpful if you provide a minimal test file.  I've tried to come up
> with one that I think should capture what you're describing.

Mea culpa, I should have done this. 

>
> --8<---------------cut here---------------start------------->8---
> * TODO h1                                                               :PROJ:
> * TODO h2
> * DONE h3                                                               :PROJ:
> * DONE h4
> * TODO h5                                                               :PROJ:
> SCHEDULED: <2020-06-14 Sun>
> * TODO h6
> SCHEDULED: <2020-06-14 Sun>
> * DONE h7                                                               :PROJ:
> SCHEDULED: <2020-06-14 Sun>
> * DONE h8
> SCHEDULED: <2020-06-14 Sun>
> --8<---------------cut here---------------end--------------->8---
>
> With that, a1-4 all show:
>
>     scratch:    TODO h2
>     scratch:    TODO h6
>
> That doesn't match what you're seeing.  I'm testing with 706970 checked
> out, the commit you reported in your follow-up message.

For me a2 and a4 returns the same, but a1 and a3 just returns TODO h2.
However, I can reproduce what you're seeing by setting this:

(setq org-agenda-todo-ignore-scheduled nil)


>> What I'm seeing for b1-4 is even weirder. Here I observe b1, b2 and b4
>> have identical behaviour[*], but b3 is the odd one out: while the other
>> three return a list of DONE non-project tasks, b3 doesn't find anything.
>>
>> [*] I suspect the reason b2 and b4 are identical is that I have no
>> scheduled DONE tasks.
>
> For b2 and b4, I see
>
>     scratch:    DONE h4
>     scratch:    DONE h8
>
> b1 and b3 are empty, which I think is expected given the tags-todo type.

Well, I disagree :-)

This behaviour of `tags-todo` seems inconsistent to me. If `todo` can
find DONE items, why shouldn't `tags-todo` do the same?

Stig


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: tags-todo org-agenda-custom-command weirdness
  2020-06-15 18:52   ` Stig Brautaset
@ 2020-06-16  5:11     ` Kyle Meyer
  2020-06-16  8:31       ` Stig Brautaset
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2020-06-16  5:11 UTC (permalink / raw)
  To: Stig Brautaset; +Cc: emacs-orgmode

Stig Brautaset writes:

> For me a2 and a4 returns the same, but a1 and a3 just returns TODO h2.
> However, I can reproduce what you're seeing by setting this:
>
> (setq org-agenda-todo-ignore-scheduled nil)

So, provided you've configured org-agenda-todo-ignore-scheduled and
org-agenda-tags-todo-honor-ignore-options away from their default values
of nil, the a1-4 behavior you described is as advertised, correct?

>> b1 and b3 are empty, which I think is expected given the tags-todo type.
>
> Well, I disagree :-)
>
> This behaviour of `tags-todo` seems inconsistent to me. If `todo` can
> find DONE items, why shouldn't `tags-todo` do the same?

Perhaps it should.  The behavior has been that way for a long time, and
the code makes it look very deliberate.  That of course is not an
argument that it should be that way, just one basis for expectations
(and a reason to be wary of breaking workflows).

And it looks like it was actually supposed to change to your preference
in 2017.  There was a report [0] that essentially boils down to what
you're saying, I think.  In response, 942b6267a (org-agenda: `tags-todo'
command type includes DONE keywords, 2017-04-18) was applied, but then
reverted for reasons not related to the intended change in behavior [1].

There was then a follow-up in 2fb129b5c (`org-scan-tags' retrieve all
TODO keywords, not only not-done ones, 2017-08-17).  As far as I can
tell, that was supposed to achieve the behavior you're after but didn't.
I don't have time to dig much at the moment, but quickly stepping
through org-scan-tags, I think the issue is that the MATCHER argument
still filters out done states.


[0] https://orgmode.org/list/CAF96XX0XxhPKjAxy0dQmOiy3rnT+DUok4p1y71F1AwyJaNL-MA@mail.gmail.com/
[1] https://orgmode.org/list/874lt89fi2.fsf@free.fr/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: tags-todo org-agenda-custom-command weirdness
  2020-06-16  5:11     ` Kyle Meyer
@ 2020-06-16  8:31       ` Stig Brautaset
  0 siblings, 0 replies; 6+ messages in thread
From: Stig Brautaset @ 2020-06-16  8:31 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> writes:

> Stig Brautaset writes:
>
>> For me a2 and a4 returns the same, but a1 and a3 just returns TODO h2.
>> However, I can reproduce what you're seeing by setting this:
>>
>> (setq org-agenda-todo-ignore-scheduled nil)
>
> So, provided you've configured org-agenda-todo-ignore-scheduled and
> org-agenda-tags-todo-honor-ignore-options away from their default values
> of nil, the a1-4 behavior you described is as advertised, correct?

I'm not sure. I would have expected that my configured values of
org-agenda-todo-ignore-scheduled and
org-agenda-tags-todo-honor-ignore-options would apply for all a1-4, so
whatever I configure those to the result of a1-4 should be consistent.
It looks like `tags-todo` takes my configured values into account, but
`tags` does not.

>>> b1 and b3 are empty, which I think is expected given the tags-todo type.
>>
>> Well, I disagree :-)
>>
>> This behaviour of `tags-todo` seems inconsistent to me. If `todo` can
>> find DONE items, why shouldn't `tags-todo` do the same?
>
> Perhaps it should.  The behavior has been that way for a long time, and
> the code makes it look very deliberate.  That of course is not an
> argument that it should be that way, just one basis for expectations
> (and a reason to be wary of breaking workflows).
>
> And it looks like it was actually supposed to change to your preference
> in 2017.  There was a report [0] that essentially boils down to what
> you're saying, I think.  In response, 942b6267a (org-agenda: `tags-todo'
> command type includes DONE keywords, 2017-04-18) was applied, but then
> reverted for reasons not related to the intended change in behavior [1].
>
> There was then a follow-up in 2fb129b5c (`org-scan-tags' retrieve all
> TODO keywords, not only not-done ones, 2017-08-17).  As far as I can
> tell, that was supposed to achieve the behavior you're after but didn't.
> I don't have time to dig much at the moment, but quickly stepping
> through org-scan-tags, I think the issue is that the MATCHER argument
> still filters out done states.
>
>
> [0] https://orgmode.org/list/CAF96XX0XxhPKjAxy0dQmOiy3rnT+DUok4p1y71F1AwyJaNL-MA@mail.gmail.com/
> [1] https://orgmode.org/list/874lt89fi2.fsf@free.fr/

Thank you for looking into this. I'm going to try to come up with some
tests for the behaviour, and with the help of your references see if I
can get those tests to pass.

Stig


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 14:40 tags-todo org-agenda-custom-command weirdness Stig Brautaset
2020-06-13 16:19 ` Stig Brautaset
2020-06-15  3:16 ` Kyle Meyer
2020-06-15 18:52   ` Stig Brautaset
2020-06-16  5:11     ` Kyle Meyer
2020-06-16  8:31       ` Stig Brautaset

unofficial mirror of emacs-orgmode@gnu.org

Archives are clonable:
	git clone --mirror https://yhetil.org/orgmode/0 orgmode/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 orgmode orgmode/ https://yhetil.org/orgmode \
		emacs-orgmode@gnu.org
	public-inbox-index orgmode

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git