summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-08-27 02:24:21 +0300
committerThanos Apollo <[email protected]>2024-08-27 02:24:21 +0300
commit56ed928045f20bb7e9a6840774d852599489a585 (patch)
treeb5e05be70afca35b96075be0e25062c21bb5c329 /gnosis.el
parentbb1469aad5e488f1cf5ed1983feee3ee283a7152 (diff)
export-deck: Add demo export.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index 5476d52..2e8af51 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -50,6 +50,8 @@
(require 'gnosis-string-edit)
(require 'gnosis-dashboard)
+(require 'gnosis-org)
+
(require 'animate)
(defgroup gnosis nil
@@ -2509,6 +2511,19 @@ If STRING-SECTION is nil, apply FACE to the entire STRING."
:tags note-tags))
(error "Demo deck already exists"))))
+;; Export
+;; This is a demo!
+(defun gnosis-export-deck (&optional deck)
+ "Export contents of DECK."
+ (interactive (list (gnosis--get-deck-id)))
+ (with-current-buffer (get-buffer-create "*test*")
+ (insert (format "#+GNOSIS_DECK: %s\n\n" (gnosis--get-deck-name deck)))
+ (cl-loop for note in (gnosis-select '[main answer id type] 'notes `(= deck-id ,deck))
+ do (gnosis-org-insert-heading :main (car note)
+ :answer (cadr note)
+ :id (number-to-string (caddr note))
+ :type (cadddr note)))))
+
;; Gnosis mode ;;
;;;;;;;;;;;;;;;;;