summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnosis-test.el3
-rw-r--r--gnosis.el40
2 files changed, 24 insertions, 19 deletions
diff --git a/gnosis-test.el b/gnosis-test.el
index 46edcf1..3104789 100644
--- a/gnosis-test.el
+++ b/gnosis-test.el
@@ -97,8 +97,7 @@ by the thoracodorsal nerve."
(when (y-or-n-p "Add multimple Clozes note?")
(dotimes (_ num)
(gnosis-add-note--cloze :deck testing-deck
- :note "this is a {c1:note}, a note with multiple {c1:clozes}"
- :hint "note"
+ :note "this is a {c1:note}, a note with multiple {c1:clozes::what}"
:tags (gnosis-test-random-items gnosis-test-tags 2)
:images (cons gnosis-test-image gnosis-test-image)
:extra "extra")))
diff --git a/gnosis.el b/gnosis.el
index f5e6d1a..f9ddd7d 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -142,7 +142,7 @@ a string describing the action."
(defconst gnosis-db-version 2
"Gnosis database version.")
-(defvar gnosis-note-types '("MCQ" "MC-Cloze" "Cloze" "Basic" "Double" "y-or-n")
+(defvar gnosis-note-types '("MCQ" "Cloze" "Basic" "Double" "y-or-n")
"Gnosis available note types.")
(defvar gnosis-previous-note-tags '()
@@ -1493,6 +1493,11 @@ If user-input is equal to CLOZE, return t."
(num 0) ;; Number of clozes revealed
(hints (gnosis-get 'options 'notes `(= id ,id)))
(success nil))
+ ;; Quick fix for old cloze note versions.
+ (cond ((and (stringp hints) (string-empty-p hints))
+ (setq hints nil))
+ ((and (not (listp hints)) (not (string-empty-p hints)))
+ (setq hints (list hints))))
;; Initially display the sentence with no reveals
(gnosis-display-cloze-string main clozes hints nil nil)
(cl-loop for cloze in clozes
@@ -1677,6 +1682,23 @@ NOTES: List of note ids"
(gnosis-review-actions success note note-count))
finally (gnosis-review-commit note-count)))))))
+;;;###autoload
+(defun gnosis-review ()
+ "Start gnosis review session."
+ (interactive)
+ ;; Refresh modeline
+ (setq gnosis-due-notes-total (length (gnosis-review-get-due-notes)))
+ (let ((review-type (gnosis-completing-read "Review: " '("Due notes"
+ "Due notes of deck"
+ "Due notes of specified tag(s)"
+ "All notes of tag(s)"))))
+ (pcase review-type
+ ("Due notes" (gnosis-review-session (gnosis-collect-note-ids :due t)))
+ ("Due notes of deck" (gnosis-review-session (gnosis-collect-note-ids :due t :deck (gnosis--get-deck-id))))
+ ("Due notes of specified tag(s)" (gnosis-review-session (gnosis-collect-note-ids :due t :tags t)))
+ ("All notes of tag(s)" (gnosis-review-session (gnosis-collect-note-ids :tags t))))))
+
+
;; Editing notes
(defun gnosis-edit-read-only-values (&rest values)
"Make the provided VALUES read-only in the whole buffer."
@@ -1952,22 +1974,6 @@ to improve readability."
(format "\n%s '%s" (symbol-name field) (prin1-to-string value)))
(t (format "\n%s %s" (symbol-name field) (prin1-to-string value))))))))
-;;;###autoload
-(defun gnosis-review ()
- "Start gnosis review session."
- (interactive)
- ;; Refresh modeline
- (setq gnosis-due-notes-total (length (gnosis-review-get-due-notes)))
- (let ((review-type (gnosis-completing-read "Review: " '("Due notes"
- "Due notes of deck"
- "Due notes of specified tag(s)"
- "All notes of tag(s)"))))
- (pcase review-type
- ("Due notes" (gnosis-review-session (gnosis-collect-note-ids :due t)))
- ("Due notes of deck" (gnosis-review-session (gnosis-collect-note-ids :due t :deck (gnosis--get-deck-id))))
- ("Due notes of specified tag(s)" (gnosis-review-session (gnosis-collect-note-ids :due t :tags t)))
- ("All notes of tag(s)" (gnosis-review-session (gnosis-collect-note-ids :tags t))))))
-
;;; Database Schemas
(defvar gnosis-db-schema-decks '([(id integer :primary-key :autoincrement)
(name text :not-null)