2

When I use hs-hide-level, it only hides code blocks at at the current level, but leaves comment blocks at the same level open. For example, if I take the following un-folded code:

top level code {
    /* Level 2
     * Multi-line
     * Comment
     */
    level 2 code block {
        Code inside
        level 2
        block
    }
}

And I use the hs-hide-level inside the top-level block, I will get

top level code {
    /* Level 2
     * Multi-line
     * Comment
     */
    level 2 code block { ... }
}

but I want

top level code {
    /* Level 2 ... 
    level 2 code block {...}
}
Spevak
  • 55
  • 5

2 Answers2

1

This does not answer your question directly, but it might help nevertheless.

You can use library hide-comnt.el to hide only comments. The description is here.

You can hide comments interactively or using Lisp macro with-comments-hidden. The effect of both is controlled by option ignore-comments-flag, which gives you additional control over the behavior.

Command hide/show-comments acts on the active region, or the whole buffer if the region is not active.

Drew
  • 29,895
  • 7
  • 74
  • 104
1

I don't know if this feature only appeared since the question was asked, but there is the option hs-hide-comments-when-hiding-all, which according to the documentation does this:

Hide the comments too when you do an hs-hide-all.

quazgar
  • 4,304
  • 2
  • 29
  • 41