Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vulpea does not detect my org-roam notes #151

Open
wuqui opened this issue Sep 27, 2022 · 7 comments
Open

vulpea does not detect my org-roam notes #151

wuqui opened this issue Sep 27, 2022 · 7 comments

Comments

@wuqui
Copy link

wuqui commented Sep 27, 2022

vulpea does not detect my notes, even though org-roam works fine.

I use the following paths, which might be unusual, but I like having everything inside org-roam.

org-roam-directory ~/roam
org-directory ~/roam/org
org-agenda-files ~/roam/agenda/

I have vulpea configure like this (using Doom):

(use-package! vulpea
  :hook ((org-roam-db-autosync-mode . vulpea-db-autosync-enable))
  :commands (vulpea-utils-collect-while))

What am I doing wrong?

@d12frosted
Copy link
Owner

Hey @wuqui,

Vulpea uses org-roam db under the hood. So my wild guess would be that you haven't force synced your database before using Vulpea. See installation instructions, especially point (3). These days Vulpea should do it by itself, but I don't know which version you are using.

Let me know if it doesn't fix your issue. In that case, please provide the following information:

  1. Which version of Vulpea are you using? And even better, upgrade to the latest version.
  2. What do you mean by 'does not detect my notes'?

I use the following paths, which might be unusual, but I like having everything inside org-roam.

I also keep everything under one directory. It's unrelated, but I find it confusing that you have org-agenda-files that is not under org-directory.

@wuqui
Copy link
Author

wuqui commented Sep 27, 2022

Vulpea uses org-roam db under the hood. So my wild guess would be that you haven't force synced your database before using Vulpea. See installation instructions, especially point (3).

I had not. I completely missed this, sorry 🤦‍♂️

However, running (org-roam-db-sync 'force) did not completely resolve the issue for me. I'll explain further below.

  1. What do you mean by 'does not detect my notes'?

When I call vulpea-find, 0 notes are found – I can't select anything.

  1. Which version of Vulpea are you using? And even better, upgrade to the latest version.

I should have the current version. At the top of vulpea.el it says Version: 0.3.0.

I've installed it like this:

(package! vulpea
  :recipe (:host github
           :repo "d12frosted/vulpea"
           :files ("*.el")))

I use the following paths, which might be unusual, but I like having everything inside org-roam.

I also keep everything under one directory. It's unrelated, but I find it confusing that you have org-agenda-files that is not under org-directory.

You're right. To be honest, I don't have much use for an 'org directory'. But I've changed it to ~/roam now.

I got everything working now.

I used (org-roam-db-sync 'force) as you suggested.

Calling vulpea-find after this produced an error. I no longer have the error message, but it was something like this:

emacs-sql: table `notes` not found

However, calling vulpea-db-autosync-mode interactively after that fixed everything for me. Because I have this autosync hook in. my config (see above), I assumed this wasn't necessary, but it works now.

Thank you for your quick help!

@d12frosted
Copy link
Owner

emacs-sql: table notes not found

This error means that Vulpea was not properly bootstrapped. There is a mechanism to ensure that Vulpea-specific stuff is injected into Org Roam database, but it kicks in only if you enable vulpea-db-autosync-enable.

There is also a simple tests for this:

(describe "vulpea-db-setup"
(before-all
(vulpea-test--init 'no-setup))
(after-all
(vulpea-test--teardown))
(it "applies cleanly on existing database"
(org-roam-db-sync 'force)
;; initially there are no vulpea specific tables
(pcase-dolist (`(,table ,_) vulpea-db--schemata)
(expect (org-roam-db-query
[:select name
:from sqlite_master
:where (and (= type 'table)
(= name $r1))]
(emacsql-escape-identifier table))
:to-equal nil))
(pcase-dolist (`(,index-name ,_ ,_) vulpea-db--indices)
(expect (org-roam-db-query
[:select name
:from sqlite_master
:where (and (= type 'index)
(= name $r1))]
(emacsql-escape-identifier index-name))
:to-equal nil))
;; then we setup vulpea-db
(message "vulpea-db-setup")
(vulpea-db-autosync-enable)
;; and vulpea specific tables should exist
(pcase-dolist (`(,table ,_) vulpea-db--schemata)
(expect (org-roam-db-query
[:select name
:from sqlite_master
:where (and (= type 'table)
(= name $r1))]
(emacsql-escape-identifier table))
:to-equal (list (list (intern (emacsql-escape-identifier table))))))
(pcase-dolist (`(,index-name ,_ ,_) vulpea-db--indices)
(expect (org-roam-db-query
[:select name
:from sqlite_master
:where (and (= type 'index)
(= name $r1))]
(emacsql-escape-identifier index-name))
:to-equal (list (list (intern (emacsql-escape-identifier index-name))))))
(expect (caar (org-roam-db-query [:select version :from cache :where (= id "vulpea")]))
:to-equal
vulpea-db-version)
;; sync a file
(message "update file")
(org-roam-db-clear-file (expand-file-name "with-meta.org" org-roam-directory))
(org-roam-db-update-file (expand-file-name "with-meta.org" org-roam-directory))
;; and now everything is available
(expect (vulpea-db-get-by-id "05907606-f836-45bf-bd36-a8444308eddd")
:to-equal
(make-vulpea-note
:path (expand-file-name "with-meta.org" org-roam-directory)
:title "Note with META"
:tags nil
:level 0
:id "05907606-f836-45bf-bd36-a8444308eddd"
:links '(("https" . "https://en.wikipedia.org/wiki/Frappato")
("id" . "444f94d7-61e0-4b7c-bb7e-100814c6b4bb")
("id" . "5093fc4e-8c63-4e60-a1da-83fc7ecd5db7"))
:properties (list
(cons "CATEGORY" "with-meta")
(cons "ID" "05907606-f836-45bf-bd36-a8444308eddd")
(cons "BLOCKED" "")
(cons "FILE" (expand-file-name "with-meta.org" org-roam-directory))
(cons "PRIORITY" "B"))
:meta '(("name" . ("some name"))
("tags" . ("tag 1" "tag 2" "tag 3"))
("numbers" . ("12" "18" "24"))
("singleton" . ("only value"))
("symbol" . ("red"))
("url" . ("[[https://en.wikipedia.org/wiki/Frappato][wikipedia.org]]"))
("link" . ("[[id:444f94d7-61e0-4b7c-bb7e-100814c6b4bb][Note without META]]"))
("references" . ("[[id:444f94d7-61e0-4b7c-bb7e-100814c6b4bb][Note without META]]"
"[[id:5093fc4e-8c63-4e60-a1da-83fc7ecd5db7][Reference]]"))
("answer" . ("42")))
:attach-dir (expand-file-name "data/05/907606-f836-45bf-bd36-a8444308eddd" org-roam-directory)))))

Not saying that you did anything wrong. Just trying to understand, how to improve either instructions or the automatic bootstrap flow to avoid these problems. I guess the correct order would be to enable vulpea-db-autosync-mode and run (org-roam-db-sync 'force). The mode hooks into Org Roam db and after that force sync should do everything correctly.

At least, I am glad it works now for you.

P.S. Could you please share how and when you enable org-roam sync mode? Or are you using whatever Doom is providing?

@kronikpillow
Copy link

I ran in to the same problem, plus reading that blog, confused me quite bit xD every time i create a new note, and try to add a tag to it, it tells me that the current file it's not a note xD

@d12frosted
Copy link
Owner

@kronikpillow 🤔 so did you figure out how to fix that? Did vulpea-db-autosync-mode + (org-roam-db-sync 'force) help?

@kronikpillow
Copy link

yes vulpea-db-autosync-mode + (org-roam-db-sync 'force) helped me, notes are now displayed in the vulpea-find function, but the rest of this project is a total confusion to me, wish the guide/readme was more newbie friendly ... I'v started my own #156 discussion, to get assistance in setting up vulpea properly :) thanks for your patience

@dmitrym0
Copy link

I had to follow the similar set of steps (down to notes table not found). But all seems to be good now.

I had vulpea installed for a while, perhaps without completing the necessary force sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants