From 5391e2cb31b2d05e6d2e8007121da2a097cc3cee Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 11 Sep 2023 21:03:13 -0700 Subject: [PATCH] [oni-org] Clean up agenda category icon settings --- oni-org/oni-org.el | 85 +++++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index aa8bb3b..1f84c4f 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -568,44 +568,53 @@ also move point to the start of the heading." (defun oni-org-set-agenda-category-icons () "Set ‘org-agenda-category-icon-alist’." - (let* ((icon-height (window-default-font-height)) - (defaults `(nil :height ,icon-height :ascent center)) - (svg `(svg ,@defaults))) - (setq org-agenda-category-icon-alist - `((,(rx string-start "task" string-end) ,(expand-file-name "bx-task.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "inbox" string-end) ,(expand-file-name "bxs-inbox.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "email" string-end) ,(expand-file-name "mat-email.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "mail" string-end) ,(expand-file-name "mat-email.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "life" string-end) ,(expand-file-name "mat-one-up.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "feature" string-end) ,(expand-file-name "mat-star-circle-outline.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "work" string-end) ,(expand-file-name "bs-building.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "game" string-end) ,(expand-file-name "bxs-game.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "shopping" string-end) ,(expand-file-name "bx-shopping-bag.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "bug" string-end) ,(expand-file-name "bx-bug.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "idea" string-end) ,(expand-file-name "bxs-bulb.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "article" string-end) ,(expand-file-name "mat-post-outline.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "project" string-end) ,(expand-file-name "bs-kanban.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "ebook" string-end) ,(expand-file-name "bxs-book-content.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "book" string-end) ,(expand-file-name "mat-book-open-variant.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "Morning Cup of Coding" string-end) ,(expand-file-name "bxs-coffee.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "paper" string-end) ,(expand-file-name "mat-note-text-outline.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "question" string-end) ,(expand-file-name "mat-head-question.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "music" string-end) ,(expand-file-name "bxs-music.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "emacs" string-end) ,(expand-file-name "emacs.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "guix" string-end) ,(expand-file-name "guix.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "moving" string-end) ,(expand-file-name "bxs-truck.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "security" string-end) ,(expand-file-name "mat-security.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "website" string-end) ,(expand-file-name "mat-web.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "desktop" string-end) ,(expand-file-name "bx-desktop.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "maint" string-end) ,(expand-file-name "bs-tools.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "comm" string-end) ,(expand-file-name "bs-telephone-fill.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "config" string-end) ,(expand-file-name "bx-cog.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "blog" string-end) ,(expand-file-name "bx-rss.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "writing" string-end) ,(expand-file-name "bxs-pencil.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "code" string-end) ,(expand-file-name "code.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "list" string-end) ,(expand-file-name "list.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "video" string-end) ,(expand-file-name "video-fill.svg" oni-org-icons-dir) ,@svg) - (,(rx string-start "album" string-end) ,(expand-file-name "album-fill.svg" oni-org-icons-dir) ,@svg))))) + (setq org-agenda-category-icon-alist + (mapcar (lambda (pair) (list (rx string-start (literal (car pair)) string-end) + (expand-file-name (cdr pair) oni-org-icons-dir) + 'svg nil + :height (window-default-font-height) + :ascent 'center)) + '(("task" . "bx-task.svg") + ("inbox" . "bxs-inbox.svg") + ("email" . "mat-email.svg") + ("mail" . "mat-email.svg") + ("life" . "mat-one-up.svg") + ("feature" . "mat-star-circle-outline.svg") + ("work" . "bs-building.svg") + ("game" . "bxs-game.svg") + ("shopping" . "bx-shopping-bag.svg") + ("bug" . "bx-bug.svg") + ("idea" . "bxs-bulb.svg") + ("article" . "mat-post-outline.svg") + ("project" . "bs-kanban.svg") + ("ebook" . "bxs-book-content.svg") + ("book" . "mat-book-open-variant.svg") + ("Morning Cup of Coding" . "bxs-coffee.svg") + ("paper" . "mat-note-text-outline.svg") + ("question" . "mat-head-question.svg") + ("music" . "bxs-music.svg") + ("emacs" . "emacs.svg") + ("guix" . "guix.svg") + ("moving" . "bxs-truck.svg") + ("security" . "mat-security.svg") + ("website" . "mat-web.svg") + ("desktop" . "bx-desktop.svg") + ("maint" . "bs-tools.svg") + ("comm" . "bs-telephone-fill.svg") + ("config" . "bx-cog.svg") + ("blog" . "bx-rss.svg") + ("writing" . "bxs-pencil.svg") + ("code" . "code.svg") + ("list" . "list.svg") + ("video" . "video-fill.svg") + ("album" . "album-fill.svg"))))) + +(defun oni-org-roam-todo-files () + "Collect all files that have TODO items in them." + (mapcar + #'car + (org-roam-db-query + [:select :distinct file :from nodes :where (= todo $s1)] "TODO"))) (setq org-agenda-files (cons oni-org-todo-main-file