Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs disable-theme after loading a different one (themes conflict)

Tags:

emacs

On Emacs 24.3.1 if I M-X load-theme and load another theme, it often interferes with my current theme instead of replacing it, giving a very ugly result colour-wise.

An example is here, where the solarized-light and wombat themes are conflicting:

solarized-light and wombad conflict

I solve this by doing a M-X disable-theme of the old theme, is there a cleaner way to solve this?

like image 873
Mike Vella Avatar asked Mar 19 '23 23:03

Mike Vella


1 Answers

Disabling first the active theme certainly helps.

If you add this to your init.el:

(defun disable-all-themes ()
  "disable all active themes."
  (dolist (i custom-enabled-themes)
    (disable-theme i)))

(defadvice load-theme (before disable-themes-first activate)
  (disable-all-themes))

the function load-theme will first disable the active themes, before loading the new one.

like image 77
martin Avatar answered Apr 27 '23 19:04

martin