[Top][All Lists]

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

Re: [O] [bug] org-cycle changed behavior in orgstruct-mode

From: Rasmus
Subject: Re: [O] [bug] org-cycle changed behavior in orgstruct-mode
Date: Sun, 30 Aug 2015 20:22:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)


Nicolas Goaziou <address@hidden> writes:

>> I tried to add show-children, and NOT have org-show-children in the setup
>> but alas it doesn't change the situation.  But anyway it's called through
>> `org-cycle', in my use-case at least.  This in turn rely on at least
>> org-cycle-internal-local which in turn uses org-show-children.
> Then `org-cycle-internal-local' could use something like:
>   (if (derived-mode-p 'org-mode) #'org-show-children #'show-children)
> This would require a comment in the code. This is a small leak but as
> long as we don't have a clear (non broken) design for orgstruct, I think
> we cannot do much.

Do you mean to change org-cycle-internal-local as in this patch or to make
a hook around it?  Maybe the exception should be if orgstruct is detected
rather than if org is not detected.

>> So maybe the easiest way to "fix" this is to advice orgstruct to redirect
>> call?  Maybe add-function :around... We can rely on nadvice in master,
>> right?
> Actually, we can't. "nadvice.el" was introduced in 24.4. AFAIK master
> still supports release 24.3.

OK.  If we can pollute org-cycle-internal-local it doesn't matter.
Otherwise I can write an "old-style" advice.


History is what should never happen again
>From 1dcad907938450d0c718aa6f79a1a363ed6d72cd Mon Sep 17 00:00:00 2001
From: Rasmus <address@hidden>
Date: Sun, 30 Aug 2015 20:16:28 +0200
Subject: [PATCH] org.el: Only call org-show-children from org-mode

* org.el (org-cycle-internal-local): Only call org-show-children in

orgstruct-mode does not behave nicely when using org-show-children as
opposed to show-children.
 lisp/org.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 82c42c2..49e4e53 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6902,7 +6902,11 @@ in special contexts.
       (if (org-at-item-p)
          (org-list-set-item-visibility (point-at-bol) struct 'children)
-       (org-with-limited-levels (org-show-children))
+       (org-with-limited-levels
+        ;; `orgstruct-mode' does not work well with
+        ;; `org-show-children'.  Thus, use `show-children' unless in
+        ;; org-mode.
+        (if (derived-mode-p 'org-mode) (org-show-children) (show-children)))
        ;; FIXME: This slows down the func way too much.
        ;; How keep drawers hidden in subtree anyway?
        ;; (when (memq 'org-cycle-hide-drawers org-cycle-hook)

reply via email to

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