Hi folks. Brand new member here. I'm hoping someone can point me in the right direction. I'm a tech writer working on a large org-mode doc with 100's of headings that have ROPERTY: tags requiring IDs. With shorter docs like this I've just manually run M-x, org-id-copy for each heading property. To save a huge amount of time, what I'd like to use here is use a macro that steps through the doc, finds each instance of ROPERTIES: and runs org-id-copy.

Just to give you and idea of what I am thinking of, here is a somewhat lame pseudo-code of the procedure, from someone a bit rusty at programming:

You can use this function by either adding it to your .emacs file after the org-mode setup, or for a single session by putting it in any buffer any doing eval-last-sexp (by default bound to C-x C-e) with point after the definition.

Thank you! I'll give it a try. A colleague here at my company did a little digging and came up with a temporary solution: Using F3 to record my little find ':PROPERTIES:' and then run org-id-copy procedure as a macro. I then named the macro "id-add" and used C-u to tell org-mode to run the macro x number of times. As in, entering:

C-u 200 M-x id-add

It got the job done, for now. But it's only a temporary solution since the macro seems to get blown away when I either close the buffer or org-mode... not sure which it is. I guess user-created macros only live in the current buffer? or do they live as long as org-mode remains open?

In any case, your script is probably a better solution in the long run.