[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master dd1aa62642: * lisp/outline.el: Optimize performance of S-TAB (bug
From: |
Juri Linkov |
Subject: |
master dd1aa62642: * lisp/outline.el: Optimize performance of S-TAB (bug#57813) |
Date: |
Fri, 16 Sep 2022 12:16:46 -0400 (EDT) |
branch: master
commit dd1aa62642e9c121c783b4973c1289d409d915ef
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/outline.el: Optimize performance of S-TAB (bug#57813)
(outline-hide-subtree): Don't call outline--insert-close-button, because
it's handled by outline--fix-up-all-buttons called from outline-flag-region.
(outline-show-subtree): Don't call outline--insert-open-button, same reason.
(outline--fix-up-all-buttons): Check invisible outlines explicitly instead
of
using slow outline--cycle-state.
---
lisp/outline.el | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/lisp/outline.el b/lisp/outline.el
index 8281f24291..25ef1616b9 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -986,8 +986,6 @@ If non-nil, EVENT should be a mouse event."
(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)
@@ -1052,12 +1050,12 @@ If non-nil, EVENT should be a mouse event."
(setq from (line-beginning-position))))
(outline-map-region
(lambda ()
- ;; `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")
@@ -1080,8 +1078,6 @@ If non-nil, EVENT should be a mouse event."
(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")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master dd1aa62642: * lisp/outline.el: Optimize performance of S-TAB (bug#57813),
Juri Linkov <=