【问题标题】:Emacs 24.5 new line indenting in text modeEmacs 24.5 文本模式下的新行缩进
【发布时间】:2016-08-05 07:54:45
【问题描述】:

我在 cygwin 中使用 emacs 24.5。我需要在文本模式下缩进 4 个空格,当我按下回车键时,换行符应该与前一行的缩进对齐。我试过以下。

(setq-default indent-tabs-mode nil)  
(setq-default tab-width 4)  
(setq-default electric-indent-mode 1)  

但是,当我按下回车而不是缩进当前行时,它也会删除前一行的缩进。像这样

    This is the first line. When I press enter, this line becomes...  
This is the first line  
New line - cursor is not indented in this new line.  

如何获得所需的缩进?

【问题讨论】:

    标签: emacs


    【解决方案1】:

    你可以试试

    (add-hook 'text-mode-hook
              (lambda ()
                (setq-local left-margin 4)))
    

    而不是使用tab-width(这通常是用于缩进的错误工具)。

    【讨论】:

      猜你喜欢
      • 2017-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多