branch: elpa/gnosis
commit 2bc91763b9848fab96ed21f7af40a7d6270ca5a2
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>

    [Feature] Implement monkeytype functionality.
---
 gnosis-monkeytype.el |  2 ++
 gnosis.el            | 18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/gnosis-monkeytype.el b/gnosis-monkeytype.el
index 974c5558b42..557759db939 100644
--- a/gnosis-monkeytype.el
+++ b/gnosis-monkeytype.el
@@ -58,6 +58,8 @@
 
 (defvar gnosis-monkeytype-string nil)
 
+(defvar gnosis-monkeytype-wpm-result nil)
+
 (defun gnosis-monkeytype--format-text (text)
   "Format TEXT using a temp buffer."
   (with-temp-buffer
diff --git a/gnosis.el b/gnosis.el
index dd9b246c70e..a4c6f4d86cd 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1218,10 +1218,24 @@ If NEW? is non-nil, increment new themata log by 1."
           (funcall func-name id))
       (error "Malformed thema type: '%s'" type))))
 
+(defun gnosis-monkeytype-session (themata &rest_)
+  "Start monkeytype session for THEMATA ids."
+  (cl-assert (listp themata) nil "Themata must be a list of ids")
+  (catch 'monkeytype-loop
+    (cl-loop for thema in themata
+            do (gnosis-review-process-thema--monkeytype thema))))
+
+(defun gnosis-monkeytype-start ()
+  "Gnosis Monkeytype Session"
+  (interactive)
+  (gnosis-review #'gnosis-monkeytype-session))
+
 (defun gnosis-review-process-thema--monkeytype (thema)
-  "Process monkeytyping for THEMA."
+  "Process monkeytyping for THEMA id."
   (let* ((thema-context (gnosis-select '[keimenon type answer] 'themata `(= id 
,thema) t))
-        (keimenon (nth 0 thema-context))
+        (keimenon (replace-regexp-in-string
+                   "\\[\\[\\([^]]+\\)\\]\\[\\([^]]+\\)\\]\\]" "\\2" ;; remove 
links
+                   (nth 0 thema-context)))
         (type (nth 1 thema-context))
         (answer (nth 2 thema-context)))
     (cond ((string= type "basic")

Reply via email to