I'd like to use hs-minor-mode is some buffers that are not related code editing, but still includes some structured data which I'd like to fold.

For instance, in eshell I run a program with some debug output in JSON and it would be neat if I could collapse it to focus on specific fields, in regular code buffer I can do that, but for eshell it says that it "doesn't support Hideshow Minor Mode".

Is there any way to direct it with some syntax hints or maybe there are some smaller building blocks in Emacs to make my customized Hideshow for such cases?

1 Answer 1


There are two variables that could help you, which you can set when starting an eshell buffer:

(add-hook 'eshell-mode-hook #'outline-minor-mode)
(add-hook 'eshell-mode-hook
            (lambda () (setq-local page-delimiter eshell-prompt-regexp
                              outline-regexp eshell-prompt-regexp)))

With outline-regexp you can fold/unfold commands where each prompt serves as a 'heading'.

By setting the page delimiter to your prompt regexp, you can easily browse between different command outputs or easily narrow to a 'page' (C-x n p)

  • This is something I can work with, thanks! I guess it's not suitable for things like folding key inside {yeet: 1337, key: { ... } } in one line, right?
    – fevgenym
    Jan 14, 2023 at 21:59

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.