summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2020-01-25 19:23:34 +0100
committerBastien <bzg@gnu.org>2020-01-25 19:23:34 +0100
commit32f00fe90e7c0c5abdd765a6898e267c0c4ff8eb (patch)
tree6ab270b813e4512674fcdb1fd10b8c5650382000
parentea6349d671be70f235e971cb5cf7114a1825bd22 (diff)
downloadorg-mode-32f00fe90e7c0c5abdd765a6898e267c0c4ff8eb.tar.gz
org.el: Remove variables, small refactoring
* lisp/org.el (org-get-level-face): Remove variables, small refactoring. Thanks to Jorge P. de Morais Neto for pointing to this.
-rw-r--r--lisp/org.el21
1 files changed, 9 insertions, 12 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 062d6cb..bb6cc81 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5837,20 +5837,17 @@ needs to be inserted at a specific position in the font-lock sequence.")
(org-font-lock-ensure)
(buffer-string))))
-(defvar org-m nil)
-(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))
- (when 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 (unless org-level-color-stars-only org-f))))
+ (let* ((org-l0 (- (match-end 2) (match-beginning 1) 1))
+ (org-l (when org-odd-levels-only (1+ (/ org-l0 2)) org-l0))
+ (org-f (if org-cycle-level-faces
+ (nth (% (1- org-l) org-n-level-faces) org-level-faces)
+ (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 (unless org-level-color-stars-only org-f)))))
(defun org-face-from-face-or-color (context inherit face-or-color)
"Create a face list that inherits INHERIT, but sets the foreground color.