[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Per command org-agenda-prefix-format
From: |
Nick Dokos |
Subject: |
Re: [O] Per command org-agenda-prefix-format |
Date: |
Thu, 08 Oct 2015 03:02:02 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Suvayu Ali <address@hidden> writes:
> On Wed, Oct 07, 2015 at 02:52:24PM -0400, Nick Dokos wrote:
>> Suvayu Ali <address@hidden> writes:
>>
>> > Hi,
>> >
>> > I wanted to prefix the results of a tags-todo agenda command with
>> > scheduling information. But I can't seem to figure out the
correct way
>> > to do this. This is what I tried:
>> >
>> > (setq org-agenda-custom-commands
>> > '(("J" "Type1/Type2"
>> > ((tags-todo "CATEGORY=\"foo\"+type1"
>> > ((org-agenda-overriding-header "Type1")))
>> > (tags-todo "CATEGORY=\"foo\"+type2"
>> > ((org-agenda-overriding-header "Type2"))))
>> > ((org-agenda-files (list "~/tmp/org/tasks.org"))
>> > (org-agenda-prefix-format " % s")
>>
>> org-agenda-prefix-format is an alist, not a string.
>
> Forgot to mention in my earlier post, I tried that too! Something like
> this:
>
> (org-agenda-prefix-format '(tags " % s"))
>
> Same result.
Although that's not the right form (it should be '((tags . " % s")) -
and according to the doc it should be the whole 5-element alist), you
are right: it does not make any difference. Also, internally, the string
form is accepted just as well as the alist form by
org-compile-prefix-format, so I was wrong about the alist vs string
distinction.
IIUC (do I?), you expect the format to produce the Deadline: or Scheduled:
prefixes that you get in the timeline. Unfortunately, that code is
completely separate from the code that gets executed here. In the
timeline, we go
org-timeline -> org-agenda-get-scheduled (or org-agenda-get-deadlines)
-> org-agenda-format-item("Scheduled: " ....)
with the first argument providing the appropriate prefix.
But with the custom agenda, we go a different way:
org-tags-view -> org-scan-tags -> org-agenda-format-item("" ...)
and org-scan-tags calls org-agenda-format-item with a hardwired empty
string for the "extra" argument - it does not matter that %s has been
specified in org-agenda-prefix-format. So I don't think you can do what
you want (again IIUC).
Presumably, stealing the code that calculates whether the entry should
get a scheduling prefix from org-agenda-get-scheduled and grafting it
into org-scan-tags would do the trick, but that's not the way things are
today.
--
Nick