emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [patch] Prevent inlinetasks right after a headline from breaking cycling-behaviour
@ 2012-02-11 15:49 Marc-Oliver Ihm
  2012-02-13 10:23 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Marc-Oliver Ihm @ 2012-02-11 15:49 UTC (permalink / raw)
  To: public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2071 bytes --]

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 #2: org.el.diff --]
[-- Type: text/x-patch, Size: 486 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
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.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] Prevent inlinetasks right after a headline from breaking cycling-behaviour
  2012-02-11 15:49 [patch] Prevent inlinetasks right after a headline from breaking cycling-behaviour Marc-Oliver Ihm
@ 2012-02-13 10:23 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2012-02-13 10:23 UTC (permalink / raw)
  To: Marc-Oliver Ihm; +Cc: emacs-orgmode, public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw

Hello,

> 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.

Thank you for your patch. I've applied it with a slight modification.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-13 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-11 15:49 [patch] Prevent inlinetasks right after a headline from breaking cycling-behaviour Marc-Oliver Ihm
2012-02-13 10:23 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).