summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-09-22 11:02:34 +0200
committerBastien Guerry <bzg@altern.org>2012-09-22 11:02:34 +0200
commit59f9e22dda26067caee0bda380f6d1259ed70101 (patch)
treebd6107aade86b121533c37c755a5c25ac3e63388
parent5d62f26fbc942944ed3fe4b554c29db15f50c036 (diff)
downloadorg-mode-59f9e22dda26067caee0bda380f6d1259ed70101.tar.gz
org.el: Add a new function to `org-cycle-hook' to hide inline tasks from the 'contents view
* org.el (org-cycle-hide-inline-tasks): New function to hide inline tasks when cycling. (org-cycle-hook): Use the new function. Thanks to Christopher Witte for triggering this and to Carsten for suggesting this change.
-rw-r--r--lisp/org.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el
index ddac8ff..f30ba3f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -970,6 +970,7 @@ the values `folded', `children', or `subtree'."
(defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers
+ org-cycle-hide-inline-tasks
org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
"Hook that is run after `org-cycle' has changed the buffer visibility.
@@ -6788,6 +6789,13 @@ open and agenda-wise Org files."
(while (re-search-forward org-drawer-regexp end t)
(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))))
+
(defun org-flag-drawer (flag)
"When FLAG is non-nil, hide the drawer we are within.
Otherwise make it visible."