org-inlinetask: Hide inline tasks in 'children visibility state
authorJonas Hoersch <coroa@online.de>
Wed, 30 Oct 2013 14:39:33 +0000 (15:39 +0100)
committerNicolas Goaziou <n.goaziou@gmail.com>
Wed, 6 Nov 2013 15:51:56 +0000 (16:51 +0100)
* lisp/org.el (org-cycle-hide-inline-tasks): Re-hide inline tasks when
  switching to 'children visibility state.

TINYCHANGE

lisp/org.el

index 2b5e3d0..7042d69 100644 (file)
@@ -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.