From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [bug] org-cycle changed behavior in orgstruct-mode Date: Sun, 30 Aug 2015 20:22:03 +0200 Message-ID: <87vbbwbpro.fsf@gmx.us> References: <87fv3q2lxs.fsf@gmx.us> <878u9ic8sv.fsf@nicolasgoaziou.fr> <87zj1y0zst.fsf@gmx.us> <87614l95p7.fsf@nicolasgoaziou.fr> <877fodpzn0.fsf@gmx.us> <8737z145bo.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW7FI-0001jX-9d for emacs-orgmode@gnu.org; Sun, 30 Aug 2015 14:22:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZW7FE-00005Q-CT for emacs-orgmode@gnu.org; Sun, 30 Aug 2015 14:22:24 -0400 Received: from plane.gmane.org ([80.91.229.3]:57020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW7FE-00005H-5w for emacs-orgmode@gnu.org; Sun, 30 Aug 2015 14:22:20 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZW7F8-000123-Dq for emacs-orgmode@gnu.org; Sun, 30 Aug 2015 20:22:14 +0200 Received: from 46.165.251.155 ([46.165.251.155]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 30 Aug 2015 20:22:14 +0200 Received: from rasmus by 46.165.251.155 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 30 Aug 2015 20:22:14 +0200 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: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi, Nicolas Goaziou 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. Rasmus -- History is what should never happen again --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org.el-Only-call-org-show-children-from-org-mode.patch >From 1dcad907938450d0c718aa6f79a1a363ed6d72cd Mon Sep 17 00:00:00 2001 From: Rasmus 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 org-mode. 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-show-entry) - (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) -- 2.5.1 --=-=-=--