summaryrefslogtreecommitdiff
path: root/gnosis-dashboard.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-08-03 18:54:10 +0300
committerThanos Apollo <[email protected]>2024-08-03 18:54:10 +0300
commit5d6c8d996d1e700c4f2476f96b726a80de7421b8 (patch)
tree7e953fe4d52d19666a97d884ef03fce6cc400849 /gnosis-dashboard.el
parent14c5059d751a9ba5e39064dcd71f4172431c98ca (diff)
New function: dashboard-rename-tag.
* Rename TAG to NEW-TAG for all notes under TAG.
Diffstat (limited to 'gnosis-dashboard.el')
-rw-r--r--gnosis-dashboard.el10
1 files changed, 10 insertions, 0 deletions
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