summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-12-29 00:33:26 +0200
committerThanos Apollo <[email protected]>2023-12-29 00:33:26 +0200
commit61e2da6b34792b24fbc6f458b44cbe365fa8007e (patch)
treea56951e6adf4d8a50fdbbad9bae64a6a3ac362b2 /gnosis.el
parenta6dd907bfceeda0e7aecc91baa505f0db6cf2f7f (diff)
Add gnosis-completing-read
This function is under development, it will be used to display additional info on the minibuffer, such as number of (review-option . due cards).
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index edd7c4e..7215d6b 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -99,6 +99,27 @@ Example:
"Execute BODY in gnosis buffer."
`(with-current-buffer (switch-to-buffer (get-buffer-create "*gnosis*"))
,@body))
+;; TODO: Use gnosis-completing-read to display total notes for review
+;; option
+(defun gnosis-completing-read (prompt candidates)
+ "Gnosis `completing-read' alternative.
+
+`PROMPT' for choice between `CANDIDATES'.
+CANDIDATES need to be in a format of ((\"Option1\" \"Additional Info\")).
+
+WARNING: This function is still under development, DO NOT use this as is now."
+ (let* ((collection (lambda (str pred action)
+ (if (eq action 'metadata)
+ `(metadata
+ (affixation-function . ,(lambda (cands)
+ (mapcar
+ (lambda (cand)
+ (list cand "" (format " %s"
+ (or (cdr (assoc cand candidates)) ""))))
+ cands))))
+ (complete-with-action action candidates str pred))))
+ (choice (completing-read prompt collection)))
+ choice))
(defun gnosis-display--question (id)
"Display main row for note ID."