Showing Org Agenda For The Year

I am just starting to include more of my org files into org-agenda. By default C-c a a gives a show for the next 7 days but I think for now I would like something of a more calendarish overview with a long form look of scheduled and completed tasks.

I thought I would write an elisp function:

(defun display-year-agenda (&optional year)
  "Display an agenda entry for a whole year."
  (interactive (list (read-string "Enter the year: "
                       (format-time-string "%Y" (current-time)))))
  (setq year (string-to-number year))
  (org-agenda-list)
  (org-agenda-year-view year)
  (setq this-year (string-to-number (format-time-string "%Y" (current-time))))
  (when (= year this-year)
    (org-agenda-goto-today)
    (recenter-top-bottom 10)))

;; Bind a key for easy access
(global-set-key (kbd "C-c y") 'display-year-agenda)

The default prompt is the current year but with the ability to enter any year desired. I also thought that if calling up this current year then I would want to highlight today and recenter a little.

As with all things I will give this a go for a while and see if it fits nicely into my workflow.

Comments

comments powered by Disqus