From f7be6913f6ba1e7b69ce2a04c16b10deacbcf4af Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 11 Aug 2024 23:06:47 +0300 Subject: New function: dashboard-rename-deck. * Rename deck during dashboard view. * Bind function to "e" and "r". --- gnosis-dashboard.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el index 1dcf9fb..efc50fe 100644 --- a/gnosis-dashboard.el +++ b/gnosis-dashboard.el @@ -294,6 +294,14 @@ Optionally, use when using multiple months." (new-tags (cl-substitute new-tag tag tags :test #'string-equal))) (gnosis-update 'notes `(= tags ',new-tags) `(= id ,note)))))) +(defun gnosis-dashboard-rename-deck (&optional deck-id new-name) + "Rename deck where DECK-ID with NEW-NAME." + (interactive) + (let ((deck-id (or deck-id (string-to-number (tabulated-list-get-id)))) + (new-name (or new-name (read-string "New deck name: ")))) + (gnosis-update 'decks `(= name ,new-name) `(= id ,deck-id)) + (gnosis-dashboard-output-decks))) + (defun gnosis-dashboard-suspend-tag (&optional tag) "Suspend notes of TAG." (interactive) @@ -346,7 +354,8 @@ Optionally, use when using multiple months." collect (format "%s" item))) (defvar-keymap gnosis-dashboard-decks-mode-map - "e" #'gnosis-dashboard-edit-deck + "e" #'gnosis-dashboard-rename-deck + "r" #'gnosis-dashboard-rename-deck "a" #'gnosis-dashboard-decks-add "s" #'gnosis-dashboard-decks-suspend-deck "d" #'gnosis-dashboard-decks-delete -- cgit v1.2.3