为什么修改主题背景色不会改变?

如图, 这是我在 theme-gallery 看到的效果 image

而实际效果只有行号的部分变了

只有黑色背景的主题不受影响, 之前不是这样的, 也不记得做了这方面的修改…

  • 怎么修改的?

    代码 & 步骤

  • 如何不生效?

    • 修改当下不生效
    • 重启后失效
  • custom.el 中有无 theme 配置残余?

一般都是custom.el的锅


说到custom.el,怎么防止custom.el留下theme的残余啊?每次到要去custom文件手动删除。

第二张图用的是哪个字体?

Hermit

2 个赞

两种方式:

  1. 直接 package-install 安装后 load-theme 无效.
  2. 这种重启也无效
   dotspacemacs-themes '(
                         sanityinc-tomorrow-blue
                         monokai-alt
                         atom-one-dark
                         spacemacs-dark
                         spacemacs-light
                         )

老哥, 请问手动在哪删… 没看到这个文件啊

检查一下这个变量 custom-file

custom-file is a variable defined in ‘cus-edit.el’.
Its value is "/Users/mzy/.spacemacs.d/init.el"
Original value was nil

我在 init.el 里面并没有找到这个变量.

并不是要找这个变量。

这个变量custome-file的值是一个文件路径,这个文件路径存放着custom信息,信息大概是这种格式

(custom-set-variables
 '(package-selected-packages
   (quote
     ;; 你的package
    )))
(custom-set-faces
  )

如果你没有在配置文件中,显式给 custom-file赋值的话,会把上面这串代码写在你的init.el文件里面。

一般大家都在init.el写上这样一句话

(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(unless (file-exists-p custom-file)
  (write-region "" nil custom-file))

把它存在custom.el文件里面,以免让相关信息影响init.el文件

相关讨论见 Reddit: How to forbid emacs to touch configuration files

我把 init.el 里的 custom-set-variables 删掉了, 把那段代码放到了 user-init 方法里, 然后用重启的方式可以设置主题 奇怪的是, 之前好多自定义的东西, 即使删了也是生效的… 我不大明白这段代码的意思.

 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.

这串代码是由Custom自动生成的,最好别修改,More info:Custom,一般我都不碰这串代码,你的主题设置不了,我建议删掉这串代码,让emacs重新生成就可以,自己手动修改不太建议。

这段代码的意思是,当你启动customize系统的时候,执行customize-*,并且save了,会把数据保存在这串代码里,以便下次打开emacs使用,customize-themes也是如此。

Stack Overflow: custom.el 相关变量解释

原来如此, 不过我那样设置后 init.el 文件里再也不自动生成那段代码了. 好像没有任何影响…