Is there a way to call a certain function after a certain org-capture template has been run (successfully, ie. not aborted)?
You can add a function to
org-capture-after-finalize-hook to have it run after an org-capture entry has been either confirmed or aborted. Then, within the function, you can use the variable
org-note-abort to test whether the template was run successfully (nil) or aborted (t), and
plist-get with the variable
org-capture-plist to test which template was being used. For example:
(defun tina/test-finalize () (let ((key (plist-get org-capture-plist :key)) (desc (plist-get org-capture-plist :description))) (if org-note-abort (message "Template with key %s and description “%s” aborted" key desc) (message "Template with key %s and description “%s” run successfully" key desc)))) (add-hook 'org-capture-after-finalize-hook 'tina/test-finalize)
Hope that helps!