diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 9e0aa9963..78659cb89 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -367,6 +367,30 @@ (org-remove-occur-highlights))) (advice-add #'evil-force-normal-state :before #'+org*remove-occur-highlights) - ;; Don't reset org-hide! - (advice-add #'org-find-invisible-foreground :override #'ignore)) + (after! org-bullets + (define-minor-mode org-bullets-mode + "Modified version of `org-bullets-mode' that respects the `org-hide' face." + nil nil nil + (let* ((keyword + `((,org-outline-regexp-bol + (0 (let ((level (- (match-end 0) (match-beginning 0) 1))) + (compose-region (- (match-end 0) 2) + (- (match-end 0) 1) + (org-bullets-level-char level)) + (when (facep org-bullets-face-name) + (put-text-property (- (match-end 0) 2) + (- (match-end 0) 1) + 'face org-bullets-face-name)) + (put-text-property (match-beginning 0) (match-end 0) + 'keymap org-bullets-bullet-map) + nil)))))) + (if org-bullets-mode + (progn (font-lock-add-keywords nil keyword) + (font-lock-fontify-buffer)) + (save-excursion + (goto-char (point-min)) + (font-lock-remove-keywords nil keyword) + (while (re-search-forward org-outline-regexp-bol nil t) + (decompose-region (match-beginning 0) (match-end 0))) + (font-lock-fontify-buffer)))))))