Subject: bug#78673: outline-revert-buffer-restore-visibility modifies visibility

From: Stefan Monnier <[email-masked]>
Date: Mon, 02 Jun 2025 14:13:02 -0400

Package: Emacs
Version: 31.0.50

While playing in bug#78665 I noticed the following bug:

    src/emacs -Q lisp/transient.el -f outline-minor-mode
    M-: (hide-sublevels 1000) RET
    M-: (funcall (outline-revert-buffer-restore-visibility)) RET

Notice that after the first `M-:` all the definitions' first lines are
visible (and their bodies are hidden), whereas after the second `M-:`
only the `;;;` headings are visible and none of the actual code.
This seems to be due to the design of this save&restore code which
presumes that all the hiding is applied always to whole subtrees.

        Stefan