【问题标题】:Change the color of the characters in whitespace-mode [closed]在空白模式下更改字符的颜色[关闭]
【发布时间】:2013-04-11 10:14:19
【问题描述】:

我最近从 Geany 迁移到 Emacs,我想自定义 Emacs 中的空白字符,使其看起来像 Geany 中的那样。

在 Geany 中,这些点很小且呈灰色:

在 Emacs 中,点更大且更白:

我发现 Geany 中的点在眼睛上要轻得多。

解决方案

在我从我的 .emacs 文件中评论 (setq whitespace-style (quote (spaces tabs newline space-mark tab-mark newline-mark))) 后问题解决了:

;; make whitespace-mode use just basic coloring
;;(setq whitespace-style (quote (spaces tabs newline space-mark tab-mark newline-mark)))
(setq whitespace-display-mappings
  ;; all numbers are Unicode codepoint in decimal. ⁖ (insert-char 182 1)
  '(
    (space-mark 32 [183] [46]) ; 32 SPACE 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
    (newline-mark 10 [182 10]) ; 10 LINE FEED
    (tab-mark 9 [9655 9] [92 9]) ; 9 TAB, 9655 WHITE RIGHT-POINTING TRIANGLE 「▷」
    ))

空白字符现在看起来完全符合预期。

【问题讨论】:

  • 您可以将face 添加到whitespace-style 列表中,而不是评论该行。

标签: emacs colors whitespace


【解决方案1】:

试试 M-x customize-face RET whitespace-space RET

(可能从gray30 左右的前景色开始,然后从那里调整。)

在 elisp 中,类似于:

(set-face-attribute 'whitespace-space nil :background nil :foreground "gray30")

(可能有一个比您正在使用的更小的点,但我不知道那会是什么。)

【讨论】:

  • 感谢您的帮助。不幸的是, M-x customize-face RET whitespace-space RET 和颜色设置为浅灰色不会改变任何东西。这些点仍然显示为纯白色。
  • @Mathieu:确定一下,您在更改颜色后是否点击了“应用”按钮?
  • @phils,我已经编辑了我的问题以考虑您的观点。看起来空白面与点的颜色无关。
  • 我怀疑您使用的颜色主题以某种方式发生冲突,因为这应该在默认配置中工作(使用emacs -Q 测试)。但是,如果您将光标放在一个空格上(在您当前的配置中)并输入C-u C-x =,您应该能够看到正在使用哪些面孔(如果看起来合理,可以自定义它们)。
  • 法律列表:您可以在 cmets 中使用 `[,escape] 反引号。带有反斜杠的前缀。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-08-03
  • 2017-02-01
  • 1970-01-01
  • 1970-01-01
  • 2023-02-09
  • 2020-10-11
  • 1970-01-01
相关资源
最近更新 更多