【问题标题】:Get back behaviour of C-j from older version of Emacs [duplicate]从旧版本的 Emacs 中取回 C-j 的行为 [重复]
【发布时间】:2015-08-05 05:08:03
【问题描述】:

不与Emacs version 24.4: New obnoxious loss of indentation on hitting RETURN 重复

关闭electric-indent-mode 并不能解决我遇到的问题。请注意,该问题没有可接受的答案。

原问题:

目前在 Windows 7 上使用 Emacs 版本 24.5.1,C-j 的更改行为非常令人讨厌。我敢肯定设计师一定认为这是个好主意,但我不这么认为。

有没有办法从旧版本中恢复C-j 的行为?更具体地说,我正在考虑 v21.x(几年前在我的 Mac 上安装了它)。

说明:

这是我在旧版本中得到的(想象一下在每一行的末尾点击C-j

Line 01:    Some text.
Line 02:    Some more text.
Line 03:
Line 04:    Yet more text (notice the indentation stays the same despite
Line 05:    the empty line in-between).

默认情况下,在 24.5.1 中,我得到(再次想象在每行末尾点击 C-j):

Line 01:    Some text.
Line 02:    Some more text.
Line 03:
Line 04: Yet more text (notice the indentation goes to zero because of
Line 05: the empty line in-between).

键绑定 C-j 在 Emacs 24.5.1 中运行 newline-and-indent

【问题讨论】:

  • 您是否有旧版本,您可以将函数复制到新的.emacs 文件中,然后将键盘快捷键更改为旧版本稍作修改的名称?
  • @lawlist 我在上面添加了解释。希望这是可以理解的:-)。

标签: emacs emacs24


【解决方案1】:

您可能想要使用内置函数default-indent-new-line。试试M-x default-indent-new-line。至少在text-mode 中,它会按照您的描述进行。

要在每种模式下覆盖 C-j,您只需在 .emacs 文件中使用这个 sn-p。

(global-set-key (kbd "C-j")  'default-indent-new-line)

【讨论】:

  • 似乎与newline-and-indent 的工作方式相同,所以不能解决我的问题。
猜你喜欢
  • 2014-03-03
  • 1970-01-01
  • 1970-01-01
  • 2013-10-23
  • 2016-09-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多