开发者

Change Emacs color theme based on extension of open file

开发者 https://www.devze.com 2023-02-22 10:10 出处:网络
emacs have differen开发者_如何学Got color theme; I can chose one when it starts up by setting the right color theme in my .emacs file or change it later using M-x.

emacs have differen开发者_如何学Got color theme; I can chose one when it starts up by setting the right color theme in my .emacs file or change it later using M-x.

But I want to let emacs chose the color theme automatically when I open a file.

For example, when the open file is a *.py, use color theme A, but when the open file is a *.c file, use color theme B.

Could i do it? Does it require lisp programming? (I have no skill in lisp programming.)

Any ideas?


 (defun c-mode-theme-hook ()
  (require 'color-theme)
  (color-theme-initialize)
  (color-theme-gray30))

 (add-hook 'c-mode-hook
   'c-mode-theme-hook)

Something like this code should add gray30 color theme when Emacs enters c-mode. You might have to write these things for each mode you want a color-theme.

So, you could do it. It does not require lisp programming.

0

精彩评论

暂无评论...
验证码 换一张
取 消