1

Is there an org function or combination of such that will hide all content but keep the currently visible headings visible? That is, something like org-content but which does not show currently invisible headings.

  • I don't use Org, but just looking at the Org menu-bar menu, submenu Show/Hide it seems like something like Cycle Global Visibility (<backtab>) might do what you want. – Drew May 23 at 13:50
  • @Drew org-cycle does not help much since it also changes the visibility of the headings. OP: "...but which does not show currently invisible headings". – Tobias May 24 at 11:10
2

outline-hide-body hides all text that does not belong to a headline below the first headline.

Is there an org function or combination of such that will hide all content but keep the currently visible headings visible?

If you do not have text before the first headline outline-hide-body does exactly what you want.


You can use the following function to hide or reveal the text before the first headline.

(defun outline-hide-preamble (&optional show)
  "Hide preamble, i.e., text before the first header.
   Show the preamble with non-nil SHOW.
   Interactively, use prefix arg to reveal the preamble."
  (interactive "P")
  (save-excursion
    (org-with-wide-buffer
     (goto-char (point-min))
     (unless (looking-at outline-regexp)
       (outline-next-heading)
       (outline-flag-region (point-min) (1- (point)) (null show))))))
  • great, thanks! but how do i get the preamble back? (should it perhaps be preamble rather than prefix?) – Toothrot May 24 at 22:34
  • @Toothrot outline-show-all really shows all inclusively the preamble. BTW I am open for suggestions. Changed prefix to preamble. – Tobias May 24 at 23:17
  • @Toothrot I have changed outline-hide-preamble such that it reveals the preamble if it is called with prefix arg. – Tobias May 24 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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