Emacs ESS Mode - Tabbing for Comment Region

前端 未结 4 1214
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-08 00:00

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

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 00:44

    Setting ess-indent-with-fancy-comments to nil will remove the weird single-# indentation, but it must be set either buffer-locally in a hook (as in Rob's answer), OR before ESS is loaded:

    (setq ess-indent-with-fancy-comments nil)
    (require 'ess)
    

    Other ways to make sure it is set before ESS is loaded, is to set it in M-x configure, or to set it in the :init section of use-package.

    What's going on is that ESS defines styles at initialization in ess-style-alist, and then applies the default style in every buffer. So to make sure these styles respect ess-indent-with-fancy-comment, you must make sure to set it before the styles are defined.

提交回复
热议问题