diff options
author | Aaron LI <aaronly.me@outlook.com> | 2017-03-14 09:13:16 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2017-03-14 09:13:16 +0800 |
commit | 983d66b40e34faee7a0cd89bbd00bb0aa7a31491 (patch) | |
tree | 5934665d54b63810a7939e5f73e1e6193ad1c274 | |
parent | 9a07d3aacce17cb7ccaf489c53b5cb12d1f5da9f (diff) | |
download | dotfiles-983d66b40e34faee7a0cd89bbd00bb0aa7a31491.tar.bz2 |
spacemacs: Add config/calendar: show Chinese birthday on agenda
-rw-r--r-- | _spacemacs.d/config/my-calendar.el | 44 | ||||
-rw-r--r-- | _spacemacs.d/init.el | 1 |
2 files changed, 45 insertions, 0 deletions
diff --git a/_spacemacs.d/config/my-calendar.el b/_spacemacs.d/config/my-calendar.el new file mode 100644 index 0000000..c6c6c55 --- /dev/null +++ b/_spacemacs.d/config/my-calendar.el @@ -0,0 +1,44 @@ +;;; my-calendar.el --- Custom calendar configurations +;; -*- mode: emacs-lisp -*- +;; vim: set ts=8 sw=2 tw=0 fenc=utf-8 ft=lisp: +;; +;; Aaron LI +;; Created: 2017-03-01 +;; Updated: 2017-03-14 +;; + +;;; Commentary: +;; Custom calendar configurations +;; + +;;; Code: + +(with-eval-after-load 'calendar + (require 'cal-china) + + ;; Date style: month/day/year (default) + (setq calendar-date-style 'american) + + ;; Wrapper function of `diary-chinese-anniversary' using an intuitive year + ;; NOTE: Built-in `diary-chinese-anniversary' accepts an obscure year + ;; notation consisting of the 60-year cycle number and year number + ;; within this cycle. + ;; Credit: https://emacs-china.org/t/agenda-list/2119/15 + (defun my/diary-chinese-anniversary (month day &optional year mark) + "Like `diary-chinese-anniversary' but use an intuitive year argument." + (if year + (let* ((d-date (diary-make-date month day year)) + (a-date (calendar-absolute-from-gregorian d-date)) + (c-date (calendar-chinese-from-absolute a-date)) + (cycle (car c-date)) + (yy (cadr c-date)) + (y (+ (* 100 cycle) yy))) + (diary-chinese-anniversary month day y mark)) + (diary-chinese-anniversary month day year mark))) + + ;; END: `with-eval-after-load' + ) + +(provide 'my-calendar) + +;;; my-calendar.el ends here diff --git a/_spacemacs.d/init.el b/_spacemacs.d/init.el index 9b3b791..09bf288 100644 --- a/_spacemacs.d/init.el +++ b/_spacemacs.d/init.el @@ -487,6 +487,7 @@ (push "~/.spacemacs.d/config" load-path) (require 'my-org) (require 'my-mu4e) + (require 'my-calendar) ;; ;; Set custom file location instead of using this file (setq custom-file "~/.spacemacs.d/custom.el") |