I want to have in an unique buffer with agenda and todo list, and only for the current buffer (not for all my org mode files).
I found how to define two functions (org-agenda-list-current-file and org-todo-list-current-file) but I cannot manage to write a function calling both agenda and todo-list.
Thanks in advance.
;; org-agenda-current-file : agenda for current buffer
(defun org-agenda-list-current-file (&optional arg)
"org-agenda-list, but using only the current buffer's file."
(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-agenda-list arg))))
;; org-todo-list-current-file : todo list for current buffer
(defun org-todo-list-current-file (&optional arg)
"`org-todo-list', but using only the current buffer's file."
(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))))
;; org-agenda-and-todo-list
;; ???
(setq org-agenda-custom-commands
'(
("a" "calendar" org-agenda-list-current-file )
("t" "todo" org-todo-list-current-file )
("z" "calendar + todo" org-agenda-and-todo-list )
))