On Wed, Apr 14, 2010 at 10:54 AM, Nathan Neff
<address@hidden> wrote:
I'm trying to build a custom agenda that works with the current buffer.
I've succeeded in getting the agenda to display with the
current buffer like this:
(setq org-agenda-custom-commands
(quote (
("c" "Current Buffer" agenda "" ((org-agenda-files (list (buffer-file-name)))))
("f" "Home Buffer" agenda "" ((org-agenda-files '("~/Documents/personal/nate.org"))))
)
)
)
However, when I view the agenda for the current buffer (by pressing "c",
every key I press gives me "Wrong type argument: stringp, nil".
I fixed it! I found a fairly slick workaround for the problem.
Before calling (org-agenda), I set a variable called njn/current-buffer-file-name, and refer to that variable in my custom agenda view.
(defun njn/org-agenda ()
(interactive)
(setq njn/current-buffer-name (buffer-file-name))
(org-agenda)
)
I have an example of the fixed and broken custom agenda commands below:
(setq org-agenda-custom-commands
'(
("c" "Current Buffer" agenda ""
((org-agenda-files (list njn/current-buffer-name)))
)
("x" "This doesn't Work. It gets the right data, but wont
let you issue any other agenda commands" agenda ""
((org-agenda-files (list (buffer-file-name))))
)
)
)
Instead of calling (org-agenda), I just call (njn/org-agenda)
(global-set-key (kbd "<f5>") 'njn/org-agenda)
Thanks,
--Nate