[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eldoc-diffstat 1a75ccb1ec 02/10: Use cached result if call
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eldoc-diffstat 1a75ccb1ec 02/10: Use cached result if called with same commit |
Date: |
Fri, 13 Dec 2024 16:01:49 -0500 (EST) |
branch: elpa/eldoc-diffstat
commit 1a75ccb1ec7e79ac368abd3e55de93c10a4ff8f2
Author: Johann Klähn <johann@jklaehn.de>
Commit: Johann Klähn <johann@jklaehn.de>
Use cached result if called with same commit
This is useful in, e.g., `vc-annotate-mode`, where consecutive lines often
have
the same commit.
---
eldoc-diffstat.el | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/eldoc-diffstat.el b/eldoc-diffstat.el
index e4d372622e..dc2efdca42 100644
--- a/eldoc-diffstat.el
+++ b/eldoc-diffstat.el
@@ -52,7 +52,11 @@ Intended for `eldoc-documentation-functions'."
(boundp 'log-view-vc-backend)
(eq log-view-vc-backend 'Git)
(log-view-current-tag)))))
- (eldoc-diffstat--docstring-1 commit callback)))
+ (if-let* (((processp eldoc-diffstat--process))
+ (result (process-get eldoc-diffstat--process :result))
+ ((equal commit (car result))))
+ (funcall callback (cdr result))
+ (eldoc-diffstat--docstring-1 commit callback))))
(defun eldoc-diffstat--docstring-1 (commit callback &rest _ignored)
"Display diffstat for COMMIT by calling CALLBACK."
@@ -73,6 +77,7 @@ Intended for `eldoc-documentation-functions'."
(append eldoc-diffstat--command (list commit))
:sentinel
(apply-partially #'eldoc-diffstat--sentinel callback)))
+ (process-put eldoc-diffstat--process :commit commit)
;; Signal that the doc string is computed asynchronously.
t)
@@ -100,7 +105,10 @@ Intended for `eldoc-documentation-functions'."
'face 'italic)
(forward-line)
(reverse-region (point) (point-max))
- (funcall callback (buffer-string)))))
+ (let ((result (buffer-string))
+ (commit (process-get eldoc-diffstat--process :commit)))
+ (process-put eldoc-diffstat--process :result (cons commit result))
+ (funcall callback result)))))
(provide 'eldoc-diffstat)
;;; eldoc-diffstat.el ends here
- [nongnu] branch elpa/eldoc-diffstat created (now 99b49c9793), ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat 1a75ccb1ec 02/10: Use cached result if called with same commit,
ELPA Syncer <=
- [nongnu] elpa/eldoc-diffstat eb3a9e7f3a 06/10: Add support for git-rebase-mode, ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat fdce0b8e2a 03/10: Include subject in eldoc-diffstat output, ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat a15690a8a7 05/10: Minor refactoring, ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat 956f2dc247 09/10: Fix typos, ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat 583a4959c0 01/10: Initial import, ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat 8786bab235 04/10: Add support for Hg repos, ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat b79a94abab 07/10: Add support for stashes in magit, ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat 10d42b8b51 08/10: Add README.md and .gitignore, ELPA Syncer, 2024/12/13
- [nongnu] elpa/eldoc-diffstat 99b49c9793 10/10: Silence byte compilation warnings, ELPA Syncer, 2024/12/13