Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(defun use-theme (theme &optional no-confirm no-enable)
(intern (completing-read "Load custom theme: "
(mapcar 'symbol-name
nil nil))
(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 ()
;; 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))))))

Thanks for this -- use-theme is great! It's really nice not having color theme artifacts after switching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment