Hullo Richard,
I recently tried to use the hanging.module with a document and got a
Latex error (input stack size capacity exceeded). Some experimenting
showed there was a conflict between hanging.sty and the use in maths
mode of a prime embellishment to a symbol (e.g. to indicate feet and
inches, as in a person's height: 5'8'', five feet eight inches). The
prime can occur anywhere in the document to trip the error, not
necessarily in a hanging paragraph itself.
However I notice your module is in two parts, the if-part applying if
hanging.sty is available and the else-part if it isn't. If I rename
hanging.sty so that the else-part of the definition is used, the
document compiles successfully.
Since the prime is a frequently used symbol in maths and as an
abbreviation for feet and inches (and angular minutes and seconds), I
suggest omitting the if-part from your module and retaining only the
else-part. (I've edited my own copy to this effect.)
Incidentally, entering in maths mode 5^\prime 8^{\prime\prime} (rather
than 5'8'') causes no problems -- hanging.sty copes with that.
Andrew