public
Created

  • Download Gist
explore-theme.el
Emacs Lisp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
(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))))))

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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.