From 5d6c8d996d1e700c4f2476f96b726a80de7421b8 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 3 Aug 2024 18:54:10 +0300 Subject: New function: dashboard-rename-tag. * Rename TAG to NEW-TAG for all notes under TAG. --- gnosis-dashboard.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el index f70142d..cab77a1 100644 --- a/gnosis-dashboard.el +++ b/gnosis-dashboard.el @@ -277,6 +277,16 @@ Optionally, use when using multiple months." (total2 (string-to-number (elt (cadr entry2) 1)))) (< total1 total2))) +(defun gnosis-dashboard-rename-tag (&optional tag new-tag ) + "Rename TAG to NEW-TAG." + (interactive) + (let ((new-tag (or new-tag (read-string "News tag name: "))) + (tag (or tag (tabulated-list-get-id)))) + (cl-loop for note in (gnosis-get-tag-notes tag) + do (let* ((tags (car (gnosis-select '[tags] 'notes `(= id ,note) t))) + (new-tags (cl-substitute new-tag tag tags :test #'string-equal))) + (gnosis-update 'notes `(= tags ',new-tags) `(= id ,note)))))) + (defun gnosis-dashboard-output-deck (id) "Output contents from deck with ID, formatted for gnosis dashboard." (cl-loop for item in (append (gnosis-select -- cgit v1.2.3