仅突出显示"*",而不是org-mode,emacs中的整个标题行

ryr*_*yrd 5 emacs themes org-mode

我怎样才能突出显示*星,而不是整个标题行,以保持文本颜色相同?在伟大的emacs组织模式

多谢你们


例子(用#替换*,因为在堆栈溢出时不能加粗*)

(不在下面)

#heading text

这是文本正文

(但在下面)

# 标题文本

这是文本正文

law*_*ist 7

更新的答案

请参阅变量org-level-color-stars-only,其中包含一个文档字符串,其中指出:" 非零值表示仅标注每个标题中的星号.当为零时,整个标题都会显示出来.更改它需要重新启动`font-lock-mode'才能生效也在已经完成的地区. "

用法:  (setq org-level-color-stars-only t)


上一个答案

您可以根据需要移除或添加星星 - 此示例一起使用两(2)颗星.如果你只做一颗星,那么它也会影响两颗星(2颗星和三颗星).也许我们的论坛本地regexp专家可以请给我们一个明星的代码(但不超过一颗星):)

(defvar bumble-bee (make-face 'bumble-bee))

(set-face-attribute 'bumble-bee nil :background "black" :foreground "yellow")

(font-lock-add-keywords 'org-mode (list

    (list (concat "\\*\\*")
        '(0 bumble-bee t))

   ))
Run Code Online (Sandbox Code Playgroud)

它们控制着任务的标题 - 您可以将它们设置为相同或使它们不同.任何你不想要的东西,只需设置nil或设置为与常规字体相同的颜色.

(custom-set-faces

  '(org-level-1 ((t (:foreground "orange" :bold t))))

  '(org-level-2 ((t (:foreground "black" :bold t))))

  '(org-level-3 ((t (:foreground "pink" :bold t))))

  '(org-level-4 ((t (:foreground "cyan" :bold t))))

  )
Run Code Online (Sandbox Code Playgroud)

第一行的其他组成部分通常是: org-tag; org-tag-faces; org-todo-keyword-faces; org-priority-faces; 并且org-warning:

(setq org-todo-keyword-faces '(
  ("Active" . (:foreground "red"))
  ("Next Action" . (:foreground "ForestGreen"))
  ("Reference" . (:foreground "purple"))
  ("Someday" . (:foreground "gray65"))
  ("None" . (:foreground "green"))
  ("Delegated" . (:foreground "cyan")) ))

(setq org-tag-faces '(
  ("TODO" . org-warning)
  ))

(setq org-priority-faces '(
  (?A . (:foreground "firebrick" :weight bold))
  (?B . (:foreground "orange"))
  (?C . (:foreground "green"))
  (?D . (:foreground "purple"))
  (?E . (:foreground "blue")) ))

(custom-set-faces
  '(org-tag ((t (:background "gray97" :foreground "gray50"
    :box (:line-width 1 :color "black") :weight regular))))
  '(org-warning ((t (:foreground "black"))))
  )
Run Code Online (Sandbox Code Playgroud)