Open felipeochoa opened 7 years ago
@felipeochoa In the current implementation, the changing of the rendering place for holiday text is difficult in trivial way.
Non trivial way is following:
cfw:display-calendar-holidays
to nil;;define holiday source
(setq cfw:holiday-source
(make-cfw:source
:name "Holidays"
:color "Red"
:data
(lambda (b e)
(let ((displayed-month (calendar-extract-month b))
(displayed-year (calendar-extract-year b)))
(mapcar (lambda (v)
(destructuring-bind (d name) v
(make-cfw:event :title name :start-date d)))
(calendar-holiday-list))))))
;; ex: displaying calfw component
(let* ((cp (cfw:create-calendar-component-buffer
:contents-sources
(list cfw:holiday-source
;; other source here
))))
(switch-to-buffer (cfw:cp-get-buffer cp)))
This should display the holiday texts as you like.
The sort order of the scheduling items may be considered.
Please check the function cfw:default-text-sorter
and try modify it.
@kiwanami Thanks! I'm using the org
calendar, so am adding the source using this advice on cfw:open-org-calendar
(defun cfw:open-org-calednar-holiday-advice ()
"Add the custom holiday source to the calendar."
(nconc (cdr (assq 'contents-sources (cfw:component-model cfw:component)))
(cons cfw:holiday-source nil))
(cfw:refresh-calendar-buffer t))
Are the model's keys a private API? Next up is adding a custom sorter to keep holidays pinned to the top...
Actually, this doesn't work as advice since there's no way to get the buffer that was added, and it doesn't work as a mode hook as cfw:component
is defined after mode hooks are run. Would it be possible to have cfw:open-org-calendar
return the new component or add an optional argument to not save-excursion?
Is it possible to move the holiday text down one line? I keep a narrow display, which results in not much room for the day + the holiday name, so I'd rather have:
instead of