Skip to content

Instantly share code, notes, and snippets.

@randomwangran
Created April 30, 2020 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randomwangran/60692255875faeeecb97314f308d75fe to your computer and use it in GitHub Desktop.
Save randomwangran/60692255875faeeecb97314f308d75fe to your computer and use it in GitHub Desktop.
luna
https://emacs-china.org/t/05-org-as/12092/32
(setq org-agenda-format-date 'yuchen/org-agenda-format-date-aligned)
(defun yuchen/org-agenda-format-date-aligned (date)
"Format a DATE string for display in the daily/weekly agenda, or timeline.
This function makes sure that dates are aligned for easy reading."
(require 'cal-iso)
(let* ((dayname (aref cal-china-x-days
(calendar-day-of-week date)))
(day (cadr date))
(month (car date))
(year (nth 2 date))
(cn-date (calendar-chinese-from-absolute (calendar-absolute-from-gregorian date)))
(cn-month (cl-caddr cn-date))
(cn-day (cl-cadddr cn-date))
(cn-month-string (concat (aref cal-china-x-month-name
(1- (floor cn-month)))
(if (integerp cn-month)
""
"(闰月)")))
(cn-day-string (aref cal-china-x-day-name
(1- cn-day))))
(format "%04d-%02d-%02d 周%s %s%s" year month
day dayname cn-month-string cn-day-string)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment