Created
January 12, 2013 03:11
-
-
Save benhsu/4515857 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun use-theme (theme &optional no-confirm no-enable) | |
(interactive | |
(list | |
(intern (completing-read "Load custom theme: " | |
(mapcar 'symbol-name | |
(custom-available-themes)))) | |
nil nil)) | |
(progn | |
(dolist (curtheme (custom-available-themes)) | |
(disable-theme curtheme)) | |
(setq used-theme theme) | |
;; todo add to mode line | |
(load-theme theme))) | |
(defun following(n l) | |
(if (eq n (car l)) (car (cdr l)) (following n (cdr l)))) | |
(defun cycle-theme () | |
(interactive) | |
(progn | |
;; hack: append car of list to list to allow it to cycle | |
(let ((hacktheme (append (custom-available-themes) (list (car (custom-available-themes)))))) | |
(use-theme (following used-theme hacktheme))) | |
;; yuck! I'm still learning mode-line-format. important thing is appending (list (symbol-name used-theme)) to the end | |
(setq mode-line-format (append '( " =^..^=" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification " " mode-line-position | |
(vc-mode vc-mode) | |
" " mode-line-modes mode-line-misc-info mode-line-end-spaces) (list (symbol-name used-theme)))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this --
use-theme
is great! It's really nice not having color theme artifacts after switching.