Emacs颜色和字体混乱

时间:2013-09-26 19:10:42

标签: emacs elisp

我很长一段时间(26年)Emacs用户,从TECO Emacs一直到GNU Emacs 23.4 for MacOS X.我可以破解Lisp宏并且经常找到我的方式。

Emacs变得非常大。非常丰富多彩。

有没有一种简单的方法可以确保Emacs永远不会改变字体大小或颜色?

3 个答案:

答案 0 :(得分:2)

您可以使用.emacs中的以下行关闭所有字体颜色和其他装饰:

(global-font-lock-mode 0)

答案 1 :(得分:2)

Emacs有一些不受font-lock-mode控制的突出显示。

这是Juri Linkov在2007年发布到Emacs Dev邮件列表的solution

I use the following trick to post-process faces immediately after they
get created.  I also modified this code to not reset mode line faces:

(defun my-faces-fix (&optional frame)
  "Fix defined faces."
  (interactive)
  ;; Check if this function is called by `custom-define-hook' from
  ;; `custom-declare-face' where the variable `face' is bound locally.
  (when (boundp 'face)
    (dolist (face (face-list))
      (unless (memq face '(mode-line mode-line-highlight mode-line-inactive))
        ;; Reset all face attributes
        (modify-face face)))))

;; 1. Fix existing faces
(let ((face t)) (my-faces-fix))

;; 2. Call `my-faces-fix' every time some new face gets defined
(add-to-list 'custom-define-hook 'my-faces-fix)

答案 2 :(得分:1)

这是我两年来一直在使用的东西:

(custom-set-faces
 '(default ((t (:inherit nil :height 113 :family "DejaVu Sans Mono"))))
 '(font-lock-builtin-face ((nil (:foreground "#7F0055" :weight bold))))
 '(font-lock-keyword-face ((nil (:foreground "#7F0055" :weight bold))))
 '(font-lock-comment-face ((nil (:foreground "#3F7F5F"))))
 '(font-lock-string-face ((nil (:foreground "#2A00FF"))))
 '(font-lock-type-face ((t (:underline t :slant italic :foreground "#000000"))))
 '(font-lock-constant-face ((t (:foreground "#110099"))))
 '(font-lock-variable-name-face ((nil nil)))
 '(font-lock-function-name-face ((t (:weight bold)))))

您也可以自定义一堆其他面孔: 只需调用 M-x customize-face。它会自动选择 当前的面孔。