what I want to achieve
++2d habit not accomplished yesterday, I don't want it shown in today's agenda
view but shown in tomorrow's and 2 days after tomorrow's and so forth.
what I tried
(defun my/several-day-habit-and-not-due-today () "only work for today's habit list" (interactive) (let ((time (my/floor-time-to-date (org-time-string-to-time (org-entry-get nil "SCHEDULED")))) (repeater (org-get-repeat))) (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" repeater) (let ((repeater-type (match-string 1 repeater)) (day (string-to-number (match-string 2 repeater))) (what (match-string 3 repeater)) (today (my/floor-time-to-date))) (when (and (equal what "d") (< day 5)) (while (time-less-p time today) (setq time (time-add time (* day 60 60 24)))) (time-less-p today time))))) (defun my/org-is-habit-p (&optional pom) "Is the task at POM or point a habit?" (and (string= "habit" (org-entry-get (or pom (point)) "STYLE" t)) (not (my/several-day-habit-and-not-due-today)) ;will show in ordinary agenda )) (advice-add 'org-is-habit-p :override 'my/org-is-habit-p)
This way filtered it out as a habit, but it will show as a normal entry in agnda view.