summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-04-11 09:47:58 +0300
committerThanos Apollo <[email protected]>2024-04-11 09:47:58 +0300
commit2486661ba86dd02d3abe4dc7f92ab68b84602c86 (patch)
tree46e51c476456f57031eaa113b2c0646b9952cac6 /gnosis.el
parenta2e4893a5c78a4c49db0b967f73c678cadf08369 (diff)
gnosis-display-next-review: Adjust for overrides
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el19
1 files changed, 13 insertions, 6 deletions
diff --git a/gnosis.el b/gnosis.el
index a29ca1f..3890ac5 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -418,12 +418,19 @@ Also see `gnosis-string-edit'."
(defun gnosis-display-next-review (id success)
"Display next interval of note ID for SUCCESS."
- (let ((interval (car (gnosis-review-algorithm id success))))
- (goto-char (point-max))
- (insert "\n\n"
- (propertize "Next review:" 'face 'gnosis-face-directions)
- " "
- (propertize (format "%s" interval) 'face 'gnosis-face-next-review))))
+ (let* ((interval (car (gnosis-review-algorithm id success)))
+ (next-review-msg (format "\n\n%s %s"
+ (propertize "Next review:" 'face 'gnosis-face-directions)
+ (propertize (format "%s" interval) 'face 'gnosis-face-next-review))))
+ (if (search-backward "Next review" nil t)
+ ;; Delete previous result, and override with new this should
+ ;; occur only when used with `gnosis-review-override'
+ (progn (delete-region (point) (progn (end-of-line) (point)))
+ (insert (propertize (replace-regexp-in-string "\n" "" next-review-msg)
+ 'face (if success 'gnosis-face-correct 'gnosis-face-false))))
+ ;; Default behaviour
+ (goto-char (point-max))
+ (insert next-review-msg))))
(cl-defun gnosis--prompt (prompt &optional (downcase nil) (split nil))
"PROMPT user for input until `q' is given.