Fixed function call of anki-editor-cloze from anki-editor-cloze-region/dwim (#33)

Fix 'Wrong number of arguments' error calling `anki-editor-cloze`
This commit is contained in:
cwur 2018-12-31 06:41:55 +00:00 committed by Lei Tan
parent 0bee0064bc
commit 7af16c6447

View file

@ -690,13 +690,13 @@ same as how it is used by `M-RET'(org-insert-heading)."
"Cloze region with number ARG." "Cloze region with number ARG."
(interactive "p\nsHint (optional): ") (interactive "p\nsHint (optional): ")
(unless (region-active-p) (error "No active region")) (unless (region-active-p) (error "No active region"))
(anki-editor-cloze (region-beginning) (region-end))) (anki-editor-cloze (region-beginning) (region-end) arg hint))
(defun anki-editor-cloze-dwim (&optional arg hint) (defun anki-editor-cloze-dwim (&optional arg hint)
"Cloze current active region or a word the under the cursor" "Cloze current active region or a word the under the cursor"
(interactive "p\nsHint (optional): ") (interactive "p\nsHint (optional): ")
(cond (cond
((region-active-p) (anki-editor-cloze (region-beginning) (region-end))) ((region-active-p) (anki-editor-cloze (region-beginning) (region-end) arg hint))
((thing-at-point 'word) (let ((bounds (bounds-of-thing-at-point 'word))) ((thing-at-point 'word) (let ((bounds (bounds-of-thing-at-point 'word)))
(anki-editor-cloze (car bounds) (cdr bounds) arg hint))) (anki-editor-cloze (car bounds) (cdr bounds) arg hint)))
(t (error "Nothing to create cloze from")))) (t (error "Nothing to create cloze from"))))