[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/highlight-parentheses 59ff08a 23/49: Merge pull request #1
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/highlight-parentheses 59ff08a 23/49: Merge pull request #11 from tsdh/master |
Date: |
Sun, 15 Aug 2021 03:57:46 -0400 (EDT) |
branch: elpa/highlight-parentheses
commit 59ff08a07f25a8e571632207b3d48fda1f6cad27
Merge: f3b1acc 5e1fa9d
Author: Nikolaj Schumacher <me@nschum.de>
Commit: Nikolaj Schumacher <me@nschum.de>
Merge pull request #11 from tsdh/master
Fix slowdown by moving overlays less often.
---
highlight-parentheses.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/highlight-parentheses.el b/highlight-parentheses.el
index 0597721..1159b0f 100644
--- a/highlight-parentheses.el
+++ b/highlight-parentheses.el
@@ -96,6 +96,9 @@ Color attributes might be overriden by `hl-paren-colors' and
This is used to prevent analyzing the same context over and over.")
(make-variable-buffer-local 'hl-paren-last-point)
+(defvar hl-paren-timer nil
+ "A timer initiating the movement of the `hl-paren-overlays'.")
+
(defun hl-paren-highlight ()
"Highlight the parentheses around point."
(unless (= (point) hl-paren-last-point)
@@ -109,13 +112,18 @@ This is used to prevent analyzing the same context over
and over.")
(cdr overlays))
(move-overlay (pop overlays) pos1 (1+ pos1))
(when (setq pos2 (scan-sexps pos1 1))
- (move-overlay (pop overlays) (1- pos2) pos2)
- ))
+ (move-overlay (pop overlays) (1- pos2) pos2)))
(error nil))
(goto-char pos))
(dolist (ov overlays)
(move-overlay ov 1 1)))))
+(defun hl-paren-initiate-highlight ()
+ "Move the `hl-paren-overlays' after a short fraction of time."
+ (when hl-paren-timer
+ (cancel-timer hl-paren-timer))
+ (setq hl-paren-timer (run-at-time 0.23 nil #'hl-paren-highlight)))
+
;;;###autoload
(define-minor-mode highlight-parentheses-mode
"Minor mode to highlight the surrounding parentheses."
@@ -123,10 +131,10 @@ This is used to prevent analyzing the same context over
and over.")
(mapc 'delete-overlay hl-paren-overlays)
(kill-local-variable 'hl-paren-overlays)
(kill-local-variable 'hl-paren-last-point)
- (remove-hook 'post-command-hook 'hl-paren-highlight t)
+ (remove-hook 'post-command-hook 'hl-paren-initiate-highlight t)
(when highlight-parentheses-mode
(hl-paren-create-overlays)
- (add-hook 'post-command-hook 'hl-paren-highlight nil t)))
+ (add-hook 'post-command-hook 'hl-paren-initiate-highlight nil t)))
;;;###autoload
(define-globalized-minor-mode global-highlight-parentheses-mode
@@ -148,7 +156,7 @@ This is used to prevent analyzing the same context over and
over.")
(setq attributes (plist-put attributes :background (car bg))))
(pop bg)
(dotimes (i 2) ;; front and back
- (push (make-overlay 0 0) hl-paren-overlays)
+ (push (make-overlay 0 0 nil t) hl-paren-overlays)
(overlay-put (car hl-paren-overlays) 'face attributes)))
(setq hl-paren-overlays (nreverse hl-paren-overlays))))
- [nongnu] elpa/highlight-parentheses 8869fba 21/49: Fix slowdown by moving overlays less often., (continued)
- [nongnu] elpa/highlight-parentheses 8869fba 21/49: Fix slowdown by moving overlays less often., ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 5e1fa9d 22/49: Make overlays front-advancing, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 9b9137b 24/49: New defcustom: hl-paren-delay (see issue #12), ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses ebf8827 25/49: Fix Travis build incidator, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses c38885b 31/49: Merge pull request #18 from Bad-ptr/master, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 73b4aa7 34/49: Added angle brackets!, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 69c694a 30/49: Allow hl-paren- -[background-]colors, -attributes to be functions, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses f0bd58c 35/49: Merge pull request #20 from tprk77/master, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 21fd617 41/49: Update README, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses b335e9e 49/49: Don't exclude README.md from ELPA package, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 59ff08a 23/49: Merge pull request #11 from tsdh/master,
ELPA Syncer <=
- [nongnu] elpa/highlight-parentheses ba48dac 36/49: Remove deprecated cl.el, fix compiler/linter nag, version bump, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 72283a2 45/49: Add highlight-parentheses property to our overlays, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses d871467 43/49: Adapt URL to sr.ht, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 23fe07f 39/49: Add LICENSE and screenshot, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 9d8f351 44/49: Release 2.0.1, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 013ac29 38/49: Fix errors due to forgotten version in define-obsolete-function/variable-alias, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses ac0fc4e 13/49: Protect against double initialization of mode., ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses 7692039 29/49: Allow to specify face attributes for each level of parens, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses a821a31 27/49: Don't enable highlight-parentheses-mode in *Messages*, ELPA Syncer, 2021/08/15
- [nongnu] elpa/highlight-parentheses e18f2c2 37/49: Declare cl-lib dependency; update Compatibility, ELPA Syncer, 2021/08/15