* property matching in org-agenda-custom-commands
@ 2019-04-05 17:31 Matt Price
2019-04-05 18:39 ` Nick Dokos
2019-04-05 20:16 ` Thomas Plass
0 siblings, 2 replies; 5+ messages in thread
From: Matt Price @ 2019-04-05 17:31 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 678 bytes --]
Embarassed that I still don't really know how to use the agenda commands
after all this time :-(
I have a bunch of trees that look in part like this:
* Asisgnment 1
** Student A
:PROPERTIES:
:GRADE: 0
:END:
I would like to store a search in org-agenda-custom-commands. I generated
it initially with ~C-c a < m +GRADE="0"~. Now I have tried to store it in
org-agenda-custom-commands with this line:
("F" "Failing Students in Current Buffer Only" tags-tree "+GRADE=\"0\"")
However, this seems to choke, and the agenda is not generated. There are no
error messages in *Messages* so I'm not quite sure what's going on. Can
anyone see obvious mistakes in my syntax?
Thank you!
[-- Attachment #2: Type: text/html, Size: 1000 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: property matching in org-agenda-custom-commands
2019-04-05 17:31 property matching in org-agenda-custom-commands Matt Price
@ 2019-04-05 18:39 ` Nick Dokos
2019-04-05 20:16 ` Thomas Plass
1 sibling, 0 replies; 5+ messages in thread
From: Nick Dokos @ 2019-04-05 18:39 UTC (permalink / raw)
To: emacs-orgmode
Matt Price <moptop99@gmail.com> writes:
> Embarassed that I still don't really know how to use the agenda commands after all this time :-(
Ditto - I need to read the doc for org-agenda-custom-commands every
time I try to use it.
>
> I have a bunch of trees that look in part like this:
> * Asisgnment 1
> ** Student A
> :PROPERTIES:
> :GRADE: 0
> :END:
> I would like to store a search in org-agenda-custom-commands. I generated it initially with ~C-c a < m
> +GRADE="0"~. Now I have tried to store it in org-agenda-custom-commands with this line:
>
> ("F" "Failing Students in Current Buffer Only" tags-tree "+GRADE=\"0\"")
>
> However, this seems to choke, and the agenda is not generated. There are no error messages in *Messages*
> so I'm not quite sure what's going on. Can anyone see obvious mistakes in my syntax?
>
> Thank you!
>
This looks right and it also seems to work correctly for me.
One thing to note is the doc for tags-tree:
,----
| tags-tree Sparse tree with all tags matches in *current* file.
`----
so you need to be visiting the file.
Here's what I did:
I added it to the end of org-agenda-custom-commands with
(add-to-list 'org-agenda-custom-commands
'("F" "Failing Students in Current Buffer Only" tags-tree "+GRADE=\"0\"")
t)
then added a bunch of entries to an org file:
--8<---------------cut here---------------start------------->8---
* Asisgnment 1
** Student A
:PROPERTIES:
:GRADE: 0
:END:
** Student B
:PROPERTIES:
:GRADE: 1
:END:
** Student C
:PROPERTIES:
:GRADE: 0
:END:
** Student D
:PROPERTIES:
:GRADE: 2
:END:
** Student E
:PROPERTIES:
:GRADE: 0
:END:
** Student F
:PROPERTIES:
:GRADE: 3
:END:
--8<---------------cut here---------------end--------------->8---
Then while visiting this file, I did
C-c a F
I get a sparse tree with the headings for students A, C and E.
--
Nick
"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: property matching in org-agenda-custom-commands
2019-04-05 17:31 property matching in org-agenda-custom-commands Matt Price
2019-04-05 18:39 ` Nick Dokos
@ 2019-04-05 20:16 ` Thomas Plass
2019-04-06 1:26 ` Matt Price
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Plass @ 2019-04-05 20:16 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode
Matt,
Matt Price wrote at 13:31 on April 5, 2019:
:
: ("F" "Failing Students in Current Buffer Only" tags-tree "+GRADE=\"0\"")
:
: However, this seems to choke, and the agenda is not generated.
Works as advertised (docstring'ed?), I think. The 'tags-tree creates
a sparse tree, not an agenda. Plain 'tags does. If that's what
you're after.
("F" "Failing Students in Current Buffer Only" tags "+GRADE=\"0\"")
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: property matching in org-agenda-custom-commands
2019-04-05 20:16 ` Thomas Plass
@ 2019-04-06 1:26 ` Matt Price
2019-04-06 9:06 ` Thomas Plass
0 siblings, 1 reply; 5+ messages in thread
From: Matt Price @ 2019-04-06 1:26 UTC (permalink / raw)
To: Thomas Plass; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]
Ah, I was being pretty stupid. Thanks to both Thomas and Nick.
Is it possible to specify "current buffer only" in the definition of a
shortcut, but still produce an agenda, rather than a sparse tree? I find
the agenda in some ways easier to navigate than the sparse tree.
Also (side note) I'm having trouble using the boolean "|" in the pattern
for the property value. I thought something like one of these would work,
but I'm having some trouble with it:
+GRADE={"0"|"Fail"}
or maybe
+GRADE={0|Fail}
etc.
Thansk as always,
Matt
On Fri, Apr 5, 2019 at 4:17 PM Thomas Plass <thunk2@arcor.de> wrote:
> Matt,
>
> Matt Price wrote at 13:31 on April 5, 2019:
> :
> : ("F" "Failing Students in Current Buffer Only" tags-tree "+GRADE=\"0\"")
> :
> : However, this seems to choke, and the agenda is not generated.
>
> Works as advertised (docstring'ed?), I think. The 'tags-tree creates
> a sparse tree, not an agenda. Plain 'tags does. If that's what
> you're after.
>
> ("F" "Failing Students in Current Buffer Only" tags "+GRADE=\"0\"")
>
> Thomas
>
[-- Attachment #2: Type: text/html, Size: 1759 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: property matching in org-agenda-custom-commands
2019-04-06 1:26 ` Matt Price
@ 2019-04-06 9:06 ` Thomas Plass
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Plass @ 2019-04-06 9:06 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode, Thomas Plass
Matt,
Matt Price wrote at 21:26 on April 5, 2019:
: Is it possible to specify "current buffer only" in the definition of a shortcut, but still
: produce an agenda, rather than a sparse tree?
Agenda matching will always use 'org-agend-files, sparse tree matching
doesn't. So, you'd need to force "current buffer" (really: current
file) by fiddling und unfiddling 'org-agend-files. Kludgy.
: +GRADE={"0"|"Fail"}
The thing is that the tags matcher, used here to match PROPERTYs,
translates the "=" in the string above to Lisp `string='. You're on
the right track to use "{|}" but then it the contents of the {}
has to be a properly escaped regexp.
This works for me:
("F" "Failing Students in Current Buffer Only" tags "+GRADE={0\\|Fail}")
Overkill:
("F" "Failing Students in Current Buffer Only" tags "+GRADE={^\\(0\\|Fail\\)$}")
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-06 9:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-05 17:31 property matching in org-agenda-custom-commands Matt Price
2019-04-05 18:39 ` Nick Dokos
2019-04-05 20:16 ` Thomas Plass
2019-04-06 1:26 ` Matt Price
2019-04-06 9:06 ` Thomas Plass
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).