Fix Issue #139 and #183.  Mimics emacs behavior.