From 1f40cbc59643e1404ebf80a23092e3efbf951c24 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 12 Nov 2010 13:37:38 -0600 Subject: [PATCH] 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 --- lisp/org-faces.el | 9 +++++++++ lisp/org.el | 19 +++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lisp/org-faces.el b/lisp/org-faces.el index e4e17f15c..ea98e592b 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -685,6 +685,15 @@ If it is less than 8, the level-1 face gets re-used for level N+1 etc." :type 'integer :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 (let ((font (cond ((assq :inherit custom-face-attributes) '(:inherit underline)) diff --git a/lisp/org.el b/lisp/org.el index d774a35c6..35fa462e2 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5581,14 +5581,17 @@ needs to be inserted at a specific position in the font-lock sequence.") (defvar org-l nil) (defvar org-f nil) (defun org-get-level-face (n) - "Get the right face for match N in font-lock matching of headlines." - (setq org-l (- (match-end 2) (match-beginning 1) 1)) - (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)) - (cond - ((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)))) + "Get the right face for match N in font-lock matching of headlines." + (setq org-l (- (match-end 2) (match-beginning 1) 1)) + (if org-odd-levels-only (setq org-l (1+ (/ org-l 2)))) + (if org-cycle-level-faces + (setq org-f (nth (% (1- org-l) org-n-level-faces) org-level-faces)) + (setq org-f (nth (1- (min org-l org-n-level-faces)) org-level-faces))) + (cond + ((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) "Get the right face for a TODO keyword KWD. -- 2.11.4.GIT