Pythonでtabをスペース4つ分の幅に

ただしスペースをタブに置き換えたりはしないで欲しい場合。


まずはデフォルトタブも4つ分に。
;; Turn on tabs (setq indent-tabs-mode t) (setq-default indent-tabs-mode t) ;; Bind the TAB key (global-set-key (kbd "TAB") 'self-insert-command) ;; Set the tab width (setq default-tab-width 4) (setq tab-width 4) (setq c-basic-indent 4)
で、python-modeにも適用
;; python tab (add-hook 'python-mode-hook '(lambda () (setq tab-width 4)))

ただし、最新のEmacsだとpython-modeは標準で入っているので
設定が少し違います。
;; python tab (add-hook 'python-mode-hook '(lambda() (setq indent-tabs-mode t) (setq indent-level 4) (setq tab-width 4)))
最終更新:2008年06月15日 16:09
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。