summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-02-20 19:12:30 +0200
committerThanos Apollo <[email protected]>2024-02-20 19:12:30 +0200
commitd0487b77d18d2280442eab217c5db97e27879a5d (patch)
tree3c96d529e823c201f7891a4a407631efdcc2de94 /gnosis.el
parent2b6c3f43eadd2eae0155544c29bb51ac9ce38a47 (diff)
[Feature] Add select image prompt
Add gnosis-select-image for adding notes
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/gnosis.el b/gnosis.el
index fd4713a..b15e42f 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -493,6 +493,7 @@ Refer to `gnosis-add-note--mcq' for more."
:choices (gnosis--prompt "Choices")
:correct-answer (string-to-number (read-string "Which is the correct answer (number)? "))
:extra (read-string "Extra: ")
+ :image (gnosis-select-image)
:tags (gnosis-tag-prompt)))))
(cl-defun gnosis-add-note--basic (&key deck question hint answer
@@ -524,6 +525,7 @@ Refer to `gnosis-add-note--basic' for more."
:answer (read-string "Answer: ")
:hint (read-string "Hint: ")
:extra (read-string "Extra: ")
+ :image (gnosis-select-image)
:tags (gnosis-tag-prompt)))))
(cl-defun gnosis-add-note--double (&key deck question hint answer extra (image nil) tags (suspend 0) (second-image nil))
@@ -560,6 +562,7 @@ Refer to `gnosis-add-note--double' for more."
(gnosis-directory-files)))
:hint (read-string "Hint: ")
:extra (read-string "Extra: ")
+ :image (gnosis-select-image)
:tags (gnosis-tag-prompt)))))
(cl-defun gnosis-add-note--y-or-n (&key deck question hint answer extra (image nil) tags (suspend 0) (second-image nil))
@@ -588,6 +591,7 @@ refer to `gnosis-add-note--y-or-n' for more information about keyword values."
:answer (read-char-choice "Answer: [y] or [n]? " '(?y ?n))
:hint (read-string "Hint: ")
:extra (read-string "Extra: ")
+ :image (gnosis-select-image)
:tags (gnosis-tag-prompt)))))
@@ -660,6 +664,7 @@ See `gnosis-add-note--cloze' for more reference."
:note (read-string "Question: ")
:hint (read-string "Hint: ")
:extra (read-string "Extra: ")
+ :image (gnosis-select-image)
:tags (gnosis-tag-prompt)))))
;;;###autoload
@@ -753,9 +758,12 @@ By default, DIR value is `gnosis-images-dir' & REGEX value is \"^[^.]\""
"Return PATH for file in `gnosis-images-dir'.
Optionally, add cusotm PROMPT."
- (let* ((prompt (or prompt "Select image: "))
- (image (funcall gnosis-completing-read-function prompt (gnosis-directory-files gnosis-images-dir))))
- image))
+ (if (y-or-n-p "Add image?")
+ (let* ((prompt (or prompt "Select image: "))
+ (image (funcall gnosis-completing-read-function prompt
+ (cons nil (gnosis-directory-files gnosis-images-dir)))))
+ (if (string= image "nil") nil image))
+ nil))
(defun gnosis-get-tags--unique ()
"Return a list of unique strings for tags in `gnosis-db'."