如何让 emacs 在 tab 字符上执行与其他编辑器相同的操作?
emacs 中的 TAB 键与 indent-for-tab-command 绑定,但缩进本身会将所有制表符转换为空格,我不喜欢这种做法,因为在代码中定位字符比较困难,而且代码会变大。
我尝试使用 (setq-default indent-tabs-mode t)、(setq tab-width 4) 或 (setq default-tab-width 4),以上都不起作用。 \t 字符的宽度不会改变,缩进也不会使用制表符而不是空格。 而且“Mx tabify”也不起作用。
我搜索了很长时间但几乎一无所获。有什么想法吗?
The TAB key in emacs is bound to indent-for-tab-command, but the indent itself converts all the tabs into spaces, which I didn't like because it's harder to locate character in the code and the code gets bigger.
I tried to use (setq-default indent-tabs-mode t), (setq tab-width 4) or (setq default-tab-width 4), none of the above works. Neither the width of \t character changes, nor the indent uses tabs instead of spaces.
And 'M-x tabify' does not work either.
I searched for a long time but got nearly nothing. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您的 .emacs 设置,如果您的 .emacs 文件中没有任何特殊设置,则应默认插入制表符。
这另外两个设置不相关。
检查 emacswiki.org 是否有任何与 Emacs 相关的问题。
It's your .emacs settings, if you don't have any special settings in your .emacs file, tab should be inserted by default.
This other two settings are not related.
Check emacswiki.org for any Emacs related questions.