如何在每个新文件中将 Emacs 制表符设置为空格?

发布于 2024-07-25 17:29:46 字数 98 浏览 5 评论 0原文

我想要一个 .emacs 设置,以便制表符始终由连续空格组成。 优选地在每种可能的模式中。 在其他编辑器中,这似乎从来都不是问题,但在 .emacs 中,我担心选项卡有点卡住了。

I would like to have an .emacs setting so that tabs are always formed by consecutive spaces. Preferably in each possible mode. In other editors it never seemed a problem, but in .emacs I'm a bit stuck with the tabs I'm afraid.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡看悲欢离合 2024-08-01 17:29:46

将其添加到您的 .emacs 中:

(setq-default indent-tabs-mode nil)

或者您可以定义一个 before-save-hook 来消除硬选项卡

add this in your .emacs:

(setq-default indent-tabs-mode nil)

or you can define a before-save-hook that eliminate hard tabs

记忆里有你的影子 2024-08-01 17:29:46

还可以使用 Mx untabify,它将当前区域中的所有制表符转换为空格。 在正确设置 indent-tabs-mode 之前,您可以使用它来删除已编辑的文件中的现有选项卡。

C-x h                   (M-x mark-whole-buffer)
M-x untabify

Also of use, M-x untabify, which will convert all the tabs into spaces in the current region. You can use this to get rid of the existing tabs in files you've edited before you had the indent-tabs-mode set properly.

C-x h                   (M-x mark-whole-buffer)
M-x untabify
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文