I have the following defvar that declares a variable and gives it a string value. Notice, I used the word "gives" but I was wondering if "bind" would be the proper one to use.

(defvar my/capture-template-contact
      (concat "* %^{Name}\n"
              ":Created: %U\n"
              ":Birthday: yyyy-mm-dd\n"

I want to know this: do we bind a capture template to a variable in the code above? In other words, is the result of the concat bound to a variable?

  • Note that the value is not an Org mode capture template, so calling it a "capture template" might lead to some confusion (although I realize this question is not about Org mode at all).
    – NickD
    Commented Feb 20, 2023 at 12:59
  • We bind "the value of the capture template" to a variable. Or would be it more precise to say: "Bind the value of the concat function to a variable?" Can the thing the concat function returns be called "a value"?
    – Zoli
    Commented Feb 20, 2023 at 13:02
  • "Can the thing the concat function returns be called a value?" - yes, it can and it is, e.g. "the value of the function + applied to the arguments 2, 3, and 4 (represented in Lisp as (+ 2 3 4)) is 9".
    – NickD
    Commented Feb 20, 2023 at 13:12
  • I think the confusion here is that you have a meaning for the value being bound that isn't being communicated in the code but is in the description you have given. As far as Elisp is concerned, the result of concat is a string. If that string is later used as an input to a capture template, that is not known to the variable at this stage. So the answer to "is this template being bound to a variable?" is that a string is being bound to that variable, and that string may end up being used as a template later on if you so choose.
    – Malle Yeno
    Commented Feb 20, 2023 at 14:39
  • emacs.stackexchange.com/tags/elisp/info
    – Drew
    Commented Feb 20, 2023 at 17:13

3 Answers 3


Yes. It can also be written this way:

(defvar my/capture-template-contact
  "* %^{Name}
:Created: %U
:Birthday: yyyy-mm-dd

if you won’t change/destruct the string.


Yes, please see the manual about defvar: the variable my/capture-template-contact...

...should always be dynamically bound...

and it is

... set to the result ...

of evaluating the value form (concat in your case).




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.