Fix bytecompilation warnings for some undefined variables/functions

These byte-compilation warnings are visible when installing using elpa, so I added some of the missing dependencies between files. I tried to document why there was a dependency to assist in any future attempts to untangle dependencies.

It also re-orders some defcustom's to they are defined before they are used in nrepl-client.el.