Set 4 Space Indent in Emacs in Text Mode

后端 未结 20 2267
梦谈多话
梦谈多话 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:50

    Customizations can shadow (setq tab width 4) so either use setq-default or let Customize know what you're doing. I also had issues similar to the OP and fixed it with this alone, did not need to adjust tab-stop-list or any insert functions:

    (custom-set-variables
     '(tab-width 4 't)
     )
    

    Found it useful to add this immediately after (a tip from emacsWiki):

    (defvaralias 'c-basic-offset 'tab-width)
    (defvaralias 'cperl-indent-level 'tab-width)
    

提交回复
热议问题