403-python-mode: introduce python-mode via use-package
* custom adaption to meet PIP 8 style * use spaces and no tabs (as suggested by PIP 8) Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
49
site-start.d/403-python-mode.el
Normal file
49
site-start.d/403-python-mode.el
Normal file
@@ -0,0 +1,49 @@
|
||||
;;; 403-python-mode.el --- major mode for python code
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
(use-package python-mode
|
||||
:ensure t
|
||||
:config
|
||||
(add-hook 'python-mode-hook
|
||||
(lambda ()
|
||||
(setq indent-tabs-mode nil) ; use only spaces and no tabs
|
||||
(setq python-indent-offset 4)
|
||||
;;(setq indent-tabs-mode t) ; use tabs to indent
|
||||
;;(setq tabs-width 4) ;
|
||||
(add-to-list 'write-file-functions 'whitespace-cleanup)))
|
||||
|
||||
(use-package 'py-autopep8
|
||||
:custom
|
||||
;; Be complient with PIP 8 -- Style Guide
|
||||
;; https://www.python.org/dev/peps/pep-0008/#indentation
|
||||
;;(require 'py-autopep8)
|
||||
(py-autopep8-enable-on-save))
|
||||
)
|
||||
|
||||
;; (autoload 'python-mode "python-mode"
|
||||
;; "Major mode for the python programming language" t)
|
||||
|
||||
;; (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
|
||||
;; (add-to-list 'interpreter-mode-alist '("python" . python-mode))
|
||||
|
||||
;; ;; used, if working code is usings tabs (instead of PIP8 encuraged spaces)
|
||||
;; ;;(add-hook 'python-mode-hook 'guess-style-guess-tabs-mode)
|
||||
;; ;;(add-hook 'python-mode-hook (lambda ()
|
||||
;; ;; (guess-style-guess-tab-width)))
|
||||
|
||||
;; ;; Be complient with PIP 8 -- Style Guide
|
||||
;; ;; https://www.python.org/dev/peps/pep-0008/#indentation
|
||||
;; ;;(require 'py-autopep8)
|
||||
|
||||
;; (add-hook 'python-mode-hook
|
||||
;; (lambda ()
|
||||
;; (setq indent-tabs-mode nil) ; use only spaces and no tabs
|
||||
;; (setq python-indent-offset 4)
|
||||
;; ;;(setq indent-tabs-mode t) ; use tabs to indent
|
||||
;; ;;(py-autopep8-enable-on-save)
|
||||
;; (add-to-list 'write-file-functions 'whitespace-cleanup)))
|
||||
|
||||
|
||||
;;; 403-python-mode.el ends here
|
||||
Reference in New Issue
Block a user