After creating a custom fold, `+fold/open-all` no longer opens structured folds in the buffer

What happened?

I created a custom fold using zf (evil-vimish-fold/create). Subsequently zr (+fold/open-all) stopped opening structured folds.

What did you expect to happen?

I expected +fold/open-all (zr) to open all folds in the buffer, including structured ones.

Steps to reproduce

  1. Create a test file

    cat > /tmp/ <<XXX
    import this
    import that
    import the as other
    def foo():
    def bar():
  2. Doom sandbox seems to be broken, so use workaround to open test file in vanilla doom sandbox:

    DOOMDIR=/does/not/exist emacs /tmp/ &

  3. Verify that +fold/close-all and +fold/open-all close and open structured code (hideshow):

    • zm: observe the function definitions being folded
    • zr: observe the function definitions being unfolded
    • repeat the two above steps an arbitrary number of times: they continue to work.
  4. Create a custom fold (vimish-fold)


  5. Observe that zr no longer opens structured (hideshow) folds, only custom ones (vimish-fold):

    zr, zm, zr, zm … ad boredom

  6. Observe that C-c @ C-a does still open structured folds.

Note, this example happens to use Python, but the same problem occurs in at least Rust, elisp, C and C++ code/modes too.

System information

Loading data dump...
1 Like

I stumbled into this problem just today, glad someone has it documented. However, the special case you mention where you can still open/close I think offers a unique opportunity, that is, ‘zr’ now opens ALL vimish folds and we can bind eg. ‘zg’ for open all structured folds. Then, we can open ALL folds with ‘zrzg’ or ‘zgzr’

put the following line in ‘.doom.d/config.el’

(define-key evil-normal-state-map “zg” 'hs-show-all)

Even though it’s a hack I actually think its pretty useful, and not that much more cumbersome.

This topic was automatically closed after 360 days. New replies are no longer allowed.