Closed ehamberg closed 2 years ago
There are many layers to this issue; we need to unpack them.
First, is your Org-roam up-to-date?
Do you update packages via doom sync
?
I don't use Doom but I have seen many people not updating, or somehow doom sync
does not update correctly so the old version is still used. I have seen people having to delete Org-roam folder entirely to get Doom to use new version...
Second:
If I don't type [[, but just type Emac and then use completion-at-point, [[roam:Emacs]] gets inserted, and I get this error:
Do you get the same error when Md-roam is not active? That is only with Org-roam?
Thee error to me looks like Org-roam error (I don't md-roam
appearing in the warning/error message).
Let's start with these two.
First, is your Org-roam up-to-date? Do you update packages via
doom sync
? I don't use Doom but I have seen many people not updating, or somehowdoom sync
does not update correctly so the old version is still used. I have seen people having to delete Org-roam folder entirely to get Doom to use new version...
I have synced and even rebuilt the packages.
org-roam-version
returns a2e46db
which seems to be 9 days old. md-roam is at 434e33d
which, as of now, is the newest commit.
Do you get the same error when Md-roam is not active? That is only with Org-roam? Thee error to me looks like Org-roam error (I don't
md-roam
appearing in the warning/error message).
If I disable md-roam, open an existing node (a .org
file) and type “[[Emac” I get completion suggestions, and when I choose “Emacs” [[id:e50032fd-fc65-448c-ac5b-3fd4a6853af5][Emacs]]
gets inserted in the buffer (shown as a link). Saving the file produces no errors, and the “Emacs” notes shows the new backlink.
If I type “Emac” and then run completion-at-point
in the .org
file, I get the same result (link, saving works, backlink is shown in Emacs node).
(After re-enbling md-roam, my .md
file is indexed findable again, but I get the same errors as above when attempting to insert a link.)
Thank you. Okay, I can't reproduce the issue (I have no problem) and so it may be specific to Doom or the "cutting edge" Org version that Doom brings (v9.6, which is not released).
I can't solve it properly now, but if you turn this variable off org-roam-link-auto-replace
, I think you won't have this issue on Md-roam. You may start having the issue with Org-roam, instead...
As to this issue:
However, when I attempt to insert a link in the markdown file by typing [[Emac, I don't get any completion like I get in .org files.
I'm not sure but perhaps you need to explicitly turn on Company mode in Markdown files (?).
Let me know how you go.
I'll work on a proper fix later (today or some day this week/weekend hopefully).
Thank you so much, @nobiot.
I can't solve it properly now, but if you turn this variable off
org-roam-link-auto-replace
, I think you won't have this issue on md-roam. You may start having the issue with Org-roam, instead…
That works, or at least I no longer get the error, and the link from the .md
file is shown in the list of backlinks for the .org
file I link to.
I'm not sure but perhaps you need to explicitly turn on Company mode in Markdown files (?).
Company is listed when I describe-mode
. Strange. 🤔
I'll work on a proper fix later (today or some day this week/weekend hopefully).
That would be amazing, but I want to make it clear that I don't expect to trample in here with my custom Emacs setup and have you fix my issues. ☺️ Hopefully I'll be able to do more debugging once I learn more Emacs and elisp.
e6d64a2 should fix the issue of error/warning message without the need for you to change variable org-roam-link-auto-replace
.
For your issue of Company not working, what's the value of org-roam-completion-functions
when you are in a markdown file in Md-roam/Org-roam directory?
It should be as follows -- the order is important with the md-roam one at the end of the list.
(org-roam-complete-link-at-point org-roam-complete-everywhere md-roam-complete-wiki-link-at-point)
e6d64a2 should fix the issue of error/warning message without the need for you to change variable
org-roam-link-auto-replace
.
Thanks! That fixed the error I was getting.
For your issue of Company not working, what's the value of
org-roam-completion-functions
when you are in a markdown file in Md-roam/Org-roam directory?
Its value is (org-roam-complete-link-at-point org-roam-complete-everywhere md-roam-complete-wiki-link-at-point)
and its original Value is (org-roam-complete-link-at-point org-roam-complete-everywhere)
, which seems correct.
(If I open an org-roam .org
file, the value is the same.)
Here's how the completion looks in a .md
file:
… and here's how it looks in a .org
file:
Okay, then it's probably the configuration for company-backends
Can you have a look its value? It should be a list, and should contain company-capf
but probably doesn't in your case for some reason.
Doom has this line for the org
module. I don't see anything similar for the markdown
module.
Maybe you can try this in your mardown mode, and if it fixes the problem add it to your markdown-mode configuration.
(set-company-backend! 'company-capf)
Okay, then it's probably the configuration for
company-backends
Can you have a look its value? It should be a list, and should contain
company-capf
but probably doesn't in your case for some reason.
Correct.
Doom has this line for the
org
module. I don't see anything similar for themarkdown
module.Maybe you can try this in your mardown mode, and if it fixes the problem add it to your markdown-mode configuration.
That solved it! I added (set-company-backend! 'markdown-mode 'company-capf)
to my config and now everything seems to work. Thank you so much!
The updated config:
(use-package! md-roam
:after org-roam
:config
(set-company-backend! 'markdown-mode 'company-capf) ; add company-capf as company backend in markdown buffers
(setq org-roam-file-extensions '("org" "md")) ; enable Org-roam for a markdown files
(md-roam-mode 1) ; md-roam-mode needs to be active before org-roam-db-sync
(org-roam-db-autosync-mode 1)
(add-to-list 'org-roam-capture-templates
'("m" "Markdown" plain "" :target
(file+head "%<%Y-%m-%dT%H%M%S>-${slug}.md"
"---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: \n---\n")
:unnarrowed t)))
I'm trying to use md-roam with Doom Emacs.
org
with+roam
have been enabled ininit.el
and seems to work well. I have added the following to mypackages.el
for md-roam:… and the following to my
config.el
:I then created the following file using
org-roam-node-find
and the “Markdown” template:So far, so good. The file is indexed and findable, and I can link to it from existing
.org
files. However, when I attempt to insert a link in the markdown file by typing[[Emac
, I don't get any completion like I get in.org
files. If I leave it like[[Emacs]]
, I get the following error when I save the file:If I don't type
[[
, but just typeEmac
and then usecompletion-at-point
,[[roam:Emacs]]
gets inserted, and I get this error:I'm not a very experience Emacs user, so it could be something very rudimentary. I'm happy to hear if someone knows how to fix this.