Since the last version of this patch, I have: - moved the code which sets `type' in `org-insert-link' to a position where it covers more cases - rewritten the macros used in the tests, so that always (and correctly) restore the original state after running, even after errors. Thanks to Max Nikulin for suggesting using `condition-case' There is only one thing left which I am not happy with. Currently, the test fails in the case where :default-description is 'ignore. This was intended to test for situations where the parameter is set to a function, but the function doesn't return a string (I used ignore because it returns 'nil). Accordingly, the test is a `should-error' (because the function *should* return a string, so we should error if it doesn't, right?). But the error condition is inside the error clause of a condition case---which is only triggered if the code errors. Calling 'ignore with any arguments and getting 'nil back doesn't cause any errors, so the error clause is never triggered, and 'nil is just used as the default description (which is then ignored, because it is 'nil -- other non-string values like numbers would not be ignored). I'd like some input on what to do about this: I could rewrite the tests so that a nil-value doesn't matter. In the case of this test, a non-interactive call would just insert a link without a description. Alternatively I could rewrite the function so that if the :default-description parameter returns something, we error unless it is a string. tl;dr The question is: what is the Good Behaviour when :default-description is set to something, which is meant to return a string and returns 'nil instead? Should it be treated like an empty string, or as an error? Thanks, Hugo