add real option parsing and emacs support