1
0
Fork 0

Enable whitespace-mode for Python

This commit is contained in:
Tom Willemse 2019-02-01 14:04:30 -08:00
parent d0b5e742d2
commit 9feb0bfa45

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 20190201004304 ;; Version: 20190201140623
;; Package-Requires: (company-jedi fill-column-indicator flycheck rainbow-delimiters reformatter) ;; Package-Requires: (company-jedi fill-column-indicator flycheck rainbow-delimiters reformatter)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -36,6 +36,7 @@
(require 'company) (require 'company)
(require 'reformatter) (require 'reformatter)
(require 'whitespace)
(autoload 'hl-indent-mode "hl-indent-mode") (autoload 'hl-indent-mode "hl-indent-mode")
@ -46,6 +47,13 @@ The values are taken from the PEP8 coding standard for Python."
(setq-local fill-column 80) (setq-local fill-column 80)
(setq-local comment-fill-column 72)) (setq-local comment-fill-column 72))
(defun oni-python-whitespace-mode ()
"Set the `whitespace-style' to show the relevat whitespace.
In Python buffers it should show any tabs being used and and used
for indentation."
(setq-local whitespace-style '(face tabs))
(whitespace-mode))
(add-to-list 'company-backends 'company-jedi) (add-to-list 'company-backends 'company-jedi)
(reformatter-define python-black (reformatter-define python-black
@ -62,6 +70,7 @@ The values are taken from the PEP8 coding standard for Python."
(add-hook 'python-mode-hook 'rainbow-delimiters-mode) (add-hook 'python-mode-hook 'rainbow-delimiters-mode)
(add-hook 'python-mode-hook 'python-black-on-save-mode) (add-hook 'python-mode-hook 'python-black-on-save-mode)
(add-hook 'python-mode-hook 'oni-python-set-fill-column) (add-hook 'python-mode-hook 'oni-python-set-fill-column)
(add-hook 'python-mode-hook 'oni-python-whitespace-mode)
;;;###autoload(with-eval-after-load 'python (require 'oni-python)) ;;;###autoload(with-eval-after-load 'python (require 'oni-python))