emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Possible to get a subtree agenda view?
@ 2008-12-13 18:05 Robert Goldman
  2008-12-13 21:29 ` Matthew Lundin
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Goldman @ 2008-12-13 18:05 UTC (permalink / raw)
  To: emacs-orgmode

I have a @car category that I use to keep track of things I might want
to do when out in the car.  Getting the agenda view *almost* works for
this.  But often an item here indicates that I should visit some store,
and underneath the item is a list of things to purchase.  The agenda
view, of course, suppresses that list.  This means that printing out (or
pushing to my palm) the agenda view isn't really what I want.  I'd
really like to have the subtree below the matching items (because I know
the subtree is always trivial).

I *think* I should be able to do this with a custom agenda command,
using sparse trees, but I'm having a couple of problems figuring this out:

1.  I don't really want a sparse tree, because I don't want anything
"upstream" of the selected items.

2.  I want to force the matches to be expanded.

3.  I want to match on a tag (@car) *and* on a TODO tag "TODO".  I may
be missing something, but I don't see any obvious conjunctive matching
command in the sparse tree or agenda codes.

Is there any existing way to do this, or should I start rooting around
in the code?

thanks!
Robert

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

* Re: Possible to get a subtree agenda view?
  2008-12-13 18:05 Possible to get a subtree agenda view? Robert Goldman
@ 2008-12-13 21:29 ` Matthew Lundin
  2008-12-13 22:35   ` Possible to get a subtree agenda view? --- possible bug? Robert Goldman
  2008-12-13 23:43   ` Possible to get a subtree agenda view? Robert Goldman
  0 siblings, 2 replies; 11+ messages in thread
From: Matthew Lundin @ 2008-12-13 21:29 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode


Hi Robert,

Robert Goldman <rpgoldman@sift.info> writes:

> I have a @car category that I use to keep track of things I might want
> to do when out in the car.  Getting the agenda view *almost* works for
> this.  But often an item here indicates that I should visit some store,
> and underneath the item is a list of things to purchase.  The agenda
> view, of course, suppresses that list.  This means that printing out (or
> pushing to my palm) the agenda view isn't really what I want.  I'd
> really like to have the subtree below the matching items (because I know
> the subtree is always trivial).
>
> I *think* I should be able to do this with a custom agenda command,
> using sparse trees, but I'm having a couple of problems figuring this out:
>
> 1.  I don't really want a sparse tree, because I don't want anything
> "upstream" of the selected items.

See the variable org-show-hierarchy-above.

>
> 2.  I want to force the matches to be expanded.

See the variable org-show-entry-below.

>
> 3.  I want to match on a tag (@car) *and* on a TODO tag "TODO".  I may
> be missing something, but I don't see any obvious conjunctive matching
> command in the sparse tree or agenda codes.

C-c / T +@car+TODO="TODO"

>
> Is there any existing way to do this, or should I start rooting around
> in the code?

For a custom agenda command:

(setq org-agenda-custom-commands
      '(("f" tags-tree "+car+TODO=\"TODO\""
	 ((org-show-entry-below t)
	  (org-show-hierarchy-above nil)))
          ;; other commands
        ))
        
I believe all of this is in the manual of the most recent version of
org.

Regards,
Matt

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

* Re: Possible to get a subtree agenda view? --- possible bug?
  2008-12-13 21:29 ` Matthew Lundin
@ 2008-12-13 22:35   ` Robert Goldman
  2008-12-14  5:34     ` Matthew Lundin
  2008-12-13 23:43   ` Possible to get a subtree agenda view? Robert Goldman
  1 sibling, 1 reply; 11+ messages in thread
From: Robert Goldman @ 2008-12-13 22:35 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode

Matthew Lundin wrote:
> Hi Robert,
> 
....
> 
>> Is there any existing way to do this, or should I start rooting around
>> in the code?
> 
> For a custom agenda command:
> 
> (setq org-agenda-custom-commands
>       '(("f" tags-tree "+car+TODO=\"TODO\""
> 	 ((org-show-entry-below t)
> 	  (org-show-hierarchy-above nil)))
>           ;; other commands
>         ))
>         

Actually, I just tried this with a recent git pull, and when I try to
execute it, it crashes, with the following error:

Debugger entered--Lisp error: (error "Cannot execute org-mode agenda
command on buffer in org-agenda-mode.")
  signal(error ("Cannot execute org-mode agenda command on buffer in
org-agenda-mode."))
  ad-Orig-error("Cannot execute org-mode agenda command on buffer in
%s." org-agenda-mode)
  apply(ad-Orig-error ("Cannot execute org-mode agenda command on buffer
in %s." org-agenda-mode))
  error("Cannot execute org-mode agenda command on buffer in %s."
org-agenda-mode)
  org-check-for-org-mode()
  byte-code(...)
  org-agenda(nil)
  call-interactively(org-agenda)

Looks like something's being called here that is only callable in
org-mode, not org-agenda-mode.

Indeed, looking at org-agenda, I see:

	       ((eq type 'tags-tree)
		(org-check-for-org-mode)
		(org-let lprops '(org-tags-sparse-tree current-prefix-arg match)))

Aren't we always in org-agenda-mode at this point?

I tried moving to a different buffer (in emacs-lisp mode) to invoke the
same command, thinking it might be a problem specifically with invoking
this custom agenda from inside org-agenda-mode, but then got the same
error with emacs-lisp-mode instead of org-agenda-mode

I have just this moment pulled an update from git, so I think this bug
is current (unless it's some weird misconfiguration on my part).

R

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

* Re: Possible to get a subtree agenda view?
  2008-12-13 21:29 ` Matthew Lundin
  2008-12-13 22:35   ` Possible to get a subtree agenda view? --- possible bug? Robert Goldman
@ 2008-12-13 23:43   ` Robert Goldman
  2008-12-14 13:46     ` Matthew Lundin
  1 sibling, 1 reply; 11+ messages in thread
From: Robert Goldman @ 2008-12-13 23:43 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode

Matthew Lundin wrote:
> Hi Robert,
> 
> Robert Goldman <rpgoldman@sift.info> writes:
> 
>> I have a @car category that I use to keep track of things I might want
>> to do when out in the car.  Getting the agenda view *almost* works for
>> this.  But often an item here indicates that I should visit some store,
>> and underneath the item is a list of things to purchase.  The agenda
>> view, of course, suppresses that list.  This means that printing out (or
>> pushing to my palm) the agenda view isn't really what I want.  I'd
>> really like to have the subtree below the matching items (because I know
>> the subtree is always trivial).
>>
>> I *think* I should be able to do this with a custom agenda command,
>> using sparse trees, but I'm having a couple of problems figuring this out:
>>
>> 1.  I don't really want a sparse tree, because I don't want anything
>> "upstream" of the selected items.
> 
> See the variable org-show-hierarchy-above.
> 
>> 2.  I want to force the matches to be expanded.
> 
> See the variable org-show-entry-below.
> 
>> 3.  I want to match on a tag (@car) *and* on a TODO tag "TODO".  I may
>> be missing something, but I don't see any obvious conjunctive matching
>> command in the sparse tree or agenda codes.
> 
> C-c / T +@car+TODO="TODO"
> 
>> Is there any existing way to do this, or should I start rooting around
>> in the code?
> 
> For a custom agenda command:
> 
> (setq org-agenda-custom-commands
>       '(("f" tags-tree "+car+TODO=\"TODO\""
> 	 ((org-show-entry-below t)
> 	  (org-show-hierarchy-above nil)))
>           ;; other commands
>         ))
>         
> I believe all of this is in the manual of the most recent version of
> org.

Thank you very much for the tutorial Matt.  Yes, it's all there, now
that you pointed me in the right direction, but it's scattered hither
and yon and I simply wasn't able to pull all the pieces together without
some hand-holding.

In particular, the variable settings weren't near the agenda discussion,
and are not in the index.  Question:  would it be useful to add a
variable index to the info file?  If it is, and there isn't someone more
texinfo competent than me to do it, I'll look into seeing how hard it
would be to do this.

Also, in the manual and code there's no real discussion of how the
settings part of the org-agenda-custom-commands is to be used.  I mean,
it's clear that they are variable bindings, but there's no use case.

Would it be reasonable to modify your example above into an example to
be added to the texinfo file?  I would be happy to have a whack if this
seems like a good idea.

best,
R

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

* Re: Possible to get a subtree agenda view? --- possible bug?
  2008-12-13 22:35   ` Possible to get a subtree agenda view? --- possible bug? Robert Goldman
@ 2008-12-14  5:34     ` Matthew Lundin
  2008-12-14 19:43       ` Robert Goldman
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Lundin @ 2008-12-14  5:34 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode


Hi Robert,

Robert Goldman <rpgoldman@sift.info> writes:

> Matthew Lundin wrote:
>> Hi Robert,
>> 
> ....
>> 
>>> Is there any existing way to do this, or should I start rooting around
>>> in the code?
>> 
>> For a custom agenda command:
>> 
>> (setq org-agenda-custom-commands
>>       '(("f" tags-tree "+car+TODO=\"TODO\""
>> 	 ((org-show-entry-below t)
>> 	  (org-show-hierarchy-above nil)))
>>           ;; other commands
>>         ))
>>         
>
> Actually, I just tried this with a recent git pull, and when I try to
> execute it, it crashes, with the following error:

Sorry if I forgot to mention it in my first post, but I believe this
custom command only works when the agenda is called from within an org
buffer. As far as I understand it, since the tags tree command creates
a sparse tree within an org buffer, it needs a particular org buffer
to work with. 

Someone else please correct me if I'm wrong.

Re: the manual. I only mentioned it because I've found it to be such a
comprehensive and helpful source of information and I like to "spread
the word" about how good it is.

Best,

Matt

>
> Debugger entered--Lisp error: (error "Cannot execute org-mode agenda
> command on buffer in org-agenda-mode.")
>   signal(error ("Cannot execute org-mode agenda command on buffer in
> org-agenda-mode."))
>   ad-Orig-error("Cannot execute org-mode agenda command on buffer in
> %s." org-agenda-mode)
>   apply(ad-Orig-error ("Cannot execute org-mode agenda command on buffer
> in %s." org-agenda-mode))
>   error("Cannot execute org-mode agenda command on buffer in %s."
> org-agenda-mode)
>   org-check-for-org-mode()
>   byte-code(...)
>   org-agenda(nil)
>   call-interactively(org-agenda)
>
> Looks like something's being called here that is only callable in
> org-mode, not org-agenda-mode.
>
> Indeed, looking at org-agenda, I see:
>
> 	       ((eq type 'tags-tree)
> 		(org-check-for-org-mode)
> 		(org-let lprops '(org-tags-sparse-tree current-prefix-arg match)))
>
> Aren't we always in org-agenda-mode at this point?
>
> I tried moving to a different buffer (in emacs-lisp mode) to invoke the
> same command, thinking it might be a problem specifically with invoking
> this custom agenda from inside org-agenda-mode, but then got the same
> error with emacs-lisp-mode instead of org-agenda-mode
>
> I have just this moment pulled an update from git, so I think this bug
> is current (unless it's some weird misconfiguration on my part).
>
> R

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

* Re: Possible to get a subtree agenda view?
  2008-12-13 23:43   ` Possible to get a subtree agenda view? Robert Goldman
@ 2008-12-14 13:46     ` Matthew Lundin
  2008-12-14 19:14       ` Robert Goldman
  2008-12-15 10:50       ` Carsten Dominik
  0 siblings, 2 replies; 11+ messages in thread
From: Matthew Lundin @ 2008-12-14 13:46 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode


Hi Robert,

Robert Goldman <rpgoldman@sift.info> writes:

> Matthew Lundin wrote:
>> 
[snip]
>>
>> For a custom agenda command:
>> 
>> (setq org-agenda-custom-commands
>>       '(("f" tags-tree "+car+TODO=\"TODO\""
>> 	 ((org-show-entry-below t)
>> 	  (org-show-hierarchy-above nil)))
>>           ;; other commands
>>         ))
>>
[snip]
>
> In particular, the variable settings weren't near the agenda discussion,
> and are not in the index.  Question:  would it be useful to add a
> variable index to the info file?  If it is, and there isn't someone more
> texinfo competent than me to do it, I'll look into seeing how hard it
> would be to do this.
>
> Also, in the manual and code there's no real discussion of how the
> settings part of the org-agenda-custom-commands is to be used.  I mean,
> it's clear that they are variable bindings, but there's no use case.
>
> Would it be reasonable to modify your example above into an example to
> be added to the texinfo file?  I would be happy to have a whack if this
> seems like a good idea.

I'm guessing the best place for such a tutorial would be Worg (the
org-mode wiki). http://orgmode.org/worg/

When I have a chance, I'll put together a basic tutorial on agenda
custom commands and put it up on Worg. Then others will be free to
correct my mistakes. :)

Best,

Matt

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

* Re: Possible to get a subtree agenda view?
  2008-12-14 13:46     ` Matthew Lundin
@ 2008-12-14 19:14       ` Robert Goldman
  2008-12-15  3:07         ` Matthew Lundin
  2008-12-15 10:50       ` Carsten Dominik
  1 sibling, 1 reply; 11+ messages in thread
From: Robert Goldman @ 2008-12-14 19:14 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode

Matthew Lundin wrote:
> Hi Robert,
> 
> Robert Goldman <rpgoldman@sift.info> writes:
> 
>> Matthew Lundin wrote:
> [snip]
>>> For a custom agenda command:
>>>
>>> (setq org-agenda-custom-commands
>>>       '(("f" tags-tree "+car+TODO=\"TODO\""
>>> 	 ((org-show-entry-below t)
>>> 	  (org-show-hierarchy-above nil)))
>>>           ;; other commands
>>>         ))
>>>
> [snip]
>> In particular, the variable settings weren't near the agenda discussion,
>> and are not in the index.  Question:  would it be useful to add a
>> variable index to the info file?  If it is, and there isn't someone more
>> texinfo competent than me to do it, I'll look into seeing how hard it
>> would be to do this.
>>
>> Also, in the manual and code there's no real discussion of how the
>> settings part of the org-agenda-custom-commands is to be used.  I mean,
>> it's clear that they are variable bindings, but there's no use case.
>>
>> Would it be reasonable to modify your example above into an example to
>> be added to the texinfo file?  I would be happy to have a whack if this
>> seems like a good idea.
> 
> I'm guessing the best place for such a tutorial would be Worg (the
> org-mode wiki). http://orgmode.org/worg/

I think it would be appropriate to have a tutorial like this in Worg,
but not a replacement.  If you look at the custom agenda commands
discussion in the manual, you will see that there is a discussion of how
most of the fields of custom command s-expression are to be used, but no
mention of the settings.  I was just arguing that modifying the example
in the manual (or, possibly adding material from your example to it)
would be useful.

As an aside, I found the doc string somewhat confusing, as well.  The
docstring says

"settings  A list of option settings, similar to that in a let form, so like
          this: ((opt1 val1) (opt2 val2) ...).   The values will be
          evaluated at the moment of execution, so quote them when
needed." [apologies --- Thunderbird will no doubt make a hash of this]

I don't believe that there is any special notion of "option settings"
that this should be --- isn't this just a command that can be used to
bind arbitrary variables?

I will try to write up a proposed documentation patch and post it to the
list.  Probably easier at this point to do that than to try to describe
what I /would/ do!

Best,
Robert

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

* Re: Possible to get a subtree agenda view? --- possible bug?
  2008-12-14  5:34     ` Matthew Lundin
@ 2008-12-14 19:43       ` Robert Goldman
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Goldman @ 2008-12-14 19:43 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode

Matthew Lundin wrote:
> Hi Robert,
> 
> Robert Goldman <rpgoldman@sift.info> writes:
> 
>> Matthew Lundin wrote:
>>> Hi Robert,
>>>
>> ....
>>>> Is there any existing way to do this, or should I start rooting around
>>>> in the code?
>>> For a custom agenda command:
>>>
>>> (setq org-agenda-custom-commands
>>>       '(("f" tags-tree "+car+TODO=\"TODO\""
>>> 	 ((org-show-entry-below t)
>>> 	  (org-show-hierarchy-above nil)))
>>>           ;; other commands
>>>         ))
>>>         
>> Actually, I just tried this with a recent git pull, and when I try to
>> execute it, it crashes, with the following error:
> 
> Sorry if I forgot to mention it in my first post, but I believe this
> custom command only works when the agenda is called from within an org
> buffer. As far as I understand it, since the tags tree command creates
> a sparse tree within an org buffer, it needs a particular org buffer
> to work with. 

If that is the case, isn't it incorrect to offer "tags-tree" as one of
the org-agenda custom commands?  Since it can't be safely invoked as
part of org-agenda?

One suggested possible solution:  Change tags-tree argument to (tags
tree <filename>), then do some kind of with-excursion to get into the
buffer for <filename> (in org mode).  But here we're running up against
my limited understanding of the tags tree.  Is tags-tree even really an
agenda command?  I.e., does it build a new agenda buffer that we can
use, or is it a way of viewing the current buffer?  I think the latter.
 If that is correct, it suggests ....

Alternate solution:  remove tags-tree from the set of org-agenda
commands.  tags-tree isn't really an agenda-building command, and should
not be treated as one.

Note also that this means that this doesn't work as a solution to my
problem, because it requires all of the car category items to appear in
a single org file, and ignores the org-agenda-files setting.  So, for
example, I can't have work-related in-car tasks in one org file and
personal chores that are in-car tasks in another.  :-(

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

* Re: Possible to get a subtree agenda view?
  2008-12-14 19:14       ` Robert Goldman
@ 2008-12-15  3:07         ` Matthew Lundin
  2008-12-15  3:35           ` Robert Goldman
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Lundin @ 2008-12-15  3:07 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode


Hi Robert,

Robert Goldman <rpgoldman@sift.info> writes:
>
> I think it would be appropriate to have a tutorial like this in Worg,
> but not a replacement.  If you look at the custom agenda commands
> discussion in the manual, you will see that there is a discussion of how
> most of the fields of custom command s-expression are to be used, but no
> mention of the settings.  I was just arguing that modifying the example
> in the manual (or, possibly adding material from your example to it)
> would be useful.

Sorry to perpetuate our endless thread, but I was wondering whether
section 10.6.3 of the manual has the information you are looking for?
It states that the options that can be set in
org-agenda-custom-commands are the options that control "agenda
construction and display" and it offers a few examples.

Best,

Matt

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

* Re: Possible to get a subtree agenda view?
  2008-12-15  3:07         ` Matthew Lundin
@ 2008-12-15  3:35           ` Robert Goldman
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Goldman @ 2008-12-15  3:35 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode

Matthew Lundin wrote:
> Hi Robert,
> 
> Robert Goldman <rpgoldman@sift.info> writes:
>> I think it would be appropriate to have a tutorial like this in Worg,
>> but not a replacement.  If you look at the custom agenda commands
>> discussion in the manual, you will see that there is a discussion of how
>> most of the fields of custom command s-expression are to be used, but no
>> mention of the settings.  I was just arguing that modifying the example
>> in the manual (or, possibly adding material from your example to it)
>> would be useful.
> 
> Sorry to perpetuate our endless thread, but I was wondering whether
> section 10.6.3 of the manual has the information you are looking for?
> It states that the options that can be set in
> org-agenda-custom-commands are the options that control "agenda
> construction and display" and it offers a few examples.
> 

Yes, you are quite right.  I was reading this in the info reader in
emacs (instead of in PDF which I sometimes do), and when I didn't find
what I wanted in the main page (10.6.1, I believe), I jumped directly to
the docstring for the function.  Hypertext considered harmful! ;-)

Seriously, when I look at those info pages, I think I lose track of too
much context.  I'll go back and reread the pdf and I will probably do a
lot better.

thanks again for all of your help,

R

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

* Re: Possible to get a subtree agenda view?
  2008-12-14 13:46     ` Matthew Lundin
  2008-12-14 19:14       ` Robert Goldman
@ 2008-12-15 10:50       ` Carsten Dominik
  1 sibling, 0 replies; 11+ messages in thread
From: Carsten Dominik @ 2008-12-15 10:50 UTC (permalink / raw)
  To: Matthew Lundin; +Cc: emacs-orgmode, Robert Goldman


On Dec 14, 2008, at 2:46 PM, Matthew Lundin wrote:

>
> Hi Robert,
>
> Robert Goldman <rpgoldman@sift.info> writes:
>
>> Matthew Lundin wrote:
>>>
> [snip]
>>>
>>> For a custom agenda command:
>>>
>>> (setq org-agenda-custom-commands
>>>      '(("f" tags-tree "+car+TODO=\"TODO\""
>>> 	 ((org-show-entry-below t)
>>> 	  (org-show-hierarchy-above nil)))
>>>          ;; other commands
>>>        ))
>>>
> [snip]
>>
>> In particular, the variable settings weren't near the agenda  
>> discussion,
>> and are not in the index.  Question:  would it be useful to add a
>> variable index to the info file?  If it is, and there isn't someone  
>> more
>> texinfo competent than me to do it, I'll look into seeing how hard it
>> would be to do this.
>>
>> Also, in the manual and code there's no real discussion of how the
>> settings part of the org-agenda-custom-commands is to be used.  I  
>> mean,
>> it's clear that they are variable bindings, but there's no use case.
>>
>> Would it be reasonable to modify your example above into an example  
>> to
>> be added to the texinfo file?  I would be happy to have a whack if  
>> this
>> seems like a good idea.
>
> I'm guessing the best place for such a tutorial would be Worg (the
> org-mode wiki). http://orgmode.org/worg/
>
> When I have a chance, I'll put together a basic tutorial on agenda
> custom commands and put it up on Worg.

That would be super valuable, this is a key area with a very bad ratio  
between
available power on the onside, and accessible documentation on the  
other hand.

- Carsten

P.S.  Thanks for the excellent FAQ you wrote about filtering agenda  
views.

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

end of thread, other threads:[~2008-12-15 10:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-13 18:05 Possible to get a subtree agenda view? Robert Goldman
2008-12-13 21:29 ` Matthew Lundin
2008-12-13 22:35   ` Possible to get a subtree agenda view? --- possible bug? Robert Goldman
2008-12-14  5:34     ` Matthew Lundin
2008-12-14 19:43       ` Robert Goldman
2008-12-13 23:43   ` Possible to get a subtree agenda view? Robert Goldman
2008-12-14 13:46     ` Matthew Lundin
2008-12-14 19:14       ` Robert Goldman
2008-12-15  3:07         ` Matthew Lundin
2008-12-15  3:35           ` Robert Goldman
2008-12-15 10:50       ` Carsten Dominik

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).