diff options
author | Thanos Apollo <[email protected]> | 2024-04-11 09:47:58 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-04-11 09:47:58 +0300 |
commit | 2486661ba86dd02d3abe4dc7f92ab68b84602c86 (patch) | |
tree | 46e51c476456f57031eaa113b2c0646b9952cac6 | |
parent | a2e4893a5c78a4c49db0b967f73c678cadf08369 (diff) |
gnosis-display-next-review: Adjust for overrides
-rw-r--r-- | gnosis.el | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -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. |