Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

only highlight "*", not the entire heading line in org-mode, emacs

How can I only highlight the * star, not the entire heading line, to keep texts in same color? In the great emacs org-mode

thanks guys


excample (replace * by #, for cann't bold * in stack-overflow)

(not below)

# heading text

this is text body

(but below)

# heading text

this is text body

like image 311
ryrd Avatar asked Sep 03 '13 01:09

ryrd


People also ask

How do I enable Org Mode in Emacs?

Emacs does not actually understand you are editing an Org document, yet. To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document.

Is org mode built in Emacs?

Org is included in GNU Emacs. If you already have Emacs installed, you can start using org-mode right away!

What is ORG mode doom Emacs?

Org is a system for writing plain text notes with syntax highlighting, code execution, task scheduling, agenda management, and many more. The whole idea is that you can write notes and mix them with references to things like articles, images, and example code combined with the output of that code after it is executed.

What does Org mode do?

Org mode is routinely used to build and manage complex workflows. It does this using an elegantly simple syntax that scales from basic markup to full LaTeX typesetting and from plain text notes to literate programs. Everything you need to get started is demonstrated in the example.


1 Answers

Updated Answer

See the variable org-level-color-stars-only, which contains a doc-string that states: "Non-nil means fontify only the stars in each headline. When nil, the entire headline is fontified. Changing it requires restart of `font-lock-mode' to become effective also in regions already fontified."

USAGE:  (setq org-level-color-stars-only t)


Previous Answer

You can remove or add stars as you see fit -- this example uses two (2) stars together. If you do just one star, then that would also affect two (2) and three (3) stars together. Maybe one of our forum local regexp experts could please give us the code for one star (but not more than one star) :)

(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))

   ))

These control the title of tasks -- you could set them all the same or make them different. Anything you don't want, just set to nil or set to the same color as whatever your regular font is.

(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))))

  )

The other components of the first line are usually: org-tag; org-tag-faces; org-todo-keyword-faces; org-priority-faces; and 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"))))
  )
like image 107
lawlist Avatar answered Nov 30 '22 11:11

lawlist