TAB键在emacs的暂存缓冲区中不起作用 [英] TAB key not working in scratch buffer of emacs

查看:147
本文介绍了TAB键在emacs的暂存缓冲区中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在暂存缓冲区中输入文本时,按TAB键不会执行任何操作。我希望TAB键的行为与在其他普通缓冲区中完全一样(通过插入一些X空格或插入TAB字符来向前移动点)。你能帮我实现这个目标吗?谢谢。



我遇到了以下问题,但没有答案,评论中提到的链接无效。我的分数不足,无法对其添加评论。



如何在emacs的暂存缓冲区中启用Tab键?



随意关闭当前问题,是否可以为上述问题添加答案。

解决方案

TAB在大多数编程语言模式下的行为不是插入标签,但请确保根据当前规则正确缩进这一行的代码。暂存缓冲区的默认模式为 lisp-interaction-mode ,由于您尚未编写任何Lisp代码,因此无需缩进,因此TAB不会执行任何操作。 / p>

有几种方法可以更改此设置。您可以将主要模式更改为例如单个会话的文本模式基本模式 Mx文本模式)或永久添加(通过将(setq initial-major-mode'text-mode)放入您的.emacs文件)。



或者您可以不使用该模式,而完全重新绑定TAB键。做到这一点的一种方法是

  M-:(global-set-key(kbd TAB)'自我插入-command)

我确定还有很多其他选择,具体取决于您希望抓挠的程度行动起来。


Hitting TAB key while entering text into scratch buffer does not do anything. I would like TAB key to behave exactly as it would in other normal buffers(move point forward by inserting some X number of spaces or insert a TAB character). Could you please help me achieve that? Thank you.

I have come across below question, but it doesn't have an answer and the link mentioned in its comment is not working. I do not have enough score to add a comment to it.

How to enable tab key in scratch buffer of emacs?

Feel free to close the current question if you could add an answer to above question.

解决方案

TAB's behavior in most programming-language modes is not "insert a tab" but "make sure the code on this line is indented correctly according to the current rules". The default mode for the scratch buffer is lisp-interaction-mode, and since you have not written any Lisp code, there is no indenting to do, so TAB does nothing.

There are a few ways you could change this. You could change the major mode to, say, text-mode or fundamental-mode, either for a single session (with M-x text-mode) or permanently (by putting (setq initial-major-mode 'text-mode) into your .emacs file).

Or you could leave the mode alone, and rebind the TAB key entirely. One way to do this would be

M-: (global-set-key (kbd "TAB") 'self-insert-command)

I'm sure there are many other alternatives, depending on how exactly you want your scratch buffer to act.

这篇关于TAB键在emacs的暂存缓冲区中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆