emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: [bug] org-cycle changed behavior in orgstruct-mode
Date: Sun, 30 Aug 2015 20:22:03 +0200	[thread overview]
Message-ID: <87vbbwbpro.fsf@gmx.us> (raw)
In-Reply-To: 8737z145bo.fsf@nicolasgoaziou.fr

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

Hi,

Nicolas Goaziou <mail@nicolasgoaziou.fr> 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Only-call-org-show-children-from-org-mode.patch --]
[-- Type: text/x-diff, Size: 1163 bytes --]

From 1dcad907938450d0c718aa6f79a1a363ed6d72cd Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
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


  reply	other threads:[~2015-08-30 18:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11  9:50 [bug] org-cycle changed behavior in orgstruct-mode Rasmus
2015-08-11 12:24 ` Nicolas Goaziou
2015-08-11 12:34   ` Rasmus
2015-08-11 12:45     ` Nicolas Goaziou
2015-08-11 13:31       ` Rasmus
2015-08-14 15:53         ` Nicolas Goaziou
2015-08-16  9:10           ` Rasmus
2015-08-11 15:59     ` Nicolas Goaziou
2015-08-29 21:12       ` Rasmus
2015-08-30  7:13         ` Nicolas Goaziou
2015-08-30 18:22           ` Rasmus [this message]
2015-08-30 19:26             ` Nicolas Goaziou
2015-08-30 19:39               ` Rasmus
2015-08-30 19:56                 ` Nicolas Goaziou
2015-08-31  7:53                   ` Rasmus
2015-09-13 11:21                   ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vbbwbpro.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).