From c2aebcee273b23185bb0263013e2ea9f683b6032 Mon Sep 17 00:00:00 2001 From: Bastien Date: Wed, 29 Jan 2020 21:39:52 +0100 Subject: [PATCH] org.el: Fix bug about visibility cycling * lisp/org.el (org-cycle-internal-local): When cycling visibility on a subtree, don't take a list has a child. These two subtrees should cycle the same way: * A subtree A Paragraph. * A subtree - A list. Before the fix, the second subtree would cycle through three steps instead of two. Thanks to Samuel Wales for reporting this. --- lisp/org.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 00d93d6a7..768216cf4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6403,13 +6403,11 @@ Use `\\[org-edit-special]' to edit table.el tables")) (setq eos (save-excursion (org-end-of-subtree t t) (when (bolp) (backward-char)) (point))) (setq has-children - (or (save-excursion - (let ((level (funcall outline-level))) - (outline-next-heading) - (and (org-at-heading-p t) - (> (funcall outline-level) level)))) - (save-excursion - (org-list-search-forward (org-item-beginning-re) eos t))))) + (save-excursion + (let ((level (funcall outline-level))) + (outline-next-heading) + (and (org-at-heading-p t) + (> (funcall outline-level) level)))))) ;; Determine end invisible part of buffer (EOL) (beginning-of-line 2) (while (and (not (eobp)) ;This is like `next-line'.