Closed akashpal-21 closed 10 months ago
I have thought about the problem more, and have come up with a much better solution. This code will do what I was originally intending.
(with-eval-after-load 'delve
(defun delve-dashboard-update ()
"Refresh Delve Dashboard"
(interactive)
(let ((delve-buffer (concat "DELVE " delve-dashboard-name)))
;; Close Delve Dashboard if it's active & current window
(when (and delve-buffer (get-buffer-window delve-buffer t))
(kill-buffer delve-buffer)
;; Then create a new Delve dashboard
;; Logic from delve--new-dashboard
(with-temp-message "Setting up dashboard..."
(let* ((tag-queries (--map (delve--create-tag-query (-list it)) delve-dashboard-tags))
(items (list tag-queries (mapcar #'funcall delve-dashboard-queries))))
(delve--new-buffer delve-dashboard-name (flatten-tree items))
(switch-to-buffer delve-buffer)
))
)))
(define-key delve-mode-map (kbd "G") #'delve-dashboard-update)
)
This code will not work for others since it involves a line that is not originally present in delve.el, I will update this code once a new version of delve releases which adds the customisable variable 'delve-dashboard-queries. Maybe @publicimageltd can implement this in the source itself, he can produce a much cleaner code than I can.
I'll look at it.
I have changed the behavior of "update" (g). If queries are open, new Zettels are automatically inserted in the indented tree belonging to the query. I hope it works satisfactorily. Please have a look and then close this issue.
I have changed the behavior of "update" (g). If queries are open, new Zettels are automatically inserted in the indented tree belonging to the query. I hope it works satisfactorily. Please have a look and then close this issue.
It updates newly created nodes wonderfully - additionally, if it will not be too complicated, update on deletion of the nodes could also be incorporated in the future, in that case it can sync in these two conditions.
Best, and thank you.
Ah I see, I forgot to test that direction of sync. So I'll add that next, that's a good idea.
Two-way sync is set up. Have fun!
Two-way sync is set up. Have fun!
Hi, I updated to the new version and tried to test it - unfortunately it doesn't seem to be working in my case, if I open the dashboard - then create a new node - I can go the relevant query and do 'g' to update it, for example the 'last modified' query will be updated and the node will be inserted. However if I do the opposite - delete a node then update the relevant query - it complains that the file doesn't exist
Some thing like this
org-roam-db--file-hash: Opening input file: No such file or directory, /home/akash/roam/test.org
Is is problem on my end - or is this a bug?
I can press '\<delete>' to manually delete the node from the listing and then do update - everything works out then.
I can't replicate the problem. Please use the test environment which can be started with bin/test-emacs
from the repo's root directory to reprduce it. I just did the following in the test environment and had no error, maybe I misunderstood you:
org-store-link
, write file)g
, and the new node shows up.g
. The new node disappears.PS: You need to install Eldev for the test environment
Ah, I just found the bug. It can be reproduced when you delete the whole file, instead of just a node in a file (what I did). I'll have a look. Great bug hunting! :-)
That was easy, I fixed it and close the issue again. Please open a new, clean issue if you find another bug, or if your bug was actually different and still persists.
All the bugs i could find you solved so quickly; I apologise, i understand my wording regarding node and file was not clear enough and the bug you described was exactly what I was pointing to. This issue is now solved in its entirety.
If i mange to find some other bug I will let you know, but my intuition is that if tomorrow you version bump to V.1 and call it stable - you probably don't have to change any code ever again, everything works so nicely, i cannot think of anything else to complain about!
Best.
Suppose I create a new node after the DELVE DASHBOARD is created, the node doesn't show up in the dashboard, I have to close and reopen it to achieve it... Is there any way to update the dashboard with new nodes/pages without closing it ?
Currently I use this hack function to achieve this : This function will depending where the user is currently, do two things, if the user is on the Delve Dashboard, it will update it - if the user is not on the Dashboard it will simply call the (delve) function which asks the user if they want to visit any collection.
If anyone want to reuse this code, substitute 0 for your buffer name, "DASHBOARD" is the default name.
My delve-dashboard-name is "0"