Dynamically generate keyword and tag faces
This commit is contained in:
parent
ca219e2293
commit
6697d5af83
1 changed files with 29 additions and 23 deletions
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
(require 'org-habit)
|
(require 'org-habit)
|
||||||
(require 'org-crypt)
|
(require 'org-crypt)
|
||||||
|
(require 'subr-x)
|
||||||
|
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(require 'desktop)
|
(require 'desktop)
|
||||||
|
@ -133,6 +134,28 @@ predecessor if there is a non-DONE sibling defined before it."
|
||||||
(point))
|
(point))
|
||||||
(point-max)))
|
(point-max)))
|
||||||
|
|
||||||
|
(defun oni:org-generate-todo-keyword-faces ()
|
||||||
|
"Create faces for all todo keywords in the current buffer."
|
||||||
|
(when-let ((keywords (cl-remove-if (lambda (tag) (assoc tag org-todo-keyword-faces))
|
||||||
|
org-todo-keywords-1)))
|
||||||
|
(setq org-todo-keyword-faces
|
||||||
|
(append org-todo-keyword-faces
|
||||||
|
(mapcar (lambda (keyword)
|
||||||
|
(cons keyword (oni:color-for keyword)))
|
||||||
|
keywords)))))
|
||||||
|
|
||||||
|
(defun oni:org-generate-tag-faces ()
|
||||||
|
"Create faces for all tags in the current buffer."
|
||||||
|
(when-let ((tags (cl-remove-if (lambda (tag) (assoc (car tag) org-tag-faces))
|
||||||
|
(org-get-buffer-tags))))
|
||||||
|
(setq org-tag-faces
|
||||||
|
(append org-tag-faces
|
||||||
|
(mapcar (lambda (tag)
|
||||||
|
(let ((tag (car tag)))
|
||||||
|
(cons tag (oni:color-for tag))))
|
||||||
|
tags)))
|
||||||
|
(org-set-tag-faces 'org-tag-faces org-tag-faces)))
|
||||||
|
|
||||||
(defun org-init-skip-tags ()
|
(defun org-init-skip-tags ()
|
||||||
"Skip the \"ex\" and \"unconfirmed\" tags."
|
"Skip the \"ex\" and \"unconfirmed\" tags."
|
||||||
(let ((tags (org-get-tags-at (point))))
|
(let ((tags (org-get-tags-at (point))))
|
||||||
|
@ -230,29 +253,10 @@ predecessor if there is a non-DONE sibling defined before it."
|
||||||
(setq org-tags-column (- 70))
|
(setq org-tags-column (- 70))
|
||||||
(setq org-tags-exclude-from-inheritance '("crypt"))
|
(setq org-tags-exclude-from-inheritance '("crypt"))
|
||||||
(setq org-todo-keyword-faces
|
(setq org-todo-keyword-faces
|
||||||
(append '(("ADDED" . "#65a854")
|
'(("ADDED" . "#65a854")
|
||||||
("CHANGED" . "#8d995c")
|
("CHANGED" . "#8d995c")
|
||||||
("REMOVED" . "#a85454"))
|
("REMOVED" . "#a85454")))
|
||||||
(oni:org-colors-for '("TODO" "WIP" "DONE" "CANCELLED" "FAILED"
|
|
||||||
"ACQUIRE" "IGNORED" "COMMENT" "GOT"
|
|
||||||
"TOREAD" "READING" "READ"
|
|
||||||
"PLAY" "PLAYING" "PLAYED"
|
|
||||||
"LISTEN" "LISTENED"))))
|
|
||||||
(setq org-tag-faces
|
|
||||||
(oni:org-colors-for '("noexport" "tv" "dailies" "ex" "maintenance"
|
|
||||||
"housework" "cdispass" "clark" "emacsd"
|
|
||||||
"eye_on_manga" "kaarvok" "silbot" "hypo"
|
|
||||||
"unconfirmed" "gitto" "urxvt_modeline"
|
|
||||||
"scrumli" "clark_conkeror"
|
|
||||||
"git_auto_commit_mode" "mode_icons"
|
|
||||||
"dispassel" "hypo_emacs" "hypocli"
|
|
||||||
"conkeror" "transient_navigation" "pkgbuilds"
|
|
||||||
"edocs" "cask" "fiplr" "avandu"
|
|
||||||
"gitolite_admin" "yoshi_theme" "dvdroid"
|
|
||||||
"commit_check" "imsleepy" "indent_shift"
|
|
||||||
"work" "picturefix" "euler" "scss_imenu"
|
|
||||||
"bookmark" "blog" "shirtlobby"
|
|
||||||
"roterdamfestivals")))
|
|
||||||
(setq org-use-fast-todo-selection t)
|
(setq org-use-fast-todo-selection t)
|
||||||
(setq org-agenda-skip-function-global 'org-init-skip-tags)
|
(setq org-agenda-skip-function-global 'org-init-skip-tags)
|
||||||
(setq org-use-property-inheritance '("slug"))
|
(setq org-use-property-inheritance '("slug"))
|
||||||
|
@ -261,6 +265,8 @@ predecessor if there is a non-DONE sibling defined before it."
|
||||||
(setq org-insert-heading-respect-content t)
|
(setq org-insert-heading-respect-content t)
|
||||||
(setf (cdar org-blank-before-new-entry) t)
|
(setf (cdar org-blank-before-new-entry) t)
|
||||||
|
|
||||||
|
(add-hook 'org-mode-hook #'oni:org-generate-tag-faces)
|
||||||
|
(add-hook 'org-mode-hook #'oni:org-generate-todo-keyword-faces)
|
||||||
(add-hook 'org-agenda-mode-hook 'org-agenda-to-appt)
|
(add-hook 'org-agenda-mode-hook 'org-agenda-to-appt)
|
||||||
|
|
||||||
(add-to-list 'org-modules 'org-habit)
|
(add-to-list 'org-modules 'org-habit)
|
||||||
|
|
Loading…
Reference in a new issue