python – 为什么我在Emacs中收到太多标签?
发布时间:2020-12-20 13:24:22 所属栏目:Python 来源:网络整理
导读:init.el (setq make-backup-files nil)(add-to-list 'load-path "~/.emacs.d/"); Add all top-level subdirectories of .emacs.d to the load path(progn (cd "~/.emacs.d") (normal-top-level-add-subdirs-to-load-path)); Third party libraries are store
|
init.el
(setq make-backup-files nil)
(add-to-list 'load-path "~/.emacs.d/")
; Add all top-level subdirectories of .emacs.d to the load path
(progn (cd "~/.emacs.d")
(normal-top-level-add-subdirs-to-load-path))
; Third party libraries are stored in ~/.emacs.d/extern
(add-to-list 'load-path "~/.emacs.d/extern")
(progn (cd "~/.emacs.d/extern")
(normal-top-level-add-subdirs-to-load-path))
; Python-specific enchancements
(load-library "python")
; Zenburn color theme
(require 'color-theme-zenburn)
(color-theme-zenburn)
python.el ; use tabs in files (urgh...yelp!)
;(setq-default indent-tabs-mode t)
; tab display width of 4 columns by default
; (throw everything at the wall,and eventually something will stick...)
;(setq-default tab-width 4) ; Normal emacs tab-width
; (setq-default c-basic-offset 2) ; python-mode.el setting
;(setq-default py-indent-offset 4) ; Use Tabs,not spaces
;(setq-default py-smart-indentation nil) ; Don't try to guess tab width
(defun customize-py-tabs ()
(setq tab-width 4
py-indent-offset 4
indent-tabs-mode t
py-smart-indentation nil
)
)
(add-hook 'python-mode-hook 'customize-py-tabs)
; Highlight useless whitespace
(add-hook 'python-mode-hook
(lambda () (setq show-trailing-whitespace t)))
我正在尝试将我的emacs设置为我的python代码上的选项卡,但它添加了额外的选项卡.它是一致的.如果应该有4个标签,我得到5.任何建议? 例如 def func:
# This is where it puts me
# This is where it SHOULD put be
解决方法
任何以将tab-width设置为8以外的其他Python缩进都注定会带来麻烦. tab-width确定Emacs如何显示TAB字符,而不是在响应按Tab键时缩进的距离.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
