Subject: bug#51809: 29.0.50; [PATCH] Support for outline default state in Diff buffers

From: Matthias Meulien <[email-masked]>
Date: Sun, 26 Dec 2021 21:32:17 +0100

Matthias Meulien <[email-masked]> writes:

> There's a bug when used with diff-mode (where `outline-level' returns
> unexpected values), the starting point of that thread! I'll try to
> study this in the forthcoming days.

Fixed with (applied to the patch sent in reply to Eli's suggestions on
documentation):

diff --git a/lisp/outline.el b/lisp/outline.el
index ad45e38946..2dc9805b85 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1449,7 +1449,7 @@ outline--show-headings-up-to-level
         ;; Then unhide the top level headers.
         (outline-map-region
          (lambda ()
-             (let ((current-level (outline-level)))
+             (let ((current-level (funcall outline-level)))
 	       (when (< current-level level)
                  (outline-show-heading)
                  (outline-show-entry))

I am now back to the origin of this bug report (toggling visibility of
some diff hunks depending on long lines, chunks size, or file names) and
I see there's a major drawback with the outline mode default visibility
state approach: When outline minor mode is set through diff-mode-hook,
the buffer is emtpy and applying the default state visibility is a
no-op; It's a side-effect of the buffer content being generated
asynchronously...