【发布时间】:2020-01-29 13:24:44
【问题描述】:
我最近开始使用 Emacs,遇到的一个问题是编辑器会自动将所有制表符转换为空格。现在开始有点烦了。
这是我的.emacs 文件供参考:
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(custom-set-variables
'(custom-enabled-themes (quote (dracula)))
'(custom-safe-themes)
'(display-line-numbers-type (quote relative))
'(global-display-line-numbers-mode t)
'(menu-bar-mode nil)
'(package-selected-packages
(quote
(company-irony-c-headers company-irony micgoline elpy company-jedi molokai-theme gruvbox-theme autopair auto-complete anaconda-mode nyan-mode dracula-theme company)))
'(scroll-bar-mode nil)
'(tool-bar-mode nil))
(custom-set-faces
)
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq inhibit-startup-message t) ;; hide the startup message
(elpy-enable)
(pyenv-mode)
(setq python-shell-interpreter "ipython"
python-shell-interpreter-args "-i --simple-prompt")
(require 'powerline)
关于如何阻止 emacs 执行此行为的任何建议?
【问题讨论】:
-
你检查变量缩进标签模式了吗?有了这个,您应该能够使用空格或制表符在 emacs 之间切换。
-
@AltruisticDelay:请将其发布为答案。评论可以随时删除。
-
如果你只想要 空格 那么
indent-tabs-mode(禁用)就是你所需要的。如果您想要标签,那么您可能还需要了解其他内容,因为标签只会在每个tab-width列中使用,这意味着您可能需要配置其他确保每个缩进都是tab-width的精确倍数。这些东西可以特定于主模式,但M-x apropos-variable搜索offset和indent会很方便。M-x customize-group所讨论的图书馆也应该向您展示您需要了解的内容。
标签: emacs indentation auto-indent spacemacs