Switching between color themes in Emacs ( < v.24)

时间秒杀一切 提交于 2019-12-10 04:12:12

问题


Update:

Note that this thread does not applyt o recent versions of Emacs (24+). Emacs now comes with it's own powerful color theming system (e.g. see a review here) that does not required loading the external package color-theme .


I have the following code snippet in my .emacs file, where I defined a few aliases that allow me to switch conveniently between a couple of color themes using short extended commands:

(require 'color-theme)            
(eval-after-load "color-theme"   
  '(progn                        
     (color-theme-initialize)    
     (color-theme-aalto-light))) 

;; Aliases to color-themes, e.g. 'M-x a' switches to color-theme-hober

(defalias 'a 'color-theme-hober)
(defalias 'b 'color-theme-aalto-light)

Now, when Emacs loads, it displays the color-theme-aalto-light theme properly, and, when I M-x a to change to color-theme-hober, that works too.

The problem is when I try to change the color theme back again to color-theme-aalto-light. Some color faces remain in the old color-theme while others are changed to the new color theme. I have tried with different color theme combinations with no luck (the color faces are not always fully updated, regardless of the color-themes I switch between). Any thoughts?


回答1:


This is a known bug in 'color-theme' package. If that feature is important for you, consider upgrading to trunk (future emacs-24.1), it natively supports changing themes (M-x customize-themes).




回答2:


colour themes are basically just functions, which assign new colours to certain faces. There is nothing special about them, especially faces are not reset before switching colour themes. If one colour theme A sets a colour for a certain face, and another B does not, then B will simply take over the colour defined by A for this face.

This is more or less by design, and there is nothing, you can do about, save modifying the colour themes to cover all defined faces (which is rather tedious, and also quite impossible, because any elisp library can define its own faces).



来源:https://stackoverflow.com/questions/4914014/switching-between-color-themes-in-emacs-v-24

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!