Code Monkey home page Code Monkey logo

Comments (6)

zaeph avatar zaeph commented on August 22, 2024 1

First of all, thanks for this package. It works wonderfully for me :)

Glad you're liking it!

The correct way to do it is:

  (setq org-roam-bibtex-template
        `(("r" "ref" plain (function org-roam-capture--get-point) ""
           :file-name "${=key=}"
           :head ,(concat "#+TITLE: ${=key=}: ${title}\n"
                         "#+ROAM_KEY: ${ref}\n"
                         "- tags ::\n"
           :unnarrowed t)))

Note the backquote =`= and the =,=.

You don't actually need to do that. Compare:

(setq org-roam-bibtex-template
      '(("r" "ref" plain (function org-roam-capture--get-point) ""
         :file-name "${=key=}"
         :head "#+TITLE: ${=key=}: ${title}\n#+ROAM_KEY: ${ref}\n- tags ::\n"
         :unnarrowed t)))

:head accepts a string argument, not a sexp that returns a string argument. Your original solution works, yes, but here, you can just manually concatenate the string by joining all the parts.

from org-roam-bibtex.

tdehaeze avatar tdehaeze commented on August 22, 2024

Ok, I could figure it out, so instead of deleting the issue, I post the answer I found here: https://emacs.stackexchange.com/questions/38757/cannot-use-concat-within-org-capture-template

The correct way to do it is:

  (setq org-roam-bibtex-template
        `(("r" "ref" plain (function org-roam-capture--get-point) ""
           :file-name "${=key=}"
           :head ,(concat "#+TITLE: ${=key=}: ${title}\n"
                         "#+ROAM_KEY: ${ref}\n"
                         "- tags ::\n"
           :unnarrowed t)))

Note the backquote =`= and the =,=.

from org-roam-bibtex.

tdehaeze avatar tdehaeze commented on August 22, 2024

Thanks for the tip, but I actually plan to have quite large template like:

  (setq org-roam-bibtex-template
        `(("r" "ref" plain (function org-roam-capture--get-point) ""
           :file-name "${=key=}"
           :head ,(concat "#+TITLE: ${=key=}: ${title}\n"
                          "#+ROAM_KEY: ${ref}\n"
                          "- Tags :: %?\n"
                          "- Author(s) :: ${author}\n"
                          "- Year :: ${year}\n"
                          "\n"
                          "* Notes                                                               :ignore:\n"
                          ":PROPERTIES:\n"
                          ":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n"
                          ":END:\n")
           :unnarrowed t)))

Which would be quite unreadable without the concat in my opinion.

from org-roam-bibtex.

zaeph avatar zaeph commented on August 22, 2024

I agree that it'd get unwieldy quite quickly. I only mentioned this because it saves a few keystrokes and saves an eval, but since it's only a setq assignment for your config, it's a-OK. 👍

from org-roam-bibtex.

zaeph avatar zaeph commented on August 22, 2024

Thanks for the tip, but I actually plan to have quite large template like:

You might be interested in using a file-template as explained in #10.

from org-roam-bibtex.

tdehaeze avatar tdehaeze commented on August 22, 2024

Thanks for the tip, but I actually plan to have quite large template like:

You might be interested in using a file-template as explained in #10.

Thanks! I was not aware of this very nice option :).

from org-roam-bibtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.