In org mode in Doom Emacs, i am used, that i am just cycling through the next heading and close it right after that.

But in vanilla Emacs, I am cycling through three stages (for whatever reason). How can i avoid this in vanilla Emacs?

Or is there a "close only the heading of this subtree" function?

For example, let the file be:

* test1
** test2

In Doom Emacs, it shows

* test1 ...

pressing tab shows

* test1

pressing tab should now close it again:

* test1...

instead in vanilla Emacs it shows

* test1
** test2
  • 1
    It's not clear to me what you want. In particular, Org mode IS in vanilla emacs, so I don't understand the difference between your first and second paragraph. Is the buffer in the second case not an Org mode buffer? Maybe you can provide a more detailed example and say exactly what the buffer contains and what you are doing in each case.
    – NickD
    Commented Mar 17, 2023 at 13:51
  • @NickD I provided an example, thank you for pointing that out.
    – David
    Commented Mar 17, 2023 at 16:38
  • 1
    But you are still contrasting "Org mode" vs "vanilla Emacs" which does not make sense. Are you talking about "Doom Emacs" vs "vanilla Emacs" as the answer below surmises?
    – NickD
    Commented Mar 17, 2023 at 18:49

1 Answer 1


This is not a solution to your problem but rather a referral to one, which I suspect would do what you want. If the non-vanilla version of Emacs you used to use before was Doom Emacs, then, in Doom Emacs, the behaviour of the org-cycle bound to TAB has been changed by adding a hook called +org-cycle-only-current-subtree-h to org-tab-first-hook. This function is located in https://github.com/doomemacs/doomemacs/blob/master/modules/lang/org/autoload/org.el You can just copy paste it from there.

The hook is applied as in the following code snippet from Doom Emacs, I have removed a few irrelevant things from it:

 (add-hook 'org-tab-first-hook
           ;; Only fold the current tree, rather than recursively

Please NOTE, I haven't tested this in any way!

  • Works perfectly.
    – David
    Commented Mar 17, 2023 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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