I know I can use the function org-content to fold all my outlines to specific levels when I'm in org-mode. That means:

  1. Using (org-content 1) will fold all my org outlines to the first level
  2. Using (org-content 2) will fold all my org outlines until the second level
  3. Using (org-content 3) will fold all my org outlines until the third level

That works fine. However, I want to do exactly the same thing in the outline-minor-mode instead of the org-mode. My outlines are defined as:

(defvar my-outline-regexp-alist
  '((emacs-lisp-mode . "\\s-*;;\\*+")
    (js2-mode        . "\\s-*//\\*+")
    (web-mode        . "\\s-*//\\*+")
    (java-mode       . "\\s-*//\\*+")
    (c-mode          . "\\s-*//\\*+")
    (python-mode     . "\\s-*##\\*+")
    (sh-mode         . "\\s-*##\\*+")))

The complete configuration can be found on this other emacs exchange answer. I haven't found any built-in outline function that substitutes the function org-content. The function outline-hide-sublevels is apparently the equivalent to the org-content, but if I execute (outline-hide-sublevels 1) for example it doesn't work as the (org-content 1) does in org-mode.

Is there any built-in function I can use in outline-minor-mode that will work as the org-content function? If not, is there any workaround for that?

1 Answer 1


This functionality is provided by outline-hide-sublevels but you have to fix your outline-regexp. Try e.g. with an emacs-lisp-mode outline-regexp of ;;;*.

  • That's not working in my case... I said in my question that I've tried using (outline-hide-sublevels 1) but it doesn't work at all... I only see ... at my first outline when I use it, and even the headings of my outlines are not shown. I'm not sure if it's a conflict with the way I'm configuring my outlines. But the function outline-hide-sublevels is not doing what it should be doing in my case.
    – raylight
    Apr 30, 2023 at 19:05
  • Ah sorry, I notice now that I did not read that part. Anyway, when I replace my emacs-lisp outline-regexp with the version from your alist, indeed the function doesn't work. Try again with the following emacs-lisp outline-regexp ;;;;* (or with the default emacs-lisp outline-regexp when starting from emacs -q). I guess, similarly, your other 'outline-regexp' break the outline-hide-sublevels functionality. Apr 30, 2023 at 19:24

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.