commit 1de96825dbc22f3aa4b41eecb6ab219e5bf93b76
parent ee7f93c769c13f9714e3b5150576de0815f7a7ce
Author: Nick Econopouly <wry@mm.st>
Date: Tue, 20 Oct 2020 14:35:38 -0400
Add anki-capture-auto-yank and document it.
Diffstat:
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/README b/README
@@ -59,6 +59,10 @@ Configuration
│ (define-key global-map (kbd "C-c e") 'anki-capture) ;; capture a new note into Anki
└────
+ If you would like to automatically insert text from the kill
+ ring/clipboard into your notes, set the variable
+ `anki-capture-auto-yank' to non-nil.
+
Usage
═════
diff --git a/README.org b/README.org
@@ -42,6 +42,9 @@ preferred keybindings:
(define-key global-map (kbd "C-c e") 'anki-capture) ;; capture a new note into Anki
#+end_src
+If you would like to automatically insert text from the kill
+ring/clipboard into your notes, set the variable
+=anki-capture-auto-yank= to non-nil.
# You can optionally set some defaults note settings for when you first
# start Emacs:
diff --git a/anki-capture.el b/anki-capture.el
@@ -34,6 +34,8 @@
;; These are global vars that you can set yourself in your init
(defcustom anki-capture-file nil
"Optional file to save anki-capture notes in.")
+(defcustom anki-capture-auto-yank nil
+ "Whether to automatically yank the clipboard into your notes.")
(defcustom anki-capture-deck nil
"Current Anki deck for anki-capture.")
(defcustom anki-capture-note-type nil
@@ -41,6 +43,7 @@
(defcustom anki-capture-tags nil
"Current tags for anki-capture.")
+
;; Thank you Cheong Yiufung for these functions!
(defun anki-editor-cloze-region-auto-incr (&optional arg)
"Cloze region without hint and increase card number."
@@ -176,6 +179,7 @@ fresh and choose new note settings."
(newline)
(narrow-to-region (point) (point-max))
(anki-capture-insert-note-skeleton)
+ (if anki-capture-auto-yank (yank))
(org-show-all)
(anki-editor-reset-cloze-number)))