From 9357fe4c96a8c127a66f52a51e4a3d5d51fcd7a7 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jan 2024 02:42:30 +0200 Subject: Update gnosis-algorithm-next-interval - Use keywords! - Add argument for initial-interval, successful-reviews, successful-reviews-c, fails-c, fails-t - Use initial-interval which is could be different for every note, instead of gnosis-algorithm-interval value. - Depending on the value of new arguments for total/consecutive fails/successful reviews calculate a different interval. --- gnosis.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 752d828..a1c356e 100644 --- a/gnosis.el +++ b/gnosis.el @@ -861,10 +861,21 @@ SUCCESS is a binary value, 1 = success, 0 = failure. Returns a list of the form ((yyyy mm dd) ef)." (let ((ff gnosis-algorithm-ff) (ef (nth 2 (gnosis-get 'ef 'review `(= id ,id)))) - (t-success (gnosis-get 't-success 'review-log `(= id ,id)))) - (gnosis-algorithm-next-interval (gnosis-review--get-offset id) - (gnosis-get 'n 'review-log `(= id ,id)) - ef success ff t-success))) + (t-success (gnosis-get 't-success 'review-log `(= id ,id))) + (c-success (gnosis-get 'c-success 'review-log `(= id ,id))) + (c-fails (gnosis-get 'c-fails 'review-log `(= id ,id))) + (t-fails (gnosis-get 't-fails 'review-log `(= id ,id))) + (initial-interval (gnosis-get 'interval 'review `(= id ,id)))) + (gnosis-algorithm-next-interval :last-interval (gnosis-review--get-offset id) + :review-num (gnosis-get 'n 'review-log `(= id ,id)) + :ef ef + :success success + :failure-factor ff + :successful-reviews t-success + :successful-reviews-c c-success + :fails-c c-fails + :fail-t t-fails + :initial-interval initial-interval))) (defun gnosis-review-due-notes--with-tags () "Return a list of due note tags." -- cgit v1.2.3 From 2473e9127a8f8ece2bcb1052d5450834bbbbb4c8 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jan 2024 03:26:48 +0200 Subject: gnosis-db-init: Redo without length= Length= is available only for Emacs 28.1 > Pointed out by Nicholas Vollmer --- gnosis.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index a1c356e..e25a59e 100644 --- a/gnosis.el +++ b/gnosis.el @@ -1390,7 +1390,7 @@ review." ;; Make sure gnosis-db is initialized (setf gnosis-db (emacsql-sqlite (concat (file-name-as-directory gnosis-dir) "gnosis.db")))) ;; Create database tables - (unless (length= (emacsql gnosis-db [:select name :from sqlite-master :where (= type table)]) 6) + (unless (= (length (emacsql gnosis-db [:select name :from sqlite-master :where (= type table)])) 6) ;; Enable foreign keys (emacsql gnosis-db "PRAGMA foreign_keys = ON") ;; Gnosis version -- cgit v1.2.3 From 53ad378397cf9558ea273d64592bda551199d59d Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jan 2024 03:28:21 +0200 Subject: Remove unnecessary progn's from cl-loop cl-loop's do clause is an implicit progn. --- gnosis.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index e25a59e..211a5d6 100644 --- a/gnosis.el +++ b/gnosis.el @@ -395,8 +395,8 @@ When called with a prefix, unsuspends all notes in deck." (suspend (if current-prefix-arg 0 1)) (note-count 0)) (cl-loop for note in notes - do (progn (gnosis-update 'review-log `(= suspend ,suspend) `(= id ,(car note))) - (setq note-count (1+ note-count))) + do (gnosis-update 'review-log `(= suspend ,suspend) `(= id ,(car note))) + (setq note-count (1+ note-count)) finally (if (equal suspend 0) (message "Unsuspended %s notes" note-count) (message "Suspended %s notes" note-count))))) @@ -1052,15 +1052,15 @@ NOTE-NUM: The number of notes reviewed in the session." (message "No notes for review.") (when (y-or-n-p (format "You have %s total notes for review, start session?" (length notes))) (cl-loop for note in notes - do (progn (gnosis-review-note note) - (setf note-count (1+ note-count)) - (pcase (read-char-choice "Note Action: [n]ext, [s]uspend, [e]dit, [q]uit: " '(?n ?s ?e ?q)) - (?n nil) - (?s (gnosis-suspend-note note)) - (?e (progn (gnosis-edit-note note) - (recursive-edit))) - (?q (progn (gnosis-review-commit note-count) - (cl-return))))) + do (gnosis-review-note note) + (setf note-count (1+ note-count)) + (pcase (read-char-choice "Note Action: [n]ext, [s]uspend, [e]dit, [q]uit: " '(?n ?s ?e ?q)) + (?n nil) + (?s (gnosis-suspend-note note)) + (?e (progn (gnosis-edit-note note) + (recursive-edit))) + (?q (progn (gnosis-review-commit note-count) + (cl-return)))) finally (gnosis-review-commit note-count)))))) @@ -1275,7 +1275,7 @@ name and all notes formatted as nested lists" (with-temp-file (concat filename ".el") (insert "(gnosis-define-deck " "'" deck-name " '(") (cl-loop for note in notes - do (progn (insert "(") (gnosis-export-note note) (insert ")" "\n")) + do (insert "(") (gnosis-export-note note) (insert ")" "\n") finally (insert "))"))))) ;; TODO: Add defcustom to have suspended as 0 or 1 depending on -- cgit v1.2.3 From baf0e4a9eb30a5929fcd18daad2e425edbbaa851 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jan 2024 03:29:30 +0200 Subject: Rename gnosis-cloze-char to gnosis-cloze-string Change suggested by Nicholas Vollmer --- gnosis.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 211a5d6..564b3dc 100644 --- a/gnosis.el +++ b/gnosis.el @@ -56,7 +56,7 @@ :type 'directory :group 'gnosis) -(defcustom gnosis-cloze-char "__" +(defcustom gnosis-cloze-string "__" "Gnosis cloze character." :type 'string :group 'gnosis) @@ -229,7 +229,7 @@ FACE-FOR-INFO is the face used to display info for option." (fill-paragraph (insert (concat "\n" - (gnosis-cloze-replace-words sentence clozes (propertize gnosis-cloze-char 'face 'gnosis-face-cloze))))))) + (gnosis-cloze-replace-words sentence clozes (propertize gnosis-cloze-string 'face 'gnosis-face-cloze))))))) (defun gnosis-display--basic-answer (answer success user-input) "Display ANSWER. @@ -271,7 +271,7 @@ SUCCESS is t when user-input is correct, else nil" (propertize "\n\n-----\n" 'face 'gnosis-face-seperator) (propertize hint 'face 'gnosis-face-hint))))) -(cl-defun gnosis-display-cloze-reveal (&key (cloze-char gnosis-cloze-char) replace (success t) (face nil)) +(cl-defun gnosis-display-cloze-reveal (&key (cloze-char gnosis-cloze-string) replace (success t) (face nil)) "Replace CLOZE-CHAR with REPLACE. If FACE nil, propertize replace using `gnosis-face-correct', or -- cgit v1.2.3 From 6502273b69381ce6664bed096f956191193bdd15 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jan 2024 03:30:13 +0200 Subject: gnosis-db: Remove warning from docstring No need to warn user not to change the value of a defconst Change suggested by Nicholas Vollmer --- gnosis.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 564b3dc..f62710e 100644 --- a/gnosis.el +++ b/gnosis.el @@ -69,7 +69,7 @@ (if (not (file-directory-p gnosis-dir)) (gnosis-db-init) (emacsql-sqlite (concat (file-name-as-directory gnosis-dir) "gnosis.db"))) - "Gnosis database file. WARNING: Do not change this value!") + "Gnosis database file.") (defvar gnosis-testing nil "When t, warn user he is in a testing environment.") -- cgit v1.2.3 From dffc25ca6244d9260f5ca379e728e4eeb0771ed7 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jan 2024 03:31:00 +0200 Subject: gnosis--prompt: Update docstring Fix quotes --- gnosis.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index f62710e..86b07ef 100644 --- a/gnosis.el +++ b/gnosis.el @@ -339,8 +339,8 @@ If FALSE t, use gnosis-face-false face" (cl-defun gnosis--prompt (prompt &optional (downcase nil) (split nil)) "PROMPT user for input until `q' is given. -The user is prompted to provide input for the 'PROMPT' message. -Returns the list of non-'q' inputs in reverse order of their entry. +The user is prompted to provide input for the PROMPT message. +Returns the list of non-q inputs in reverse order of their entry. Set DOWNCASE to t to downcase all input given. Set SPLIT to t to split all input given." -- cgit v1.2.3 From 99b849d8d87725050f8dbe7aa8770a513715d6a3 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jan 2024 03:40:26 +0200 Subject: Rename gnosis-display functions - No need to have them as 'hidden' with double dash (--) Change suggested by Nicholas Vollmer --- gnosis.el | 165 ++++++++++++++++++++++++++++---------------------------------- 1 file changed, 75 insertions(+), 90 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 86b07ef..0e1f9a1 100644 --- a/gnosis.el +++ b/gnosis.el @@ -179,12 +179,6 @@ Example: "From TABLE use where to delete VALUE." (emacsql gnosis-db `[:delete :from ,table :where ,value])) -(defmacro with-gnosis-buffer (&rest body) - "Execute BODY in gnosis buffer." - `(with-current-buffer (switch-to-buffer (get-buffer-create "*gnosis*")) - (gnosis-mode) - ,@body)) - (cl-defun gnosis-completing-read (prompt options info &optional (face-for-info 'font-lock-doc-face)) "A version of `completing-read' with text properties, padding & choosable face. Returns selected option from OPTIONS. @@ -214,28 +208,25 @@ FACE-FOR-INFO is the face used to display info for option." if (= i index) collect new-item else collect item)) -(defun gnosis-display--question (id) +(defun gnosis-display-question (id) "Display main row for note ID." (let ((question (gnosis-get 'main 'notes `(= id ,id)))) - (with-gnosis-buffer (erase-buffer) (fill-paragraph (insert (concat "\n" - (propertize question 'face 'gnosis-face-main))))))) + (propertize question 'face 'gnosis-face-main)))))) -(defun gnosis-display--cloze-sentence (sentence clozes) +(defun gnosis-display-cloze-sentence (sentence clozes) "Display cloze sentence for SENTENCE with CLOZES." - (with-gnosis-buffer - (erase-buffer) - (fill-paragraph - (insert - (concat "\n" - (gnosis-cloze-replace-words sentence clozes (propertize gnosis-cloze-string 'face 'gnosis-face-cloze))))))) - -(defun gnosis-display--basic-answer (answer success user-input) + (erase-buffer) + (fill-paragraph + (insert + (concat "\n" + (gnosis-cloze-replace-words sentence clozes (propertize gnosis-cloze-string 'face 'gnosis-face-cloze)))))) + +(defun gnosis-display-basic-answer (answer success user-input) "Display ANSWER. When SUCCESS nil, display USER-INPUT as well" - (with-gnosis-buffer (insert (concat "\n\n" (propertize "Answer:" 'face 'gnosis-face-directions) @@ -246,7 +237,7 @@ When SUCCESS nil, display USER-INPUT as well" (insert (concat "\n" (propertize "Your answer:" 'face 'gnosis-face-directions) " " - (propertize user-input 'face 'gnosis-face-false)))))) + (propertize user-input 'face 'gnosis-face-false))))) (cl-defun gnosis-display-y-or-n-answer (&key answer success) "Display y-or-n answer for note ID. @@ -255,48 +246,43 @@ ANSWER is the correct answer, either y or n. Answer is either 121 or 110, which are the char values for y & n respectively SUCCESS is t when user-input is correct, else nil" (let ((answer (if (equal answer 121) "y" "n"))) - (with-gnosis-buffer (insert (concat "\n\n" (propertize "Answer:" 'face 'gnosis-face-directions) " " - (propertize answer 'face (if success 'gnosis-face-correct 'gnosis-face-false))))))) + (propertize answer 'face (if success 'gnosis-face-correct 'gnosis-face-false)))))) -(defun gnosis-display--hint (hint) +(defun gnosis-display-hint (hint) "Display HINT." - (with-gnosis-buffer (goto-char (point-max)) (insert (concat (propertize "\n\n-----\n" 'face 'gnosis-face-seperator) - (propertize hint 'face 'gnosis-face-hint))))) + (propertize hint 'face 'gnosis-face-hint)))) (cl-defun gnosis-display-cloze-reveal (&key (cloze-char gnosis-cloze-string) replace (success t) (face nil)) "Replace CLOZE-CHAR with REPLACE. If FACE nil, propertize replace using `gnosis-face-correct', or `gnosis-face-false' when (not SUCCESS). Else use FACE value." - (with-gnosis-buffer (goto-char (point-min)) (search-forward cloze-char nil t) (replace-match (propertize replace 'face (if (not face) (if success 'gnosis-face-correct 'gnosis-face-false) - face))))) + face)))) (cl-defun gnosis-display-cloze-user-answer (user-input &optional (false t)) "Display USER-INPUT answer for cloze note upon failed review. If FALSE t, use gnosis-face-false face" - (with-gnosis-buffer (goto-char (point-max)) (insert (concat "\n\n" (propertize "Your answer:" 'face 'gnosis-face-directions) " " - (propertize user-input 'face (if false 'gnosis-face-false 'gnosis-face-correct)))))) + (propertize user-input 'face (if false 'gnosis-face-false 'gnosis-face-correct))))) -(defun gnosis-display--correct-answer-mcq (answer user-choice) +(defun gnosis-display-correct-answer-mcq (answer user-choice) "Display correct ANSWER & USER-CHOICE for MCQ note." - (with-gnosis-buffer (insert (concat "\n\n" (propertize "Correct Answer:" 'face 'gnosis-face-directions) " " @@ -306,35 +292,32 @@ If FALSE t, use gnosis-face-false face" " " (propertize user-choice 'face (if (string= answer user-choice) 'gnosis-face-correct - 'gnosis-face-false)))))) + 'gnosis-face-false))))) -(defun gnosis-display--extra (id) +(defun gnosis-display-extra (id) "Display extra information for note ID." (let ((extras (gnosis-get 'extra-notes 'extras `(= id ,id)))) - (with-gnosis-buffer - (goto-char (point-max)) - (insert (propertize "\n\n-----\n" 'face 'gnosis-face-seperator)) - (fill-paragraph (insert (concat "\n" (propertize extras 'face 'gnosis-face-extra))))))) + (goto-char (point-max)) + (insert (propertize "\n\n-----\n" 'face 'gnosis-face-seperator)) + (fill-paragraph (insert (concat "\n" (propertize extras 'face 'gnosis-face-extra)))))) -(defun gnosis-display--image (id) +(defun gnosis-display-image (id) "Display image for note ID." (let* ((img (gnosis-get 'images 'extras `(= id ,id))) (path-to-image (concat (file-name-as-directory gnosis-images-dir) img)) (image (create-image path-to-image 'png nil :width 500 :height 300))) (when img - (with-gnosis-buffer - (insert "\n\n") - (insert-image image))))) + (insert "\n\n") + (insert-image image)))) -(defun gnosis-display--next-review (id) +(defun gnosis-display-next-review (id) "Display next interval for note ID." (let ((interval (gnosis-get 'next-rev 'review-log `(= id ,id)))) - (with-gnosis-buffer - (goto-char (point-max)) - (insert (concat "\n\n" - (propertize "Next review:" 'face 'gnosis-face-directions) - " " - (propertize (format "%s" interval) 'face 'gnosis-face-next-review)))))) + (goto-char (point-max)) + (insert (concat "\n\n" + (propertize "Next review:" 'face 'gnosis-face-directions) + " " + (propertize (format "%s" interval) 'face 'gnosis-face-next-review))))) (cl-defun gnosis--prompt (prompt &optional (downcase nil) (split nil)) "PROMPT user for input until `q' is given. @@ -874,7 +857,7 @@ Returns a list of the form ((yyyy mm dd) ef)." :successful-reviews t-success :successful-reviews-c c-success :fails-c c-fails - :fail-t t-fails + :fails-t t-fails :initial-interval initial-interval))) (defun gnosis-review-due-notes--with-tags () @@ -928,45 +911,45 @@ SUCCESS is a binary value, 1 is for successful review." (defun gnosis-review-mcq (id) "Display multiple choice answers for question ID." - (gnosis-display--image id) - (gnosis-display--question id) - (let* ((choices (gnosis-get 'options 'notes `(= id ,id))) - (answer (nth (- (gnosis-get 'answer 'notes `(= id ,id)) 1) choices)) - (user-choice (gnosis-mcq-answer id))) - (if (string= answer user-choice) - (progn (gnosis-review--update id 1) - (message "Correct!")) - (gnosis-review--update id 0) - (message "False")) - (gnosis-display--correct-answer-mcq answer user-choice) - (gnosis-display--extra id) - (gnosis-display--next-review id))) + (gnosis-display-image id) + (gnosis-display-question id) + (let* ((choices (gnosis-get 'options 'notes `(= id ,id))) + (answer (nth (- (gnosis-get 'answer 'notes `(= id ,id)) 1) choices)) + (user-choice (gnosis-mcq-answer id))) + (if (string= answer user-choice) + (progn (gnosis-review--update id 1) + (message "Correct!")) + (gnosis-review--update id 0) + (message "False")) + (gnosis-display-correct-answer-mcq answer user-choice) + (gnosis-display-extra id) + (gnosis-display-next-review id))) (defun gnosis-review-basic (id) "Review basic type note for ID." - (gnosis-display--image id) - (gnosis-display--question id) - (gnosis-display--hint (gnosis-get 'options 'notes `(= id ,id))) + (gnosis-display-image id) + (gnosis-display-question id) + (gnosis-display-hint (gnosis-get 'options 'notes `(= id ,id))) (let* ((answer (gnosis-get 'answer 'notes `(= id ,id))) (user-input (read-string "Answer: ")) (success (gnosis-compare-strings answer user-input))) - (gnosis-display--basic-answer answer success user-input) - (gnosis-display--extra id) + (gnosis-display-basic-answer answer success user-input) + (gnosis-display-extra id) (gnosis-review--update id (if success 1 0)) - (gnosis-display--next-review id))) + (gnosis-display-next-review id))) (defun gnosis-review-y-or-n (id) "Review y-or-n type note for ID." - (gnosis-display--image id) - (gnosis-display--question id) - (gnosis-display--hint (gnosis-get 'options 'notes `(= id ,id))) - (let* ((answer (gnosis-get 'answer 'notes `(= id ,id))) - (user-input (read-char-choice "[y]es or [n]o: " '(?y ?n))) - (success (equal answer user-input))) - (gnosis-display-y-or-n-answer :answer answer :success success) - (gnosis-display--extra id) - (gnosis-review--update id (if success 1 0)) - (gnosis-display--next-review id))) + (gnosis-display-image id) + (gnosis-display-question id) + (gnosis-display-hint (gnosis-get 'options 'notes `(= id ,id))) + (let* ((answer (gnosis-get 'answer 'notes `(= id ,id))) + (user-input (read-char-choice "[y]es or [n]o: " '(?y ?n))) + (success (equal answer user-input))) + (gnosis-display-y-or-n-answer :answer answer :success success) + (gnosis-display-extra id) + (gnosis-review--update id (if success 1 0)) + (gnosis-display-next-review id))) (defun gnosis-review-cloze--input (cloze) "Prompt for user input during cloze review. @@ -989,9 +972,9 @@ Used to reveal all clozes left with `gnosis-face-cloze-unanswered' face." (num 1) (clozes-num (length clozes)) (hint (gnosis-get 'options 'notes `(= id ,id)))) - (gnosis-display--image id) - (gnosis-display--cloze-sentence main clozes) - (gnosis-display--hint hint) + (gnosis-display-image id) + (gnosis-display-cloze-sentence main clozes) + (gnosis-display-hint hint) (cl-loop for cloze in clozes do (let ((input (gnosis-review-cloze--input cloze))) (if (equal (car input) t) @@ -1009,21 +992,23 @@ Used to reveal all clozes left with `gnosis-face-cloze-unanswered' face." (cl-return))) ;; Update note after all clozes are revealed successfully finally (gnosis-review--update id 1))) - (gnosis-display--extra id) - (gnosis-display--next-review id)) + (gnosis-display-extra id) + (gnosis-display-next-review id)) (defun gnosis-review-note (id) "Start review for note with value of id ID, if note is unsuspended." (cond ((gnosis-suspended-p id) (message "Note is suspended.")) (t - (let ((type (gnosis-get 'type 'notes `(= id ,id)))) - (pcase type - ("mcq" (gnosis-review-mcq id)) - ("basic" (gnosis-review-basic id)) - ("cloze" (gnosis-review-cloze id)) - ("y-or-n" (gnosis-review-y-or-n id)) - (_ (error "Malformed note type"))))))) + (with-current-buffer (switch-to-buffer (get-buffer-create "*gnosis*")) + (let ((type (gnosis-get 'type 'notes `(= id ,id)))) + (gnosis-mode) + (pcase type + ("mcq" (gnosis-review-mcq id)) + ("basic" (gnosis-review-basic id)) + ("cloze" (gnosis-review-cloze id)) + ("y-or-n" (gnosis-review-y-or-n id)) + (_ (error "Malformed note type")))))))) (defun gnosis-review-commit (note-num) "Commit review session on git repository. -- cgit v1.2.3 From 71ebf428d2073b03c63dbed8397f61e84287a76a Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 17 Jan 2024 04:34:37 +0200 Subject: gnosis-edit-note-contents: Insert note id as read-only - Make sure note id value will not be changed Change suggested by Nicholas Vollmer --- gnosis.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 0e1f9a1..3862d80 100644 --- a/gnosis.el +++ b/gnosis.el @@ -1119,7 +1119,9 @@ changes." (extra-notes ,extra-notes) (image ,image) (second-image ,second-image)) - do (cond ((numberp value) + do (cond ((equal field 'id) + (insert (format (concat ":%s " (propertize "%s" 'read-only t) "\n") field value))) + ((numberp value) (insert (format ":%s %s\n" field value))) ((and (listp value) (not (equal value nil))) -- cgit v1.2.3 From ada654d65cf867f37fd8a3e8ddf4160a04a69682 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 18 Jan 2024 03:41:34 +0200 Subject: gnosis: Update docstrings --- gnosis.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 3862d80..4c04093 100644 --- a/gnosis.el +++ b/gnosis.el @@ -57,7 +57,7 @@ :group 'gnosis) (defcustom gnosis-cloze-string "__" - "Gnosis cloze character." + "Gnosis string to represent a cloze." :type 'string :group 'gnosis) @@ -464,7 +464,7 @@ choice in the `CHOICES' list. Each note must correspond to one `DECK'. Create a note type MCQ for specified deck, that consists of: STEM: The question or problem statement OPTIONS: Options for the user to select -ANSWER: Answer is the NUMBER of the correct answer of OPTIONS. +ANSWER: Answer is the index NUMBER of the correct answer from OPTIONS. EXTRA: Information to display after user-input TAGS: Used to organize notes @@ -495,9 +495,9 @@ SUSPEND: Binary value of 0 & 1, when 1 note will be ignored." (defun gnosis-add-note-basic () "Add note(s) of type `Basic' interactively to selected deck. -Basic note type is a flashcard-like note, where user first sees a -\"main\" part, which is usually a question, and he is prompted to -input the answer. +Basic note type is a simple question/answer note, where user first +sees a \"main\" part, which is usually a question, and he is prompted +to input the answer. Refer to `gnosis-add-note--basic' for more." (let ((deck (gnosis--get-deck-name))) @@ -560,7 +560,7 @@ SECOND-IMAGE: Image to display after user-input." (gnosis-add-note-fields deck "y-or-n" question hint answer extra tags suspend image second-image)) (defun gnosis-add-note-y-or-n () - "Add note(s) of type `y-or-n' interactively to selected deck. + "Add note(s) of type `y-or-n'. refer to `gnosis-add-note--y-or-n' for more information about keyword values." (let ((deck (gnosis--get-deck-name))) -- cgit v1.2.3 From 5fcd13b74a7e40be8ef3f53f1f33824e9b59b814 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 18 Jan 2024 04:11:44 +0200 Subject: gnosis-algorithm-next-interval: Always pass last-interval >=1 --- gnosis.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 4c04093..7ddeb30 100644 --- a/gnosis.el +++ b/gnosis.el @@ -849,7 +849,7 @@ Returns a list of the form ((yyyy mm dd) ef)." (c-fails (gnosis-get 'c-fails 'review-log `(= id ,id))) (t-fails (gnosis-get 't-fails 'review-log `(= id ,id))) (initial-interval (gnosis-get 'interval 'review `(= id ,id)))) - (gnosis-algorithm-next-interval :last-interval (gnosis-review--get-offset id) + (gnosis-algorithm-next-interval :last-interval (max (gnosis-review--get-offset id) 1) ;; last-interv always >=1 :review-num (gnosis-get 'n 'review-log `(= id ,id)) :ef ef :success success -- cgit v1.2.3