summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-03 02:24:10 +0200
committerThanos Apollo <[email protected]>2024-03-03 02:24:28 +0200
commitfc94a7ff9f26df967b9ff5744c9c2305ed474304 (patch)
tree1ea37fbf6f00d96fafb808a4e5d502f1ae3a21a8
parenta1ea2282c0f9880fb0285e316e9a17f967e364aa (diff)
gnosis-dashboard: Rewrite using read-multiple-choice
Use multipel choice to select how to create dashboard, for now the options are only for notes & decks. Future versions should filter for tags etc
-rw-r--r--gnosis.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/gnosis.el b/gnosis.el
index 2238dd4..f88a1f2 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1555,14 +1555,20 @@ name and all notes formatted as nested lists"
tabulated-list-sort-key nil))
;;;###autoload
-(defun gnosis-dashboard ()
+(cl-defun gnosis-dashboard (&optional dashboard-type)
"Display gnosis dashboard."
(interactive)
- (pop-to-buffer "*gnosis-dashboard*" nil)
- (gnosis-dashboard-mode)
- (setq tabulated-list-entries
- (gnosis-dashboard-output-notes))
- (tabulated-list-print t))
+ (let ((type (or dashboard-type
+ (cadr (read-multiple-choice
+ "Display:"
+ '((?N "Notes")
+ (?D "Decks")))))))
+ (pop-to-buffer "*gnosis-dashboard*")
+ (gnosis-dashboard-mode)
+ (pcase type
+ ("Notes" (gnosis-dashboard-output-notes))
+ ("Decks" (gnosis-dashboard-output-decks)))
+ (tabulated-list-print t)))
(defun gnosis-db-init ()
"Create gnosis essential directories & database."