From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suvayu Ali Subject: Re: Per command org-agenda-prefix-format Date: Thu, 8 Oct 2015 15:19:30 +0200 Message-ID: <20151008131930.GC2967@chitra.no-ip.org> References: <20151007152450.GA20502@chitra.no-ip.org> <87y4fea4uv.fsf@alphaville.usersys.redhat.com> <20151007222949.GA6352@chitra.no-ip.org> <87pp0plu6t.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkB7j-0005Bk-U0 for emacs-orgmode@gnu.org; Thu, 08 Oct 2015 09:21:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkB6d-0006NY-5k for emacs-orgmode@gnu.org; Thu, 08 Oct 2015 09:20:41 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:36376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkB6c-0006JZ-Qm for emacs-orgmode@gnu.org; Thu, 08 Oct 2015 09:19:34 -0400 Received: by wicgb1 with SMTP id gb1so25353958wic.1 for ; Thu, 08 Oct 2015 06:19:34 -0700 (PDT) Received: from chitra.no-ip.org (5072840E.static.ziggozakelijk.nl. [80.114.132.14]) by smtp.gmail.com with ESMTPSA id wc12sm7235900wic.18.2015.10.08.06.19.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Oct 2015 06:19:31 -0700 (PDT) Content-Disposition: inline In-Reply-To: <87pp0plu6t.fsf@alphaville.usersys.redhat.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Nick, On Thu, Oct 08, 2015 at 03:02:02AM -0400, Nick Dokos wrote: > Suvayu Ali writes: > > > On Wed, Oct 07, 2015 at 02:52:24PM -0400, Nick Dokos wrote: > >> Suvayu Ali 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.