Avoid use of buffer-local variables

Most buffer-local variables are useless, it's better to just use
function arguments.
Make indentation of open-protocol-stream slightly nicer
Consequently use EOL defining variables