org-habit: Preserve invisibility when inserting consistency graph

* lisp/org-habit.el (org-habit-insert-consistency-graphs): Inherit
'invisible text property of the habit line when the habit is hidden in
agenda.

Fixes https://orgmode.org/list/PAXPR06MB776069E9085C1CD606156493C6709@PAXPR06MB7760.eurprd06.prod.outlook.com
This commit is contained in:
Ihor Radchenko 2021-12-18 21:12:22 +08:00
parent 85aaa19908
commit 1778eb94c5
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -428,7 +428,8 @@ current time."
(save-excursion
(goto-char (if line (point-at-bol) (point-min)))
(while (not (eobp))
(let ((habit (get-text-property (point) 'org-habit-p)))
(let ((habit (get-text-property (point) 'org-habit-p))
(invisible-prop (get-text-property (point) 'invisible)))
(when habit
(move-to-column org-habit-graph-column t)
(delete-char (min (+ 1 org-habit-preceding-days
@ -439,7 +440,12 @@ current time."
habit
(time-subtract moment (days-to-time org-habit-preceding-days))
moment
(time-add moment (days-to-time org-habit-following-days))))))
(time-add moment (days-to-time org-habit-following-days))))
;; Inherit invisible state of hidden entries.
(when invisible-prop
(put-text-property
(- (point) org-habit-graph-column) (point)
'invisible invisible-prop))))
(forward-line)))))
(defun org-habit-toggle-habits ()