You may use per-buffer-theme.el
. For example you could start with a setup like this:
(require 'per-buffer-theme)
(setq per-buffer-theme/use-timer t)
(setq per-buffer-theme/timer-idle-delay 0.1)
(setq per-buffer-theme/default-theme 'notheme)
(setq per-buffer-theme/themes-alist
'(((:theme . dichromacy)
(:buffernames nil)
(:modes haskell-mode
haskell-interactive-mode)))) ; Is this the mode the Haskell REPL in Emacs uses? I'm not sure.
In my testing it has worked best with per-buffer-theme/use-timer
set to non-nil. Also, you may want to tell per-buffer-theme
to avoid changing themes for some buffers (say, Help buffers). You can do it with the per-buffer-theme/ignored-buffernames-regex
variable:
(setq per-buffer-theme/ignored-buffernames-regex
(append ido-ignore-buffers '("*Completions*" "*Help*" "*info*" "*Warnings*")
per-buffer-theme/ignored-buffernames-regex))
This question had been asked on Stack Overflow a few years ago: Different color themes per mode in Emacs. There are other approaches there but notice that most answers are old and better solutions could have come up since then.
change-major-mode-hook
for major modes, and for minor modes just using its own mode hook), but from my reading that's not remotely what you want. Emacs maintains an arbitrary number of buffers, each of which can have different modes to any others, and switching buffers does not "exit" any of the modes which are active in the buffer you started in -- so reacting to mode changes doesn't help you with your problem.haskell-mode
buffers (possibly along with certain other particular modes) to look different to other buffers. Try elaborating on that requirement, and what you would like to change specifically.