diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index d2dc28d..ba2b05c 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2023.0911.210345 +;; Version: 2023.0918.233520 ;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-bullets org-edna diminish all-the-icons olivetti form-feed org-pretty-table ob-async) ;; This program is free software; you can redistribute it and/or modify @@ -48,6 +48,7 @@ (require 'org-habit) (require 'org-protocol) (require 'org-roam) +(require 'range) (require 'subr-x) (require 'yasnippet) @@ -282,6 +283,17 @@ located at the start of the line." tags)) org-tag-faces)) +(defun oni-org-generate-priority-faces () + "Create faces for all the priorities in the current buffer." + (let (new-faces) + (range-map + (lambda (x) (push (cons x (oni-org-color-for x)) new-faces)) + (cons (min org-priority-highest + org-priority-lowest) + (max org-priority-lowest + org-priority-highest))) + new-faces)) + (defun oni-org-set-todo-keyword-faces () "Set ‘org-todo-keyword-faces’ to all different colors." (setq org-todo-keyword-faces (oni-org-generate-todo-keyword-faces))) @@ -291,6 +303,11 @@ located at the start of the line." (setq org-tag-faces (oni-org-generate-tag-faces)) (org-set-tag-faces 'org-tag-faces org-tag-faces)) +(defun oni-org-set-priority-faces () + "Set ‘org-priority-faces’ to all different colors." + (setq org-priority-faces + (map-merge 'alist org-priority-faces (oni-org-generate-priority-faces)))) + ;;;###autoload(autoload 'oni-hydra-org/body "oni-org") (defhydra oni-hydra-org (:color teal :hint nil) " @@ -521,6 +538,7 @@ also move point to the start of the heading." (add-hook 'before-save-hook #'oni-org-update-all-dblocks-live) (add-hook 'org-mode-hook #'oni-org-set-tag-faces) (add-hook 'org-mode-hook #'oni-org-set-todo-keyword-faces) +(add-hook 'org-mode-hook #'oni-org-set-priority-faces) (add-hook 'org-mode-hook #'oni-org-set-yasnippet-condition) (add-hook 'org-mode-hook 'electric-pair-local-mode) (add-hook 'org-mode-hook 'electric-quote-local-mode)