diff options
| author | Blake Romero <blake@developercraft.com> | 2025-10-15 19:45:35 +0100 |
|---|---|---|
| committer | Blake Romero <blake@developercraft.com> | 2025-10-15 19:45:35 +0100 |
| commit | 5bb60baed6217df1c7f30de6659d834173854fa0 (patch) | |
| tree | 49b09cbf974bb4e2a8adbead2fd5fc3d31784b6c | |
| parent | bbb9e2ed8b7f5a1017c466280d02ca57cb65be74 (diff) | |
Propertize categories in agenda view
| -rw-r--r-- | emacs-config.org | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/emacs-config.org b/emacs-config.org index 13f5d9c..0b3bb7d 100644 --- a/emacs-config.org +++ b/emacs-config.org @@ -872,6 +872,36 @@ Set time grid. "⏰" "——————————————————————————————")) #+end_src +Procedure to colour categories in agenda. +#+begin_src elisp + (defvar +category-faces '(("Task" . "tan") + ("Rcur" . "MediumPurple") + ("Evnt" . "orchid") + ("Hbit" . "MediumSeaGreen") + ("Proj" . "DeepSkyBlue") + ("Work" . "indianred")) + "Category labels and colours that will be displayed in \\[org-agenda].") + + (defun +propertize-face (regexp attributes) + "Propertise REGEXP with a list of face ATTRIBUTES." + (interactive) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (add-text-properties + (match-beginning 1) (match-end 0) `(face (,@attributes)))))) + + (defun +org-agenda-propertize-category () + "Propertise `+category-faces' in buffer." + (dolist (category +category-faces) + (let ((name (car category)) + (fg (cdr category))) + (+propertize-face (format "^\\s_\\W+\\(%s\\)" name) + `(:foreground ,fg))))) + + (add-hook 'org-agenda-finalize-hook + #'+org-agenda-propertize-category) +#+end_src **** Org Agenda Commands Command to view to personal planner. #+begin_src elisp @@ -1039,6 +1069,7 @@ Command to review the weekend. (org-agenda-start-day "saturday"))) org-agenda-custom-commands) #+end_src + *** Org Clock-table Define a custom clocktable formatter function for ~+org-clocktable-format~. #+begin_src elisp |
