lang/org: make org-bullets respect org-hide
This commit is contained in:
parent
0d53c3cbc7
commit
694e3c4e28
1 changed files with 26 additions and 2 deletions
|
@ -367,6 +367,30 @@
|
||||||
(org-remove-occur-highlights)))
|
(org-remove-occur-highlights)))
|
||||||
(advice-add #'evil-force-normal-state :before #'+org*remove-occur-highlights)
|
(advice-add #'evil-force-normal-state :before #'+org*remove-occur-highlights)
|
||||||
|
|
||||||
;; Don't reset org-hide!
|
(after! org-bullets
|
||||||
(advice-add #'org-find-invisible-foreground :override #'ignore))
|
(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)))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue