I'm having an issue when using (org-global-cycle) from a subheading followed by (org-cycle).

For example in the following org file:

* Level 1 Heading 1
** Level 2 Heading 1
** Level 2 Heading 2
*** Level 3 Heading 1

If the cursor is at *** Level 3 Heading 1{cursor here} and I hit S-<TAB> everything will fold up to * Level 1 Heading 1{cursor here}... properly. But the if I use <TAB> to view the level 2 headings I instead get:

* Level 1 Heading 1...
*** Level 3 Heading 1{cursor here}

Any clue what's going on? I'm running emacs.exe -q with Emacs 24.5.1 and org-mode 8.2.10 when I use -q and 8.3.6 when running with my config.

1 Answer 1


I can tell you what's going on, but it is not clear to me whether we should call it a bug or glitch. When you get the position of the cursor in the unfolded document (using (point)) you get 84. Now, when you use the global folding and everything folds to the first headline, your cursor may seem to be positioned at * Level 1 Heading 1{cursor here}, but you can test that the buffer position is still 84. So, the cursor is still positioned at the end of the level 3 headline. When you do an `(org-cycle), it just opens the contents under that headline (and the headline itself).

To prevent this behavior, you need to execute any action which has an influence on the cursor. E.g. moving it one space. Even executing the (point) statement to get the position will end up placing the cursor in the visible region, so the first execution in the above setup will return 84, the second invocation 20.

  • Thanks for the response, very helpful. I would say it's a bug because I can't think of any situation where that would be the desirable behavior, however I could certainly be overlooking something. I wrote a function that just calls (point) and calling that first does solve the problem. Is there a way to call this every time (org-cycle) is called? Or maybe is there a better way to handle this?
    – kfoley
    Sep 22, 2016 at 16:03
  • I think this is definitely a bug, and I think it's one I've experienced for a long time but haven't been able to put my finger on as you have. Maybe we should bring it up on the mailing list.
    – user3871
    Sep 22, 2016 at 22:22
  • @blujay I'm all for this but don't really have any experience working with the mailing list. If someone else is more comfortable submitting it (or pointing to some guidelines on how I can submit it) I'd be very appreciative.
    – kfoley
    Sep 23, 2016 at 13:37
  • Here's a thread discussing it: lists.gnu.org/archive/html/emacs-orgmode/2016-09/msg00386.html
    – user3871
    Sep 24, 2016 at 2:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.