python-mode: fix indent offset guessing for tab indentation
This commit is contained in:
parent
35b258cd51
commit
f31bed7f52
|
@ -33,6 +33,9 @@ and `lsp'.")
|
||||||
(defvar python-tab-width 4
|
(defvar python-tab-width 4
|
||||||
"Tab width value for python buffers")
|
"Tab width value for python buffers")
|
||||||
|
|
||||||
|
(defvar python-spacemacs-indent-guess t
|
||||||
|
"If non-nil, try to guess correct indentation settings for python buffers on opening")
|
||||||
|
|
||||||
(defvar python-auto-set-local-pyenv-version 'on-visit
|
(defvar python-auto-set-local-pyenv-version 'on-visit
|
||||||
"Automatically set pyenv version from \".python-version\".
|
"Automatically set pyenv version from \".python-version\".
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,11 @@ when this mode is enabled since the minibuffer is cleared all the time."
|
||||||
(setq mode-name "Python"
|
(setq mode-name "Python"
|
||||||
tab-width python-tab-width
|
tab-width python-tab-width
|
||||||
fill-column python-fill-column)
|
fill-column python-fill-column)
|
||||||
|
|
||||||
|
;; since we changed the tab-width we need to manually cally python-indent-guess-inden-offset herr
|
||||||
|
(when python-spacemacs-indent-guess
|
||||||
|
(python-indent-guess-indent-offset))
|
||||||
|
|
||||||
(when (version< emacs-version "24.5")
|
(when (version< emacs-version "24.5")
|
||||||
;; auto-indent on colon doesn't work well with if statement
|
;; auto-indent on colon doesn't work well with if statement
|
||||||
;; should be fixed in 24.5 and above
|
;; should be fixed in 24.5 and above
|
||||||
|
|
|
@ -334,6 +334,9 @@
|
||||||
"sR" 'spacemacs/python-shell-send-region-switch
|
"sR" 'spacemacs/python-shell-send-region-switch
|
||||||
"sr" 'python-shell-send-region)
|
"sr" 'python-shell-send-region)
|
||||||
|
|
||||||
|
;; we call python-indent-guess-indent-offset ourselves so set to nil to avoid duplicate work
|
||||||
|
(setq-default python-indent-guess-indent-offset nil)
|
||||||
|
|
||||||
;; Emacs users won't need these key bindings
|
;; Emacs users won't need these key bindings
|
||||||
;; TODO: make these key bindings dynamic given the current style
|
;; TODO: make these key bindings dynamic given the current style
|
||||||
;; Doing it only at init time won't update it if the user switches style
|
;; Doing it only at init time won't update it if the user switches style
|
||||||
|
|
Loading…
Reference in a new issue