[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/why-this 3497115c2b 35/59: Don't store unnecessary data
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/why-this 3497115c2b 35/59: Don't store unnecessary data |
Date: |
Sun, 27 Nov 2022 16:02:52 -0500 (EST) |
branch: elpa/why-this
commit 3497115c2b3cc6f288770d3ae61ff1079ecc3b1e
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Don't store unnecessary data
---
why-this.el | 44 +++++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/why-this.el b/why-this.el
index 104b4cec1b..17ccf9558c 100644
--- a/why-this.el
+++ b/why-this.el
@@ -374,7 +374,7 @@ TIME-FORMAT is used to format data."
(defun why-this--render ()
"Render overlays."
(while why-this--overlays
- (delete-overlay (car (pop why-this--overlays))))
+ (delete-overlay (pop why-this--overlays)))
(when why-this-mode
(let* ((begin (line-number-at-pos (if (use-region-p)
(region-beginning)
@@ -422,7 +422,7 @@ TIME-FORMAT is used to format data."
(overlay-put ov 'why-this-column column)
(overlay-put ov 'why-this-line (+ begin i))
(overlay-put ov 'why-this-bg-type type)
- (push (cons ov (current-buffer)) why-this--overlays)))))))
+ (push ov why-this--overlays)))))))
(defun why-this--render-non-blocking ()
"Render overlays, but don't block Emacs."
@@ -443,14 +443,14 @@ TIME-FORMAT is used to format data."
nil
(mapcar
(lambda (ov)
- (if (and (eq (cdr ov) (current-buffer))
+ (if (and (eq (overlay-buffer ov) (current-buffer))
(let ((line (line-number-at-pos
- (overlay-start (car ov)))))
+ (overlay-start ov))))
(and (>= line begin)
(< line end)
- (eq line (overlay-get (car ov) 'why-this-line)))))
+ (eq line (overlay-get ov 'why-this-line)))))
(progn
- (let* ((ov-start (overlay-start (car ov)))
+ (let* ((ov-start (overlay-start ov))
line-begin
line-end
column)
@@ -460,10 +460,10 @@ TIME-FORMAT is used to format data."
(setq line-end (line-end-position))
(setq column (- line-end line-begin)))
(unless (eq ov-start line-end)
- (move-overlay (car ov) line-end line-end))
- (unless (eq (overlay-get (car ov) 'why-this-column)
+ (move-overlay ov line-end line-end))
+ (unless (eq (overlay-get ov 'why-this-column)
column)
- (overlay-put (car ov) 'after-string
+ (overlay-put ov 'after-string
(apply
#'propertize
(concat
@@ -471,26 +471,26 @@ TIME-FORMAT is used to format data."
(max (- why-this-minimum-column column)
0)
? )
- (overlay-get (car ov) 'why-this-message))
- (overlay-get (car ov) 'why-this-props)))
- (overlay-put (car ov) 'why-this-column column)))
+ (overlay-get ov 'why-this-message))
+ (overlay-get ov 'why-this-props)))
+ (overlay-put ov 'why-this-column column)))
(when why-this-calculate-background
(let ((type (why-this--overlay-bg-type
- (overlay-start (car ov)))))
- (unless (eq (overlay-get (car ov) 'why-this-bg-type)
+ (overlay-start ov))))
+ (unless (eq (overlay-get ov 'why-this-bg-type)
type)
- (overlay-put (car ov) 'why-this-props
- (plist-put (overlay-get (car ov)
+ (overlay-put ov 'why-this-props
+ (plist-put (overlay-get ov
'why-this-props)
'face (why-this--get-face
type)))
- (overlay-put (car ov) 'after-string
+ (overlay-put ov 'after-string
(propertize
- (overlay-get (car ov) 'after-string)
+ (overlay-get ov 'after-string)
'face (why-this--get-face type)))
- (overlay-put (car ov) 'why-this-bg-type type))))
+ (overlay-put ov 'why-this-bg-type type))))
ov)
- (delete-overlay (car ov))
+ (delete-overlay ov)
nil))
why-this--overlays)))))
@@ -537,7 +537,7 @@ Actually the supported backend is returned."
;;;###autoload
(defun why-this ()
- "Show why the current line contains this."
+ "Why is this line here? Ask version control."
(interactive)
(let ((backend (why-this-supported-p)))
(if backend
@@ -675,6 +675,8 @@ Actually the supported backend is returned."
(run-with-idle-timer why-this-idle-delay t
#'why-this--render-non-blocking))
(setq why-this--buffer-count (1+ why-this--buffer-count)))
+ (while why-this--overlays
+ (delete-overlay (pop why-this--overlays)))
(remove-hook 'post-command-hook #'why-this--update-overlays t)
(setq why-this--buffer-count (1- why-this--buffer-count))
(when (zerop why-this--buffer-count)
- [nongnu] elpa/why-this 82397f6a45 03/59: Add support for nick names, (continued)
- [nongnu] elpa/why-this 82397f6a45 03/59: Add support for nick names, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 3c252a6621 07/59: Allow showing last change manually, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this f62dccdd90 10/59: Add annonation support, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 340194b6d2 24/59: Calculate background for message, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 167397e7ad 25/59: Fix copyright year, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 9c0daa799c 28/59: Rename a variable, change backend API and update docs, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 53b2b803f0 22/59: Update commentary, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this d47f547250 39/59: Allow customization of executable paths, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 7f1ae28159 36/59: Fix Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 9f656b59dd 33/59: Change package summary, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 3497115c2b 35/59: Don't store unnecessary data,
ELPA Syncer <=
- [nongnu] elpa/why-this 7a2e4af450 19/59: Rewrite Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 41fe21da73 15/59: Fontify before annotate, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 006ea3864a 13/59: Fix Git backend 'supported-p command, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 0c1686d8d3 12/59: Fix misspelled word "annonate", ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 73398fb7cb 04/59: Don't interfere with writing, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 2093cadb03 06/59: Add relative time support and fix Git backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this c2a21ca13d 01/59: Core implementation without any backends, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this b26fca274d 21/59: Add COPYING, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 88ee5f9746 27/59: Add Mercurial backend, ELPA Syncer, 2022/11/27
- [nongnu] elpa/why-this 624e98bc78 23/59: Fix relative time calculation, ELPA Syncer, 2022/11/27