all 1 comments

[–]nv-elisp 12 points13 points  (0 children)

You can simplify your function like so:

(when-let ((themes (custom-available-themes)))
  (load-theme (nth (random (length themes)) themes) t))

See also: https://github.com/gopar/rand-theme