summaryrefslogtreecommitdiffstats
path: root/.emacs.d/site-lisp
diff options
context:
space:
mode:
authorGravatar Tom Willemse2014-02-24 23:16:12 +0100
committerGravatar Tom Willemse2014-02-24 23:16:12 +0100
commite1cb8353421d573c404975c3a752a17f251fc9dc (patch)
tree320d05547837c47a14d586764968414ddfcd3ca0 /.emacs.d/site-lisp
parentaa0aae52f4026eb265ce4b19e241e002aa9381ae (diff)
downloademacs-e1cb8353421d573c404975c3a752a17f251fc9dc.tar.gz
emacs-e1cb8353421d573c404975c3a752a17f251fc9dc.zip
Programmatically generate colors for todo and tags
Diffstat (limited to '.emacs.d/site-lisp')
-rw-r--r--.emacs.d/site-lisp/org-init.el37
1 files changed, 24 insertions, 13 deletions
diff --git a/.emacs.d/site-lisp/org-init.el b/.emacs.d/site-lisp/org-init.el
index 4ca88bd..a65321d 100644
--- a/.emacs.d/site-lisp/org-init.el
+++ b/.emacs.d/site-lisp/org-init.el
@@ -37,14 +37,22 @@
(autoload 'org-clocking-p "org-clock")
-(eval-after-load "org-crypt"
- '(org-crypt-use-before-save-magic))
+(with-eval-after-load 'org-crypt
+ (org-crypt-use-before-save-magic))
(defun tagify (str)
"Remove dots, replace - with _ in STR."
(replace-regexp-in-string
"-" "_" (replace-regexp-in-string "\\." "" (downcase str))))
+(defun oni:color-for (object)
+ "Generate a hex color by taking the first 6 characters of OBJECT's MD5 sum."
+ (format "#%s" (substring (md5 object) 0 6)))
+
+(defun oni:org-colors-for (names)
+ "Create an alist for NAMES with corresponding colors."
+ (mapcar (lambda (name) (cons name (oni:color-for name))) names))
+
(defun oni:note-template ()
(concat
"* %<%c>\n"
@@ -139,17 +147,20 @@
(setq org-tags-column (- 70))
(setq org-tags-exclude-from-inheritance '("crypt"))
(setq org-todo-keyword-faces
- '(("TODO" 'font-lock-constant-face)
- ("HOLD" 'font-lock-keyword-face)
- ("WIP" 'font-lock-variable-name-face)
- ("REVIEW" 'font-lock-builtin-face)
- ("DONE" 'font-lock-function-name-face)
- ("CANCELLED" 'font-lock-comment-face)
- ("FAILED" 'font-lock-type-face)
- ("ACQUIRE" 'font-lock-constant-face)
- ("IGNORED" 'font-lock-comment-face)
- ("COMMENT" 'font-lock-comment-delimiter-face)
- ("GOT" 'font-lock-function-name-face)))
+ (oni:org-colors-for '("TODO" "WIP" "DONE" "CANCELLED" "FAILED"
+ "ACQUIRE" "IGNORED" "COMMENT" "GOT")))
+(setq org-tag-faces
+ (oni:org-colors-for '("aethon" "noexport" "tv" "myaethon2"
+ "dailies" "ex" "maintenance" "housework"
+ "cdispass" "clark" "emacsd" "eye_on_manga"
+ "kaarvok" "silbot" "myaethon" "hypo"
+ "unconfirmed" "gitto" "urxvt_modeline"
+ "scrumli" "clark_conkeror"
+ "git_auto_commit_mode" "mode_icons"
+ "dispassel" "hypo_emacs" "hypo_cli"
+ "conkeror" "transient_navigation" "pkgbuilds"
+ "edocs" "cask" "fiplr" "avandu"
+ "gitolite_admin" "yoshi_theme" "dvdroid")))
(setq org-use-fast-todo-selection t)
(setq org-agenda-skip-function-global 'org-init-skip-tags)
(setq org-use-property-inheritance '("slug"))