Open mankoff opened 9 years ago
How about this:
(defun my--cfw:open-calendar-buffer-view (orig-func &rest args &allow-other-keys)
(apply orig-func :view 'week :allow-other-keys t args)
)
(advice-add 'cfw:open-calendar-buffer :around #'my--cfw:open-calendar-buffer-view)
;;(advice-remove 'cfw:open-calendar-buffer #'my--cfw:open-calendar-buffer-view)
Thanks for this as I was looking for this as well. I used 'two-weeks
instead of 'week
to get what I wanted.
It seems like doesn't work with cfw:open-org-calendar
:-0
I changed the file ~/.emacs.d/elpa/calfw-org-20160303.258/calfw-org.el
directly and it's working.
I couldn't find an alternative answer than It's an answer I found so far.
go to L472 (in cfw:open-org-calendar
function)
and change :view 'month to 'two-weeks
and recompile calfw-org.el
(M-x: byte-compile-file) then restart emacs and It's working.
I had the same issue with not being able to set cfw:open-org-calendar
with the above lisp.
I don't like to tinker with the .el files directly, but edward0im's approach helped me to figure out how I could do this in my user-config by defining a custom function:
(defun my-custom-org-calendar ()
(interactive)
(save-excursion
(let* ((source1 (cfw:org-create-source "White"))
(curr-keymap (if cfw:org-overwrite-default-keybinding cfw:org-custom-map cfw:org-schedule-map))
(cp (cfw:create-calendar-component-buffer
:view 'week
:contents-sources (list source1)
:custom-map curr-keymap
:sorter 'cfw:org-schedule-sorter)))
(switch-to-buffer (cfw:cp-get-buffer cp))
(when (not org-todo-keywords-for-agenda)
(message "Warn : open org-agenda buffer first.")))))
The default view is month view. Is there a way to set the default view to be one week or two weeks instead?