d12frosted / vulpea

A collection of functions for note taking based on `org` and `org-roam`.
GNU General Public License v3.0
236 stars 12 forks source link

Why I need to make (org-roam-db-sync 'force) with the same files? #140

Closed Cletip closed 2 years ago

Cletip commented 2 years ago

Hello,

Small context: 

I'm on ubuntu and would like to have emacs + org-roam + vulpea on my phone. Everything works fine (I use exactly the same configuration thanks to termux)

Except that, with exactly the same files, I have to redo the "(org-roam-db-sync 'force)" command in termux, which I don't understand.

The only files and folders that I don't copy from my pc's configuration are the following ones:  straight/ var/savehist.el var/save-place.el var/recentf-save.el var/keyfreq.el which I think should have no influence (maybe straight)

So my question is: where is the "variable" / configuration that allows vulpea to read the "org-roam.db" file without doing the command (org-roam-db-sync 'force).

Thanks in advance for your answer ^^

d12frosted commented 2 years ago

Hey,

Are you forced to (org-roam-db-sync 'force) every time? Basically, you need to do it only once and only if you were using org-roam without vulpea from the start. But if you enable vulpea-auto-sync-enable, then vulpea table is updated together with org-roam and no full rebuild is needed. See Installation.

Maybe you can share me your vulpea configurations?

Cletip commented 2 years ago

I don't think this is used here, I don't know if I expressed it well, and I think this simple question would answer my expectations: what exactly does the "(org-roam-db-sync 'force)" command on vulpea? Where is stored the database used by vulpea ?

PS: your package is great. I've read your 7 episodes on its different possibilities of use, and it's really impressive. Thanks you for this.

d12frosted commented 2 years ago

So the thing is that vulpea' doesn't use its own db file, but rather injects few tables intoorg-roam-db-location. You need to enablevulpea-auto-syncso that every time something is updated inorg-roam-db`, injected tables are also updated.

https://github.com/d12frosted/vulpea/blob/ba44342aea6a81c7b7ca6fcaae9a537701789b5e/vulpea-db.el#L334-L356

what exactly does the "(org-roam-db-sync 'force)" command on vulpea? Where is stored the database used by vulpea

It rebuilds entire org-roam-db, and if vulpea-auto-sync is enabled, then it also builds vulpea tables.

I also use org-roam + vulpea on multiple machines, and the only thing I need to do when I switch from one to another is to run (org-roam-db-sync) without 'force, which simply calculates what notes were changed since the last sync (maybe you modified files on another machine) and updates db for these modified notes. If vulpea-auto-sync is on, then org-roam-db-sync also updates vulpea tables in org-roam-db-location.

Hope I explained it. If not, please let me know 😸

PS: your package is great. I've read your 7 episodes on its different possibilities of use, and it's really impressive. Thanks you for this.

Glad you liked it. I haven't described all the use cases, but most importantly, I haven't described the most important use case of the vulpea library - https://github.com/d12frosted/vino. Their combination powers https://barberry.io. You can find less sophisticated things in https://github.com/d12frosted/environment/tree/master/emacs#interesting-modules.

Cletip commented 2 years ago

Hmm, strange, after deleting and resynchronizing the org-roam-db-location file, everything seems to work normally.

I had already put the hook with vulpea, that's why I didn't understand ^^. Thank you for your quick help!

Yes I saw your other libraries, it's even more impressive (I'm unfortunately not a fan of wine, but there is a lot of work behind your packages)

Can I ask you two little questions (by mail for exemple) ? I don't think this github issue is the right endroid for questions not related to the issue.

PS : have you found a way to automate org-roam-db-sync when changing the device?

d12frosted commented 2 years ago

Hmm, strange, after deleting and resynchronizing the org-roam-db-location file, everything seems to work normally.

I think this needs to be done /once/ and then it should work without any hassle. One more reason to implement #130 at last.

Thank you for your quick help!

🙇

Yes I saw your other libraries, it's even more impressive (I'm unfortunately not a fan of wine, but there is a lot of work behind your packages)

I am also using it for tea 😸

Can I ask you two little questions (by mail for exemple) ? I don't think this github issue is the right endroid for questions not related to the issue.

Of course, just mail me to boris at d12frsoted dot io. Sometimes I am slow to respond, but I try to react on every email I get.

PS : have you found a way to automate org-roam-db-sync when changing the device?

I played around with running sync either periodically or when files under directory change (as a service). But I never kept it for long. First of all, if you are using default org-roam setup (e.g. you do not disable db sync when org-roam is loaded), then db is synced on Emacs start. Secondly, db sync is part of eru install emacs, which I run periodically on every machine (eru install emacs -> cd $HOME/.config/emacs -> make vulpea -> eldev -C --unstable exec "(progn (run-hooks 'after-init-hook) (vulpea-db-build))"). So it really depends on the way you sync your notes and the way you use Emacs (e.g. do you quit Emacs? or do you run it as a servce? etc).