什么是我的.emacs中的自定义变量和面孔?

时间:2011-02-19 16:46:16

标签: emacs dot-emacs emacs-faces

这是我的.emacs,我可以把它搞乱吗?

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(better-fringes-bitmap ((t (:foreground "#00dd44"))))
 '(font-lock-string-face ((((class color) (min-colors 88) (background light)) (:foreground "#113355")))))

到目前为止,我正在添加我想要的所有内容......

3 个答案:

答案 0 :(得分:50)

这些块由customize接口添加,正如Noufal指出的那样。但是,如果您愿意,可以将它们移动到单独的文件中。

只需将其添加到~/.emacs.d/init.el

即可
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)

或者,如果您仍在使用old-fashioned ~/.emacs文件:

(setq custom-file "~/.custom.el")
(load custom-file)

答案 1 :(得分:11)

使用customise系统时,这些是添加到文件中的行。它们是在您使用customize-*时生成的。默认情况下,自定义选项存储在.emacs文件中。您通常不会手动编辑这些。您必须使用customize-*命令对其进行编辑。

答案 2 :(得分:8)

不要手动向这些行添加任何内容 - 您的更改将在某些事件上被emacs消失。而是使用customize-set-variable添加自定义变量,使用set-face-attribute添加自定义面:

(customize-set-variable 'blink-cursor-mode nil)
(set-face-attribute 'default nil :family "DejaVu Sans Mono")

为了自定义一些包的面,有时需要首先请求包,然后设置它的面:

(require 'mumamo)
(set-face-attribute 'mumamo-background-chunk-major nil :background nil)