From 5494b874eb7cbd8f2542757034e9e109162f90fd Mon Sep 17 00:00:00 2001 From: Daneel Date: Tue, 24 Feb 2026 22:34:56 +0100 Subject: [PATCH] =?UTF-8?q?feat=20calfw:=20barevn=C3=A9=20zdroje=20s=20con?= =?UTF-8?q?dition-case=20fallback=20(research=20verified)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.el | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/config.el b/config.el index fcb4f8b..55ea425 100644 --- a/config.el +++ b/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))