12

In org-mode, I like to run org-todo-list, which displays the global todo list including all my org-agenda files. How do I view a TODO list for only the current buffer, ignoring my other org-agenda files?

12

You can use < from the agenda menu to restrict the current agenda call to the buffer that the agenda was invoked from. To restrict to that file for more than one call, you can use C-c C-x < (org-agenda-set-restriction-lock). See (info "(org) Agenda files") for more information.

9

You can use org-show-todo-tree to get a sparse tree view of the current buffer's TODO items. It's bound to C-c / t by default.

7

You could bind org-agenda-files dynamically to the current buffer's file and call org-todo-list from there:

(defun org-todo-list-current-file (&optional arg)
  "Like `org-todo-list', but using only the current buffer's file."
  (interactive "P")
  (let ((org-agenda-files (list (buffer-file-name (current-buffer)))))
    (if (null (car org-agenda-files))
        (error "%s is not visiting a file" (buffer-name (current-buffer)))
      (org-todo-list arg))))

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.