progfolio / doct

DOCT: Declarative Org Capture Templates for Emacs
GNU General Public License v3.0
380 stars 8 forks source link

org-roam / DOCT #23

Closed algon-ns closed 4 years ago

algon-ns commented 4 years ago

Hello, Here I am again, Using the snippets (without changes), I get this messages (and the graphic i roam don't work)

Warning (doct): :function org-roam-capture--get-point unbound during conversion in the "default" declaration Warning (doct): :function org-roam-capture--get-point unbound during conversion in the "ref" declaration

Here is the actual code:

(setq org-roam-capture-templates (doct-org-roam '(("default" :keys "d" :type plain :function org-roam-capture--get-point :template "%?" :org-roam ( :file-name "%<%Y%m%d%H%M%S>-${slug}" :head "#+TITLE: ${title}\n" :unnarrowed t)) ("ref" :keys "r" :type plain :function org-roam-capture--get-point :template "" :org-roam ( :file-name "${slug}" :head "#+TITLE: ${title}\n" :unnarrowed t))))) mvh Niels

progfolio commented 4 years ago

(and the graphic i roam don't work)

You'll have to be more specific here. I don't know what you mean. Please provide an example of the behavior you are expecting and what actually happens.

As far as the warning messages go: doct is warning you that the function org-roam-capture--get-point is unbound when it is creating your template because if it is not bound prior to invoking org-capture the template will fail. This is to catch typos and/or improper configuration. If you are able to run doct after org-roam defines that function, the warning will go away. Alternatively, if you know the function is bound by the time org-capture runs, you can silence the warning. For an example of how to use the :warn keyword to silence warnings on a per-declaration basis see:

https://github.com/progfolio/doct#disabling-warnings

algon-ns commented 4 years ago

I figured out the reason to failure at org-roam-graph (which do not have anything to do with doct, but that I've never heard of a browser called 'Brave Browser', so I got a separate issue there, but I stille got the warnings for org-roam-captures. Se beneath for the code.

I'm an old man, and find this rather complicated, and I'm not sure that I understand what's going on.

I still gets the warnings: Warning (doct): :function org-roam-capture--get-point unbound during conversion in the "default" declaration Warning (doct): :function org-roam-capture--get-point unbound during conversion in the "ref" declaration

define doct...... set org-capture-templates (which works OK)

and then

(setq org-roam-capture-templates (let ((doct-warnings t)) (doct-org-roam '(("default" :keys "d" :warn (:not unbound) :type plain :function org-roam-capture--get-point :template "%?" :org-roam ( :file-name "%<%Y%m%d%H%M%S>-${slug}" :head "#+TITLE: ${title}\n" :unnarrowed t)) ("ref" :keys "r" :warn (:not unbound) :type plain :function org-roam-capture--get-point :template "" :org-roam ( :file-name "${slug}" :head "#+TITLE: ${title}\n" :unnarrowed t))))))

med venlig hilsen Niels

progfolio commented 4 years ago

Instead of what you have above, try this:

(setq org-roam-capture-templates
      (doct-org-roam '(("default"
                        :keys "d"
                        :warn (:not unbound)
                        :type plain
                        :function org-roam-capture--get-point
                        :template "%?"
                        :org-roam ( :file-name "%<%Y%m%d%H%M%S>-${slug}"
                                    :head "#+TITLE: ${title}\n"
                                    :unnarrowed t))
                       ("ref"
                        :keys "r"
                        :warn (:not unbound)
                        :type plain
                        :function org-roam-capture--get-point
                        :template ""
                        :org-roam ( :file-name "${slug}"
                                    :head "#+TITLE: ${title}\n"
                                    :unnarrowed t)))))

That should go in your config.org file in the use-package declaration for org-roam. replace:

(setq org-roam-capture-templates (list `("d" "default" plain #'org-roam--capture-get-point
                                             "%?"
                                             :file-name "%<%Y%m%d%H%M%S>-${slug}"
                                             :head ,(concat "#+title: ${title}\n"
                                                     "#+author: \"Niels Søndergaard\"\n"
                                                     "#+date: <%<%Y-%m-%d>>\n")
algon-ns commented 4 years ago

Thanks, doct and org-roam works, my problem now is solely to show the graph, and I didn't get rid of warnings....

I'll work on it, so eventually I get it right

mvh Niels

progfolio commented 4 years ago

Glad to hear you got it to a mostly functional state. I'd have to see how everything is configured to diagnosis the issue with the warnings.

Keep working at it! ~ NV

snuffop commented 3 years ago

Putting this hear as it's the most relevant. Would the Gist of doct-org-roam be getting into the default code base? and would there be an update to handle org-roam v2 changes to the templates.

progfolio commented 3 years ago

I have no intention of supporting org-roam via doct. It's beyond the scope of the package, and it would make more sense the other way around (org-roam depending on doct). I don't have any interest in developing that because I no longer use org-roam, but if someone wants to make their own package to extend doct or fork that gist, I have no issue with that.

I'm not familiar with the changes between v1 and v2 of org-roam, so I don't know what's broken with that gist. If you could provide an example of how you're using the doct-org-roam function in that gist, what it outputs and what you expect it to output, I may be able to help.