The above is solved by adding this to a function that is hooked to ‘save_post’.
<?php
if (!wp_is_post_revision($post_id) and empty($_POST['post_name'])) {
// unhook this function so it doesn't loop infinitely
remove_action('save_post', 'wpf_quote_save');
// update the post, which calls save_post again
wp_update_post(array('ID' => $post_id, 'post_name' => $post->post_type . '-' . $post_id));
// re-hook this function
add_action('save_post', 'wpf_quote_save');
}
?>