1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-29 11:02:33 +00:00

New option to stop level nine headline to use level 1 face

* lisp/org-faces.el (org-cycle-level-faces): New option.
* lisp/org.el (org-get-level-face): Honor org-cycle-level-faces

Original patch by Jonathan BISSON, modified by Carsten Dominik
This commit is contained in:
Carsten Dominik 2010-11-12 13:37:38 -06:00
parent 42dd7afe45
commit 1f40cbc596
2 changed files with 20 additions and 8 deletions

View File

@ -685,6 +685,15 @@ If it is less than 8, the level-1 face gets re-used for level N+1 etc."
:type 'integer :type 'integer
:group 'org-faces) :group 'org-faces)
(defcustom org-cycle-level-faces t
"Non-nil means level styles cycle after level `org-n-level-faces'.
Then so level org-n-level-faces+1 is styled like level 1.
If nil, then all levels >=org-n-level-faces are styled like
level org-n-level-faces"
:group 'org-appearance
:group 'org-faces
:type 'boolean)
(defface org-latex-and-export-specials (defface org-latex-and-export-specials
(let ((font (cond ((assq :inherit custom-face-attributes) (let ((font (cond ((assq :inherit custom-face-attributes)
'(:inherit underline)) '(:inherit underline))

View File

@ -5581,14 +5581,17 @@ needs to be inserted at a specific position in the font-lock sequence.")
(defvar org-l nil) (defvar org-l nil)
(defvar org-f nil) (defvar org-f nil)
(defun org-get-level-face (n) (defun org-get-level-face (n)
"Get the right face for match N in font-lock matching of headlines." "Get the right face for match N in font-lock matching of headlines."
(setq org-l (- (match-end 2) (match-beginning 1) 1)) (setq org-l (- (match-end 2) (match-beginning 1) 1))
(if org-odd-levels-only (setq org-l (1+ (/ org-l 2)))) (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
(setq org-f (nth (% (1- org-l) org-n-level-faces) org-level-faces)) (if org-cycle-level-faces
(cond (setq org-f (nth (% (1- org-l) org-n-level-faces) org-level-faces))
((eq n 1) (if org-hide-leading-stars 'org-hide org-f)) (setq org-f (nth (1- (min org-l org-n-level-faces)) org-level-faces)))
((eq n 2) org-f) (cond
(t (if org-level-color-stars-only nil org-f)))) ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
((eq n 2) org-f)
(t (if org-level-color-stars-only nil org-f))))
(defun org-get-todo-face (kwd) (defun org-get-todo-face (kwd)
"Get the right face for a TODO keyword KWD. "Get the right face for a TODO keyword KWD.