[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jinx 1be1a91c14 1/2: Remove org-fold code
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jinx 1be1a91c14 1/2: Remove org-fold code |
Date: |
Sun, 1 Dec 2024 09:59:00 -0500 (EST) |
branch: externals/jinx
commit 1be1a91c14031b0cf152c87f2cd5341559b2a1ec
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Remove org-fold code
This code has always been unacceptably slow. On reasonably new Emacs
versions,
Org defaults on `org-fold-core-style=overlays` such that the normal Isearch
unfolding code just works; and it is fast.
---
jinx.el | 47 +++++++++++++++--------------------------------
1 file changed, 15 insertions(+), 32 deletions(-)
diff --git a/jinx.el b/jinx.el
index 2247a87597..032097f6b3 100644
--- a/jinx.el
+++ b/jinx.el
@@ -636,42 +636,25 @@ If CHECK is non-nil, always check first."
(defun jinx--invisible-open-temporarily ()
"Temporarily open overlays which hide the current line.
See `isearch-open-necessary-overlays' and `isearch-open-overlay-temporary'."
- (if (and (derived-mode-p 'org-mode)
- (fboundp 'org-fold-show-set-visibility)
- (fboundp 'org-fold-core-get-regions)
- (fboundp 'org-fold-core-region))
- ;; New Org 9.6 fold-core API
- (let ((regions (delq nil (org-fold-core-get-regions
- :with-markers t :from (point-min) :to
(point-max)))))
- (let ((inhibit-redisplay t)) ;; HACK: Prevent flicker due to premature
redisplay
- (org-fold-show-set-visibility 'canonical))
- (list (lambda ()
- (cl-loop for (beg end spec) in regions do
- (org-fold-core-region beg end t spec)))))
- (let (restore)
- (dolist (ov (overlays-in (pos-bol) (pos-eol)))
- (let ((inv (overlay-get ov 'invisible)))
- (when (and (invisible-p inv) (overlay-get ov
'isearch-open-invisible))
- (push (if-let ((fun (overlay-get ov
'isearch-open-invisible-temporary)))
- (progn
- (funcall fun ov nil)
- (lambda () (funcall fun ov t)))
- (overlay-put ov 'invisible nil)
- (lambda () (overlay-put ov 'invisible inv)))
- restore))))
- restore)))
+ (let (restore)
+ (dolist (ov (overlays-in (pos-bol) (pos-eol)) restore)
+ (let ((inv (overlay-get ov 'invisible)))
+ (when (and (invisible-p inv) (overlay-get ov 'isearch-open-invisible))
+ (push (if-let ((fun (overlay-get ov
'isearch-open-invisible-temporary)))
+ (progn
+ (funcall fun ov nil)
+ (lambda () (funcall fun ov t)))
+ (overlay-put ov 'invisible nil)
+ (lambda () (overlay-put ov 'invisible inv)))
+ restore))))))
(defun jinx--invisible-open-permanently ()
"Open overlays which hide the current line.
See `isearch-open-necessary-overlays' and `isearch-open-overlay-temporary'."
- (if (and (derived-mode-p 'org-mode) (fboundp 'org-fold-show-set-visibility))
- ;; New Org 9.6 fold-core API
- (let ((inhibit-redisplay t)) ;; HACK: Prevent flicker due to premature
redisplay
- (org-fold-show-set-visibility 'canonical))
- (dolist (ov (overlays-in (pos-bol) (pos-eol)))
- (when-let (fun (overlay-get ov 'isearch-open-invisible))
- (when (invisible-p (overlay-get ov 'invisible))
- (funcall fun ov))))))
+ (dolist (ov (overlays-in (pos-bol) (pos-eol)))
+ (when-let (fun (overlay-get ov 'isearch-open-invisible))
+ (when (invisible-p (overlay-get ov 'invisible))
+ (funcall fun ov)))))
(defun jinx--correct-highlight (overlay fun)
"Highlight and show OVERLAY during FUN."