I've tried following some of the other answered questions here regarding this topic but can't seem to get my head around this particular part of the problem.
I have the following function, which returns the value of a key
:PROPERTIES: pair when a cursor is under an org header:
(defun capture-noter-link () "insert PROPERTY value of pdftools link" ;; (interactive) (let ((linkStr (save-excursion (save-window-excursion (switch-to-buffer (plist-get org-capture-plist :original-buffer)) (org-entry-get nil "NOTER_PAGE")) ))) (insert linkStr)))
Calling this function interactively while in the source org file gives me the desired result. I then tried to implement this in
org-capture by using the following template:
("ai" "Anki IR" entry (file+headline org-my-anki-file "Incremental Reading Cards") "* %<%H:%M> %^g\n:PROPERTIES:\n:ANKI_NOTE_TYPE: Cloze\n:ANKI_DECK: MegaDeck\n:END:\n** Text\n%x\n** Extra\n %(capture-noter-link)\n")
However the desired link isn't inserted into the capture buffer. What could I be doing wrong?