bug#81632: 31.0.91; outline-view-change-hook is marked obsolete, without an adequate replacement

Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
The hook `outline-view-change-hook' was deprecated in 29.1 in commit
53b1e6f96cb03a461061e1e21cd185dd8a82ce6b. However there does not seem to
exist an adequate replacement. Sometimes there is a need to run some
code when folding or unfolding sections of a buffer.

For instance the new `markdown-ts-mode' has this comment and code:

    ;; NOTE: `outline-view-change-hook' was obsoleted in 29.1 (commit
    ;; 53b1e6f96cb) on the grounds that only lazy-lock used it, but no
    ;; replacement was provided and outline.el itself still runs the hook
    ;; in 10+ places.
    (with-suppressed-warnings ((obsolete outline-view-change-hook))
      (add-hook 'outline-view-change-hook
                #'markdown-ts--outline-view-change nil t))

Would it make sense to revert the deprecation or offer an alternative
API to monitor folding and unfolding? Thanks!

In GNU Emacs 31.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.4) of 2026-08-16
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure --prefix=$HOME/.local/share/emacs-install
 --without-compress-install --with-tree-sitter=ifavailable
 --with-native-compilation --with-dbus --without-selinux
 --without-threads --disable-gc-mark-trace --without-gsettings
 --without-gpm --with-cairo --with-cairo-xcb --with-xinput2
 --with-x-toolkit=gtk3 --without-toolkit-scroll-bars 'CFLAGS=-O3
 -mtune=native -march=native''

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSYSTEMD
LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 TIFF TREE_SITTER WEBP X11 XCOMPOSITE XDBE XFIXES XIM
XINERAMA XINPUT2 XPM XRANDR XRENDER XSHAPE XSYNC GTK3 ZLIB
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.