emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [patch] Prevent inlinetasks right after a headline from breaking cyc


From: Marc-Oliver Ihm
Subject: [O] [patch] Prevent inlinetasks right after a headline from breaking cycling-behaviour
Date: Sat, 11 Feb 2012 16:49:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0

Hello all,

the very small patch appended fixes an oddity with inlinetasks and cycling.
Suppose you have required 'org-inlinetask and work on the following subtree:

* 1
*************** 5
*************** END
** 2
** 3
*** 4

which has an inlinetask "5" right after the toplevel heading "1" and before any 
of its children.

Now, if you fold this tree by pressing TAB you get:

* 1...

If you unfold it again by pressing TAB, you currently (latest git pull) get 
this:

* 1
*************** 5
*************** END
** 2
** 3
*** 4

i.e. the tree is completely unfolded !

I think this behaviour is a bug, because it collides with the documentation of 
org-cycle.
This documentation says, that pressing TAB once should only reveal the direct
children like this:

* 1
*************** 5
*************** END
** 2
** 3...

note, that the heading "4" is still invisible.

The attached patch fixes this bug and makes this example behave like expected 
from
the documentation.

This bug gets more annoying if you have larger and more deeply nested 
structures with
an inlinetask right after the firstlevel heading; in that case a single TAB 
opens the
whole tree, which makes navigation quite cumbersome.

The patch below corrects the function org-cycle-internal-local by simply seting 
the
variable outline-regexp to the value of org-outline-regexp for the call to 
show-children.
org-outline-regexp is already prepared to not match inline-tasks, so using its 
value here
avoids the problem. The patch is quite minimal and I did not see any 
side-effects.


with kind regards, Marc-Oliver Ihm



index 882a41c..7107984 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6302,7 +6302,7 @@ in special contexts.
       (if (org-at-item-p)
          (org-list-set-item-visibility (point-at-bol) struct 'children)
        (org-show-entry)
-       (show-children)
+       (let ((outline-regexp org-outline-regexp)) (show-children))
        (when (memq 'org-cycle-hide-drawers org-cycle-hook)
          (org-cycle-hide-drawers 'subtree))
        ;; Fold every list in subtree to top-level items.

Attachment: org.el.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]