From 515a7009c535346a12ecf3ec823f4d0963bc0c61 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 3 Aug 2024 18:50:27 +0300 Subject: Refactor dashboard-output-notes * Replace local-set-key with dashboard-notes-mode. * Update dashboard--current-values --- gnosis-dashboard.el | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'gnosis-dashboard.el') diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el index 06bb481..a4d22a4 100644 --- a/gnosis-dashboard.el +++ b/gnosis-dashboard.el @@ -244,6 +244,7 @@ Optionally, use when using multiple months." (cl-assert (listp note-ids) t "`note-ids' must be a list of note ids.") (pop-to-buffer-same-window "*gnosis-dashboard*") (gnosis-dashboard-mode) + (gnosis-dashboard-notes-mode) (setf tabulated-list-format `[("Main" ,(/ (window-width) 4) t) ("Options" ,(/ (window-width) 6) t) ("Answer" ,(/ (window-width) 6) t) @@ -256,22 +257,8 @@ Optionally, use when using multiple months." collect (list (number-to-string id) (vconcat output))) gnosis-dashboard-note-ids note-ids) (tabulated-list-init-header) - ;; Keybindings, for editing, suspending, deleting notes. - ;; We use `local-set-key' to bind keys to the buffer to avoid - ;; conflicts when using the dashboard for displaying either notes - ;; or decks. - (local-set-key (kbd "e") #'gnosis-dashboard-edit-note) - (local-set-key (kbd "s") #'(lambda () (interactive) - (gnosis-suspend-note (string-to-number (tabulated-list-get-id))) - (gnosis-dashboard-output-notes gnosis-dashboard-note-ids) - (revert-buffer t t t))) - (local-set-key (kbd "a") #'gnosis-add-note) - (local-set-key (kbd "r") #'gnosis-dashboard) - (local-set-key (kbd "d") #'(lambda () (interactive) - (gnosis-delete-note (string-to-number (tabulated-list-get-id))) - (gnosis-dashboard-output-notes gnosis-dashboard-note-ids) - (revert-buffer t t t))) - (local-unset-key (kbd "RET"))) + (tabulated-list-print t) + (setf gnosis-dashboard--current `(:type notes :ids ,note-ids))) (defun gnosis-dashboard-deck-note-count (id) "Return total note count for deck with ID." -- cgit v1.2.3