Browse Source

org-inlinetask: Hide inline tasks in 'children visibility state

* lisp/org.el (org-cycle-hide-inline-tasks): Re-hide inline tasks when
  switching to 'children visibility state.

TINYCHANGE
Jonas Hoersch 4 years ago
parent
commit
4c04c13a18
1 changed files with 13 additions and 5 deletions
  1. 13 5
      lisp/org.el

+ 13 - 5
lisp/org.el

@@ -7071,11 +7071,19 @@ open and agenda-wise Org files."
 	  (org-flag-drawer t))))))
 
 (defun org-cycle-hide-inline-tasks (state)
-  "Re-hide inline task when switching to 'contents visibility state."
-  (when (and (eq state 'contents)
-	     (boundp 'org-inlinetask-min-level)
-	     org-inlinetask-min-level)
-    (hide-sublevels (1- org-inlinetask-min-level))))
+  "Re-hide inline tasks when switching to 'contents or 'children
+visibility state."
+  (case state
+    (contents
+     (when (org-bound-and-true-p org-inlinetask-min-level)
+       (hide-sublevels (1- org-inlinetask-min-level))))
+    (children
+     (when (featurep 'org-inlinetask)
+       (save-excursion
+	 (while (and (outline-next-heading)
+		     (org-inlinetask-at-task-p))
+	   (org-inlinetask-toggle-visibility)
+	   (org-inlinetask-goto-end)))))))
 
 (defun org-flag-drawer (flag)
   "When FLAG is non-nil, hide the drawer we are within.