Adds file context for do_function and undo_function