switched all variables to buffer-local

newline hacking functions also made a lot more robust by the
get-control-char mechanism instead of hand-coding in numbers