So I tried adding a "(nil)" in the custom agenda section. If this were allowed (presumably ignored), I could write a function that returns nil unless there were items tagged REFILE, in which case it would return (tags "REFILE" ((org-agenda-overriding-header "REFILE"))) But having (nil) caused an error. I guess I could make the entire "My Custom Agenda" section be the output of a function, but that seems overly complex. -k. On Thu, Jun 27, 2013 at 11:18 AM, Ken Mankoff wrote: > Hi Bastien, > > Here is my custom agenda section. I'd like to have the DEADLINE and the > REFILE only show up if items exist in those sections, not when they are > empty. Actually, I guess I'd like this for all sections. > > (setq org-agenda-custom-commands > '(("c" "My Custom Agenda" > ( > (tags "REFILE" ((org-agenda-overriding-header "REFILE"))) > (tags-todo "+DEADLINE<=\"<+3d>\"" > ( > (org-agenda-overriding-header "Deadline <= 3 Days") > )) > (tags-todo "+SCHEDULED<\"\"" > ( > (org-agenda-overriding-header "Scheduled Today") > )) > (todo "INPROGRESS" ((org-agenda-overriding-header "In > Progress"))) > (todo "WAITING|VERIFY" ((org-agenda-overriding-header "Waiting > or Verify"))) > (agenda "" ( > (org-agenda-overriding-header "Scheduled") > (org-deadline-warning-days 0) > )) > (todo "SOMEDAY" ((org-agenda-overriding-header "Someday"))) > (tags "REFILE" ((org-agenda-overriding-header "REFILE"))) > ) nil ("org.txt" "org.html" "org.ics")))) > > > > On Thu, Jun 27, 2013 at 10:44 AM, Bastien wrote: > >> Hi Ken, >> >> Ken Mankoff writes: >> >> > Right now I have this at the bottom of my custom agenda, and it is >> > therefore often off-screen. I would like to have it at the top, but >> > only appear when there are items under this section. Most of the time >> > it is there and three lines are wasting space (header separator ==== >> > =, header "REFILE", and a blank line). >> >> So you are using agenda blocks, right? >> >> Please post the skeleton of your custom agendas so that we can better >> understand. >> >> Thanks, >> >> -- >> Bastien >> > >