This makes a test in comp.el fail (I don't really understand why or how) but here's a possible way this could be implemented (which should also give a better insight into the sort of thing that I am thinking of):