I\'ve been using the default theme with about 10 faces changed via
custom-set-faces
for a while now. But from time to time I want to
try out a couple of the custom
Others have mentioned ways to try to work around the problem. I'll just point out that there is, so far, an inherent problem with Emacs custom themes, in terms of trying to "undo" them and get back to a previous, possibly customized but not custom-themed state.
Particularly if you want to do this non-interactively, e.g., in the code for a command that lets users try themes out but also lets them cancel (e.g. C-g
) and return to the previous state, before theming.
You can disable all themes that were ever enabled in the session, but that will not return your session to its state before the themes were enabled. Disabling a theme is, in effect, only relative to other themes, not to an uncustomized state or (especially) to other, non-theme customizations.
See also:
(Oh, and FWIW, color themes, which were presumably the inspiration for Emacs custom themes, do not have this problem. And they work fine with all Emacs versions, including the latest. They have different limitations from custom themes, however. It would be good for the custom theme implementation to be fixed/completed, so custom themes can completely replace color themes.)
I have something like this in my emacs config to change themes:
(defun zenburn ()
"Activate zenburn theme."
(interactive)
(setq dark-theme t)
;; disable other themes before setting this theme
(disable-theme 'soft-stone)
(disable-theme 'leuven)
(load-theme 'zenburn t))
This is like a year after the original, but just solved a similar problem by M-x customize-face
then entering default
.
Customize Face: Default
will give you a GUI with options for things like font, foreground and background colors, etc.
Go to the top area marked Operate on all settings in this buffer:
and click on Revert
and in the dropdown, Erase Customizations
.
Finally, reload/evaluate your .emacs
or init.el
file.
This worked for me, while trying to manually disable (almost all) themes and float around .el files hadn't.
Adding another answer here since you don't necessarily know the current theme:
This removes all custom themes.
(dolist (theme custom-enabled-themes)
(disable-theme theme))
It seems that disable-theme
does what you want.
UPDATE
Here is one way to get the 'default theme template'
1) Disable any additional theme (using disable-theme
)
2) Invoke the command customize-create-theme
it will open a customize interface, which lists all the default faces, which you can customize and create your own theme
If the customize-create-theme
is called with theme name it will list all the faces that are set by the theme.