all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Per command org-agenda-prefix-format
@ 2015-10-07 15:24 Suvayu Ali
  2015-10-07 15:46 ` Suvayu Ali
  2015-10-07 18:52 ` Nick Dokos
  0 siblings, 2 replies; 6+ messages in thread
From: Suvayu Ali @ 2015-10-07 15:24 UTC (permalink / raw)
  To: Emacs Org mode

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-compact-blocks t)))))

With the attached Org file, the agenda buffer looks like this:

Type1
  foo:        TODO Item 1                           :type1::
  foo:        TODO Item 3                           :type1::
Type2
  foo:        TODO Item 8                           :type2::

Anyone any thoughts?  Actually I have wanted a view like "Timeline" for
many years for my agenda searches.  Is that possible?  That would be
even better.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Per command org-agenda-prefix-format
  2015-10-07 15:24 Per command org-agenda-prefix-format Suvayu Ali
@ 2015-10-07 15:46 ` Suvayu Ali
  2015-10-07 18:52 ` Nick Dokos
  1 sibling, 0 replies; 6+ messages in thread
From: Suvayu Ali @ 2015-10-07 15:46 UTC (permalink / raw)
  To: Emacs Org mode

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

On Wed, Oct 07, 2015 at 05:24:50PM +0200, Suvayu Ali wrote:
> 
> With the attached Org file, the agenda buffer looks like this:

Forgot to attach the file :-p.

-- 
Suvayu

Open source is the future. It sets us free.

[-- Attachment #2: tasks.org --]
[-- Type: text/plain, Size: 459 bytes --]

#+OPTIONS: toc:nil
#+STARTUP: content


* Foo
  :PROPERTIES:
  :CATEGORY: foo
  :END:
** Type 1 [0/2] 						      :type1:
*** TODO Item 1
    DEADLINE: <2016-01-31 Sun>
*** TODO Item 3
    DEADLINE: <2015-10-31 Sat>

** Type 2 [2/3] 						      :type2:
*** DONE Item 4
    CLOSED: [2015-09-22 Tue 15:36] SCHEDULED: <2015-09-14 Mon>
*** DONE Item 6
    CLOSED: [2015-10-02 Fri 13:36] SCHEDULED: <2015-09-07 Mon>
*** TODO Item 8
    SCHEDULED: <2015-09-02 Wed>

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

* Re: Per command org-agenda-prefix-format
  2015-10-07 15:24 Per command org-agenda-prefix-format Suvayu Ali
  2015-10-07 15:46 ` Suvayu Ali
@ 2015-10-07 18:52 ` Nick Dokos
  2015-10-07 22:29   ` Suvayu Ali
  1 sibling, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2015-10-07 18:52 UTC (permalink / raw)
  To: emacs-orgmode

Suvayu Ali <fatkasuvayu+linux@gmail.com> 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.

Nick

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

* Re: Per command org-agenda-prefix-format
  2015-10-07 18:52 ` Nick Dokos
@ 2015-10-07 22:29   ` Suvayu Ali
  2015-10-08  7:02     ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Suvayu Ali @ 2015-10-07 22:29 UTC (permalink / raw)
  To: emacs-orgmode

On Wed, Oct 07, 2015 at 02:52:24PM -0400, Nick Dokos wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> 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.

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Per command org-agenda-prefix-format
  2015-10-07 22:29   ` Suvayu Ali
@ 2015-10-08  7:02     ` Nick Dokos
  2015-10-08 13:19       ` Suvayu Ali
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2015-10-08  7:02 UTC (permalink / raw)
  To: emacs-orgmode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> On Wed, Oct 07, 2015 at 02:52:24PM -0400, Nick Dokos wrote:
>> Suvayu Ali <fatkasuvayu+linux@gmail.com> 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

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

* Re: Per command org-agenda-prefix-format
  2015-10-08  7:02     ` Nick Dokos
@ 2015-10-08 13:19       ` Suvayu Ali
  0 siblings, 0 replies; 6+ messages in thread
From: Suvayu Ali @ 2015-10-08 13:19 UTC (permalink / raw)
  To: emacs-orgmode

Hi Nick,

On Thu, Oct 08, 2015 at 03:02:02AM -0400, Nick Dokos wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > On Wed, Oct 07, 2015 at 02:52:24PM -0400, Nick Dokos wrote:
> >> Suvayu Ali <fatkasuvayu+linux@gmail.com> 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.

Actually I went through these steps too!  I am not too familiar with the
agenda code, so I wasn't sure whether I was understanding it correctly.

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

Hmm, I was hoping for the timeline like prefix, but even a normal prefix
as in the usual agenda ("Sched. 2x") would also have worked for me.

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

Thanks for clearly outlining the code path for me.  Maybe if I find some
time, I'll hack around a bit.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

end of thread, other threads:[~2015-10-08 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-07 15:24 Per command org-agenda-prefix-format Suvayu Ali
2015-10-07 15:46 ` Suvayu Ali
2015-10-07 18:52 ` Nick Dokos
2015-10-07 22:29   ` Suvayu Ali
2015-10-08  7:02     ` Nick Dokos
2015-10-08 13:19       ` Suvayu Ali

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.