How to make node ID lowercase

I’m using :target (file+head (downcase "${id}.org")) in a capture template but am getting the error Wrong type argument: char-or-string-p, (downcase "${id}.org").

I do not see why the error is being thrown because "${id}.org" is a string, so isn’t (downcase "${id}.org") a string too? I ran it in the scratch buffer and indeed it worked. My only guess is that something strange is happening during/after the ID is being substituted in.

Just taking a short break off work. Excuse the brevity.

  • You need to escape (downcase STRING) with a “%” inside the capture-templates. It’s the same as Org. Suggest you to refer to the docstring of org-roam-capture-templates and find a mention of %(sexp).
  • You also likely need to escape the double quotation marks for string argument, because the whole template value is already a string. I believe the error is coming from this.

So I think it should be "%(downcase \"<your string>\")" inside your capture-template.

That is now working, thank you very much!

1 Like