Save pattern definitions/missing cases

Fixes #955. Requires a 'make lib_clean'.