From e489e729e25e15bac56901c83dc730d11ec9a92f Mon Sep 17 00:00:00 2001 From: louie Date: Sun, 7 Jan 2018 09:57:41 +0800 Subject: [PATCH] Deck insertion command accepts a prefix to only insert deck name --- anki-editor.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/anki-editor.el b/anki-editor.el index cce078c..9cb5a4a 100644 --- a/anki-editor.el +++ b/anki-editor.el @@ -52,16 +52,16 @@ (let ((failed (seq-count #'null result))) (message (format "Submitted %d notes, %d successful, %d failed." total (- total failed) failed)))))))) -(defun anki-editor-insert-deck () - (interactive) +(defun anki-editor-insert-deck (&optional prefix) + (interactive "P") (message "Fetching decks...") (anki-editor--anki-connect-invoke "deckNames" 5 nil (lambda (result) (setq result (append (sort result #'string-lessp) nil)) - (org-insert-heading-respect-content) + (unless prefix (org-insert-heading-respect-content)) (insert (completing-read "Choose a deck: " result)) - (anki-editor--set-tags-fix anki-editor-deck-tag)))) + (unless prefix (anki-editor--set-tags-fix anki-editor-deck-tag))))) (defun anki-editor-insert-note () (interactive)