|
@@ -319,14 +319,31 @@ If the task has an end part, also demote it."
|
|
|
(org-cycle-hide-drawers 'children))
|
|
|
(t (outline-flag-region start end t)))))
|
|
|
|
|
|
+(defun org-inlinetask-hide-tasks (state)
|
|
|
+ "Hide inline tasks in buffer when STATE is `contents' or `children'.
|
|
|
+This function is meant to be used in `org-cycle-hook'."
|
|
|
+ (case state
|
|
|
+ (contents
|
|
|
+ (let ((regexp (org-inlinetask-outline-regexp)))
|
|
|
+ (save-excursion
|
|
|
+ (goto-char (point-min))
|
|
|
+ (while (re-search-forward regexp nil t)
|
|
|
+ (org-inlinetask-toggle-visibility)
|
|
|
+ (org-inlinetask-goto-end)))))
|
|
|
+ (children
|
|
|
+ (save-excursion
|
|
|
+ (while (and (outline-next-heading) (org-inlinetask-at-task-p))
|
|
|
+ (org-inlinetask-toggle-visibility)
|
|
|
+ (org-inlinetask-goto-end))))))
|
|
|
+
|
|
|
(defun org-inlinetask-remove-END-maybe ()
|
|
|
"Remove an END line when present."
|
|
|
(when (looking-at (format "\\([ \t]*\n\\)*\\*\\{%d,\\}[ \t]+END[ \t]*$"
|
|
|
org-inlinetask-min-level))
|
|
|
(replace-match "")))
|
|
|
|
|
|
-(eval-after-load "org"
|
|
|
- '(add-hook 'org-font-lock-hook 'org-inlinetask-fontify))
|
|
|
+(add-hook 'org-font-lock-hook 'org-inlinetask-fontify)
|
|
|
+(add-hook 'org-cycle-hook 'org-inlinetask-hide-tasks)
|
|
|
|
|
|
(provide 'org-inlinetask)
|
|
|
|