diff --git a/.spacemacs b/.spacemacs index 7292dc71eacc807c5b5c3947feec16a558358b7c..82a57667ee349c29115342bfd74df744df042fb6 100644 --- a/.spacemacs +++ b/.spacemacs @@ -669,6 +669,33 @@ before packages are loaded." :anything t :order 4) )) +(defun pmg/org-agenda-format-date-aligned (date) + "Format a DATE string for display in the daily/weekly agenda. +This function makes sure that dates are aligned for easy reading." + (require 'cal-iso) + (let* ((dayname (calendar-day-name date)) + (day (cadr date)) + (day-of-week (calendar-day-of-week date)) + (month (car date)) + (monthname (calendar-month-name month)) + (year (nth 2 date)) + (iso-week (org-days-to-iso-week + (calendar-absolute-from-gregorian date))) + (weekyear (cond ((and (= month 1) (>= iso-week 52)) + (1- year)) + ((and (= month 12) (<= iso-week 1)) + (1+ year)) + (t year))) + (weekstring (if (= day-of-week 1) + (format " W%02d" iso-week) + ""))) + (concat (make-string (window-width) 9472) + "\n" + (format "%-10s %2d %s %4d%s " + dayname day monthname year weekstring) + ))) + +(setq org-agenda-format-date 'pmg/org-agenda-format-date-aligned) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Do not write anything past this comment. This is where Emacs will