[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gnosis 3fdcb65b0f 2/7: dashboard-streak: Limit to 666 days
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gnosis 3fdcb65b0f 2/7: dashboard-streak: Limit to 666 days |
Date: |
Tue, 10 Dec 2024 13:00:30 -0500 (EST) |
branch: elpa/gnosis
commit 3fdcb65b0f73b1e2b88f9e0494ac856192fab56d
Author: Thanos Apollo <public@thanosapollo.org>
Commit: Thanos Apollo <public@thanosapollo.org>
dashboard-streak: Limit to 666 days
* Limit possible streak value to 666 days, avoiding max-lisp-eval-depth.
---
gnosis.el | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/gnosis.el b/gnosis.el
index 28efbf9662..16625a7533 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -2648,16 +2648,18 @@ If STRING-SECTION is nil, apply FACE to the entire
STRING."
(gnosis-dashboard-output-tags)))))
(defun gnosis-dashboard--streak (dates &optional num date)
- "Return current review streak.
+ "Return current review streak number as a string.
-DATES: Dates in the activity log.
+DATES: Dates in the activity log, a list of dates in (YYYY MM DD).
NUM: Streak number.
DATE: Integer, used with `gnosis-algorithm-date' to get previous dates."
(let ((num (or num 0))
(date (or date 0)))
- (if (member (gnosis-algorithm-date date) dates)
- (gnosis-dashboard--streak dates (cl-incf num) (- date 1))
- num)))
+ (cond ((> num 666)
+ "+666") ;; do not go over 666, avoiding `max-lisp-eval-depth'
+ ((member (gnosis-algorithm-date date) dates)
+ (gnosis-dashboard--streak dates (cl-incf num) (- date 1)))
+ (t (number-to-string num)))))
(defun gnosis-dashboard-output-average-rev ()
"Output the average daily notes reviewed for current year.
@@ -3060,9 +3062,8 @@ DASHBOARD-TYPE: either Notes or Decks to display the
respective dashboard."
(insert (gnosis-center-string
(format "Current streak: %s days"
(propertize
- (number-to-string
- (gnosis-dashboard--streak
- (gnosis-select 'date 'activity-log '1=1 t)))
+ (gnosis-dashboard--streak
+ (gnosis-select 'date 'activity-log '1=1 t))
'face 'success))))
(insert "\n\n"))
(pop-to-buffer-same-window buffer)
- [nongnu] elpa/gnosis updated (eefd0abb3c -> 112693dd65), ELPA Syncer, 2024/12/10
- [nongnu] elpa/gnosis 01c37bdbc7 1/7: db: Refactor pragma operations without using strings., ELPA Syncer, 2024/12/10
- [nongnu] elpa/gnosis 710340b5f2 5/7: manifest: Use emacs-minimal., ELPA Syncer, 2024/12/10
- [nongnu] elpa/gnosis 3fdcb65b0f 2/7: dashboard-streak: Limit to 666 days,
ELPA Syncer <=
- [nongnu] elpa/gnosis 112693dd65 7/7: Version bump: 0.4.9, ELPA Syncer, 2024/12/10
- [nongnu] elpa/gnosis ab980e8153 6/7: Update docs, ELPA Syncer, 2024/12/10
- [nongnu] elpa/gnosis b27b930f3e 4/7: makefile: Update tests, ELPA Syncer, 2024/12/10
- [nongnu] elpa/gnosis 40dbaf4c8d 3/7: dashboard: Create dashboard asynch., ELPA Syncer, 2024/12/10