Subject: bug#57813: Icon images are non-functional

From: Juri Linkov <[email-masked]>
Date: Thu, 15 Sep 2022 19:36:52 +0300

>> So I tried this with 'C-h b', but images are displayed as black boxes.
>>
>> PS: "right.svg" exists in etc/images/right.svg.
>
> Fixed now in 471414fe6b.

S-TAB is so slow that it takes several seconds on etc/NEWS.
Here is an attempt to optimize it, so that it's almost
instantaneous:

diff --git a/lisp/outline.el b/lisp/outline.el
index b19e0cf811..ff6eebcd1b 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -982,8 +989,6 @@ outline-hide-subtree
   (interactive (list last-nonmenu-event))
   (when (mouse-event-p event)
     (mouse-set-point event))
-  (when (outline--use-buttons-p)
-    (outline--insert-close-button))
   (outline-flag-subtree t))
 
 (defun outline--make-button-overlay (type)
@@ -1051,9 +1056,12 @@ outline--fix-up-all-buttons
        ;; `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)))
+       (if (save-excursion
+             (outline-end-of-heading)
+             (seq-some (lambda (o) (eq (overlay-get o 'invisible) 'outline))
+                       (overlays-at (point))))
+           (outline--insert-close-button)
+         (outline--insert-open-button)))
      (or from (point-min)) (or to (point-max)))))
 
 (define-obsolete-function-alias 'hide-subtree #'outline-hide-subtree "25.1")
@@ -1076,8 +1084,6 @@ outline-show-subtree
   (interactive (list last-nonmenu-event))
   (when (mouse-event-p event)
     (mouse-set-point event))
-  (when (outline--use-buttons-p)
-    (outline--insert-open-button))
   (outline-flag-subtree nil))
 
 (define-obsolete-function-alias 'show-subtree #'outline-show-subtree "25.1")