From 844dcc6352bdd0e724da7329dc1295f67cb06c12 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 14 Jun 2024 17:02:38 -0700 Subject: Breakout Headings to File --- elchemy-dashboard.el | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'elchemy-dashboard.el') diff --git a/elchemy-dashboard.el b/elchemy-dashboard.el index a8b3482..44a22d0 100644 --- a/elchemy-dashboard.el +++ b/elchemy-dashboard.el @@ -12,17 +12,18 @@ (let ((start (point))) (insert "Elchemy Dashboard") (add-text-properties start (point) - '(face (:height 4.0)))) - (insert "\n\n") - (elchemy/display-tabular-button-alist - elchemy/dashboard/heading-buttons - elchemy/dashboard/heading-columns elchemy/dashboard/heading-padding) - (insert "\n\n") + `(face (:height ,elchemy/dashboard/header-size)))) + (insert "\n") + (when (file-exists-p (concat elchemy/elchemy-root elchemy/elchemy-headings-file)) + (elchemy/display-tabular-button-alist + (elchemy/read-alist-file (concat elchemy/elchemy-root elchemy/elchemy-headings-file)) + elchemy/dashboard/heading-columns elchemy/dashboard/heading-padding) + (insert "\n")) (when (file-exists-p (concat elchemy/elchemy-root elchemy/elchemy-projects-file)) (let ((start (point))) (insert "Projects") (add-text-properties start (point) - '(face (:height 1.5)))) + `(face (:height ,elchemy/dashboard/subheader-size)))) (insert "\n") (elchemy/display-tabular-button-alist (elchemy/read-alist-file (concat elchemy/elchemy-root elchemy/elchemy-projects-file)) @@ -35,15 +36,15 @@ (let ((start (point))) (insert "Agenda") (add-text-properties start (point) - '(face (:height 1.5)))) + '(face (:height elchemy/dashboard/subheader-size)))) (insert "\n") - (insert (apply 'format (concat "%-" (format "%d" (+ agenda-max-length elchemy/dashboard-agenda-padding)) "s" "%-" (format "%d" (+ agenda-max-length elchemy/dashboard-agenda-padding)) "s" "%s\n") elchemy/dashboard-agenda-titles)) + (insert (apply 'format (concat "%-" (format "%d" (+ agenda-max-length elchemy/dashboard/agenda-padding)) "s" "%-" (format "%d" (+ agenda-max-length elchemy/dashboard/agenda-padding)) "s" "%s\n") elchemy/dashboard-agenda-titles)) (dotimes (i agenda-max-count) (insert (format - (concat "%-" (format "%d" (+ agenda-max-length elchemy/dashboard-agenda-padding)) "s") + (concat "%-" (format "%d" (+ agenda-max-length elchemy/dashboard/agenda-padding)) "s") (elchemy/replace-nil (nth i (nth 0 agenda-items))))) (insert (format - (concat "%-" (format "%d" (+ agenda-max-length elchemy/dashboard-agenda-padding)) "s") + (concat "%-" (format "%d" (+ agenda-max-length elchemy/dashboard/agenda-padding)) "s") (elchemy/replace-nil (nth i (nth 1 agenda-items))))) (insert (format "%s" @@ -54,21 +55,21 @@ (let ((start (point))) (insert "Overdue") (add-text-properties start (point) - '(face (:height 1.5)))) + `(face (:height ,elchemy/dashboard/subheader-size)))) (insert "\n") (insert (elchemy/format-processed-agenda (mapcar 'elchemy/process-agenda-heading (org-ql-select (org-agenda-files) `(and (todo "STRT" "WAIT" "TODO" "CYCL") (ts :from ,(- elchemy/schedule-lookahead) :to today)) :sort '(todo priority date))))) (insert "\n") (let ((start (point))) (insert "Upcoming") (add-text-properties start (point) - '(face (:height 1.5)))) + `(face (:height ,elchemy/dashboard/subheader-size)))) (insert "\n") (insert (elchemy/format-processed-agenda (mapcar 'elchemy/process-agenda-heading (org-ql-select (org-agenda-files) `(and (or (todo "STRT" "WAIT" "TODO") (todo "CYCL")) (ts :from today :to ,elchemy/schedule-lookahead)) :sort '(todo priority date))))) (insert "\n")) (let ((start (point))) (insert "Command Reference") (add-text-properties start (point) - '(face (:height 1.5)))) + `(face (:height ,elchemy/dashboard/subheader-size)))) (insert "\n") (insert "C-/ ~ Undo\n") (insert "C-x n n ~ Narrow\n") @@ -91,7 +92,8 @@ (insert (buttonize "Refresh" '(lambda (x) (elchemy/recreate-dashboard)))) (insert "\n") (button-mode +1) - (read-only-mode +1)))) + (read-only-mode +1) + (beginning-of-buffer)))) (defun elchemy/recreate-dashboard () "Recreate the dashboard" -- cgit v1.2.1