fix calfw sort: všechny zdroje calfw-org-create-source + calfw-org--schedule-sorter

This commit is contained in:
2026-02-24 22:47:33 +01:00
parent 6a6b2dd512
commit 25d669dd9d

View File

@@ -1931,25 +1931,26 @@ current frame."
(defun my/open-calendar () (defun my/open-calendar ()
"Otevři calfw s barevnými zdroji. Suky=modrá, Klára=žlutá, Rodina=zelená, Agenda=černá. "Otevři calfw s barevnými zdroji. Suky=modrá, Klára=žlutá, Rodina=zelená, Agenda=černá.
Všechny zdroje přes calfw-org-create-source → jednotný formát → sort funguje.
Falls back to calfw-org-open-calendar pokud něco selže." Falls back to calfw-org-open-calendar pokud něco selže."
(interactive) (interactive)
(condition-case err (condition-case err
(let ((sources '())) (let ((sources '()))
;; Agenda zdroj — org-agenda-files, nil = automaticky ;; Agenda — org-agenda-files (nil = auto)
(push (calfw-org-create-source nil "Agenda" "black") sources) (push (calfw-org-create-source nil "Agenda" "black") sources)
;; CalDAV soubory — jen pokud existují ;; CalDAV soubory jako agenda zdroje — stejný formát = sort funguje
(dolist (spec '(("Suky" "~/org/caldav/suky.org" "SteelBlue") (dolist (spec '(("Suky" "~/org/caldav/suky.org" "SteelBlue")
("Klára" "~/org/caldav/klara.org" "Gold") ("Klára" "~/org/caldav/klara.org" "Gold")
("Rodina" "~/org/caldav/family.org" "ForestGreen"))) ("Rodina" "~/org/caldav/family.org" "ForestGreen")))
(let ((file (expand-file-name (nth 1 spec)))) (let ((file (expand-file-name (nth 1 spec))))
(when (file-exists-p file) (when (file-exists-p file)
(push (calfw-org-create-file-source (push (calfw-org-create-source
(nth 0 spec) file (nth 2 spec)) (list file) (nth 0 spec) (nth 2 spec))
sources)))) sources))))
(calfw-open-calendar-buffer (calfw-open-calendar-buffer
:contents-sources (nreverse sources) :contents-sources (nreverse sources)
:view 'month :view 'month
:sorter 'calfw-sorter-start-time)) :sorter 'calfw-org--schedule-sorter))
(error (error
(message "calfw colored sources failed (%s), fallback." (error-message-string err)) (message "calfw colored sources failed (%s), fallback." (error-message-string err))
(calfw-org-open-calendar)))) (calfw-org-open-calendar))))