Set 4 Space Indent in Emacs in Text Mode

后端 未结 20 2317
梦谈多话
梦谈多话 2020-11-29 15:27

I\'ve been unsuccessful in getting Emacs to switch from 8 space tabs to 4 space tabs when pressing the TAB in buffers with the major mode text-mode.

20条回答
  •  情书的邮戳
    2020-11-29 15:31

    This is the only solution that keeps a tab from ever getting inserted for me, without a sequence or conversion of tabs to spaces. Both of those seemed adequate, but wasteful:

    (setq-default
        indent-tabs-mode nil
        tab-width 4
        tab-stop-list (quote (4 8))
    )
    

    Note that quote needs two numbers to work (but not more!).

    Also, in most major modes (Python for instance), indentation is automatic in Emacs. If you need to indent outside of the auto indent, use:

    M-i

提交回复
热议问题