calfw-calendar に howm と diary の内容どっちも表示
僕はプライベートの予定は google-emacs で google カレンダーと diary を同期して管理していて、仕事の予定は howm で管理している。
calfw-howm と calfw-calendar がそれぞれ用意されているので、それぞれを calfw-calendar に表示することはできるけれど、どちらも同じカレンダーに表示したかったので以下のように書いた。
(defun cfw:open-howm-diary-calendar () "Open the diary schedule calendar in the new buffer." (interactive) (let* ((source1 (cfw:cal-create-source)) (source2 (cfw:howm-create-source)) (source3 cfw:howm-schedule-contents) (cp (cfw:create-calendar-component-buffer :view 'month :custom-map cfw:howm-schedule-map :contents-sources (append (list source1) (list source2) source3) :annotation-sources cfw:howm-annotation-contents))) (switch-to-buffer (cfw:cp-get-buffer cp)))) (defadvice cfw:cal-modify-diary-entry-string (around cfw:cal-modiffy-diary-entry-string activate) (let ((orig-string ad-do-it)) (when (string-match "^\\([0-9]+:[0-9]+-[0-9]+:[0-9]+ \\)?\\(.*\\)$" orig-string) (setq ad-return-value (match-string 2 orig-string)))))
google-calendar の記述はカレンダーに出すには冗長すぎるので、defadvice で表示したいところだけ抜き出している。