From 2a3c8f3d2e8a9b58c8b6c93168096ed096bcc5d6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 15 Nov 2021 07:38:07 +0100 Subject: [PATCH] Fix outline-cycle-buffer issue in `C-h b' buffers * lisp/outline.el (outline--fix-up-all-buttons): Fix issue when called after collapsing a buffer (bug#51855). --- lisp/outline.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/outline.el b/lisp/outline.el index cefb8117035..9a2e4324b22 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -1014,7 +1014,10 @@ If non-nil, EVENT should be a mouse event." (when outline-minor-mode-use-buttons (outline-map-region (lambda () - (if (eq (outline--cycle-state) 'show-all) + ;; `outline--cycle-state' will fail if we're in a totally + ;; collapsed buffer -- but in that case, we're not in a + ;; `show-all' situation. + (if (eq (ignore-errors (outline--cycle-state)) 'show-all) (outline--insert-open-button) (outline--insert-close-button))) (or from (point-min)) (or to (point-max))))) -- 2.39.2