branch: elpa/gnosis
commit 568407b9b44b8cc4873bc2f8cba146318d82b556
Author: Thanos Apollo <pub...@thanosapollo.org>
Commit: Thanos Apollo <pub...@thanosapollo.org>

    display-next-review: Ensure the right buffer is being used.
---
 gnosis.el | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/gnosis.el b/gnosis.el
index f42deca5de..4533f0700e 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -551,26 +551,27 @@ If FALSE t, use gnosis-face-false face"
 
 (defun gnosis-display-next-review (id success)
   "Display next interval of note ID for SUCCESS."
-  (let* ((interval (car (gnosis-review-algorithm id success)))
-        (next-review-msg (format "\n\n%s %s"
-                                 (propertize "Next review:" 'face 
'gnosis-face-directions)
-                                 (propertize
-                                  (replace-regexp-in-string
-                                   "[]()[:space:]]"
-                                   (lambda (match)
-                                     (if (string= match " ") "/" ""))
-                                   (format "%s" interval) t t)
-                                  '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 for overriding review result.
-        (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 (gnosis-center-string next-review-msg)))))
+  (with-current-buffer gnosis-review-buffer-name
+    (let* ((interval (car (gnosis-review-algorithm id success)))
+          (next-review-msg (format "\n\n%s %s"
+                                   (propertize "Next review:" 'face 
'gnosis-face-directions)
+                                   (propertize
+                                    (replace-regexp-in-string
+                                     "[]()[:space:]]"
+                                     (lambda (match)
+                                       (if (string= match " ") "/" ""))
+                                     (format "%s" interval) t t)
+                                    '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 for overriding review result.
+          (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 (gnosis-center-string next-review-msg))))))
 
 (cl-defun gnosis--prompt (prompt &optional (downcase nil) (split nil))
   "PROMPT user for input until `q' is given.

Reply via email to