I am using the Emacs-Speaks-Statistics (ESS) mode for Emacs. When editing R code, any comment lines (those starting with #) automatically get tabbed to the far right when I
Either
(setq ess-fancy-comments nil)
if you never want to indent single-# comments, or
#
(add-hook 'ess-mode-hook (lambda () (local-set-key (kbd "RET") 'newline)))
if you want to change the behavior of Enter so it doesn't indent.