Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.83 KB | None | 0 0
  1. (defun my-set-theme-on-mode ()
  2.   (let* ((mode (cond
  3.                 ((memq major-mode '(clojure-mode clojurescript-mode))
  4.                  'zenburn)
  5.                 ((memq major-mode '(elisp-mode emacs-lisp-mode))
  6.                  'dracula)
  7.                 ((memq major-mode '(python-mode octave-mode))
  8.                  'solarized-dark)
  9.                 ((memq major-mode '(org-mode))
  10.                  'nord))))
  11.     (when mode
  12.       (load-theme mode))))
  13.  
  14. (defadvice switch-to-buffer (after activate)
  15.   (when buffer-file-name (my-set-theme-on-mode)))
  16. (defadvice other-window (after other-window-now activate)
  17.   (when buffer-file-name (my-set-theme-on-mode)))
  18. (defadvice other-frame (after other-frame-now activate)
  19.   (when buffer-file-name (my-set-theme-on-mode)))
  20.  
  21. (add-hook 'after-change-major-mode-hook 'my-set-theme-on-mode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement