Emacs颜色和字体混乱问题

4

我是一名使用Emacs已有26年历史的用户,从TECO Emacs到GNU Emacs 23.4 for MacOS X。我可以开发Lisp宏并且通常能够找到解决方法。

Emacs已经变得非常大,也非常花哨。

有没有简单的方法来确保Emacs永远不改变字体大小或颜色?

3个回答

2

Emacs有一些高亮显示并不受font-lock-mode控制。

这里是Juri Linkov在2007年发布在Emacs Dev邮件列表中的解决方案

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
您可以在 .emacs 文件中添加以下行来关闭所有字体颜色和其他修饰效果:
(global-font-lock-mode 0)

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即可。 它会自动选择当前的面孔。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接