fix: more idiomatic elisp, better docstrings, less byte-compiler warnings

By Stefan Monnier, with original commentary.

"Here's an untested patch of cleanups, found partly via compilation using
lexical-binding and partly via checkdoc-current-buffer (and
occasionally by stumble-upon happenstance)."