Calling (org-capture) in a loop

What code do you want reviewed?

I want to call (org-capture) in a loop because I want to add a whole bunch of items. Example code over here:

(defun bascht/this-will-be-called-in-a-loop (title)
  (org-capture nil "t")
  (insert (format "Current title %s: " title)))

(mapcar #'bascht/this-will-be-called-in-a-loop (list "First" "Second"))

What are you trying to do?

My expectation was that I would get two consecutive prompts for org-capture that I can individually review and insert or abort.

What happens instead?

Instead, I get the "Second" prompt first:

and after that, a prompt with both:

This looks like execution is not halted / blocked on the (org-capture) call, but just spawned in the background to another capture buffer.

How would I do this in a serial fashion? So – start with "First" and only call (org-capture) for "Second" when I’m done with the first item?

System information

Loading data dump...

This topic was automatically closed after 90 days. New replies are no longer allowed.