Lars Ingebrigtsen writes: > Felix Dietrich writes: > >> The first, relating to readability: I found it quit difficult to follow >> the flow of the functionʼs code due to its nesting and idiosyncratic >> order of condition checking. I want to, therefore, propose a >> restructured version, which I believe to be functionally equivalent. > > Yes, the code is pretty confusing... so reading the patches, I'm not > quite sure whether the new one is equivalent or not. So I think we'd > want to have a number of tests in mailcap-tests.el to test that the > results really are equivalent before and after the change, too. I agree that adding some automated tests is a good idea, but, since I am not familiar with writing these in Emacs Lisp, I will first have to spent a bit of time with the ERT manual and the existing tests, before I cans start writing the tests. Meanwhile, to shorten the wait ;), here is a series of patches that go through the transformation steps of ‘mailcap-add-mailcap-entry’ and demonstrate that it is still the same function (unless I misstepped). (I donʼt know if this will end up all that readable and useful; it seemed like a good idea when I started and might end up as time better spent learning ERT.)