0

I am using org-roam and the problem occurs when I try to use an org-roam-capture template. The capture template is for creating org-roam-nodes from citations using citar. It is based on this blog post by the author of org-roam.
The exact function from the blog post worked in my old configuration. I suspect that some packages have changed, as I had to do some changes in order to use citar.

I cannot figure out if it is due to some incompatibility between some of the packages, or if my configuration is wrong.
In case it is relevant, I use straight.el with use-package and the load order and versions of the relevant packages is:

  • org version 9.5.2
  • org-roam version 2.2.2
  • citar

I am using Emacs 28.1 running on windows 11.

I appreciate any help, as this is the first time I have done any significant hacking on my configuration.

The function from my configuration:

  (defun org-roam-node-from-cite (keys-entries)
      (interactive (list (citar-select-refs :multiple nil)))
      (let ((title  (citar-format--entry "${author editor} :: ${title}"
                     (citar-get-entry keys-entries))))
    (org-roam-capture- :templates
               '(("r" "reference" plain "%?" :if-new
                  (file+head "reference/${citekey}.org"
                     ":PROPERTIES:
  :ROAM_REFS: [cite:@${citekey}]
  :END:
  ,#+title: ${title}\n")
                  :immediate-finish t
                  :unnarrowed t))
               :info (list :citekey (car keys-entries))
               :node (org-roam-node-create :title title)
               :props '(:finalize find-file))))

The backtrace:

Debugger entered--Lisp error: (error "Capture template ‘r’: Symbol’s function definition is void: org-fold-show-all")
  error("Capture template `%s': %s" "r" "Symbol’s function definition is void: org-fold-show-all")
  org-capture(nil "r")
  org-roam-capture-(:templates (("r" "reference" plain "%?" :if-new (file+head "reference/${citekey}.org" ":PROPERTIES:\n:ROAM_REFS: [cite:@${citekey}]\n:END:\n...") :immediate-finish t :unnarrowed t)) :info (:citekey "rougierSiliconSoulVain") :node #s(org-roam-node :file nil :file-title nil :file-hash nil :file-atime nil :file-mtime nil :id "62250114-c23e-45a0-8279-db689cdbeea6" :level nil :point nil :todo nil :priority nil :scheduled nil :deadline nil :title " :: " :properties nil :olp nil :tags nil :aliases nil :refs nil) :props (:finalize find-file :call-location #<marker at 1 in *scratch*>))
  (let ((title (citar-format--entry "${author editor} :: ${title}" (citar-get-entry keys-entries)))) (org-roam-capture- :templates '(("r" "reference" plain "%?" :if-new (file+head "reference/${citekey}.org" ":PROPERTIES:\n:ROAM_REFS: [cite:@${citekey}]\n:END:\n...") :immediate-finish t :unnarrowed t)) :info (list :citekey (car keys-entries)) :node (record 'org-roam-node nil nil nil nil nil nil nil nil nil nil nil nil title nil nil nil nil nil) :props '(:finalize find-file :call-location #<marker at 1 in *scratch*>)))
  org-roam-node-from-cite(("rougierSiliconSoulVain"))
  funcall-interactively(org-roam-node-from-cite ("rougierSiliconSoulVain"))
  command-execute(org-roam-node-from-cite)

Here is the capture template

    ("r" "reference" plain "%?"
     :if-new
     (file+head "reference/${title}.org" "#+title: ${title}\n")
     :immediate-finish tn
     :unnarrowed t)

A node is created but it is incomplete:

:PROPERTIES:
:ROAM_REFS: [cite:@rougierSiliconSoulVain]
:ID:       c24c40e3-ca1f-4981-b05e-fcda2021a3ee
:END:
#+title:  :: 

1 Answer 1

1

The problem was the version of org, and is similar to this answer.

Straight.el clones the org repo, and uses that. The solution was to use the org version that is built in to emacs, which can be done as described in the straight.el docs.

(use-package org :straight (:type built-in))

Once I did this, the problem described above disappeared.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.