怎样让这段配置只对prog-mode生效?

我想单独设置代码的关键字字体,但是在custom-set-faces 里面加的话会影响到别的地方比如这个dashboard

但是我又想在代码中体验这种感觉

你可以给 dashboard 另外设置 face

emmmm .不太懂具体怎么做

找出 dashboard 的代码,centaur 的 dashboard 应该是从 spacemacs 抄的,我就以 spacemacs 为例。

找到用 font-lock-keyword-face 的地方,把 font-lock-keyword-face 換成自己定义的 face。

(widget-create 'push-button
                 :help-echo "Read some RSS."
                 :action (lambda (&rest _)
                           (newsticker-show-news))
                 :mouse-face 'highlight
                 :follow-link "\C-m"
                 (propertize "Newsticker" 'face 'font-lock-keyword-face))

比如,

(defface dashboard-face
  '((((class color) (min-colors 88) (background light))
     :background "darkseagreen2")))

centaur 的是用了all-the-icons的 好像跟spacemacs的不一样

找到办法了,可以自动移dashboard-navigator的face 配合use-package的话就是这样]

  (use-package dashboard
    :diminish dashboard-mode
    :functions (all-the-icons-faicon
                all-the-icons-material
                winner-undo
                widget-forward)
    :custom-face (dashboard-heading ((t (:inherit (font-lock-string-face bold)))))
    :custom-face (dashboard-navigator ((t (:inherit (font-lock-string-face bold))))))