feat calfw: barevné zdroje s condition-case fallback (research verified)
This commit is contained in:
24
config.el
24
config.el
@@ -1930,9 +1930,29 @@ current frame."
|
||||
(evil-set-initial-state 'calfw-details-mode 'emacs)
|
||||
|
||||
(defun my/open-calendar ()
|
||||
"Otevři calfw org kalendář."
|
||||
"Otevři calfw s barevnými zdroji. Suky=modrá, Klára=žlutá, Rodina=zelená, Agenda=černá.
|
||||
Falls back to calfw-org-open-calendar pokud něco selže."
|
||||
(interactive)
|
||||
(calfw-org-open-calendar))
|
||||
(condition-case err
|
||||
(let ((sources '()))
|
||||
;; Agenda zdroj — org-agenda-files, nil = automaticky
|
||||
(push (calfw-org-create-source nil "Agenda" "black") sources)
|
||||
;; CalDAV soubory — jen pokud existují
|
||||
(dolist (spec '(("Suky" "~/org/caldav/suky.org" "SteelBlue")
|
||||
("Klára" "~/org/caldav/klara.org" "Gold")
|
||||
("Rodina" "~/org/caldav/family.org" "ForestGreen")))
|
||||
(let ((file (expand-file-name (nth 1 spec))))
|
||||
(when (file-exists-p file)
|
||||
(push (calfw-org-create-file-source
|
||||
(nth 0 spec) file (nth 2 spec))
|
||||
sources))))
|
||||
(calfw-open-calendar-buffer
|
||||
:contents-sources (nreverse sources)
|
||||
:view 'month
|
||||
:sorter 'calfw-org--schedule-sorter))
|
||||
(error
|
||||
(message "calfw colored sources failed (%s), fallback." (error-message-string err))
|
||||
(calfw-org-open-calendar))))
|
||||
|
||||
(map! :leader "o C" #'my/open-calendar))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user