9

Is there a way to get a list of org-mode entries with deadlines? Ideally with the deadlines displayed and ordered by deadline.

I haven't found anything like this. The closest thing I find is org-check-deadlines, which just let's me know about things that are due in the next fortnight or are already overdue.

Dan
  • 32,584
  • 6
  • 98
  • 168
emacsomancer
  • 1,011
  • 1
  • 9
  • 16
  • 1
    Here is a link to a related thead that suggests using the built-in agenda colums / table view: http://emacs.stackexchange.com/questions/12364/show-timestamp-for-each-todo-in-org-agenda-global-todo-list – lawlist Jun 05 '15 at 18:00

1 Answers1

10

There are several ways to do this using agenda views. The simplest is to use the week agenda: C-a a a. This will display the items in org-agenda-files that have timestamps within the current week, as well as deadlines due in the next 14 days (or whatever the value of org-deadline-warning-days is).

You can also use the built-in searching tools to do this (C-c a m). Just check the DEADLINE property. A search for DEADLINE>="<today>" will return entries with deadlines of today or later and DEADLINE<"<today>" returns overdue deadlines. You can save the search in a tags custom view in org-agenda-custom-commands if you plan to use it a lot. For example:

(add-to-list 'org-agenda-custom-commands
      '("D" "Deadlines"
        tags "DEADLINE>=\"<today>\""))

Finally, you can make an agenda view that shows only deadlines by setting org-agenda-entry-types:

(add-to-list 'org-agenda-custom-commands
             '("A" "Agenda; only deadlines"
               agenda ""
               ((org-agenda-entry-types '(:deadline)))
               ))

To display the deadline, the easiest way is to use columns. There is an example in the answer @lawlist linked to in their comment.

erikstokes
  • 12,686
  • 2
  • 34
  • 56
  • Both of those seem useful. Two questions, or 3, rather: (1) Can `(setq org-columns-default-format)` be specified for a specific agenda view? (2) When I get the agenda view in columns using `DEADLINE>=\"\""`, it's actually sorted by most distant rather than most recent. Is there a way to specify within the custom command how the first column should sort? (3) For the last method you mention, is there any way to make it default to "month view" rather than "week view"? – emacsomancer Jun 05 '15 at 23:27
  • 1
    You can use `org-agenda-overriding-columns-format` to change the columns in a specific agenda view and `org-agenda-sorting-strategy` to change the sort method. The time span (in days) of the agenda is controlled by `org-agenda-span` – erikstokes Jun 05 '15 at 23:29
  • I can't quite get it. I've made: (add-to-list 'org-agenda-custom-commands `'("Z" "Deadlines" tags "DEADLINE>=\"\"" ((org-agenda-overriding-columns-format "%DEADLINE %75ITEM")(org-agenda-sorting-strategy '(priority-up))(org-agenda-view-columns-initially t)) ))` but it doesn't seem to get the sorting right. – emacsomancer Jun 06 '15 at 07:17
  • 1
    **Some** sorting cannot be accomplished because text-properties are missing in the original source code -- i.e., grep for `org-add-props txt props` and examine the text properties of the *applicable* functions used to gather the data. `org-entries-lessp` relies upon those hidden text properties to sort by the `org-agenda-sorting-strategy`. This is a new question, which would require rewriting some of the basic functions -- most people are hesitant to touch the source code by modifying lengthy functions -- it is a holy/sacred issue for most users :) . It cannot be fixed with a simple advice. – lawlist Jun 06 '15 at 16:16
  • 1
    @lawlist Have you considered submitting a patch or bug report for this? I've also had this sorting problem. – erikstokes Jun 06 '15 at 23:04
  • 1
    I just sent an email to the org-mode team -- `emacs-orgmode@gnu.org` -- suggesting that some attention be given to the nine (9) locations where `org-add-props txt props` is used -- i.e., that an effort be made to calculate values and add text properties for all sorting types of the `org-agenda-sorting-strategy`, so that `org-entries-lessp` can do its job better. I didn't receive a tracking number, so I'm not sure whether it will actually receive any attention. – lawlist Jun 06 '15 at 23:54