From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc-Oliver Ihm Subject: [patch] Prevent inlinetasks right after a headline from breaking cycling-behaviour Date: Sat, 11 Feb 2012 16:49:37 +0100 Message-ID: <4F368E11.7040205@online.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030908000600000701020602" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwFCr-00045X-2b for emacs-orgmode@gnu.org; Sat, 11 Feb 2012 10:49:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwFCp-000376-Ve for emacs-orgmode@gnu.org; Sat, 11 Feb 2012 10:49:44 -0500 Received: from moutng.kundenserver.de ([212.227.126.171]:52025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwFCp-000370-GS for emacs-orgmode@gnu.org; Sat, 11 Feb 2012 10:49:43 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@plane.gmane.org, emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------030908000600000701020602 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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. --------------030908000600000701020602 Content-Type: text/x-patch; name="org.el.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="org.el.diff" 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. --------------030908000600000701020602--