I have a function called create-org-link
that creates a file link based on an arbitrary string that I pass to it. I would like to be able to invoke this function when I invoke org capture.
Here's what I have tried:
(setq org-capture-templates
'(("w" "Work Log" entry (file+headline "c:/td/gtd/org/WorkLogs.org" "Today") "** %(create-org-link) %?")
))
I know that the function works because I can use it outside of this template. However, when I execute if from here I get the following output:
** %![Error: (wrong-number-of-arguments (lambda (title) Foobar de roobarb (interactive sPlease enter a title: ) (insert (format [[file:%s-%s.org][%s - %s]] (format-time-string org-link-date-stamp-format (current-time)) (replace-regexp-in-string title) (format-time-string org-link-date-stamp-format (current-time)) title))) 0)]
Is there a different template element that I should be using?
Edit - 5/5/2014 @ 12:48
Here's the function that is being called:
(defun create-org-link (title)
"Foobar de roobarb"
(interactive "sPlease enter a title: ")
(insert (format "[[file:%s-%s.org][%s - %s]]" (format-time-string org-link-date-stamp-format(current-time)) (replace-regexp-in-string " " "" title) (format-time-string org-link-date-stamp-format(current-time)) title)))
(defvar org-link-date-stamp-format "%y%m%d"
"Format of date stamps to use in Org links")
Ha ha - I guess I should take out my placeholder comments before asking questions about it in a forum :-)
(call-interactively #'create-org-link)
?interactive
spec:Foobar de roobarb
. See the definitions of a function, command, and lambda form. Probably you meant to put double quotes aroundFoobar de roobarb
, to create a doc string.