Reputation: 1646
I know that you can do
M-x load-theme RET
and get a list of available themes for auto-complete, of which you could select one.
What I'm looking for, is a way to get this list of themes through Emacs LISP, so that I can cycle through it with a custom key-binding, without having to look at all the available themes and switch to one manually.
Upvotes: 2
Views: 5029
Reputation: 224691
The function custom-available-themes
should give you the list of themes.
I did not know this “off the top of my head”, but Emacs is a fairly discoverable system once one is comfortable digging about in the Emacs Lisp code. Here is how I found this answer:
Started a non-customized instance of Emacs:
% emacs -q
I wanted to make sure none of my normal customizations (installed packages, et cetera) would interfere with my investigation.
Since the list is available during autocomplete after M-x load-theme RET
, I started with that function:
C-h f load-theme RET
Switched to the *Help*
buffer and hit Enter on the link to the definition of load-theme
in custom.el
.
Scanned the definition of load-theme
to see if it was arranging a custom completion handler. Its (interactive …)
form uses the function completing-read
, giving it the output of this form:
(mapcar 'symbol-name (custom-available-themes))
A quick C-h f RET
on custom-availabe-themes
verified that this is the source of the list of available themes.
Upvotes: 7