I've added a custom key for the org agenda to show all unscheduled TODO items following Sacha Chua:

(defun sacha/org-agenda-skip-scheduled ()
  (org-agenda-skip-entry-if 'scheduled 'deadline 'regexp "\n]+>"))

(setq org-agenda-custom-commands
   '(("u" "Unscheduled tasks" alltodo ""
      ((org-agenda-skip-function 'sacha/org-agenda-skip-scheduled)
       (org-agenda-overriding-header "Unscheduled TODO entries: ")))))

I can bring up this list with C-c a u, but I'd rather just bind it to a single key. Currently I have the simple:

(global-set-key (kbd "<f8>") 'org-todo-list)

but I would like this to use the above custom command. I've had a dig through the manual but I can't see how to do it.


You can do this by wrapping a call to org-agenda into a custom command and binding that to a key:

(defun org-agenda-show-unscheduled (&optional arg)
  (interactive "P")
  (org-agenda arg "u"))

(define-key org-mode-map (kbd "<f8>") 'org-agenda-show-unscheduled)
| improve this answer | |

I don't like creating an explicit function so I rolled my map within a lambda:

(define-key org-mode-map (kbd "<f8>") '(lambda (&optional arg) (interactive "P")(org-agenda arg "u")))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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