Where do I set which template file to use for a block? I know I can just override block.tpl.php using the normal template system. But is there a way to set the tpl file when I define a block in my module ?

I thinking of an equivalent to this:

function theming_example_theme() {
  return array(
    'theming_example_text_form'  =&gt; array(
      'render element' =&gt; 'form',
      // In this one the rendering will be done by a tpl.php file instead of
      // being rendered by a function, so we specify a template.
      'template' =&gt; 'theming_example_text_form',
    ),
  );
}
Most of the times I just do 

$block['subject'] = t('My block title');
$block['content'] = theme('my_custom_theme', $block_content);

return $block;


from hook_block_view() function if you're making a module that creates a block. The theme function my_custom_theme can use a template file such as my-custom-theme-block.tpl.php. Also you can suggest theme hooks through hook_preprocess_block. Just check for the delta of your own block and set a theme hook there.

function HOOK_preprocess_block(&amp;$vars) {
  if ($vars['block']-&gt;delta == 'my-block-delta') {
    $vars['template_suggestions'][] = 'my-custom-theme-block';
  }
}