From 3bde664fe2ac12dad1f2e4ba9e34e26ff66fadc6 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 3 Aug 2024 19:08:17 +0300 Subject: Rewrite dashboard-output-decks. * Remove deprecated values. * Replace local-set-key for gnosis-dashboard-decks-mode. --- gnosis-dashboard.el | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el index 2813cc2..acd3b01 100644 --- a/gnosis-dashboard.el +++ b/gnosis-dashboard.el @@ -346,42 +346,18 @@ Optionally, use when using multiple months." "Return deck contents for gnosis dashboard." (pop-to-buffer-same-window "*gnosis-dashboard*") (gnosis-dashboard-mode) + (gnosis-dashboard-decks-mode) (setq tabulated-list-format [("Name" 15 t) - ("failure-factor" 15 t) - ("ef-increase" 15 t) - ("ef-decrease" 15 t) - ("ef-threshold" 15 t) - ("Initial Interval" 20 t) - ("Total Notes" 10 t)]) + ("Total Notes" 10 gnosis-dashboard-sort-total-notes)]) (tabulated-list-init-header) (setq tabulated-list-entries (cl-loop for id in (gnosis-select 'id 'decks '1=1 t) for output = (gnosis-dashboard-output-deck id) when output collect (list (number-to-string id) (vconcat output)))) - (local-set-key (kbd "e") #'gnosis-dashboard-edit-deck) - (local-set-key (kbd "a") #'(lambda () "Add deck & refresh" (interactive) - (gnosis-add-deck (read-string "Deck name: ")) - (gnosis-dashboard-output-decks) - (revert-buffer t t t))) - (local-set-key (kbd "s") #'(lambda () "Suspend notes" (interactive) - (gnosis-suspend-deck - (string-to-number (tabulated-list-get-id))) - (gnosis-dashboard-output-decks) - (revert-buffer t t t))) - (local-set-key (kbd "d") #'(lambda () "Delete deck" (interactive) - (gnosis-delete-deck (string-to-number (tabulated-list-get-id))) - (gnosis-dashboard-output-decks) - (revert-buffer t t t))) - (local-set-key (kbd "RET") #'(lambda () "View notes of deck" (interactive) - (gnosis-dashboard--search "notes" - (gnosis-collect-note-ids - :deck (string-to-number (tabulated-list-get-id))))))) - -(defun gnosis-dashboard-edit-note (&optional dashboard) - "Get note id from tabulated list and edit it. - -DASHBOARD: Dashboard to return to after editing." + (tabulated-list-print t) + (setf gnosis-dashboard--current `(:type decks :ids ,(gnosis-select 'id 'decks '1=1 t)))) + (interactive) (let ((id (tabulated-list-get-id)) (dashboard (or dashboard "notes"))) -- cgit v1.2.3