A few months ago, I converted my init file into an org file, and I’ve since been using it as a way to organize my blog posts. I won’t go into too much detail here, suffice to say that this is a huge org-mode buffer, where many headlines have a SCHEDULED date.

How can I list all SCHEDULED headlines in this file, sorted by date?

All I care to see is the date, todo status, and title. Anything else is superfluous.
Other important requirements:

  • Do not ommit headlines marked as DONE.
  • List only SCHEDULED items. I don’t want to see headlines that just happen to have a date (<2014-10-04 Sat>) in them.
  • Only use this file. Do not search through all my agenda files.

For clarity, take the following file.

* DONE Hi guys
  CLOSED: [2014-10-04 Sat 15:18] SCHEDULED: <2014-10-04 Sat>
* Hello me
** Hello everyone <2014-10-05 Sun>
** TODO The world is at my feet
   SCHEDULED: <2014-10-11 Sat>

I’d like to run a command which would display a list something like this:

<2014-10-04 Sat> DONE Hi guys
<2014-10-11 Sat> TODO The world is at my feet

Of course, I’m not picky about the format. The important thing is to have this information displayed in a convenient way.

My gut tells me this has something to do with org-agenda, but I’m not sure how to get there.

1 Answer 1


Here a way to do it using org-agenda. You can write a custom agenda command like the one below

(setq org-agenda-custom-commands
  '(("i" "Only scheduled entries in init.org sorted by time" agenda ""
     ((org-agenda-files '("~/.emacs.d/init.org"))
      (org-agenda-entry-types '(:scheduled))
      (org-agenda-start-day "2014-01-01")
      (org-agenda-span 'year)
      (org-agenda-include-diary nil)
      (org-agenda-show-all-dates nil))))) 

Most of the configuration is happening settings part of custom command (I am the skipping the explanation of format of org-agenda-custom-commands for brevity, see C-hvorg-agenda-custom-commandsRET). Following is a brief explanation of each of the setting used

1) org-agenda-files is set to the init file so that org mode does not search all the agenda files while building this particular agenda.

2) org-agenda-entry-types is set to ':scheduled' to restrict it to just to scheduled items.

3)The org-agenda-start-day is the day onwards which you want the entries to be listed, I have set it to this years start you might want to set to the day of your first article.

4) org-agenda-span tells the numbers days to be included in the agenda view. org-agenda-include-diary is set to nil to avoid having diary entries in the agenda view.

5) Finally empty dates are hidden by setting org-agenda-show-all-dates to nil.

Now when you run the command org-agenda in the dispatcher menu you will get the an option 'i' which you can select to obtain the desired view.

Old answer

Use the command org-occur from the docstring


Make a compact tree which shows all matches of REGEXP. The tree will show the lines where the regexp matches, and all higher headlines above the match.

Here is another way to do it. Use occur with a prefix argument. From the docstring of the command.

(occur REGEXP &optional NLINES)

Show all lines in the current buffer containing a match for REGEXP. If a match spreads across multiple lines, all those lines are shown.

Each line is displayed with NLINES lines before and after, or -NLINES before if NLINES is negative.

So doing C-u-1M-xoccurRETSCHEDULEDRET should give you what you want

I am not sure how to sort the headlines tough.

  • Perfect, I knew org agenda had to have a solution.
    – Malabarba
    Oct 5, 2014 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.