1

How can I customize emacs to use a different theme based on major mode or file-type? And, could it work to have different themes active in different windows?

My use case would be: have (1) one general them for code and stuff and (2) one special theme (leuven) for org-mode only.

0

A theme is mostly a set of variable names and values. Enabling a theme means setting each variable to its correspond value in the theme. The variables are changed globally, i.e., for every buffer, window and frame. As a result, you can't have different windows with different themes.

Something you can do though is to have a different font for org-mode. For example, you could use variable pitch:

(add-hook 'org-mode-hook (lambda () (variable-pitch-mode t)))

Another solution is to have separate Emacs processes (i.e., you start Emacs twice, once for programming, once for org-mode). This can be done (untested) by setting a variable from the command line:

emacs --eval="(setq my/for-org t)"

And then, your init file could select the theme based on that:

(when (bound-and-true-p my/for-org) (load-them 'leuven))
  • ok, so a command line argument to start emacs with different config files then? – NeuronQ Jun 1 '18 at 7:11
  • I've edited my answer – Damien Cassou Jun 4 '18 at 8:36
  • please mark the answer as correct if you are satisfied. – Damien Cassou Jul 19 '18 at 9:11
  • sorry, forgot to do that :) thx! – NeuronQ Jul 21 '18 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.