summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnosis.el b/gnosis.el
index 3487001..a819c9d 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -730,8 +730,12 @@ Works both with {} and {{}} to make easier to import anki notes."
"In STRING replace only the first occurrence of each word in WORDS with NEW."
(cl-assert (listp words))
(cl-loop for word in words
- do (when (string-match (concat "\\<" word "\\>") string)
- (setq string (replace-match new t t string))))
+ do (if (string-match (concat "\\<" word "\\>") string)
+ (setq string (replace-match new t t string))
+ ;; This error will be produced when user has edited a
+ ;; note to an invalid cloze.
+ (error "`%s' is an invalid cloze for question: `%s'."
+ word string )))
string)
(defun gnosis-cloze-extract-answers (str)